2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
28 #ifndef _IOKIT_ROOTDOMAIN_H
29 #define _IOKIT_ROOTDOMAIN_H
31 #include <IOKit/IOService.h>
32 #include <IOKit/pwr_mgt/IOPM.h>
33 #include <IOKit/IOBufferMemoryDescriptor.h>
35 #ifdef XNU_KERNEL_PRIVATE
36 struct AggressivesRecord
;
37 struct IOPMMessageFilterContext
;
39 struct IOPMSystemSleepParameters
;
40 class PMSettingObject
;
44 class IOPMPowerStateQueue
;
45 class RootDomainUserClient
;
46 class PMAssertionsTracker
;
50 * Types for PM Assertions
51 * For creating, releasing, and getting PM assertion levels.
54 /*! IOPMDriverAssertionType
55 * A bitfield describing a set of assertions. May be used to specify which assertions
56 * to set with <link>IOPMrootDomain::createPMAssertion</link>; or to query which
57 * assertions are set with <link>IOPMrootDomain::releasePMAssertion</link>.
59 typedef uint64_t IOPMDriverAssertionType
;
61 /* IOPMDriverAssertionID
62 * Drivers may create PM assertions to request system behavior (keep the system awake,
63 * or keep the display awake). When a driver creates an assertion via
64 * <link>IOPMrootDomain::createPMAssertion</link>, PM returns a handle to
65 * the assertion of type IOPMDriverAssertionID.
67 typedef uint64_t IOPMDriverAssertionID
;
68 #define kIOPMUndefinedDriverAssertionID 0
70 /* IOPMDriverAssertionLevel
71 * Possible values for IOPMDriverAssertionLevel are <link>kIOPMDriverAssertionLevelOff</link>
72 * and <link>kIOPMDriverAssertionLevelOn</link>
74 typedef uint32_t IOPMDriverAssertionLevel
;
75 #define kIOPMDriverAssertionLevelOff 0
76 #define kIOPMDriverAssertionLevelOn 255
79 * Flags for get/setSleepSupported()
82 kRootDomainSleepNotSupported
= 0x00000000,
83 kRootDomainSleepSupported
= 0x00000001,
84 kFrameBufferDeepSleepSupported
= 0x00000002,
85 kPCICantSleep
= 0x00000004
89 *IOPMrootDomain registry property keys
91 #define kRootDomainSupportedFeatures "Supported Features"
92 #define kRootDomainSleepReasonKey "Last Sleep Reason"
93 #define kRootDomainSleepOptionsKey "Last Sleep Options"
94 #define kIOPMRootDomainWakeReasonKey "Wake Reason"
95 #define kIOPMRootDomainWakeTypeKey "Wake Type"
96 #define kIOPMRootDomainPowerStatusKey "Power Status"
99 * Possible sleep reasons found under kRootDomainSleepReasonsKey
101 #define kIOPMClamshellSleepKey "Clamshell Sleep"
102 #define kIOPMPowerButtonSleepKey "Power Button Sleep"
103 #define kIOPMSoftwareSleepKey "Software Sleep"
104 #define kIOPMOSSwitchHibernationKey "OS Switch Sleep"
105 #define kIOPMIdleSleepKey "Idle Sleep"
106 #define kIOPMLowPowerSleepKey "Low Power Sleep"
107 #define kIOPMThermalEmergencySleepKey "Thermal Emergency Sleep"
108 #define kIOPMMaintenanceSleepKey "Maintenance Sleep"
111 * String constants for communication with PM CPU
113 #define kIOPMRootDomainLidCloseCString "LidClose"
114 #define kIOPMRootDomainBatPowerCString "BatPower"
117 * Supported Feature bitfields for IOPMrootDomain::publishFeature()
120 kIOPMSupportedOnAC
= (1<<0),
121 kIOPMSupportedOnBatt
= (1<<1),
122 kIOPMSupportedOnUPS
= (1<<2)
125 typedef IOReturn (*IOPMSettingControllerCallback
)
126 (OSObject
*target
, const OSSymbol
*type
,
127 OSObject
*val
, uintptr_t refcon
);
130 IONotifier
* registerSleepWakeInterest(
131 IOServiceInterestHandler
, void *, void * = 0);
133 IONotifier
* registerPrioritySleepWakeInterest(
134 IOServiceInterestHandler handler
,
135 void * self
, void * ref
= 0);
137 IOReturn
acknowledgeSleepWakeNotification(void * );
139 IOReturn
vetoSleepWakeNotification(void * PMrefcon
);
142 #define IOPM_ROOTDOMAIN_REV 2
144 class IOPMrootDomain
: public IOService
146 OSDeclareFinalStructors(IOPMrootDomain
)
149 static IOPMrootDomain
* construct( void );
151 virtual bool start( IOService
* provider
);
152 virtual IOReturn
setAggressiveness( unsigned long, unsigned long );
153 virtual IOReturn
getAggressiveness( unsigned long, unsigned long * );
155 virtual IOReturn
sleepSystem( void );
156 IOReturn
sleepSystemOptions( OSDictionary
*options
);
158 virtual IOReturn
setProperties( OSObject
* );
159 virtual bool serializeProperties( OSSerialize
* s
) const;
161 /*! @function systemPowerEventOccurred
162 @abstract Other drivers may inform IOPMrootDomain of system PM events
163 @discussion systemPowerEventOccurred is a richer alternative to receivePowerNotification()
164 Only Apple-owned kexts should have reason to call systemPowerEventOccurred.
165 @param event An OSSymbol describing the type of power event.
166 @param value A 32-bit integer value associated with the event.
167 @param shouldUpdate indicates whether the root domain should send a notification
168 to interested parties. Pass false if you're calling systemPowerEventOccurred
169 several times in succession; and pass true only on the last invocatino.
170 @result kIOReturnSuccess on success */
172 IOReturn
systemPowerEventOccurred(
173 const OSSymbol
*event
,
176 IOReturn
systemPowerEventOccurred(
177 const OSSymbol
*event
,
180 virtual IOReturn
receivePowerNotification( UInt32 msg
);
182 virtual void setSleepSupported( IOOptionBits flags
);
184 virtual IOOptionBits
getSleepSupported( void );
186 void wakeFromDoze( void );
188 // KEXT driver announces support of power management feature
190 void publishFeature( const char *feature
);
192 // KEXT driver announces support of power management feature
193 // And specifies power sources with kIOPMSupportedOn{AC/Batt/UPS} bitfield.
194 // Returns a unique uint32_t identifier for later removing support for this
196 // NULL is acceptable for uniqueFeatureID for kexts without plans to unload.
198 void publishFeature( const char *feature
,
199 uint32_t supportedWhere
,
200 uint32_t *uniqueFeatureID
);
202 // KEXT driver announces removal of a previously published power management
203 // feature. Pass 'uniqueFeatureID' returned from publishFeature()
205 IOReturn
removePublishedFeature( uint32_t removeFeatureID
);
207 /*! @function copyPMSetting
208 @abstract Copy the current value for a PM setting. Returns an OSNumber or
209 OSData depending on the setting.
210 @param whichSetting Name of the desired setting.
211 @result OSObject value if valid, NULL otherwise. */
213 OSObject
* copyPMSetting( OSSymbol
*whichSetting
);
215 /*! @function registerPMSettingController
216 @abstract Register for callbacks on changes to certain PM settings.
217 @param settings NULL terminated array of C strings, each string for a PM
218 setting that the caller is interested in and wants to get callbacks for.
219 @param callout C function ptr or member function cast as such.
220 @param target The target of the callback, usually 'this'
221 @param refcon Will be passed to caller in callback; for caller's use.
222 @param handle Caller should keep the OSObject * returned here. If non-NULL,
223 handle will have a retain count of 1 on return. To deregister, pass to
224 unregisterPMSettingController()
225 @result kIOReturnSuccess on success. */
227 IOReturn
registerPMSettingController(
228 const OSSymbol
*settings
[],
229 IOPMSettingControllerCallback callout
,
232 OSObject
**handle
); // out param
234 /*! @function registerPMSettingController
235 @abstract Register for callbacks on changes to certain PM settings.
236 @param settings NULL terminated array of C strings, each string for a PM
237 setting that the caller is interested in and wants to get callbacks for.
238 @param supportedPowerSources bitfield indicating which power sources these
239 settings are supported for (kIOPMSupportedOnAC, etc.)
240 @param callout C function ptr or member function cast as such.
241 @param target The target of the callback, usually 'this'
242 @param refcon Will be passed to caller in callback; for caller's use.
243 @param handle Caller should keep the OSObject * returned here. If non-NULL,
244 handle will have a retain count of 1 on return. To deregister, pass to
245 unregisterPMSettingController()
246 @result kIOReturnSuccess on success. */
248 IOReturn
registerPMSettingController(
249 const OSSymbol
*settings
[],
250 uint32_t supportedPowerSources
,
251 IOPMSettingControllerCallback callout
,
254 OSObject
**handle
); // out param
256 virtual IONotifier
* registerInterest(
257 const OSSymbol
* typeOfInterest
,
258 IOServiceInterestHandler handler
,
259 void * target
, void * ref
= 0 );
261 virtual IOReturn
callPlatformFunction(
262 const OSSymbol
*functionName
,
263 bool waitForFunction
,
264 void *param1
, void *param2
,
265 void *param3
, void *param4
);
267 /*! @function createPMAssertion
268 @abstract Creates an assertion to influence system power behavior.
269 @param whichAssertionBits A bitfield specify the assertion that the caller requests.
270 @param assertionLevel An integer detailing the initial assertion level, kIOPMDriverAssertionLevelOn
271 or kIOPMDriverAssertionLevelOff.
272 @param ownerService A pointer to the caller's IOService class, for tracking.
273 @param ownerDescription A reverse-DNS string describing the caller's identity and reason.
274 @result On success, returns a new assertion of type IOPMDriverAssertionID
276 IOPMDriverAssertionID
createPMAssertion(
277 IOPMDriverAssertionType whichAssertionsBits
,
278 IOPMDriverAssertionLevel assertionLevel
,
279 IOService
*ownerService
,
280 const char *ownerDescription
);
282 /* @function setPMAssertionLevel
283 @abstract Modify the level of a pre-existing assertion.
284 @discussion Change the value of a PM assertion to influence system behavior,
285 without undergoing the work required to create or destroy an assertion. Suggested
286 for clients who will assert and de-assert needs for PM behavior several times over
288 @param assertionID An assertion ID previously returned by <link>createPMAssertion</link>
289 @param assertionLevel The new assertion level.
290 @result kIOReturnSuccess if it worked; kIOReturnNotFound or other IOReturn error on failure.
292 IOReturn
setPMAssertionLevel(IOPMDriverAssertionID assertionID
, IOPMDriverAssertionLevel assertionLevel
);
294 /*! @function getPMAssertionLevel
295 @absract Returns the active level of the specified assertion(s).
296 @discussion Returns <link>kIOPMDriverAssertionLevelOff</link> or
297 <link>kIOPMDriverAssertionLevelOn</link>. If multiple assertions are specified
298 in the bitfield, only returns <link>kIOPMDriverAssertionLevelOn</link>
299 if all assertions are active.
300 @param whichAssertionBits Bits defining the assertion or assertions the caller is interested in
301 the level of. If in doubt, pass <link>kIOPMDriverAssertionCPUBit</link> as the argument.
302 @result Returns <link>kIOPMDriverAssertionLevelOff</link> or
303 <link>kIOPMDriverAssertionLevelOn</link> indicating the specified assertion's levels, if available.
304 If the assertions aren't supported on this machine, or aren't recognized by the OS, the
307 IOPMDriverAssertionLevel
getPMAssertionLevel(IOPMDriverAssertionType whichAssertionBits
);
309 /*! @function releasePMAssertion
310 @abstract Removes an assertion to influence system power behavior.
311 @result On success, returns a new assertion of type IOPMDriverAssertionID *
313 IOReturn
releasePMAssertion(IOPMDriverAssertionID releaseAssertion
);
316 virtual IOReturn
changePowerStateTo( unsigned long ordinal
);
317 virtual IOReturn
changePowerStateToPriv( unsigned long ordinal
);
318 virtual IOReturn
requestPowerDomainState( IOPMPowerFlags
, IOPowerConnection
*, unsigned long );
319 virtual void powerChangeDone( unsigned long );
320 virtual bool tellChangeDown( unsigned long );
321 virtual bool askChangeDown( unsigned long );
322 virtual void tellChangeUp( unsigned long );
323 virtual void tellNoChangeDown( unsigned long );
324 #ifdef XNU_KERNEL_PRIVATE
325 /* Root Domain internals */
327 void tagPowerPlaneService(
329 IOPMActions
* actions
);
331 void overrideOurPowerChange(
333 IOPMActions
* actions
,
334 unsigned long * inOutPowerState
,
335 uint32_t * inOutChangeFlags
);
337 void handleOurPowerChangeStart(
339 IOPMActions
* actions
,
341 uint32_t * inOutChangeFlags
);
343 void handleOurPowerChangeDone(
345 IOPMActions
* actions
,
347 uint32_t changeFlags
);
349 void overridePowerChangeForUIService(
351 IOPMActions
* actions
,
352 unsigned long * inOutPowerState
,
353 uint32_t * inOutChangeFlags
);
355 void handleActivityTickleForDisplayWrangler(
357 IOPMActions
* actions
);
359 bool shouldDelayChildNotification(
360 IOService
* service
);
362 void handlePowerChangeStartForPCIDevice(
364 IOPMActions
* actions
,
366 uint32_t * inOutChangeFlags
);
368 void handlePowerChangeDoneForPCIDevice(
370 IOPMActions
* actions
,
372 uint32_t changeFlags
);
374 void askChangeDownDone(
375 IOPMPowerChangeFlags
* inOutChangeFlags
,
378 void handlePublishSleepWakeUUID(
381 void handleQueueSleepWakeUUID(
384 void handleSuspendPMNotificationClient(
385 uint32_t pid
, bool doSuspend
);
387 IOReturn
setMaintenanceWakeCalendar(
388 const IOPMCalendarStruct
* calendar
);
390 IOReturn
getSystemSleepType( uint32_t * sleepType
);
392 // Handle callbacks from IOService::systemWillShutdown()
393 void acknowledgeSystemWillShutdown( IOService
* from
);
395 // Handle platform halt and restart notifications
396 void handlePlatformHaltRestart( UInt32 pe_type
);
398 IOReturn
shutdownSystem( void );
399 IOReturn
restartSystem( void );
400 void handleSleepTimerExpiration( void );
402 bool activitySinceSleep(void);
403 bool abortHibernation(void);
405 IOReturn
joinAggressiveness( IOService
* service
);
406 void handleAggressivesRequests( void );
408 void tracePoint( uint8_t point
);
409 void tracePoint( uint8_t point
, uint8_t data
);
410 void traceDetail( uint32_t data32
);
412 bool systemMessageFilter(
413 void * object
, void * arg1
, void * arg2
, void * arg3
);
415 void updatePreventIdleSleepList(
416 IOService
* service
, bool addNotRemove
);
417 void updatePreventSystemSleepList(
418 IOService
* service
, bool addNotRemove
);
420 void publishPMSetting(
421 const OSSymbol
* feature
, uint32_t where
, uint32_t * featureID
);
423 /*! @function recordPMEvent
424 @abstract Logs IOService PM event timing.
425 @discussion Should only be called from IOServicePM. Should not be exported.
426 @result kIOReturn on success.
428 IOReturn
recordPMEvent( PMEventDetails
*details
);
429 IOReturn
recordAndReleasePMEvent( PMEventDetails
*details
);
430 IOReturn
recordPMEventGated( PMEventDetails
*details
);
431 IOReturn
recordAndReleasePMEventGated( PMEventDetails
*details
);
433 void pmStatsRecordEvent(
435 AbsoluteTime timestamp
);
437 void pmStatsRecordApplicationResponse(
438 const OSSymbol
*response
,
445 /*! @function suspendPMNotificationsForPID
446 @abstract kernel process management calls this to disable sleep/wake notifications
447 when a process is suspended.
448 @param pid the process ID
449 @param doSuspend true suspends the notifications; false enables them
451 void suspendPMNotificationsForPID( uint32_t pid
, bool doSuspend
);
453 /*! @function pmNotificationIsSuspended
454 @abstract returns true if PM notifications have been suspended
455 @param pid the process ID
456 @result true if the process has been suspended
458 bool pmNotificationIsSuspended( uint32_t pid
);
461 bool getHibernateSettings(
462 uint32_t * hibernateMode
,
463 uint32_t * hibernateFreeRatio
,
464 uint32_t * hibernateFreeTime
);
468 friend class PMSettingObject
;
469 friend class RootDomainUserClient
;
470 friend class PMAssertionsTracker
;
472 static IOReturn
sysPowerDownHandler( void * target
, void * refCon
,
473 UInt32 messageType
, IOService
* service
,
474 void * messageArgument
, vm_size_t argSize
);
476 static IOReturn
displayWranglerNotification( void * target
, void * refCon
,
477 UInt32 messageType
, IOService
* service
,
478 void * messageArgument
, vm_size_t argSize
);
480 static IOReturn
rootBusyStateChangeHandler( void * target
, void * refCon
,
481 UInt32 messageType
, IOService
* service
,
482 void * messageArgument
, vm_size_t argSize
);
484 static bool displayWranglerMatchPublished( void * target
, void * refCon
,
485 IOService
* newService
,
486 IONotifier
* notifier
);
488 static bool batteryPublished( void * target
, void * refCon
,
489 IOService
* resourceService
,
490 IONotifier
* notifier
);
492 IOService
* wrangler
;
494 IOLock
*featuresDictLock
; // guards supportedFeatures
495 IOPMPowerStateQueue
*pmPowerStateQueue
;
497 OSArray
*allowedPMSettings
;
498 OSArray
*noPublishPMSettings
;
499 PMTraceWorker
*pmTracer
;
500 PMAssertionsTracker
*pmAssertions
;
502 // Settings controller info
503 IOLock
*settingsCtrlLock
;
504 OSDictionary
*settingsCallbacks
;
505 OSDictionary
*fPMSettingsDict
;
507 IONotifier
*_batteryPublishNotifier
;
508 IONotifier
*_displayWranglerNotifier
;
511 const OSSymbol
*_statsNameKey
;
512 const OSSymbol
*_statsPIDKey
;
513 const OSSymbol
*_statsTimeMSKey
;
514 const OSSymbol
*_statsResponseTypeKey
;
515 const OSSymbol
*_statsMessageTypeKey
;
517 OSString
*queuedSleepWakeUUIDString
;
518 OSArray
*pmStatsAppResponses
;
522 // Pref: idle time before idle sleep
523 unsigned long sleepSlider
;
524 unsigned long idleSeconds
;
525 uint64_t autoWakeStart
;
526 uint64_t autoWakeEnd
;
528 // Difference between sleepSlider and longestNonSleepSlider
529 unsigned long extraSleepDelay
;
531 // Used to wait between say display idle and system idle
532 thread_call_t extraSleepTimer
;
533 thread_call_t diskSyncCalloutEntry
;
535 // IOPMActions parameter encoding
537 kPMActionsFlagIsDisplayWrangler
= 0x00000001,
538 kPMActionsFlagIsGraphicsDevice
= 0x00000002,
539 kPMActionsFlagIsAudioDevice
= 0x00000004,
540 kPMActionsFlagLimitPower
= 0x00000008,
541 kPMActionsPCIBitNumberMask
= 0x000000ff
544 // Track system capabilities.
545 uint32_t _desiredCapability
;
546 uint32_t _currentCapability
;
547 uint32_t _pendingCapability
;
548 uint32_t _highestCapability
;
549 OSSet
* _joinedCapabilityClients
;
550 uint32_t _systemStateGeneration
;
552 // Type of clients that can receive system messages.
554 kSystemMessageClientConfigd
= 0x01,
555 kSystemMessageClientApp
= 0x02,
556 kSystemMessageClientUser
= 0x03,
557 kSystemMessageClientKernel
= 0x04,
558 kSystemMessageClientAll
= 0x07
560 uint32_t _systemMessageClientMask
;
562 // Power state and capability change transitions.
564 kSystemTransitionNone
= 0,
565 kSystemTransitionSleep
= 1,
566 kSystemTransitionWake
= 2,
567 kSystemTransitionCapability
= 3,
568 kSystemTransitionNewCapClient
= 4
569 } _systemTransitionType
;
571 unsigned int systemBooting
:1;
572 unsigned int systemShutdown
:1;
573 unsigned int systemDarkWake
:1;
574 unsigned int clamshellExists
:1;
575 unsigned int clamshellClosed
:1;
576 unsigned int clamshellDisabled
:1;
577 unsigned int desktopMode
:1;
578 unsigned int acAdaptorConnected
:1;
579 unsigned int clamshellSleepDisabled
:1;
581 unsigned int idleSleepTimerPending
:1;
582 unsigned int userDisabledAllSleep
:1;
583 unsigned int ignoreTellChangeDown
:1;
584 unsigned int wranglerAsleep
:1;
585 unsigned int wranglerTickled
:1;
586 unsigned int wranglerSleepIgnored
:1;
587 unsigned int graphicsSuppressed
:1;
588 unsigned int darkWakeThermalAlarm
:1;
590 unsigned int capabilityLoss
:1;
591 unsigned int pciCantSleepFlag
:1;
592 unsigned int pciCantSleepValid
:1;
593 unsigned int logWranglerTickle
:1;
594 unsigned int logGraphicsClamp
:1;
595 unsigned int darkWakeToSleepASAP
:1;
596 unsigned int darkWakeMaintenance
:1;
597 unsigned int darkWakeSleepService
:1;
599 unsigned int darkWakePostTickle
:1;
600 unsigned int sleepTimerMaintenance
:1;
601 unsigned int lowBatteryCondition
:1;
602 unsigned int darkWakeThermalEmergency
:1;
603 unsigned int hibernateDisabled
:1;
604 unsigned int hibernateNoDefeat
:1;
605 unsigned int rejectWranglerTickle
:1;
606 unsigned int wranglerTickleLatched
:1;
608 uint32_t hibernateMode
;
609 uint32_t userActivityCount
;
610 uint32_t userActivityAtSleep
;
611 uint32_t lastSleepReason
;
612 uint32_t hibernateAborted
;
614 // Info for communicating system state changes to PMCPU
615 int32_t idxPMCPUClamshell
;
616 int32_t idxPMCPULimitedPower
;
618 IOOptionBits platformSleepSupport
;
619 uint32_t _debugWakeSeconds
;
620 uint32_t _lastDebugWakeSeconds
;
622 queue_head_t aggressivesQueue
;
623 thread_call_t aggressivesThreadCall
;
624 OSData
* aggressivesData
;
626 AbsoluteTime wranglerSleepTime
;
627 AbsoluteTime systemWakeTime
;
629 // PCI top-level PM trace
630 IOService
* pciHostBridgeDevice
;
631 IOService
* pciHostBridgeDriver
;
633 IONotifier
* systemCapabilityNotifier
;
635 IOPMTimeline
*timeline
;
640 } PMNotifySuspendedStruct
;
642 uint32_t pmSuspendedCapacity
;
643 uint32_t pmSuspendedSize
;
644 PMNotifySuspendedStruct
*pmSuspendedPIDS
;
646 OSSet
* preventIdleSleepList
;
647 OSSet
* preventSystemSleepList
;
649 UInt32 _scheduledAlarms
;
650 UInt32 _userScheduledAlarm
;
653 clock_sec_t _standbyTimerResetSeconds
;
656 int findSuspendedPID(uint32_t pid
, uint32_t *outRefCount
);
658 // IOPMrootDomain internal sleep call
659 IOReturn
privateSleepSystem( uint32_t sleepReason
);
660 void reportUserInput( void );
661 void setDisableClamShellSleep( bool );
662 bool checkSystemCanSleep( IOOptionBits options
= 0 );
663 bool checkSystemCanSustainFullWake( void );
665 void adjustPowerState( bool sleepASAP
= false );
666 void setQuickSpinDownTimeout( void );
667 void restoreUserSpinDownTimeout( void );
669 bool shouldSleepOnClamshellClosed(void );
670 void sendClientClamshellNotification( void );
672 // Inform PMCPU of changes to state like lid, AC vs. battery
673 void informCPUStateChange( uint32_t type
, uint32_t value
);
675 void dispatchPowerEvent( uint32_t event
, void * arg0
, uint64_t arg1
);
676 void handlePowerNotification( UInt32 msg
);
678 IOReturn
setPMSetting(const OSSymbol
*, OSObject
*);
680 void startIdleSleepTimer( uint32_t inSeconds
);
681 void cancelIdleSleepTimer( void );
683 IOReturn
setAggressiveness(
686 IOOptionBits options
);
688 void synchronizeAggressives(
689 queue_head_t
* services
,
690 const AggressivesRecord
* array
,
693 void broadcastAggressives(
694 const AggressivesRecord
* array
,
697 // getPMTraceMemoryDescriptor should only be called by our friend RootDomainUserClient
698 IOMemoryDescriptor
*getPMTraceMemoryDescriptor(void);
700 IOReturn
setPMAssertionUserLevels(IOPMDriverAssertionType
);
702 void publishSleepWakeUUID( bool shouldPublish
);
704 void evaluatePolicy( int stimulus
, uint32_t arg
= 0 );
706 void evaluateAssertions(IOPMDriverAssertionType newAssertions
,
707 IOPMDriverAssertionType oldAssertions
);
709 void deregisterPMSettingObject( PMSettingObject
* pmso
);
712 bool getSleepOption( const char * key
, uint32_t * option
);
713 bool evaluateSystemSleepPolicy( IOPMSystemSleepParameters
* p
,
714 int phase
, uint32_t * hibMode
);
715 void evaluateSystemSleepPolicyEarly( void );
716 void evaluateSystemSleepPolicyFinal( void );
717 #endif /* HIBERNATION */
719 bool latchDisplayWranglerTickle( bool latch
);
720 #endif /* XNU_KERNEL_PRIVATE */
723 #ifdef XNU_KERNEL_PRIVATE
724 class IORootParent
: public IOService
726 OSDeclareFinalStructors(IORootParent
)
729 static void initialize( void );
730 virtual OSObject
* copyProperty( const char * aKey
) const;
731 bool start( IOService
* nub
);
732 void shutDownSystem( void );
733 void restartSystem( void );
734 void sleepSystem( void );
735 void dozeSystem( void );
736 void sleepToDoze( void );
737 void wakeSystem( void );
739 #endif /* XNU_KERNEL_PRIVATE */
741 #endif /* _IOKIT_ROOTDOMAIN_H */