+ OSString *queuedSleepWakeUUIDString;
+ OSArray *pmStatsAppResponses;
+
+ bool uuidPublished;
+
+ // Pref: idle time before idle sleep
+ unsigned long sleepSlider;
+ unsigned long idleSeconds;
+ uint64_t autoWakeStart;
+ uint64_t autoWakeEnd;
+
+ // Difference between sleepSlider and longestNonSleepSlider
+ unsigned long extraSleepDelay;
+
+ // Used to wait between say display idle and system idle
+ thread_call_t extraSleepTimer;
+ thread_call_t diskSyncCalloutEntry;
+
+ // IOPMActions parameter encoding
+ enum {
+ kPMActionsFlagIsDisplayWrangler = 0x00000001,
+ kPMActionsFlagIsGraphicsDevice = 0x00000002,
+ kPMActionsFlagIsAudioDevice = 0x00000004,
+ kPMActionsFlagLimitPower = 0x00000008,
+ kPMActionsPCIBitNumberMask = 0x000000ff
+ };
+
+ // Track system capabilities.
+ uint32_t _desiredCapability;
+ uint32_t _currentCapability;
+ uint32_t _pendingCapability;
+ uint32_t _highestCapability;
+ OSSet * _joinedCapabilityClients;
+ uint32_t _systemStateGeneration;
+
+ // Type of clients that can receive system messages.
+ enum {
+ kSystemMessageClientConfigd = 0x01,
+ kSystemMessageClientApp = 0x02,
+ kSystemMessageClientUser = 0x03,
+ kSystemMessageClientKernel = 0x04,
+ kSystemMessageClientAll = 0x07
+ };
+ uint32_t _systemMessageClientMask;
+
+ // Power state and capability change transitions.
+ enum {
+ kSystemTransitionNone = 0,
+ kSystemTransitionSleep = 1,
+ kSystemTransitionWake = 2,
+ kSystemTransitionCapability = 3,
+ kSystemTransitionNewCapClient = 4
+ } _systemTransitionType;
+
+ unsigned int systemBooting :1;
+ unsigned int systemShutdown :1;
+ unsigned int systemDarkWake :1;
+ unsigned int clamshellExists :1;
+ unsigned int clamshellClosed :1;
+ unsigned int clamshellDisabled :1;
+ unsigned int desktopMode :1;
+ unsigned int acAdaptorConnected :1;
+
+ unsigned int idleSleepTimerPending :1;
+ unsigned int userDisabledAllSleep :1;
+ unsigned int ignoreTellChangeDown :1;
+ unsigned int wranglerAsleep :1;
+ unsigned int wranglerTickled :1;
+ unsigned int wranglerSleepIgnored :1;
+ unsigned int graphicsSuppressed :1;
+ unsigned int darkWakeThermalAlarm :1;
+
+ unsigned int capabilityLoss :1;
+ unsigned int pciCantSleepFlag :1;
+ unsigned int pciCantSleepValid :1;
+ unsigned int logWranglerTickle :1;
+ unsigned int logGraphicsClamp :1;
+ unsigned int darkWakeToSleepASAP :1;
+ unsigned int darkWakeMaintenance :1;
+ unsigned int darkWakeSleepService :1;
+
+ unsigned int darkWakePostTickle :1;
+ unsigned int sleepTimerMaintenance :1;
+ unsigned int lowBatteryCondition :1;
+ unsigned int darkWakeThermalEmergency:1;
+ unsigned int hibernateDisabled :1;
+ unsigned int hibernateNoDefeat :1;
+ unsigned int rejectWranglerTickle :1;
+ unsigned int wranglerTickleLatched :1;
+
+ uint32_t hibernateMode;
+ uint32_t userActivityCount;
+ uint32_t userActivityAtSleep;
+ uint32_t lastSleepReason;
+ uint32_t hibernateAborted;
+
+ // Info for communicating system state changes to PMCPU
+ int32_t idxPMCPUClamshell;
+ int32_t idxPMCPULimitedPower;
+
+ IOOptionBits platformSleepSupport;
+ uint32_t _debugWakeSeconds;
+ uint32_t _lastDebugWakeSeconds;
+
+ queue_head_t aggressivesQueue;
+ thread_call_t aggressivesThreadCall;
+ OSData * aggressivesData;
+
+ AbsoluteTime wranglerSleepTime;
+ AbsoluteTime systemWakeTime;
+
+ // PCI top-level PM trace
+ IOService * pciHostBridgeDevice;
+ IOService * pciHostBridgeDriver;
+
+ IONotifier * systemCapabilityNotifier;
+
+ IOPMTimeline *timeline;
+
+ typedef struct {
+ uint32_t pid;
+ uint32_t refcount;
+ } PMNotifySuspendedStruct;
+
+ uint32_t pmSuspendedCapacity;
+ uint32_t pmSuspendedSize;
+ PMNotifySuspendedStruct *pmSuspendedPIDS;
+
+ OSSet * preventIdleSleepList;
+ OSSet * preventSystemSleepList;
+
+ UInt32 _scheduledAlarms;
+
+#if HIBERNATION
+ clock_sec_t _standbyTimerResetSeconds;
+#endif
+
+ int findSuspendedPID(uint32_t pid, uint32_t *outRefCount);
+
+ // IOPMrootDomain internal sleep call
+ IOReturn privateSleepSystem( uint32_t sleepReason );
+ void reportUserInput( void );
+ bool checkSystemCanSleep( IOOptionBits options = 0 );
+ bool checkSystemCanSustainFullWake( void );
+
+ void adjustPowerState( bool sleepASAP = false );
+ void setQuickSpinDownTimeout( void );
+ void restoreUserSpinDownTimeout( void );
+
+ bool shouldSleepOnClamshellClosed(void );
+ void sendClientClamshellNotification( void );
+
+ // Inform PMCPU of changes to state like lid, AC vs. battery
+ void informCPUStateChange( uint32_t type, uint32_t value );
+
+ void dispatchPowerEvent( uint32_t event, void * arg0, uint64_t arg1 );
+ void handlePowerNotification( UInt32 msg );
+
+ IOReturn setPMSetting(const OSSymbol *, OSObject *);
+
+ void startIdleSleepTimer( uint32_t inSeconds );
+ void cancelIdleSleepTimer( void );
+
+ IOReturn setAggressiveness(
+ unsigned long type,
+ unsigned long value,
+ IOOptionBits options );
+
+ void synchronizeAggressives(
+ queue_head_t * services,
+ const AggressivesRecord * array,
+ int count );
+
+ void broadcastAggressives(
+ const AggressivesRecord * array,
+ int count );
+
+ // getPMTraceMemoryDescriptor should only be called by our friend RootDomainUserClient
+ IOMemoryDescriptor *getPMTraceMemoryDescriptor(void);
+
+ IOReturn setPMAssertionUserLevels(IOPMDriverAssertionType);
+
+ void publishSleepWakeUUID( bool shouldPublish );
+
+ void evaluatePolicy( int stimulus, uint32_t arg = 0 );
+
+ void evaluateAssertions(IOPMDriverAssertionType newAssertions,
+ IOPMDriverAssertionType oldAssertions);
+
+ void deregisterPMSettingObject( PMSettingObject * pmso );
+
+#if HIBERNATION
+ bool getSleepOption( const char * key, uint32_t * option );
+ bool evaluateSystemSleepPolicy( IOPMSystemSleepParameters * p, int phase );
+ void evaluateSystemSleepPolicyEarly( void );
+ void evaluateSystemSleepPolicyFinal( void );
+#endif /* HIBERNATION */
+
+ bool latchDisplayWranglerTickle( bool latch );
+#endif /* XNU_KERNEL_PRIVATE */