+ 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 clamshellSleepDisabled :1;
+ unsigned int idleSleepTimerPending :1;
+ unsigned int userDisabledAllSleep :1;
+ unsigned int ignoreTellChangeDown :1;
+ unsigned int wranglerAsleep :1;
+ unsigned int wranglerTickled :1;
+ unsigned int _preventUserActive :1;
+ unsigned int graphicsSuppressed :1;
+
+ unsigned int capabilityLoss :1;
+ unsigned int pciCantSleepFlag :1;
+ unsigned int pciCantSleepValid :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 sleepToStandby :1;
+ unsigned int lowBatteryCondition :1;
+ unsigned int hibernateDisabled :1;
+ unsigned int hibernateRetry :1;
+ unsigned int wranglerTickleLatched :1;
+ unsigned int userIsActive :1;
+ unsigned int userWasActive :1;
+
+ unsigned int displayIdleForDemandSleep :1;
+ unsigned int darkWakeHibernateError :1;
+ unsigned int thermalWarningState:1;
+ unsigned int toldPowerdCapWillChange :1;
+ unsigned int displayPowerOnRequested:1;
+
+ uint8_t tasksSuspended;
+ uint32_t hibernateMode;
+ AbsoluteTime userActivityTime;
+ AbsoluteTime userActivityTime_prev;
+ uint32_t userActivityCount;
+ uint32_t userActivityAtSleep;
+ uint32_t lastSleepReason;
+ uint32_t fullToDarkReason;
+ uint32_t hibernateAborted;
+ uint8_t standbyNixed;
+ uint8_t resetTimers;
+
+ enum FullWakeReason {
+ kFullWakeReasonNone = 0,
+ kFullWakeReasonLocalUser = 1,
+ kFullWakeReasonDisplayOn = 2,
+ fFullWakeReasonDisplayOnAndLocalUser = 3
+ };
+ uint32_t fullWakeReason;
+
+ // 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 userBecameInactiveTime;
+
+ // PCI top-level PM trace
+ IOService * pciHostBridgeDevice;
+ IOService * pciHostBridgeDriver;
+
+ IONotifier * systemCapabilityNotifier;
+
+ typedef struct {
+ uint32_t pid;
+ uint32_t refcount;
+ } PMNotifySuspendedStruct;
+
+ uint32_t pmSuspendedCapacity;
+ uint32_t pmSuspendedSize;
+ PMNotifySuspendedStruct *pmSuspendedPIDS;
+
+ OSSet * preventIdleSleepList;
+ OSSet * preventSystemSleepList;
+
+ UInt32 _scheduledAlarms;
+ UInt32 _userScheduledAlarm;
+
+#if HIBERNATION
+ clock_sec_t _standbyTimerResetSeconds;
+#endif
+ volatile uint32_t swd_lock; /* Lock to access swd_buffer & and its header */
+ void * swd_buffer; /* Memory allocated for dumping sleep/wake logs */
+ uint32_t swd_flags; /* Flags defined in IOPMPrivate.h */
+ uint8_t swd_DebugImageSetup;
+ void * swd_spindump_buffer;
+
+ IOBufferMemoryDescriptor *swd_memDesc;
+
+ IOMemoryMap * swd_logBufMap; /* Memory with sleep/wake logs from previous boot */
+
+ // Wake Event Reporting
+ OSArray * _systemWakeEventsArray;
+ bool _acceptSystemWakeEvents;
+
+ int findSuspendedPID(uint32_t pid, uint32_t *outRefCount);
+
+ // IOPMrootDomain internal sleep call
+ IOReturn privateSleepSystem( uint32_t sleepReason );
+ void reportUserInput( void );
+ void setDisableClamShellSleep( bool );
+ bool checkSystemSleepAllowed( IOOptionBits options,
+ uint32_t sleepReason );
+ bool checkSystemSleepEnabled( void );
+ bool checkSystemCanSleep( uint32_t sleepReason );
+ 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 );
+ uint32_t getTimeToIdleSleep( 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 );
+
+ IOReturn setPMAssertionUserLevels(IOPMDriverAssertionType);
+
+ void publishSleepWakeUUID( bool shouldPublish );
+
+ void evaluatePolicy( int stimulus, uint32_t arg = 0 );
+ void requestFullWake( FullWakeReason reason );
+ void willEnterFullWake( void );
+
+ void evaluateAssertions(IOPMDriverAssertionType newAssertions,
+ IOPMDriverAssertionType oldAssertions);
+
+ void deregisterPMSettingObject( PMSettingObject * pmso );
+
+ uint32_t checkForValidDebugData(const char *fname, vfs_context_t *ctx,
+ void *tmpBuf, struct vnode **vp);
+ void sleepWakeDebugMemAlloc( );
+ void sleepWakeDebugSpinDumpMemAlloc( );
+ void sleepWakeDebugDumpFromMem(IOMemoryMap *logBufMap);
+ void sleepWakeDebugDumpFromFile( );
+ IOMemoryMap *sleepWakeDebugRetrieve();
+ errno_t sleepWakeDebugSaveFile(const char *name, char *buf, int len);
+ errno_t sleepWakeDebugCopyFile( struct vnode *srcVp,
+ vfs_context_t srcCtx,
+ char *tmpBuf, uint64_t tmpBufSize,
+ uint64_t srcOffset,
+ const char *dstFname,
+ uint64_t numBytes,
+ uint32_t crc);
+
+
+#if HIBERNATION
+ bool getSleepOption( const char * key, uint32_t * option );
+ bool evaluateSystemSleepPolicy( IOPMSystemSleepParameters * p,
+ int phase, uint32_t * hibMode );
+ void evaluateSystemSleepPolicyEarly( void );
+ void evaluateSystemSleepPolicyFinal( void );
+#endif /* HIBERNATION */
+
+ bool latchDisplayWranglerTickle( bool latch );
+ void setDisplayPowerOn( uint32_t options );
+
+ void acceptSystemWakeEvents( bool accept );
+ void systemDidNotSleep( void );
+ void preventTransitionToUserActive( bool prevent );
+ void setThermalState(OSObject *value);
+ void copySleepPreventersList(OSArray **idleSleepList, OSArray **systemSleepList);
+#endif /* XNU_KERNEL_PRIVATE */