+#include <IOKit/IOCommand.h>
+#include <IOKit/IOEventSource.h>
+
+//******************************************************************************
+// PM command types
+//******************************************************************************
+
+enum {
+ /* Command Types */
+ kIOPMRequestTypeInvalid = 0x00,
+ kIOPMRequestTypePMStop = 0x01,
+ kIOPMRequestTypeAddPowerChild1 = 0x02,
+ kIOPMRequestTypeAddPowerChild2 = 0x03,
+ kIOPMRequestTypeAddPowerChild3 = 0x04,
+ kIOPMRequestTypeRegisterPowerDriver = 0x05,
+ kIOPMRequestTypeAdjustPowerState = 0x06,
+ kIOPMRequestTypePowerDomainWillChange = 0x07,
+ kIOPMRequestTypePowerDomainDidChange = 0x08,
+ kIOPMRequestTypePowerOverrideOnPriv = 0x09,
+ kIOPMRequestTypePowerOverrideOffPriv = 0x0A,
+ kIOPMRequestTypeActivityTickle = 0x0B,
+ kIOPMRequestTypeRequestPowerState = 0x0C,
+ kIOPMRequestTypeSynchronizePowerTree = 0x0D,
+ kIOPMRequestTypeRequestPowerStateOverride = 0x0E,
+ kIOPMRequestTypeSetIdleTimerPeriod = 0x0F,
+ kIOPMRequestTypeIgnoreIdleTimer = 0x10,
+
+ /* Reply Types */
+ kIOPMRequestTypeReplyStart = 0x80,
+ kIOPMRequestTypeAckPowerChange = 0x81,
+ kIOPMRequestTypeAckSetPowerState = 0x82,
+ kIOPMRequestTypeAllowPowerChange = 0x83,
+ kIOPMRequestTypeCancelPowerChange = 0x84,
+ kIOPMRequestTypeInterestChanged = 0x85,
+ kIOPMRequestTypeIdleCancel = 0x86,
+ kIOPMRequestTypeChildNotifyDelayCancel = 0x87
+};
+
+//******************************************************************************
+// PM actions - For root domain only
+//******************************************************************************
+
+struct IOPMActions;
+
+typedef void
+(*IOPMActionPowerChangeStart)(
+ void * target,
+ IOService * service,
+ IOPMActions * actions,
+ uint32_t powerState,
+ uint32_t * changeFlags );
+
+typedef void
+(*IOPMActionPowerChangeDone)(
+ void * target,
+ IOService * service,
+ IOPMActions * actions,
+ uint32_t powerState,
+ uint32_t changeFlags );
+
+typedef void
+(*IOPMActionPowerChangeOverride)(
+ void * target,
+ IOService * service,
+ IOPMActions * actions,
+ unsigned long * powerState,
+ uint32_t * changeFlags );
+
+typedef void
+(*IOPMActionActivityTickle)(
+ void * target,
+ IOService * service,
+ IOPMActions * actions );
+
+struct IOPMActions {
+ void * target;
+ uint32_t parameter;
+ IOPMActionPowerChangeStart actionPowerChangeStart;
+ IOPMActionPowerChangeDone actionPowerChangeDone;
+ IOPMActionPowerChangeOverride actionPowerChangeOverride;
+ IOPMActionActivityTickle actionActivityTickle;
+};
+
+//******************************************************************************
+
+enum {
+ kIOPMEventClassSystemEvent = 0x00,
+ kIOPMEventClassDriverEvent = 0x1
+};
+
+class PMEventDetails : public OSObject
+{
+ OSDeclareDefaultStructors( PMEventDetails );
+ friend class IOServicePM;
+ friend class IOPMrootDomain;
+ friend class IOPMTimeline;
+public:
+ static PMEventDetails *eventDetails(uint32_t type,
+ const char *ownerName,
+ uintptr_t ownerUnique,
+ const char *interestName,
+ uint8_t oldState,
+ uint8_t newState,
+ uint32_t result,
+ uint32_t elapsedTimeUS);
+
+ static PMEventDetails *eventDetails(uint32_t type,
+ const char *uuid,
+ uint32_t reason,
+ uint32_t result);
+private:
+ uint8_t eventClassifier;
+ uint32_t eventType;
+ const char *ownerName;
+ uintptr_t ownerUnique;
+ const char *interestName;
+ uint8_t oldState;
+ uint8_t newState;
+ uint32_t result;
+ uint32_t elapsedTimeUS;
+
+ const char *uuid;
+ uint32_t reason;
+};
+
+// Internal concise representation of IOPMPowerState
+struct IOPMPSEntry
+{
+ IOPMPowerFlags capabilityFlags;
+ IOPMPowerFlags outputPowerFlags;
+ IOPMPowerFlags inputPowerFlags;
+ uint32_t staticPower;
+ uint32_t settleUpTime;
+ uint32_t settleDownTime;
+};
+
+//******************************************************************************
+// IOServicePM
+//******************************************************************************
+