-#include <IOKit/pwr_mgt/IOPM.h>
-
-
-/*!
-@defined ACK_TIMER_PERIOD
-@discussion When an IOService is waiting for acknowledgement to a power state change
-notification from an interested driver or the controlling driver its ack timer is ticking every tenth of a second.
-(100000000 nanoseconds are one tenth of a second).
-*/
- #define ACK_TIMER_PERIOD 100000000
-
-
-
-/*!
-@class IOPMpriv : public OSObject
-@abstract Private power management private instance variables for IOService objects.
-*/
-class IOPMpriv : public OSObject
-{
- friend class IOService;
-
- OSDeclareDefaultStructors(IOPMpriv)
-
- public:
-
-/*! @field we_are_root TRUE if this device is the root power domain */
- bool we_are_root;
-
- /*! @field interestedDrivers list of interested drivers */
- IOPMinformeeList * interestedDrivers;
-
- /*! @field children list of power domain children */
- IOPMinformeeList * children;
-
- /*! @field changeList list of pending power state changes */
- IOPMchangeNoteList * changeList;
-
- /*! @field driver_timer timeout on waiting for controlling driver to acknowledgeSetPowerState */
- IOReturn driver_timer;
-
- /*! @field ackTimer */
- thread_call_t ackTimer;
-
- /*! @field settleTimer */
- thread_call_t settleTimer;
-
- /*! @field machine_state state number of state machine processing current change note */
- unsigned long machine_state;
-
- /*! @field settle_time settle timer after changing power state */
- unsigned long settle_time;
-
- /*! @field head_note ordinal of change note currently being processed */
- long head_note;
-
- /*! @field head_note_flags copy of flags field in change note currently being processed*/
- unsigned long head_note_flags;
-
- /*! @field head_note_state copy of newStateNumberfield in change note currently being processed */
- unsigned long head_note_state;
-
- /*! @field head_note_outputFlags outputPowerCharacter field from change note currently being processed */
- unsigned long head_note_outputFlags;
-
- /*! @field head_note_domainState power domain flags from parent... (only on parent change) */
- unsigned long head_note_domainState;
-
- /*! @field head_note_parent pointer to initiating parent... (only on parent change) */
- IOPowerConnection * head_note_parent;
-
- /*! @field head_note_capabilityFlags copy of capabilityFlags field in change note currently being processed */
- unsigned long head_note_capabilityFlags;
-
- /*! @field head_note_pendingAcks number of acks we are waiting for during notification */
- unsigned long head_note_pendingAcks;
-
- /*! @field our_lock used to control access to head_note_pendingAcks and driver_timer */
- IOLock * our_lock;
-
- /*! @field flags_lock used to control access to response flags array */
- IOLock * flags_lock;
-
- /*! @field queue_lock used to control access to change note queue */
- IOLock * queue_lock;
-
- /*! @field initial_change true forces first state to be broadcast even if it isn't a change */
- bool initial_change;
-
- /*! @field need_to_become_usable someone called makeUsable before we had a controlling driver */
- bool need_to_become_usable;
-
- /*! @field device_overrides state changes are made based only on subclass's desire */
- bool device_overrides;
-
- /*! @field clampOn domain is clamped on till first child registers */
- bool clampOn;
-
- /*! @field owner points to object which made this struct. Used for debug output only */
- IOService * owner;
-
- /*! @field activityLock used to protect activity flag */
- IOLock * activityLock;
-
- /*! @field timerEventSrc an idle timer */
- IOTimerEventSource * timerEventSrc;
-
- /*! @field idle_timer_period its period in seconds */
- unsigned long idle_timer_period;
-
- /*! @field clampTimerEventSrc timer for clamping power on */
- IOTimerEventSource * clampTimerEventSrc;
-
- /*! @field device_active true: there has been device activity since last idle timer expiration */
- bool device_active;
-
- /*! @field device_active_timestamp time in ticks of last activity */
- AbsoluteTime device_active_timestamp;
-
- /*! @field driverDesire
-This is the power state desired by our controlling driver. It is initialized to myCurrentState and is changed
-when the controlling driver calls changePowerStateTo. A change in driverDesire may cause a change in ourDesiredPowerState.
-*/
- unsigned long driverDesire;
-
-
-
- /*! @field deviceDesire
-This is the power state desired by a subclassed device object. It is initialized to myCurrentState and is changed
-when the subclassed object calls changePowerStateToPriv. A change in deviceDesire may cause a change in ourDesiredPowerState.
-*/
- unsigned long deviceDesire;
-
-
-
- /*! @field ourDesiredPowerState
-This is the power state we desire currently. If equal to myCurrentState, we're happy.
-Otherwise, we're waiting for the parent to raise the power domain to at least this level.
-
-If this is a power domain, this is the maximum of all our children's desires, driverDesire, and deviceDesire.
-It increases when:
-a child asks for more power via requestDomainState,
-the controlling driver asks for more power via changePowerStateTo
-
-It decreases when:
-we lose a child and the child had the highest power need of all our children,
-the child with the highest power need suggests a lower power domain state,
-the controlling driver asks for lower power for some reason via changePowerStateTo
-
-If this is not a power domain, ourDesiredPowerState represents the greater of driverDesire and deviceDesire.
-It increases when:
-the controlling driver asks for more power via changePowerStateTo
-some driver calls makeUsable
-a subclassed object asks for more power via changePowerStateToPriv
-
-It decreases when:
-the controlling driver asks for lower power for some reason via changePowerStateTo
-a subclassed object asks for lower power for some reason via changePowerStateToPriv
-*/
- unsigned long ourDesiredPowerState;
-