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 // Handle callbacks from IOService::systemWillShutdown()
391 void acknowledgeSystemWillShutdown( IOService
* from
);
393 // Handle platform halt and restart notifications
394 void handlePlatformHaltRestart( UInt32 pe_type
);
396 IOReturn
shutdownSystem( void );
397 IOReturn
restartSystem( void );
398 void handleSleepTimerExpiration( void );
400 bool activitySinceSleep(void);
401 bool abortHibernation(void);
403 IOReturn
joinAggressiveness( IOService
* service
);
404 void handleAggressivesRequests( void );
406 void tracePoint( uint8_t point
);
407 void tracePoint( uint8_t point
, uint8_t data
);
408 void traceDetail( uint32_t data32
);
410 bool systemMessageFilter(
411 void * object
, void * arg1
, void * arg2
, void * arg3
);
413 void updatePreventIdleSleepList(
414 IOService
* service
, bool addNotRemove
);
415 void updatePreventSystemSleepList(
416 IOService
* service
, bool addNotRemove
);
418 void publishPMSetting(
419 const OSSymbol
* feature
, uint32_t where
, uint32_t * featureID
);
421 /*! @function recordPMEvent
422 @abstract Logs IOService PM event timing.
423 @discussion Should only be called from IOServicePM. Should not be exported.
424 @result kIOReturn on success.
426 IOReturn
recordPMEvent( PMEventDetails
*details
);
427 IOReturn
recordAndReleasePMEvent( PMEventDetails
*details
);
428 IOReturn
recordPMEventGated( PMEventDetails
*details
);
429 IOReturn
recordAndReleasePMEventGated( PMEventDetails
*details
);
431 void pmStatsRecordEvent(
433 AbsoluteTime timestamp
);
435 void pmStatsRecordApplicationResponse(
436 const OSSymbol
*response
,
443 /*! @function suspendPMNotificationsForPID
444 @abstract kernel process management calls this to disable sleep/wake notifications
445 when a process is suspended.
446 @param pid the process ID
447 @param doSuspend true suspends the notifications; false enables them
449 void suspendPMNotificationsForPID( uint32_t pid
, bool doSuspend
);
451 /*! @function pmNotificationIsSuspended
452 @abstract returns true if PM notifications have been suspended
453 @param pid the process ID
454 @result true if the process has been suspended
456 bool pmNotificationIsSuspended( uint32_t pid
);
460 bool getHibernateSettings(
461 uint32_t * hibernateMode
,
462 uint32_t * hibernateFreeRatio
,
463 uint32_t * hibernateFreeTime
);
467 friend class PMSettingObject
;
468 friend class RootDomainUserClient
;
469 friend class PMAssertionsTracker
;
471 static IOReturn
sysPowerDownHandler( void * target
, void * refCon
,
472 UInt32 messageType
, IOService
* service
,
473 void * messageArgument
, vm_size_t argSize
);
475 static IOReturn
displayWranglerNotification( void * target
, void * refCon
,
476 UInt32 messageType
, IOService
* service
,
477 void * messageArgument
, vm_size_t argSize
);
479 static IOReturn
rootBusyStateChangeHandler( void * target
, void * refCon
,
480 UInt32 messageType
, IOService
* service
,
481 void * messageArgument
, vm_size_t argSize
);
483 static bool displayWranglerMatchPublished( void * target
, void * refCon
,
484 IOService
* newService
,
485 IONotifier
* notifier
);
487 static bool batteryPublished( void * target
, void * refCon
,
488 IOService
* resourceService
,
489 IONotifier
* notifier
);
491 IOService
* wrangler
;
493 IOLock
*featuresDictLock
; // guards supportedFeatures
494 IOPMPowerStateQueue
*pmPowerStateQueue
;
496 OSArray
*allowedPMSettings
;
497 OSArray
*noPublishPMSettings
;
498 PMTraceWorker
*pmTracer
;
499 PMAssertionsTracker
*pmAssertions
;
501 // Settings controller info
502 IOLock
*settingsCtrlLock
;
503 OSDictionary
*settingsCallbacks
;
504 OSDictionary
*fPMSettingsDict
;
506 IONotifier
*_batteryPublishNotifier
;
507 IONotifier
*_displayWranglerNotifier
;
510 const OSSymbol
*_statsNameKey
;
511 const OSSymbol
*_statsPIDKey
;
512 const OSSymbol
*_statsTimeMSKey
;
513 const OSSymbol
*_statsResponseTypeKey
;
514 const OSSymbol
*_statsMessageTypeKey
;
516 OSString
*queuedSleepWakeUUIDString
;
517 OSArray
*pmStatsAppResponses
;
521 // Pref: idle time before idle sleep
522 unsigned long sleepSlider
;
523 unsigned long idleSeconds
;
524 uint64_t autoWakeStart
;
525 uint64_t autoWakeEnd
;
527 // Difference between sleepSlider and longestNonSleepSlider
528 unsigned long extraSleepDelay
;
530 // Used to wait between say display idle and system idle
531 thread_call_t extraSleepTimer
;
532 thread_call_t diskSyncCalloutEntry
;
534 // IOPMActions parameter encoding
536 kPMActionsFlagIsDisplayWrangler
= 0x00000001,
537 kPMActionsFlagIsGraphicsDevice
= 0x00000002,
538 kPMActionsFlagIsAudioDevice
= 0x00000004,
539 kPMActionsFlagLimitPower
= 0x00000008,
540 kPMActionsPCIBitNumberMask
= 0x000000ff
543 // Track system capabilities.
544 uint32_t _desiredCapability
;
545 uint32_t _currentCapability
;
546 uint32_t _pendingCapability
;
547 uint32_t _highestCapability
;
548 OSSet
* _joinedCapabilityClients
;
549 uint32_t _systemStateGeneration
;
551 // Type of clients that can receive system messages.
553 kSystemMessageClientConfigd
= 0x01,
554 kSystemMessageClientApp
= 0x02,
555 kSystemMessageClientUser
= 0x03,
556 kSystemMessageClientKernel
= 0x04,
557 kSystemMessageClientAll
= 0x07
559 uint32_t _systemMessageClientMask
;
561 // Power state and capability change transitions.
563 kSystemTransitionNone
= 0,
564 kSystemTransitionSleep
= 1,
565 kSystemTransitionWake
= 2,
566 kSystemTransitionCapability
= 3,
567 kSystemTransitionNewCapClient
= 4
568 } _systemTransitionType
;
570 unsigned int systemBooting
:1;
571 unsigned int systemShutdown
:1;
572 unsigned int systemDarkWake
:1;
573 unsigned int clamshellExists
:1;
574 unsigned int clamshellClosed
:1;
575 unsigned int clamshellDisabled
:1;
576 unsigned int desktopMode
:1;
577 unsigned int acAdaptorConnected
:1;
579 unsigned int idleSleepTimerPending
:1;
580 unsigned int userDisabledAllSleep
:1;
581 unsigned int ignoreTellChangeDown
:1;
582 unsigned int wranglerAsleep
:1;
583 unsigned int wranglerTickled
:1;
584 unsigned int wranglerSleepIgnored
:1;
585 unsigned int graphicsSuppressed
:1;
586 unsigned int darkWakeThermalAlarm
:1;
588 unsigned int capabilityLoss
:1;
589 unsigned int pciCantSleepFlag
:1;
590 unsigned int pciCantSleepValid
:1;
591 unsigned int logWranglerTickle
:1;
592 unsigned int logGraphicsClamp
:1;
593 unsigned int darkWakeToSleepASAP
:1;
594 unsigned int darkWakeMaintenance
:1;
595 unsigned int darkWakeSleepService
:1;
597 unsigned int darkWakePostTickle
:1;
598 unsigned int sleepTimerMaintenance
:1;
599 unsigned int lowBatteryCondition
:1;
600 unsigned int darkWakeThermalEmergency
:1;
601 unsigned int hibernateDisabled
:1;
602 unsigned int hibernateNoDefeat
:1;
603 unsigned int rejectWranglerTickle
:1;
604 unsigned int wranglerTickleLatched
:1;
606 uint32_t hibernateMode
;
607 uint32_t userActivityCount
;
608 uint32_t userActivityAtSleep
;
609 uint32_t lastSleepReason
;
610 uint32_t hibernateAborted
;
612 // Info for communicating system state changes to PMCPU
613 int32_t idxPMCPUClamshell
;
614 int32_t idxPMCPULimitedPower
;
616 IOOptionBits platformSleepSupport
;
617 uint32_t _debugWakeSeconds
;
618 uint32_t _lastDebugWakeSeconds
;
620 queue_head_t aggressivesQueue
;
621 thread_call_t aggressivesThreadCall
;
622 OSData
* aggressivesData
;
624 AbsoluteTime wranglerSleepTime
;
625 AbsoluteTime systemWakeTime
;
627 // PCI top-level PM trace
628 IOService
* pciHostBridgeDevice
;
629 IOService
* pciHostBridgeDriver
;
631 IONotifier
* systemCapabilityNotifier
;
633 IOPMTimeline
*timeline
;
638 } PMNotifySuspendedStruct
;
640 uint32_t pmSuspendedCapacity
;
641 uint32_t pmSuspendedSize
;
642 PMNotifySuspendedStruct
*pmSuspendedPIDS
;
644 OSSet
* preventIdleSleepList
;
645 OSSet
* preventSystemSleepList
;
648 clock_sec_t _standbyTimerResetSeconds
;
651 int findSuspendedPID(uint32_t pid
, uint32_t *outRefCount
);
653 // IOPMrootDomain internal sleep call
654 IOReturn
privateSleepSystem( uint32_t sleepReason
);
655 void reportUserInput( void );
656 bool checkSystemCanSleep( IOOptionBits options
= 0 );
657 bool checkSystemCanSustainFullWake( void );
659 void adjustPowerState( bool sleepASAP
= false );
660 void setQuickSpinDownTimeout( void );
661 void restoreUserSpinDownTimeout( void );
663 bool shouldSleepOnClamshellClosed(void );
664 void sendClientClamshellNotification( void );
666 // Inform PMCPU of changes to state like lid, AC vs. battery
667 void informCPUStateChange( uint32_t type
, uint32_t value
);
669 void dispatchPowerEvent( uint32_t event
, void * arg0
, uint64_t arg1
);
670 void handlePowerNotification( UInt32 msg
);
672 IOReturn
setPMSetting(const OSSymbol
*, OSObject
*);
674 void startIdleSleepTimer( uint32_t inSeconds
);
675 void cancelIdleSleepTimer( void );
677 IOReturn
setAggressiveness(
680 IOOptionBits options
);
682 void synchronizeAggressives(
683 queue_head_t
* services
,
684 const AggressivesRecord
* array
,
687 void broadcastAggressives(
688 const AggressivesRecord
* array
,
691 // getPMTraceMemoryDescriptor should only be called by our friend RootDomainUserClient
692 IOMemoryDescriptor
*getPMTraceMemoryDescriptor(void);
694 IOReturn
setPMAssertionUserLevels(IOPMDriverAssertionType
);
696 void publishSleepWakeUUID( bool shouldPublish
);
698 void evaluatePolicy( int stimulus
, uint32_t arg
= 0 );
700 void evaluateAssertions(IOPMDriverAssertionType newAssertions
,
701 IOPMDriverAssertionType oldAssertions
);
703 void deregisterPMSettingObject( PMSettingObject
* pmso
);
706 bool getSleepOption( const char * key
, uint32_t * option
);
707 bool evaluateSystemSleepPolicy( IOPMSystemSleepParameters
* p
, int sleepPhase
);
708 void evaluateSystemSleepPolicyEarly( void );
709 void evaluateSystemSleepPolicyFinal( void );
710 #endif /* HIBERNATION */
712 bool latchDisplayWranglerTickle( bool latch
);
713 #endif /* XNU_KERNEL_PRIVATE */
716 #ifdef XNU_KERNEL_PRIVATE
717 class IORootParent
: public IOService
719 OSDeclareFinalStructors(IORootParent
)
722 static void initialize( void );
723 virtual OSObject
* copyProperty( const char * aKey
) const;
724 bool start( IOService
* nub
);
725 void shutDownSystem( void );
726 void restartSystem( void );
727 void sleepSystem( void );
728 void dozeSystem( void );
729 void sleepToDoze( void );
730 void wakeSystem( void );
732 #endif /* XNU_KERNEL_PRIVATE */
734 #endif /* _IOKIT_ROOTDOMAIN_H */