- friend class PMSettingObject;
- friend class RootDomainUserClient;
- friend class PMAssertionsTracker;
-
- static IOReturn sysPowerDownHandler( void * target, void * refCon,
- UInt32 messageType, IOService * service,
- void * messageArgument, vm_size_t argSize );
-
- static IOReturn displayWranglerNotification( void * target, void * refCon,
- UInt32 messageType, IOService * service,
- void * messageArgument, vm_size_t argSize );
-
- static IOReturn rootBusyStateChangeHandler( void * target, void * refCon,
- UInt32 messageType, IOService * service,
- void * messageArgument, vm_size_t argSize );
-
- static bool displayWranglerMatchPublished( void * target, void * refCon,
- IOService * newService,
- IONotifier * notifier);
-
- static bool batteryPublished( void * target, void * refCon,
- IOService * resourceService,
- IONotifier * notifier);
-
- IOService * wrangler;
-
- IOLock *featuresDictLock; // guards supportedFeatures
- IOPMPowerStateQueue *pmPowerStateQueue;
-
- OSArray *allowedPMSettings;
- OSArray *noPublishPMSettings;
- PMTraceWorker *pmTracer;
- PMAssertionsTracker *pmAssertions;
-
- // Settings controller info
- IOLock *settingsCtrlLock;
- OSDictionary *settingsCallbacks;
- OSDictionary *fPMSettingsDict;
-
- IONotifier *_batteryPublishNotifier;
- IONotifier *_displayWranglerNotifier;
-
- // Statistics
- const OSSymbol *_statsNameKey;
- const OSSymbol *_statsPIDKey;
- const OSSymbol *_statsTimeMSKey;
- const OSSymbol *_statsResponseTypeKey;
- const OSSymbol *_statsMessageTypeKey;
-
- 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 clamshellSleepDisabled :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;
- UInt32 _userScheduledAlarm;
+ friend class PMSettingObject;
+ friend class RootDomainUserClient;
+ friend class PMAssertionsTracker;
+
+ static IOReturn sysPowerDownHandler( void * target, void * refCon,
+ UInt32 messageType, IOService * service,
+ void * messageArgument, vm_size_t argSize );
+
+ static IOReturn displayWranglerNotification( void * target, void * refCon,
+ UInt32 messageType, IOService * service,
+ void * messageArgument, vm_size_t argSize );
+
+ static IOReturn rootBusyStateChangeHandler( void * target, void * refCon,
+ UInt32 messageType, IOService * service,
+ void * messageArgument, vm_size_t argSize );
+
+ static bool displayWranglerMatchPublished( void * target, void * refCon,
+ IOService * newService,
+ IONotifier * notifier);
+
+ static bool batteryPublished( void * target, void * refCon,
+ IOService * resourceService,
+ IONotifier * notifier);
+
+ void initializeBootSessionUUID( void );
+
+ void fullWakeDelayedWork( void );
+
+ IOService * wrangler;
+ OSDictionary * wranglerIdleSettings;
+
+ IOLock *featuresDictLock;// guards supportedFeatures
+ IOLock *wakeEventLock;
+ IOPMPowerStateQueue *pmPowerStateQueue;
+
+ OSArray *allowedPMSettings;
+ OSArray *noPublishPMSettings;
+ PMTraceWorker *pmTracer;
+ PMAssertionsTracker *pmAssertions;
+
+// Settings controller info
+ IOLock *settingsCtrlLock;
+ OSDictionary *settingsCallbacks;
+ OSDictionary *fPMSettingsDict;
+
+ IONotifier *_batteryPublishNotifier;
+ IONotifier *_displayWranglerNotifier;
+
+// Statistics
+ const OSSymbol *_statsNameKey;
+ const OSSymbol *_statsPIDKey;
+ const OSSymbol *_statsTimeMSKey;
+ const OSSymbol *_statsResponseTypeKey;
+ const OSSymbol *_statsMessageTypeKey;
+ const OSSymbol *_statsPowerCapsKey;
+ uint32_t sleepCnt;
+ uint32_t darkWakeCnt;
+ uint32_t displayWakeCnt;
+
+ OSString *queuedSleepWakeUUIDString;
+ OSArray *pmStatsAppResponses;
+ IOLock *pmStatsLock;// guards pmStatsAppResponses
+
+ void *sleepDelaysReport; // report to track time taken to go to sleep
+ uint32_t sleepDelaysClientCnt;// Number of interested clients in sleepDelaysReport
+ uint64_t ts_sleepStart;
+ uint64_t wake2DarkwakeDelay; // Time taken to change from full wake -> Dark wake
+
+
+ void *assertOnWakeReport;// report to track time spent without any assertions held after wake
+ uint32_t assertOnWakeClientCnt;// Number of clients interested in assertOnWakeReport
+ clock_sec_t assertOnWakeSecs; // Num of secs after wake for first assertion
+
+ bool uuidPublished;
+
+// Pref: idle time before idle sleep
+ bool idleSleepEnabled;
+ 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 powerButtonDown;
+ thread_call_t powerButtonUp;
+ thread_call_t diskSyncCalloutEntry;
+ thread_call_t fullWakeThreadCall;
+ thread_call_t updateConsoleUsersEntry;
+
+// 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 {
+ kSystemMessageClientPowerd = 0x01,
+ kSystemMessageClientLegacyApp = 0x02,
+ 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 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 isRTCAlarmWake :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;
+ uint8_t tasksSuspendState;
+ 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;
+ clock_sec_t _scheduledAlarmUTC;