+/*****************************************************************************
+ *
+ * IOPMDriverWakeEvents dictionary keys
+ *
+ *****************************************************************************/
+
+#define kIOPMWakeEventTimeKey "Time"
+#define kIOPMWakeEventFlagsKey "Flags"
+#define kIOPMWakeEventReasonKey "Reason"
+#define kIOPMWakeEventDetailsKey "Details"
+
+/*****************************************************************************
+ *
+ * Wake event flags reported to IOPMrootDomain::claimSystemWakeEvent()
+ *
+ *****************************************************************************/
+
+#define kIOPMWakeEventSource 0x00000001
+
+/*****************************************************************************
+ *
+ * System Sleep Policy
+ *
+ *****************************************************************************/
+
+#define kIOPMSystemSleepPolicySignature 0x54504c53
+#define kIOPMSystemSleepPolicyVersion 2
+
+/*!
+ * @defined kIOPMSystemSleepTypeKey
+ * @abstract Indicates the type of system sleep.
+ * @discussion An OSNumber property of root domain that describes the type
+ * of system sleep. This property is set after notifying priority sleep/wake
+ * clients, but before informing interested drivers and shutting down power
+ * plane drivers. On a hibernate abort or failure, this property will not be
+ * updated and will indicate the failed sleep type.
+ */
+#define kIOPMSystemSleepTypeKey "IOPMSystemSleepType"
+
+struct IOPMSystemSleepPolicyVariables
+{
+ uint32_t signature; // kIOPMSystemSleepPolicySignature
+ uint32_t version; // kIOPMSystemSleepPolicyVersion
+
+ uint64_t currentCapability; // current system capability bits
+ uint64_t highestCapability; // highest system capability bits
+
+ uint64_t sleepFactors; // sleep factor bits
+ uint32_t sleepReason; // kIOPMSleepReason*
+ uint32_t sleepPhase; // identify the sleep phase
+ uint32_t hibernateMode; // current hibernate mode
+
+ uint32_t standbyDelay; // standby delay in seconds
+ uint32_t poweroffDelay; // auto-poweroff delay in seconds
+ uint32_t scheduledAlarms; // bitmask of scheduled alarm types
+ uint32_t poweroffTimer; // auto-poweroff timer in seconds
+
+ uint32_t reserved[49]; // pad sizeof 256 bytes
+};
+
+enum {
+ kIOPMAlarmBitDebugWake = 0x01,
+ kIOPMAlarmBitCalendarWake = 0x02,
+ kIOPMAlarmBitMaintenanceWake = 0x04,
+ kIOPMAlarmBitSleepServiceWake = 0x08
+};
+
+enum {
+ kIOPMSleepPhase0 = 0,
+ kIOPMSleepPhase1,
+ kIOPMSleepPhase2
+};
+
+// Sleep Factor Mask / Bits
+enum {
+ kIOPMSleepFactorSleepTimerWake = 0x00000001ULL,
+ kIOPMSleepFactorLidOpen = 0x00000002ULL,
+ kIOPMSleepFactorACPower = 0x00000004ULL,
+ kIOPMSleepFactorBatteryLow = 0x00000008ULL,
+ kIOPMSleepFactorStandbyNoDelay = 0x00000010ULL,
+ kIOPMSleepFactorStandbyForced = 0x00000020ULL,
+ kIOPMSleepFactorStandbyDisabled = 0x00000040ULL,
+ kIOPMSleepFactorUSBExternalDevice = 0x00000080ULL,
+ kIOPMSleepFactorBluetoothHIDDevice = 0x00000100ULL,
+ kIOPMSleepFactorExternalMediaMounted = 0x00000200ULL,
+ kIOPMSleepFactorThunderboltDevice = 0x00000400ULL,
+ kIOPMSleepFactorRTCAlarmScheduled = 0x00000800ULL,
+ kIOPMSleepFactorMagicPacketWakeEnabled = 0x00001000ULL,
+ kIOPMSleepFactorHibernateForced = 0x00010000ULL,
+ kIOPMSleepFactorAutoPowerOffDisabled = 0x00020000ULL,
+ kIOPMSleepFactorAutoPowerOffForced = 0x00040000ULL,
+ kIOPMSleepFactorExternalDisplay = 0x00080000ULL,
+ kIOPMSleepFactorNetworkKeepAliveActive = 0x00100000ULL,
+ kIOPMSleepFactorLocalUserActivity = 0x00200000ULL,
+ kIOPMSleepFactorHibernateFailed = 0x00400000ULL,
+ kIOPMSleepFactorThermalWarning = 0x00800000ULL,
+ kIOPMSleepFactorDisplayCaptured = 0x01000000ULL
+};
+
+// System Sleep Types
+enum {
+ kIOPMSleepTypeInvalid = 0,
+ kIOPMSleepTypeAbortedSleep = 1,
+ kIOPMSleepTypeNormalSleep = 2,
+ kIOPMSleepTypeSafeSleep = 3,
+ kIOPMSleepTypeHibernate = 4,
+ kIOPMSleepTypeStandby = 5,
+ kIOPMSleepTypePowerOff = 6,
+ kIOPMSleepTypeDeepIdle = 7,
+ kIOPMSleepTypeLast = 8
+};
+
+// System Sleep Flags
+enum {
+ kIOPMSleepFlagDisableHibernateAbort = 0x00000001,
+ kIOPMSleepFlagDisableUSBWakeEvents = 0x00000002,
+ kIOPMSleepFlagDisableBatlowAssertion = 0x00000004,
+ kIOPMSleepFlagDisableS4WakeSources = 0x00000008
+};
+
+// System Wake Events
+enum {
+ kIOPMWakeEventLidOpen = 0x00000001,
+ kIOPMWakeEventLidClose = 0x00000002,
+ kIOPMWakeEventACAttach = 0x00000004,
+ kIOPMWakeEventACDetach = 0x00000008,
+ kIOPMWakeEventCDInsert = 0x00000010,
+ kIOPMWakeEventCDEject = 0x00000020,
+ kIOPMWakeEventHPDAttach = 0x00000040,
+ kIOPMWakeEventHPDDetach = 0x00000080,
+ kIOPMWakeEventPowerButton = 0x00000100,
+ kIOPMWakeEventG3PowerOn = 0x00000200,
+ kIOPMWakeEventUserPME = 0x00000400,
+ kIOPMWakeEventSleepTimer = 0x00000800,
+ kIOPMWakeEventBatteryLow = 0x00001000,
+ kIOPMWakeEventDarkPME = 0x00002000
+};
+
+/*!
+ * @defined kIOPMSystemSleepParametersKey
+ * @abstract Sleep parameters describing the upcoming sleep
+ * @discussion Root domain updates this OSData property before system sleep
+ * to pass sleep parameters to the platform driver. Some of the parameters
+ * are based on the chosen entry in the system sleep policy table.
+ */