#include <IOKit/IOService.h>
#include <IOKit/pwr_mgt/IOPM.h>
-#include "IOKit/pwr_mgt/IOPMPrivate.h"
#include <IOKit/IOBufferMemoryDescriptor.h>
#ifdef XNU_KERNEL_PRIVATE
struct AggressivesRecord;
struct IOPMMessageFilterContext;
struct IOPMActions;
+struct IOPMSystemSleepParameters;
class PMSettingObject;
class IOPMTimeline;
class PMEventDetails;
@result On success, returns a new assertion of type IOPMDriverAssertionID *
*/
IOReturn releasePMAssertion(IOPMDriverAssertionID releaseAssertion);
-
+
private:
virtual IOReturn changePowerStateTo( unsigned long ordinal );
virtual IOReturn changePowerStateToPriv( unsigned long ordinal );
void handleQueueSleepWakeUUID(
OSObject *obj);
- IOReturn setMaintenanceWakeCalendar(const IOPMCalendarStruct * calendar );
+ void handleSuspendPMNotificationClient(
+ uint32_t pid, bool doSuspend);
+
+ IOReturn setMaintenanceWakeCalendar(
+ const IOPMCalendarStruct * calendar );
// Handle callbacks from IOService::systemWillShutdown()
void acknowledgeSystemWillShutdown( IOService * from );
bool systemMessageFilter(
void * object, void * arg1, void * arg2, void * arg3 );
+ void updatePreventIdleSleepList(
+ IOService * service, bool addNotRemove );
+ void updatePreventSystemSleepList(
+ IOService * service, bool addNotRemove );
+
void publishPMSetting(
const OSSymbol * feature, uint32_t where, uint32_t * featureID );
uint32_t delay_ms,
int app_pid);
+
+/*! @function suspendPMNotificationsForPID
+ @abstract kernel process management calls this to disable sleep/wake notifications
+ when a process is suspended.
+ @param pid the process ID
+ @param doSuspend true suspends the notifications; false enables them
+*/
+ void suspendPMNotificationsForPID( uint32_t pid, bool doSuspend);
+
+/*! @function pmNotificationIsSuspended
+ @abstract returns true if PM notifications have been suspended
+ @param pid the process ID
+ @result true if the process has been suspended
+*/
+ bool pmNotificationIsSuspended( uint32_t pid );
+
+
#if HIBERNATION
bool getHibernateSettings(
uint32_t * hibernateMode,
IONotifier * notifier);
IOService * wrangler;
- IOService * wranglerConnection;
IOLock *featuresDictLock; // guards supportedFeatures
IOPMPowerStateQueue *pmPowerStateQueue;
OSArray *pmStatsAppResponses;
bool uuidPublished;
- PMStatsStruct pmStats;
// Pref: idle time before idle sleep
unsigned long sleepSlider;
unsigned int idleSleepTimerPending :1;
unsigned int userDisabledAllSleep :1;
- unsigned int childPreventSystemSleep :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 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;
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;
+
+#if HIBERNATION
+ clock_sec_t _standbyTimerResetSeconds;
+#endif
- IOPMSystemSleepPolicyHandler _sleepPolicyHandler;
- void * _sleepPolicyTarget;
- IOPMSystemSleepPolicyVariables *_sleepPolicyVars;
+ int findSuspendedPID(uint32_t pid, uint32_t *outRefCount);
// IOPMrootDomain internal sleep call
IOReturn privateSleepSystem( uint32_t sleepReason );
#if HIBERNATION
bool getSleepOption( const char * key, uint32_t * option );
- bool evaluateSystemSleepPolicy( IOPMSystemSleepParameters * p, int phase );
+ bool evaluateSystemSleepPolicy( IOPMSystemSleepParameters * p, int sleepPhase );
void evaluateSystemSleepPolicyEarly( void );
void evaluateSystemSleepPolicyFinal( void );
#endif /* HIBERNATION */