RootDomain.h Reference

Declared in
RootDomain.h

Overview

Included Headers

  • <IOKit/IOService.h>

  • <IOKit/pwr_mgt/IOPM.h>

  • <IOKit/IOBufferMemoryDescriptor.h>

Functions

See the Overview section above for header-level documentation.

copyPMSetting

Copy the current value for a PM setting. Returns an OSNumber or OSData depending on the setting.

OSObject * copyPMSetting(
   OSSymbol *whichSetting );
Parameters
whichSetting

Name of the desired setting.

Return Value

OSObject value if valid, NULL otherwise.

createPMAssertion

Creates an assertion to influence system power behavior.

IOPMDriverAssertionID createPMAssertion(
   IOPMDriverAssertionType whichAssertionsBits,
   IOPMDriverAssertionLevel assertionLevel,
   IOService *ownerService,
   const char *ownerDescription);
Parameters
whichAssertionBits

A bitfield specify the assertion that the caller requests.

assertionLevel

An integer detailing the initial assertion level, kIOPMDriverAssertionLevelOn or kIOPMDriverAssertionLevelOff.

ownerService

A pointer to the caller's IOService class, for tracking.

ownerDescription

A reverse-DNS string describing the caller's identity and reason.

Return Value

On success, returns a new assertion of type IOPMDriverAssertionID

getPMAssertionLevel

IOPMDriverAssertionLevel getPMAssertionLevel(
   IOPMDriverAssertionType whichAssertionBits);
Parameters
whichAssertionBits

Bits defining the assertion or assertions the caller is interested in the level of. If in doubt, pass kIOPMDriverAssertionCPUBit as the argument.

Return Value

Returns kIOPMDriverAssertionLevelOff or kIOPMDriverAssertionLevelOn 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.

Discussion

Returns kIOPMDriverAssertionLevelOff or kIOPMDriverAssertionLevelOn. If multiple assertions are specified in the bitfield, only returns kIOPMDriverAssertionLevelOn if all assertions are active.

registerPMSettingController(const OSSymbol *, IOPMSettingControllerCallback, OSObject *, uintptr_t, OSObject **)

Register for callbacks on changes to certain PM settings.

IOReturn registerPMSettingController(
   const OSSymbol *settings[],
   IOPMSettingControllerCallback callout,
   OSObject *target,
   uintptr_t refcon,
   OSObject **handle);  // out param
Parameters
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.

callout

C function ptr or member function cast as such.

target

The target of the callback, usually 'this'

refcon

Will be passed to caller in callback; for caller's use.

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()

Return Value

kIOReturnSuccess on success.

registerPMSettingController(const OSSymbol *, uint32_t, IOPMSettingControllerCallback, OSObject *, uintptr_t, OSObject **)

Register for callbacks on changes to certain PM settings.

IOReturn registerPMSettingController(
   const OSSymbol *settings[],
   uint32_t supportedPowerSources,
   IOPMSettingControllerCallback callout,
   OSObject *target,
   uintptr_t refcon,
   OSObject **handle);  // out param
Parameters
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.

supportedPowerSources

bitfield indicating which power sources these settings are supported for (kIOPMSupportedOnAC, etc.)

callout

C function ptr or member function cast as such.

target

The target of the callback, usually 'this'

refcon

Will be passed to caller in callback; for caller's use.

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()

Return Value

kIOReturnSuccess on success.

releasePMAssertion

Removes an assertion to influence system power behavior.

IOReturn releasePMAssertion(
   IOPMDriverAssertionID releaseAssertion);
Return Value

On success, returns a new assertion of type IOPMDriverAssertionID *

systemPowerEventOccurred

Other drivers may inform IOPMrootDomain of system PM events

IOReturn systemPowerEventOccurred(
   const OSSymbol *event,
   uint32_t intValue );
Parameters
event

An OSSymbol describing the type of power event.

value

A 32-bit integer value associated with the event.

shouldUpdate

indicates whether the root domain should send a notification to interested parties. Pass false if you're calling systemPowerEventOccurred several times in succession; and pass true only on the last invocatino.

Return Value

kIOReturnSuccess on success

Discussion

systemPowerEventOccurred is a richer alternative to receivePowerNotification() Only Apple-owned kexts should have reason to call systemPowerEventOccurred.

Data Types

See the Overview section above for header-level documentation.

IOPMDriverAssertionType

/*! IOPMDriverAssertionType
   */
typedef uint64_t IOPMDriverAssertionType;
Discussion

Types for PM Assertions For creating, releasing, and getting PM assertion levels.

Availability
  • Available in OS X v10.7 and later.
Declared In
RootDomain.h