+ // KEXT driver announces support of power management feature
+ // And specifies power sources with kIOPMSupportedOn{AC/Batt/UPS} bitfield.
+ // Returns a unique uint32_t identifier for later removing support for this
+ // feature.
+ // NULL is acceptable for uniqueFeatureID for kexts without plans to unload.
+
+ void publishFeature( const char *feature,
+ uint32_t supportedWhere,
+ uint32_t *uniqueFeatureID);
+
+ // KEXT driver announces removal of a previously published power management
+ // feature. Pass 'uniqueFeatureID' returned from publishFeature()
+
+ IOReturn removePublishedFeature( uint32_t removeFeatureID );
+
+/*! @function copyPMSetting
+ @abstract Copy the current value for a PM setting. Returns an OSNumber or
+ OSData depending on the setting.
+ @param whichSetting Name of the desired setting.
+ @result OSObject value if valid, NULL otherwise. */
+
+ OSObject * copyPMSetting( OSSymbol *whichSetting );
+
+/*! @function registerPMSettingController
+ @abstract Register for callbacks on changes to certain PM settings.
+ @param settings NULL terminated array of C strings, each string for a PM
+ setting that the caller is interested in and wants to get callbacks for.
+ @param callout C function ptr or member function cast as such.
+ @param target The target of the callback, usually 'this'
+ @param refcon Will be passed to caller in callback; for caller's use.
+ @param handle Caller should keep the OSObject * returned here. If non-NULL,
+ handle will have a retain count of 1 on return. To deregister, pass to
+ unregisterPMSettingController()
+ @result kIOReturnSuccess on success. */
+
+ IOReturn registerPMSettingController(
+ const OSSymbol *settings[],
+ IOPMSettingControllerCallback callout,
+ OSObject *target,
+ uintptr_t refcon,
+ OSObject **handle); // out param
+
+/*! @function registerPMSettingController
+ @abstract Register for callbacks on changes to certain PM settings.
+ @param settings NULL terminated array of C strings, each string for a PM
+ setting that the caller is interested in and wants to get callbacks for.
+ @param supportedPowerSources bitfield indicating which power sources these
+ settings are supported for (kIOPMSupportedOnAC, etc.)
+ @param callout C function ptr or member function cast as such.
+ @param target The target of the callback, usually 'this'
+ @param refcon Will be passed to caller in callback; for caller's use.
+ @param handle Caller should keep the OSObject * returned here. If non-NULL,
+ handle will have a retain count of 1 on return. To deregister, pass to
+ unregisterPMSettingController()
+ @result kIOReturnSuccess on success. */
+
+ IOReturn registerPMSettingController(
+ const OSSymbol *settings[],
+ uint32_t supportedPowerSources,
+ IOPMSettingControllerCallback callout,
+ OSObject *target,
+ uintptr_t refcon,
+ OSObject **handle); // out param
+
+ virtual IONotifier * registerInterest(
+ const OSSymbol * typeOfInterest,
+ IOServiceInterestHandler handler,
+ void * target, void * ref = 0 );
+
+ virtual IOReturn callPlatformFunction(
+ const OSSymbol *functionName,
+ bool waitForFunction,
+ void *param1, void *param2,
+ void *param3, void *param4 );
+
+/*! @function createPMAssertion
+ @abstract Creates an assertion to influence system power behavior.
+ @param whichAssertionBits A bitfield specify the assertion that the caller requests.
+ @param assertionLevel An integer detailing the initial assertion level, kIOPMDriverAssertionLevelOn
+ or kIOPMDriverAssertionLevelOff.
+ @param ownerService A pointer to the caller's IOService class, for tracking.
+ @param ownerDescription A reverse-DNS string describing the caller's identity and reason.
+ @result On success, returns a new assertion of type IOPMDriverAssertionID
+*/
+ IOPMDriverAssertionID createPMAssertion(
+ IOPMDriverAssertionType whichAssertionsBits,
+ IOPMDriverAssertionLevel assertionLevel,
+ IOService *ownerService,
+ const char *ownerDescription);
+
+/* @function setPMAssertionLevel
+ @abstract Modify the level of a pre-existing assertion.
+ @discussion Change the value of a PM assertion to influence system behavior,
+ without undergoing the work required to create or destroy an assertion. Suggested
+ for clients who will assert and de-assert needs for PM behavior several times over
+ their lifespan.
+ @param assertionID An assertion ID previously returned by <link>createPMAssertion</link>
+ @param assertionLevel The new assertion level.
+ @result kIOReturnSuccess if it worked; kIOReturnNotFound or other IOReturn error on failure.
+*/
+ IOReturn setPMAssertionLevel(IOPMDriverAssertionID assertionID, IOPMDriverAssertionLevel assertionLevel);
+
+/*! @function getPMAssertionLevel
+ @absract Returns the active level of the specified assertion(s).
+ @discussion Returns <link>kIOPMDriverAssertionLevelOff</link> or
+ <link>kIOPMDriverAssertionLevelOn</link>. If multiple assertions are specified
+ in the bitfield, only returns <link>kIOPMDriverAssertionLevelOn</link>
+ if all assertions are active.
+ @param whichAssertionBits Bits defining the assertion or assertions the caller is interested in
+ the level of. If in doubt, pass <link>kIOPMDriverAssertionCPUBit</link> as the argument.
+ @result Returns <link>kIOPMDriverAssertionLevelOff</link> or
+ <link>kIOPMDriverAssertionLevelOn</link> indicating the specified assertion's levels, if available.
+ If the assertions aren't supported on this machine, or aren't recognized by the OS, the
+ result is undefined.
+*/
+ IOPMDriverAssertionLevel getPMAssertionLevel(IOPMDriverAssertionType whichAssertionBits);
+
+/*! @function releasePMAssertion
+ @abstract Removes an assertion to influence system power behavior.
+ @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 );
+ virtual IOReturn requestPowerDomainState( IOPMPowerFlags, IOPowerConnection *, unsigned long );
+ virtual void powerChangeDone( unsigned long );
+ virtual bool tellChangeDown( unsigned long );
+ virtual bool askChangeDown( unsigned long );
+ virtual void tellChangeUp( unsigned long );
+ virtual void tellNoChangeDown( unsigned long );
+ virtual IOReturn configureReport(IOReportChannelList *channels,
+ IOReportConfigureAction action,
+ void *result,
+ void *destination);
+ virtual IOReturn updateReport(IOReportChannelList *channels,
+ IOReportUpdateAction action,
+ void *result,
+ void *destination);
+
+#ifdef XNU_KERNEL_PRIVATE
+ /* Root Domain internals */