X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/0b4c1975fb5e4eccf1012a35081f7e7799b81046..a1c7dba18ef36983396c282fe85292db066e39db:/iokit/IOKit/pwr_mgt/IOPM.h?ds=inline diff --git a/iokit/IOKit/pwr_mgt/IOPM.h b/iokit/IOKit/pwr_mgt/IOPM.h index fc8d7ca8f..9623838aa 100644 --- a/iokit/IOKit/pwr_mgt/IOPM.h +++ b/iokit/IOKit/pwr_mgt/IOPM.h @@ -32,10 +32,6 @@ #include #include -#ifdef __ppc__ -#include -#endif - /*! @header IOPM.h @abstract Defines power management constants and keys used by both in-kernel and user space power management. @discussion IOPM.h defines a range of power management constants used in several in-kernel and user space APIs. Most significantly, the IOPMPowerFlags used to specify the fields of an IOPMPowerState struct are defined here. @@ -80,7 +76,7 @@ enum { Useful only as a Capability. - @constant kIOPMSleepCapability + @constant kIOPMSleepCapability Used only by certain IOKit Families (USB). Not defined or used by generic Power Management. Read your family documentation to see if you should define a powerstate using these capabilities. @constant kIOPMRestartCapability @@ -91,6 +87,15 @@ enum { @constant kIOPMRestart Used only by certain IOKit Families (USB). Not defined or used by generic Power Management. Read your family documentation to see if you should define a powerstate using these capabilities. + + @constant kIOPMInitialDeviceState + Indicates the initial power state for the device. If initialPowerStateForDomainState() returns a power state with this flag set in the capability field, then the initial power change is performed without calling the driver's setPowerState(). + + @constant kIOPMRootDomainState + An indication that the power flags represent the state of the root power + domain. This bit must not be set in the IOPMPowerState structure. + Power Management may pass this bit to initialPowerStateForDomainState() + to map from a global system state to the desired device state. */ typedef unsigned long IOPMPowerFlags; enum { @@ -101,7 +106,9 @@ enum { kIOPMSleepCapability = 0x00000004, kIOPMRestartCapability = 0x00000080, kIOPMSleep = 0x00000001, - kIOPMRestart = 0x00000080 + kIOPMRestart = 0x00000080, + kIOPMInitialDeviceState = 0x00000100, + kIOPMRootDomainState = 0x00000200 }; /* @@ -121,7 +128,6 @@ enum { kIOPMNotPowerManaged = 0x0800 }; - /* * Deprecated IOPMPowerFlags * Their behavior is undefined when used in IOPMPowerState @@ -221,7 +227,16 @@ enum { * * See IOPMrootDomain notification kIOPMMessageSleepWakeUUIDChange */ -#define kIOPMSleepWakeUUIDKey "SleepWakeUUID" + #define kIOPMSleepWakeUUIDKey "SleepWakeUUID" + +/* kIOPMBootSessionUUIDKey + * Key refers to a CFStringRef that will uniquely identify + * a boot cycle. + * The key becomes valid at boot time and remains valid + * till shutdown. The property value will remain same across + * sleep/wake/hibernate cycle. + */ +#define kIOPMBootSessionUUIDKey "BootSessionUUID" /* kIOPMDeepSleepEnabledKey * Indicates the Deep Sleep enable state. @@ -230,20 +245,47 @@ enum { * false == Deep Sleep is disabled * not present == Deep Sleep is not supported on this hardware */ -#define kIOPMDeepSleepEnabledKey "DeepSleep Enabled" +#define kIOPMDeepSleepEnabledKey "Standby Enabled" /* kIOPMDeepSleepDelayKey * Key refers to a CFNumberRef that represents the delay in seconds before * entering Deep Sleep state. The property is not present if Deep Sleep is * unsupported. */ -#define kIOPMDeepSleepDelayKey "DeepSleep Delay" +#define kIOPMDeepSleepDelayKey "Standby Delay" + +/* kIOPMDestroyFVKeyOnStandbyKey + * Specifies if FileVault key can be stored when going to standby mode + * It has a boolean value, + * true == Destroy FV key when going to standby mode + * false == Retain FV key when going to standby mode + * not present == Retain FV key when going to standby mode + */ +#define kIOPMDestroyFVKeyOnStandbyKey "DestroyFVKeyOnStandby" -/* kIOPMLowBatteryWakeThresholdKey - * Key refers to a CFNumberRef that represents the percentage of battery - * remaining charge that will trigger a system wake followed by Deep Sleep. +/******************************************************************************* + * + * Properties that can control power management behavior + * + ******************************************************************************/ + +/* kIOPMResetPowerStateOnWakeKey + * If an IOService publishes this key with the value of kOSBooleanTrue, + * then PM will disregard the influence from changePowerStateToPriv() or + * any activity tickles that occurred before system sleep when resolving + * the initial device power state on wake. Influences from power children + * and changePowerStateTo() are not eliminated. At the earliest opportunity + * upon system wake, PM will query the driver for a new power state to be + * installed as the initial changePowerStateToPriv() influence, by calling + * initialPowerStateForDomainState() with both kIOPMRootDomainState and + * kIOPMPowerOn flags set. The default implementation will always return + * the lowest power state. Drivers can override this default behavior to + * immediately raise the power state when there are work blocked on the + * power change, and cannot afford to wait until the next activity tickle. + * This property should be statically added to a driver's plist or set at + * runtime before calling PMinit(). */ -#define kIOPMLowBatteryWakeThresholdKey "LowBatteryWakeThreshold" +#define kIOPMResetPowerStateOnWakeKey "IOPMResetPowerStateOnWake" /******************************************************************************* * @@ -276,9 +318,31 @@ enum { */ kIOPMDriverAssertionExternalMediaMountedBit = 0x10, + /*! kIOPMDriverAssertionReservedBit5 + * Reserved for Thunderbolt. + */ kIOPMDriverAssertionReservedBit5 = 0x20, - kIOPMDriverAssertionReservedBit6 = 0x40, - kIOPMDriverAssertionReservedBit7 = 0x80 + + /*! kIOPMDriverAssertionPreventDisplaySleepBit + * When set, the display should remain powered on while the system's awake. + */ + kIOPMDriverAssertionPreventDisplaySleepBit = 0x40, + + /*! kIOPMDriverAssertionReservedBit7 + * Reserved for storage family. + */ + kIOPMDriverAssertionReservedBit7 = 0x80, + + /*! kIOPMDriverAssertionMagicPacketWakeEnabledBit + * When set, driver is informing PM that magic packet wake is enabled. + */ + kIOPMDriverAssertionMagicPacketWakeEnabledBit = 0x100, + + /*! kIOPMDriverAssertionNetworkKeepAliveActiveBit + * When set, driver is informing PM that it is holding the network + * interface up to do TCPKeepAlive + */ + kIOPMDriverAssertionNetworkKeepAliveActiveBit = 0x200 }; /* kIOPMAssertionsDriverKey @@ -286,7 +350,7 @@ enum { * a bitfield describing the aggregate PM assertion levels. * Example: A value of 0 indicates that no driver has asserted anything. * Or, a value of kIOPMDriverAssertionCPUBit - * indicates that a driver (or drivers) have asserted a need fro CPU and video. + * indicates that a driver (or drivers) have asserted a need for CPU and video. */ #define kIOPMAssertionsDriverKey "DriverPMAssertions" @@ -295,7 +359,7 @@ enum { * a bitfield describing the aggregate PM assertion levels. * Example: A value of 0 indicates that no driver has asserted anything. * Or, a value of kIOPMDriverAssertionCPUBit - * indicates that a driver (or drivers) have asserted a need fro CPU and video. + * indicates that a driver (or drivers) have asserted a need for CPU and video. */ #define kIOPMAssertionsDriverDetailedKey "DriverPMAssertionsDetailed" @@ -312,6 +376,7 @@ enum { #define kIOPMDriverAssertionModifiedTimeKey "ModifiedTime" #define kIOPMDriverAssertionOwnerStringKey "Owner" #define kIOPMDriverAssertionOwnerServiceKey "ServicePtr" +#define kIOPMDriverAssertionRegistryEntryIDKey "RegistryEntryID" #define kIOPMDriverAssertionLevelKey "Level" #define kIOPMDriverAssertionAssertedKey "Assertions" @@ -398,6 +463,13 @@ enum { #define kIOPMMessageDriverAssertionsChanged \ iokit_family_msg(sub_iokit_powermanagement, 0x150) +/*! kIOPMMessageDarkWakeThermalEmergency + * Sent when machine becomes unsustainably warm in DarkWake. + * Kernel PM might choose to put the machine back to sleep right after. + */ +#define kIOPMMessageDarkWakeThermalEmergency \ + iokit_family_msg(sub_iokit_powermanagement, 0x160) + /******************************************************************************* * * Power commands issued to root domain @@ -406,6 +478,7 @@ enum { * These commands are issued from system drivers only: * ApplePMU, AppleSMU, IOGraphics, AppleACPIFamily * + * TODO: deprecate kIOPMAllowSleep and kIOPMPreventSleep ******************************************************************************/ enum { kIOPMSleepNow = (1<<0), // put machine to sleep now @@ -418,7 +491,8 @@ enum { kIOPMEnableClamshell = (1<<7), // sleep on clamshell closure kIOPMProcessorSpeedChange = (1<<8), // change the processor speed kIOPMOverTemp = (1<<9), // system dangerously hot - kIOPMClamshellOpened = (1<<10) // clamshell was opened + kIOPMClamshellOpened = (1<<10), // clamshell was opened + kIOPMDWOverTemp = (1<<11) // DarkWake thermal limits exceeded. }; @@ -500,6 +574,8 @@ enum { #define kIOPMPSCapacityEstimatedKey "CapacityEstimated" #define kIOPMPSBatteryChargeStatusKey "ChargeStatus" #define kIOPMPSBatteryTemperatureKey "Temperature" +#define kIOPMPSAdapterDetailsKey "AdapterDetails" +#define kIOPMPSChargerConfigurationKey "ChargerConfiguration" // kIOPMPSBatteryChargeStatusKey may have one of the following values, or may have // no value. If kIOPMBatteryChargeStatusKey has a NULL value (or no value) associated with it @@ -507,6 +583,7 @@ enum { // then the charge may have been interrupted. #define kIOPMBatteryChargeStatusTooHot "HighTemperature" #define kIOPMBatteryChargeStatusTooCold "LowTemperature" +#define kIOPMBatteryChargeStatusTooHotOrCold "HighOrLowTemperature" #define kIOPMBatteryChargeStatusGradient "BatteryTemperatureGradient" // Definitions for battery location, in case of multiple batteries. @@ -526,6 +603,16 @@ enum { kIOPMGoodValue = 3 }; +// Keys for kIOPMPSAdapterDetailsKey dictionary +#define kIOPMPSAdapterDetailsIDKey "AdapterID" +#define kIOPMPSAdapterDetailsWattsKey "Watts" +#define kIOPMPSAdapterDetailsRevisionKey "AdapterRevision" +#define kIOPMPSAdapterDetailsSerialNumberKey "SerialNumber" +#define kIOPMPSAdapterDetailsFamilyKey "FamilyCode" +#define kIOPMPSAdapterDetailsAmperageKey "Amperage" +#define kIOPMPSAdapterDetailsDescriptionKey "Description" +#define kIOPMPSAdapterDetailsPMUConfigurationKey "PMUConfiguration" + // Battery's time remaining estimate is invalid this long (seconds) after a wake #define kIOPMPSInvalidWakeSecondsKey "BatteryInvalidWakeSeconds" @@ -596,18 +683,27 @@ enum { #define kIOPMThermalLevelWarningKey "Thermal_Level_Warning" /* Thermal Warning Level values - * kIOPMThermalWarningLevelNormal - under normal operating conditions - * kIOPMThermalWarningLevelDanger - thermal pressure may cause system slowdown - * kIOPMThermalWarningLevelCrisis - thermal conditions may cause imminent shutdown + * kIOPMThermalLevelNormal - under normal operating conditions + * kIOPMThermalLevelDanger - thermal pressure may cause system slowdown + * kIOPMThermalLevelCritical - thermal conditions may cause imminent shutdown * * The platform may define additional thermal levels if necessary. + * Platform specific values are defined from 100 and above */ enum { - kIOPMThermalWarningLevelNormal = 0, - kIOPMThermalWarningLevelDanger = 5, - kIOPMThermalWarningLevelCrisis = 10 + kIOPMThermalLevelNormal = 0, + kIOPMThermalLevelDanger = 5, + kIOPMThermalLevelCritical = 10, + + kIOPMThermalLevelWarning = 100, + kIOPMThermalLevelTrap = 110, + + kIOPMThermalLevelUnknown = 255, }; +#define kIOPMThermalWarningLevelNormal kIOPMThermalLevelNormal +#define kIOPMThermalWarningLevelDanger kIOPMThermalLevelWarning +#define kIOPMThermalWarningLevelCrisis kIOPMThermalLevelCritical // PM Settings Controller setting types // Settings types used primarily with: @@ -641,6 +737,7 @@ enum { // Maintenance wake calendar. #define kIOPMSettingMaintenanceWakeCalendarKey "MaintenanceWakeCalendarDate" + struct IOPMCalendarStruct { UInt32 year; UInt8 month; @@ -648,6 +745,7 @@ struct IOPMCalendarStruct { UInt8 hour; UInt8 minute; UInt8 second; + UInt8 selector; }; typedef struct IOPMCalendarStruct IOPMCalendarStruct; @@ -688,7 +786,6 @@ enum { kIOBatteryChargerConnect = (1 << 0) }; - // Private power management message indicating battery data has changed // Indicates new data resides in the IORegistry #define kIOPMMessageBatteryStatusHasChanged iokit_family_msg(sub_iokit_pmu, 0x100) @@ -714,7 +811,6 @@ enum { kIOPMClamshellStateOnWake = (1<<10) // used only by Platform Expert }; - // ********************************************** // Internal power management data structures // ********************************************** @@ -729,15 +825,19 @@ enum { enum { kIOPMSubclassPolicy, kIOPMSuperclassPolicy1 +#ifdef KERNEL_PRIVATE + , kIOPMActivityTickleTypeAdvisory = 128 +#endif }; -struct stateChangeNote{ +struct stateChangeNote { IOPMPowerFlags stateFlags; unsigned long stateNum; void * powerRef; }; typedef struct stateChangeNote stateChangeNote; +#endif /* KERNEL && __cplusplus */ struct IOPowerStateChangeNotification { void * powerRef; unsigned long returnValue; @@ -746,7 +846,55 @@ struct IOPowerStateChangeNotification { }; typedef struct IOPowerStateChangeNotification IOPowerStateChangeNotification; typedef IOPowerStateChangeNotification sleepWakeNote; -#endif /* KERNEL && __cplusplus */ -#endif /* ! _IOKIT_IOPM_H */ +/*! @struct IOPMSystemCapabilityChangeParameters + @abstract A structure describing a system capability change. + @discussion A system capability change is a system level transition from a set + of system capabilities to a new set of system capabilities. Power management + sends a kIOMessageSystemCapabilityChange message and provides + this structure as the message data (by reference) to + gIOPriorityPowerStateInterest clients when system capability + changes. + @field notifyRef An identifier for this message notification. Clients with pending + I/O can signal completion by calling allowPowerChange() with this + value as the argument. Clients that are able to process the notification + synchronously should ignore this field. + @field maxWaitForReply A return value to the caller indicating the maximum time in + microseconds to wait for the allowPowerChange() call. The default + value is zero, which indicates the client processing has finished, and power + management should not wait for an allowPowerChange() call. + @field changeFlags Flags will be set to indicate whether the notification precedes + the capability change (kIOPMSystemCapabilityWillChange), or after + the capability change has occurred (kIOPMSystemCapabilityDidChange). + @field __reserved1 Set to zero. + @field fromCapabilities The system capabilities at the start of the transition. + @field toCapabilities The system capabilities at the end of the transition. + @field __reserved2 Set to zero. + */ +struct IOPMSystemCapabilityChangeParameters { + uint32_t notifyRef; + uint32_t maxWaitForReply; + uint32_t changeFlags; + uint32_t __reserved1; + uint32_t fromCapabilities; + uint32_t toCapabilities; + uint32_t __reserved2[4]; +}; +/*! @enum IOPMSystemCapabilityChangeFlags + @constant kIOPMSystemCapabilityWillChange Indicates the system capability will change. + @constant kIOPMSystemCapabilityDidChange Indicates the system capability has changed. +*/ +enum { + kIOPMSystemCapabilityWillChange = 0x01, + kIOPMSystemCapabilityDidChange = 0x02 +}; + +enum { + kIOPMSystemCapabilityCPU = 0x01, + kIOPMSystemCapabilityGraphics = 0x02, + kIOPMSystemCapabilityAudio = 0x04, + kIOPMSystemCapabilityNetwork = 0x08 +}; + +#endif /* ! _IOKIT_IOPM_H */