2 * Copyright (c) 1998-2005 Apple Computer, Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
31 #include <IOKit/IOTypes.h>
32 #include <IOKit/IOMessage.h>
33 #include <IOKit/IOReturn.h>
36 @abstract Defines power management constants and keys used by both in-kernel and user space power management.
37 @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.
39 Most of the constants defined in IOPM.h are deprecated or for Apple internal use only, and are not elaborated on in headerdoc.
43 kIOPMMaxPowerStates
= 10,
44 IOPMMaxPowerStates
= kIOPMMaxPowerStates
47 /*! @enum IOPMPowerFlags
48 @abstract Bits are used in defining capabilityFlags, inputPowerRequirements, and outputPowerCharacter in the IOPMPowerState structure.
49 @discussion These bits may be bitwise-OR'd together in the IOPMPowerState capabilityFlags field, the outputPowerCharacter field, and/or the inputPowerRequirement field.
51 The comments clearly mark whether each flag should be used in the capabilityFlags field, outputPowerCharacter field, and inputPowerRequirement field, or all three.
53 The value of capabilityFlags, inputPowerRequirement or outputPowerCharacter may be 0. Most drivers implement their 'OFF' state, used when asleep, by defininf each of the 3 fields as 0.
55 The bits listed below are only the most common bits used to define a device's power states. Your device's IO family may require that your device specify other input or output power flags to interact properly. Consult family-specific documentation to determine if your IOPower plane parents or children require other power flags; they probably don't.
57 @constant kIOPMPowerOn Indicates the device is on, requires power, and provides power. Useful as a: Capability, InputPowerRequirement, OutputPowerCharacter
59 @constant kIOPMDeviceUsable Indicates the device is usable in this state. Useful only as a Capability
61 @constant kIOPMLowPower
62 Indicates device is in a low power state. May be bitwis-OR'd together
63 with kIOPMDeviceUsable flag, to indicate the device is still usable.
65 A device with a capability of kIOPMLowPower may:
66 Require either 0 or kIOPMPowerOn from its power parent
67 Offer either kIOPMLowPower, kIOPMPowerOn, or 0 (no power at all)
68 to its power plane children.
70 Useful only as a Capability, although USB drivers should consult USB family documentation for other valid circumstances to use the kIOPMLowPower bit.
72 @constant kIOPMPreventIdleSleep
73 In the capability field of a power state, disallows idle system sleep while the device is in that state.
75 For example, displays and disks set this capability for their ON power state; since the system may not idle sleep while the display (and thus keyboard or mouse) or the disk is active.
77 Useful only as a Capability.
79 @constant kIOPMSleepCapability
80 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.
82 @constant kIOPMRestartCapability
83 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.
86 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.
88 @constant kIOPMRestart
89 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.
91 @constant kIOPMInitialDeviceState
92 Indicates the initial power state for the device. If <code>initialPowerStateForDomainState()</code> returns a power state with this flag set in the capability field, then the initial power change is performed without calling the driver's <code>setPowerState()</code>.
94 @constant kIOPMRootDomainState
95 An indication that the power flags represent the state of the root power
96 domain. This bit must not be set in the IOPMPowerState structure.
97 Power Management may pass this bit to initialPowerStateForDomainState()
98 or powerStateForDomainState() to map from a global system state to the
101 typedef unsigned long IOPMPowerFlags
;
103 kIOPMPowerOn
= 0x00000002,
104 kIOPMDeviceUsable
= 0x00008000,
105 kIOPMLowPower
= 0x00010000,
106 kIOPMPreventIdleSleep
= 0x00000040,
107 kIOPMSleepCapability
= 0x00000004,
108 kIOPMRestartCapability
= 0x00000080,
109 kIOPMSleep
= 0x00000001,
110 kIOPMRestart
= 0x00000080,
111 kIOPMInitialDeviceState
= 0x00000100,
112 kIOPMRootDomainState
= 0x00000200
116 * Private IOPMPowerFlags
119 * Not for use with non-Apple drivers
120 * Their behavior is undefined
123 kIOPMClockNormal
= 0x0004,
124 kIOPMClockRunning
= 0x0008,
125 kIOPMPreventSystemSleep
= 0x0010,
127 kIOPMChildClamp
= 0x0080,
128 kIOPMChildClamp2
= 0x0200,
129 kIOPMNotPowerManaged
= 0x0800
133 * Deprecated IOPMPowerFlags
134 * Their behavior is undefined when used in IOPMPowerState
135 * Capability, InputPowerRequirement, or OutputPowerCharacter fields.
138 kIOPMMaxPerformance
= 0x4000,
139 kIOPMPassThrough
= 0x0100,
140 kIOPMAuxPowerOn
= 0x0020,
141 kIOPMNotAttainable
= 0x0001,
142 kIOPMContextRetained
= 0x2000,
143 kIOPMConfigRetained
= 0x1000,
144 kIOPMStaticPowerValid
= 0x0800,
145 kIOPMSoftSleep
= 0x0400,
146 kIOPMCapabilitiesMask
= kIOPMPowerOn
| kIOPMDeviceUsable
|
147 kIOPMMaxPerformance
| kIOPMContextRetained
|
148 kIOPMConfigRetained
| kIOPMSleepCapability
|
149 kIOPMRestartCapability
153 * Support for old names of IOPMPowerFlag constants
156 IOPMNotAttainable
= kIOPMNotAttainable
,
157 IOPMPowerOn
= kIOPMPowerOn
,
158 IOPMClockNormal
= kIOPMClockNormal
,
159 IOPMClockRunning
= kIOPMClockRunning
,
160 IOPMAuxPowerOn
= kIOPMAuxPowerOn
,
161 IOPMDeviceUsable
= kIOPMDeviceUsable
,
162 IOPMMaxPerformance
= kIOPMMaxPerformance
,
163 IOPMContextRetained
= kIOPMContextRetained
,
164 IOPMConfigRetained
= kIOPMConfigRetained
,
165 IOPMNotPowerManaged
= kIOPMNotPowerManaged
,
166 IOPMSoftSleep
= kIOPMSoftSleep
171 kIOPMNextHigherState
= 1,
172 kIOPMHighestState
= 2,
173 kIOPMNextLowerState
= 3,
178 IOPMNextHigherState
= kIOPMNextHigherState
,
179 IOPMHighestState
= kIOPMHighestState
,
180 IOPMNextLowerState
= kIOPMNextLowerState
,
181 IOPMLowestState
= kIOPMLowestState
184 // Internal commands used by power managment command queue
186 kIOPMBroadcastAggressiveness
= 1,
190 // Power consumption unknown value
192 kIOPMUnknown
= 0xFFFF
195 /*******************************************************************************
197 * Root Domain property keys of interest
199 ******************************************************************************/
201 /* AppleClamshellState
202 * reflects the state of the clamshell (lid) on a portable.
203 * It has a boolean value.
204 * true == clamshell is closed
205 * false == clamshell is open
206 * not present == no clamshell on this hardware
208 #define kAppleClamshellStateKey "AppleClamshellState"
210 /* AppleClamshellCausesSleep
211 * reflects the clamshell close behavior on a portable.
212 * It has a boolean value.
213 * true == system will sleep when clamshell is closed
214 * false == system will not sleep on clamshell close
215 * (typically external display mode)
216 * not present == no clamshell on this hardware
218 #define kAppleClamshellCausesSleepKey "AppleClamshellCausesSleep"
220 /* kIOPMSleepWakeUUIDKey
221 * Key refers to a CFStringRef that will uniquely identify
222 * a sleep/wake cycle for logging & tracking.
223 * The key becomes valid at the beginning of a sleep cycle - before we
224 * initiate any sleep/wake notifications.
225 * The key becomes invalid at the completion of a system wakeup. The
226 * property will not be present in the IOPMrootDomain's registry entry
227 * when it is invalid.
229 * See IOPMrootDomain notification kIOPMMessageSleepWakeUUIDChange
231 #define kIOPMSleepWakeUUIDKey "SleepWakeUUID"
233 /* kIOPMDeepSleepEnabledKey
234 * Indicates the Deep Sleep enable state.
235 * It has a boolean value.
236 * true == Deep Sleep is enabled
237 * false == Deep Sleep is disabled
238 * not present == Deep Sleep is not supported on this hardware
240 #define kIOPMDeepSleepEnabledKey "Standby Enabled"
242 /* kIOPMDeepSleepDelayKey
243 * Key refers to a CFNumberRef that represents the delay in seconds before
244 * entering Deep Sleep state. The property is not present if Deep Sleep is
247 #define kIOPMDeepSleepDelayKey "Standby Delay"
249 /* kIOPMDestroyFVKeyOnStandbyKey
250 * Specifies if FileVault key can be stored when going to standby mode
251 * It has a boolean value,
252 * true == Destroy FV key when going to standby mode
253 * false == Retain FV key when going to standby mode
254 * not present == Retain FV key when going to standby mode
256 #define kIOPMDestroyFVKeyOnStandbyKey "DestroyFVKeyOnStandby"
258 /*******************************************************************************
260 * Properties that can control power management behavior
262 ******************************************************************************/
264 /* kIOPMResetPowerStateOnWakeKey
265 * If an IOService publishes this key with the value of kOSBooleanTrue,
266 * then PM will disregard the influence from changePowerStateToPriv() or
267 * any activity tickles that occurred before system sleep when resolving
268 * the initial device power state on wake. Influences from power children
269 * and changePowerStateTo() are not eliminated. At the earliest opportunity
270 * upon system wake, PM will query the driver for a new power state to be
271 * installed as the initial changePowerStateToPriv() influence, by calling
272 * initialPowerStateForDomainState() with both kIOPMRootDomainState and
273 * kIOPMPowerOn flags set. The default implementation will always return
274 * the lowest power state. Drivers can override this default behavior to
275 * immediately raise the power state when there are work blocked on the
276 * power change, and cannot afford to wait until the next activity tickle.
277 * This property should be statically added to a driver's plist or set at
278 * runtime before calling PMinit().
280 #define kIOPMResetPowerStateOnWakeKey "IOPMResetPowerStateOnWake"
282 /*******************************************************************************
284 * Driver PM Assertions
286 ******************************************************************************/
288 /* Driver Assertion bitfield description
289 * Driver PM assertions are defined by these bits.
292 /*! kIOPMDriverAssertionCPUBit
293 * When set, PM kernel will prefer to leave the CPU and core hardware
294 * running in "Dark Wake" state, instead of sleeping.
296 kIOPMDriverAssertionCPUBit
= 0x01,
298 /*! kIOPMDriverAssertionUSBExternalDeviceBit
299 * When set, driver is informing PM that an external USB device is attached.
301 kIOPMDriverAssertionUSBExternalDeviceBit
= 0x04,
303 /*! kIOPMDriverAssertionBluetoothHIDDevicePairedBit
304 * When set, driver is informing PM that a Bluetooth HID device is paired.
306 kIOPMDriverAssertionBluetoothHIDDevicePairedBit
= 0x08,
308 /*! kIOPMDriverAssertionExternalMediaMountedBit
309 * When set, driver is informing PM that an external media is mounted.
311 kIOPMDriverAssertionExternalMediaMountedBit
= 0x10,
313 /*! kIOPMDriverAssertionReservedBit5
314 * Reserved for Thunderbolt.
316 kIOPMDriverAssertionReservedBit5
= 0x20,
318 /*! kIOPMDriverAssertionPreventDisplaySleepBit
319 * When set, the display should remain powered on while the system's awake.
321 kIOPMDriverAssertionPreventDisplaySleepBit
= 0x40,
323 /*! kIOPMDriverAssertionReservedBit7
324 * Reserved for storage family.
326 kIOPMDriverAssertionReservedBit7
= 0x80,
328 /*! kIOPMDriverAssertionMagicPacketWakeEnabledBit
329 * When set, driver is informing PM that magic packet wake is enabled.
331 kIOPMDriverAssertionMagicPacketWakeEnabledBit
= 0x100
334 /* kIOPMAssertionsDriverKey
335 * This kIOPMrootDomain key refers to a CFNumberRef property, containing
336 * a bitfield describing the aggregate PM assertion levels.
337 * Example: A value of 0 indicates that no driver has asserted anything.
338 * Or, a value of <link>kIOPMDriverAssertionCPUBit</link>
339 * indicates that a driver (or drivers) have asserted a need for CPU and video.
341 #define kIOPMAssertionsDriverKey "DriverPMAssertions"
343 /* kIOPMAssertionsDriverKey
344 * This kIOPMrootDomain key refers to a CFNumberRef property, containing
345 * a bitfield describing the aggregate PM assertion levels.
346 * Example: A value of 0 indicates that no driver has asserted anything.
347 * Or, a value of <link>kIOPMDriverAssertionCPUBit</link>
348 * indicates that a driver (or drivers) have asserted a need for CPU and video.
350 #define kIOPMAssertionsDriverDetailedKey "DriverPMAssertionsDetailed"
352 /*******************************************************************************
354 * Kernel Driver assertion detailed dictionary keys
356 * Keys decode the Array & dictionary data structure under IOPMrootDomain property
357 * kIOPMAssertionsDriverKey.
360 #define kIOPMDriverAssertionIDKey "ID"
361 #define kIOPMDriverAssertionCreatedTimeKey "CreatedTime"
362 #define kIOPMDriverAssertionModifiedTimeKey "ModifiedTime"
363 #define kIOPMDriverAssertionOwnerStringKey "Owner"
364 #define kIOPMDriverAssertionOwnerServiceKey "ServicePtr"
365 #define kIOPMDriverAssertionLevelKey "Level"
366 #define kIOPMDriverAssertionAssertedKey "Assertions"
368 /*******************************************************************************
370 * Root Domain general interest messages
372 * Available by registering for interest type 'gIOGeneralInterest'
375 ******************************************************************************/
377 /* kIOPMMessageClamshellStateChange
378 * Delivered as a general interest notification on the IOPMrootDomain
379 * IOPMrootDomain sends this message when state of either AppleClamshellState
380 * or AppleClamshellCausesSleep changes. If this clamshell change results in
381 * a sleep, the sleep will initiate soon AFTER delivery of this message.
382 * The state of both variables is encoded in a bitfield argument sent with
383 * the message. Check bits 0 and 1 using kClamshellStateBit & kClamshellSleepBit
386 kClamshellStateBit
= (1 << 0),
387 kClamshellSleepBit
= (1 << 1)
390 #define kIOPMMessageClamshellStateChange \
391 iokit_family_msg(sub_iokit_powermanagement, 0x100)
393 /* kIOPMMessageFeatureChange
394 * Delivered when the set of supported features ("Supported Features" dictionary
395 * under IOPMrootDomain registry) changes in some way. Typically addition or
396 * removal of a supported feature.
397 * RootDomain passes no argument with this message.
399 #define kIOPMMessageFeatureChange \
400 iokit_family_msg(sub_iokit_powermanagement, 0x110)
402 /* kIOPMMessageInflowDisableCancelled
403 * The battery has drained completely to its "Fully Discharged" state.
404 * If a user process has disabled battery inflow for battery
405 * calibration, we forcibly re-enable Inflow at this point.
406 * If inflow HAS been forcibly re-enabled, bit 0
407 * (kInflowForciblyEnabledBit) will be set.
410 kInflowForciblyEnabledBit
= (1 << 0)
413 /* kIOPMMessageInternalBatteryFullyDischarged
414 * The battery has drained completely to its "Fully Discharged" state.
416 #define kIOPMMessageInternalBatteryFullyDischarged \
417 iokit_family_msg(sub_iokit_powermanagement, 0x120)
419 /* kIOPMMessageSystemPowerEventOccurred
420 * Some major system thermal property has changed, and interested clients may
421 * modify their behavior.
423 #define kIOPMMessageSystemPowerEventOccurred \
424 iokit_family_msg(sub_iokit_powermanagement, 0x130)
426 /* kIOPMMessageSleepWakeUUIDChange
427 * Either a new SleepWakeUUID has been specified at the beginning of a sleep,
428 * or we're removing the existing property upon completion of a wakeup.
430 #define kIOPMMessageSleepWakeUUIDChange \
431 iokit_family_msg(sub_iokit_powermanagement, 0x140)
433 /* kIOPMMessageSleepWakeUUIDSet
434 * Argument accompanying the kIOPMMessageSleepWakeUUIDChange notification when
435 * a new UUID has been specified.
437 #define kIOPMMessageSleepWakeUUIDSet ((void *)1)
439 /* kIOPMMessageSleepWakeUUIDCleared
440 * Argument accompanying the kIOPMMessageSleepWakeUUIDChange notification when
441 * the current UUID has been removed.
443 #define kIOPMMessageSleepWakeUUIDCleared ((void *)0)
445 /*! kIOPMMessageDriverAssertionsChanged
446 * Sent when kernel PM driver assertions have changed.
448 #define kIOPMMessageDriverAssertionsChanged \
449 iokit_family_msg(sub_iokit_powermanagement, 0x150)
451 /*! kIOPMMessageDarkWakeThermalEmergency
452 * Sent when machine becomes unsustainably warm in DarkWake.
453 * Kernel PM might choose to put the machine back to sleep right after.
455 #define kIOPMMessageDarkWakeThermalEmergency \
456 iokit_family_msg(sub_iokit_powermanagement, 0x160)
458 /*******************************************************************************
460 * Power commands issued to root domain
461 * Use with IOPMrootDomain::receivePowerNotification()
463 * These commands are issued from system drivers only:
464 * ApplePMU, AppleSMU, IOGraphics, AppleACPIFamily
466 * TODO: deprecate kIOPMAllowSleep and kIOPMPreventSleep
467 ******************************************************************************/
469 kIOPMSleepNow
= (1<<0), // put machine to sleep now
470 kIOPMAllowSleep
= (1<<1), // allow idle sleep
471 kIOPMPreventSleep
= (1<<2), // do not allow idle sleep
472 kIOPMPowerButton
= (1<<3), // power button was pressed
473 kIOPMClamshellClosed
= (1<<4), // clamshell was closed
474 kIOPMPowerEmergency
= (1<<5), // battery dangerously low
475 kIOPMDisableClamshell
= (1<<6), // do not sleep on clamshell closure
476 kIOPMEnableClamshell
= (1<<7), // sleep on clamshell closure
477 kIOPMProcessorSpeedChange
= (1<<8), // change the processor speed
478 kIOPMOverTemp
= (1<<9), // system dangerously hot
479 kIOPMClamshellOpened
= (1<<10), // clamshell was opened
480 kIOPMDWOverTemp
= (1<<11) // DarkWake thermal limits exceeded.
484 /*******************************************************************************
486 * Power Management Return Codes
488 ******************************************************************************/
492 // Returned by driver's setPowerState(), powerStateWillChangeTo(),
493 // powerStateDidChangeTo(), or acknowledgeSetPowerState() to
494 // implicitly acknowledge power change upon function return.
498 kIOPMWillAckLater
= 1,
500 // Returned by requestPowerDomainState() to indicate
501 // unrecognized specification parameter.
502 kIOPMBadSpecification
= 4,
504 // Returned by requestPowerDomainState() to indicate
505 // no power state matches search specification.
506 kIOPMNoSuchState
= 5,
509 kIOPMCannotRaisePower
= 6,
512 kIOPMParameterError
= 7,
514 // Returned when power management state is accessed
515 // before driver has called PMinit().
516 kIOPMNotYetInitialized
= 8,
518 // And the old constants; deprecated
519 IOPMNoErr
= kIOPMNoErr
,
520 IOPMAckImplied
= kIOPMAckImplied
,
521 IOPMWillAckLater
= kIOPMWillAckLater
,
522 IOPMBadSpecification
= kIOPMBadSpecification
,
523 IOPMNoSuchState
= kIOPMNoSuchState
,
524 IOPMCannotRaisePower
= kIOPMCannotRaisePower
,
525 IOPMParameterError
= kIOPMParameterError
,
526 IOPMNotYetInitialized
= kIOPMNotYetInitialized
530 // IOPMPowerSource class descriptive strings
531 // Power Source state is published as properties to the IORegistry under these
533 #define kIOPMPSExternalConnectedKey "ExternalConnected"
534 #define kIOPMPSExternalChargeCapableKey "ExternalChargeCapable"
535 #define kIOPMPSBatteryInstalledKey "BatteryInstalled"
536 #define kIOPMPSIsChargingKey "IsCharging"
537 #define kIOPMFullyChargedKey "FullyCharged"
538 #define kIOPMPSAtWarnLevelKey "AtWarnLevel"
539 #define kIOPMPSAtCriticalLevelKey "AtCriticalLevel"
540 #define kIOPMPSCurrentCapacityKey "CurrentCapacity"
541 #define kIOPMPSMaxCapacityKey "MaxCapacity"
542 #define kIOPMPSDesignCapacityKey "DesignCapacity"
543 #define kIOPMPSTimeRemainingKey "TimeRemaining"
544 #define kIOPMPSAmperageKey "Amperage"
545 #define kIOPMPSVoltageKey "Voltage"
546 #define kIOPMPSCycleCountKey "CycleCount"
547 #define kIOPMPSMaxErrKey "MaxErr"
548 #define kIOPMPSAdapterInfoKey "AdapterInfo"
549 #define kIOPMPSLocationKey "Location"
550 #define kIOPMPSErrorConditionKey "ErrorCondition"
551 #define kIOPMPSManufacturerKey "Manufacturer"
552 #define kIOPMPSManufactureDateKey "ManufactureDate"
553 #define kIOPMPSModelKey "Model"
554 #define kIOPMPSSerialKey "Serial"
555 #define kIOPMDeviceNameKey "DeviceName"
556 #define kIOPMPSLegacyBatteryInfoKey "LegacyBatteryInfo"
557 #define kIOPMPSBatteryHealthKey "BatteryHealth"
558 #define kIOPMPSHealthConfidenceKey "HealthConfidence"
559 #define kIOPMPSCapacityEstimatedKey "CapacityEstimated"
560 #define kIOPMPSBatteryChargeStatusKey "ChargeStatus"
561 #define kIOPMPSBatteryTemperatureKey "Temperature"
562 #define kIOPMPSAdapterDetailsKey "AdapterDetails"
563 #define kIOPMPSChargerConfigurationKey "ChargerConfiguration"
565 // kIOPMPSBatteryChargeStatusKey may have one of the following values, or may have
566 // no value. If kIOPMBatteryChargeStatusKey has a NULL value (or no value) associated with it
567 // then charge is proceeding normally. If one of these battery charge status reasons is listed,
568 // then the charge may have been interrupted.
569 #define kIOPMBatteryChargeStatusTooHot "HighTemperature"
570 #define kIOPMBatteryChargeStatusTooCold "LowTemperature"
571 #define kIOPMBatteryChargeStatusTooHotOrCold "HighOrLowTemperature"
572 #define kIOPMBatteryChargeStatusGradient "BatteryTemperatureGradient"
574 // Definitions for battery location, in case of multiple batteries.
575 // A location of 0 is unspecified
576 // Location is undefined for single battery systems
578 kIOPMPSLocationLeft
= 1001,
579 kIOPMPSLocationRight
= 1002
582 // Battery quality health types, specified by BatteryHealth and HealthConfidence
583 // properties in an IOPMPowerSource battery kext.
585 kIOPMUndefinedValue
= 0,
591 // Keys for kIOPMPSAdapterDetailsKey dictionary
592 #define kIOPMPSAdapterDetailsIDKey "AdapterID"
593 #define kIOPMPSAdapterDetailsWattsKey "Watts"
594 #define kIOPMPSAdapterDetailsRevisionKey "AdapterRevision"
595 #define kIOPMPSAdapterDetailsSerialNumberKey "SerialNumber"
596 #define kIOPMPSAdapterDetailsFamilyKey "FamilyCode"
597 #define kIOPMPSAdapterDetailsAmperageKey "Amperage"
598 #define kIOPMPSAdapterDetailsDescriptionKey "Description"
599 #define kIOPMPSAdapterDetailsPMUConfigurationKey "PMUConfiguration"
601 // Battery's time remaining estimate is invalid this long (seconds) after a wake
602 #define kIOPMPSInvalidWakeSecondsKey "BatteryInvalidWakeSeconds"
604 // Battery must wait this long (seconds) after being completely charged before
605 // the battery is settled.
606 #define kIOPMPSPostChargeWaitSecondsKey "PostChargeWaitSeconds"
608 // Battery must wait this long (seconds) after being completely discharged
609 // before the battery is settled.
610 #define kIOPMPSPostDishargeWaitSecondsKey "PostDischargeWaitSeconds"
613 /* CPU Power Management status keys
614 * Pass as arguments to IOPMrootDomain::systemPowerEventOccurred
615 * Or as arguments to IOPMSystemPowerEventOccurred()
616 * Or to decode the dictionary obtained from IOPMCopyCPUPowerStatus()
617 * These keys reflect restrictions placed on the CPU by the system
618 * to bring the CPU's power consumption within allowable thermal and
623 /* kIOPMGraphicsPowerLimitsKey
624 * The key representing the dictionary of graphics power limits.
625 * The dictionary contains the other kIOPMCPUPower keys & their associated
626 * values (e.g. Speed limit, Processor Count, and Schedule limits).
628 #define kIOPMGraphicsPowerLimitsKey "Graphics_Power_Limits"
630 /* kIOPMGraphicsPowerLimitPerformanceKey
631 * The key representing the percent of overall performance made available
632 * by the graphics chip as a percentage (integer 0 - 100).
634 #define kIOPMGraphicsPowerLimitPerformanceKey "Graphics_Power_Performance"
638 /* kIOPMCPUPowerLimitsKey
639 * The key representing the dictionary of CPU Power Limits.
640 * The dictionary contains the other kIOPMCPUPower keys & their associated
641 * values (e.g. Speed limit, Processor Count, and Schedule limits).
643 #define kIOPMCPUPowerLimitsKey "CPU_Power_Limits"
645 /* kIOPMCPUPowerLimitProcessorSpeedKey defines the speed & voltage limits placed
647 * Represented as a percentage (0-100) of maximum CPU speed.
649 #define kIOPMCPUPowerLimitProcessorSpeedKey "CPU_Speed_Limit"
651 /* kIOPMCPUPowerLimitProcessorCountKey reflects how many, if any, CPUs have been
652 * taken offline. Represented as an integer number of CPUs (0 - Max CPUs).
654 #define kIOPMCPUPowerLimitProcessorCountKey "CPU_Available_CPUs"
656 /* kIOPMCPUPowerLimitSchedulerTimeKey represents the percentage (0-100) of CPU time
657 * available. 100% at normal operation. The OS may limit this time for a percentage
660 #define kIOPMCPUPowerLimitSchedulerTimeKey "CPU_Scheduler_Limit"
663 /* Thermal Level Warning Key
664 * Indicates the thermal constraints placed on the system. This value may
665 * cause clients to action to consume fewer system resources.
666 * The value associated with this warning is defined by the platform.
668 #define kIOPMThermalLevelWarningKey "Thermal_Level_Warning"
670 /* Thermal Warning Level values
671 * kIOPMThermalWarningLevelNormal - under normal operating conditions
672 * kIOPMThermalWarningLevelDanger - thermal pressure may cause system slowdown
673 * kIOPMThermalWarningLevelCrisis - thermal conditions may cause imminent shutdown
675 * The platform may define additional thermal levels if necessary.
678 kIOPMThermalWarningLevelNormal
= 0,
679 kIOPMThermalWarningLevelDanger
= 5,
680 kIOPMThermalWarningLevelCrisis
= 10
684 // PM Settings Controller setting types
685 // Settings types used primarily with:
686 // IOPMrootDomain::registerPMSettingController
687 // The values are identical to the similarly named keys for use in user space
688 // PM settings work. Those keys are defined in IOPMLibPrivate.h.
689 #define kIOPMSettingWakeOnRingKey "Wake On Modem Ring"
690 #define kIOPMSettingRestartOnPowerLossKey "Automatic Restart On Power Loss"
691 #define kIOPMSettingWakeOnACChangeKey "Wake On AC Change"
692 #define kIOPMSettingSleepOnPowerButtonKey "Sleep On Power Button"
693 #define kIOPMSettingWakeOnClamshellKey "Wake On Clamshell Open"
694 #define kIOPMSettingReduceBrightnessKey "ReduceBrightness"
695 #define kIOPMSettingDisplaySleepUsesDimKey "Display Sleep Uses Dim"
696 #define kIOPMSettingTimeZoneOffsetKey "TimeZoneOffsetSeconds"
697 #define kIOPMSettingMobileMotionModuleKey "MobileMotionModule"
698 #define kIOPMSettingGraphicsSwitchKey "GPUSwitch"
700 // Setting controlling drivers can register to receive scheduled wake data
701 // Either in "CF seconds" type, or structured calendar data in a formatted
702 // IOPMCalendarStruct defined below.
703 #define kIOPMSettingAutoWakeSecondsKey "wake"
704 #define kIOPMSettingAutoWakeCalendarKey "WakeByCalendarDate"
705 #define kIOPMSettingAutoPowerSecondsKey "poweron"
706 #define kIOPMSettingAutoPowerCalendarKey "PowerByCalendarDate"
708 // Debug seconds auto wake
709 // Used by sleep cycling debug tools
710 #define kIOPMSettingDebugWakeRelativeKey "WakeRelativeToSleep"
711 #define kIOPMSettingDebugPowerRelativeKey "PowerRelativeToShutdown"
713 // Maintenance wake calendar.
714 #define kIOPMSettingMaintenanceWakeCalendarKey "MaintenanceWakeCalendarDate"
717 struct IOPMCalendarStruct
{
726 typedef struct IOPMCalendarStruct IOPMCalendarStruct
;
728 // SetAggressiveness types
730 kPMGeneralAggressiveness
= 0,
732 kPMMinutesToSpinDown
,
734 kPMEthernetWakeOnLANSettings
,
735 kPMSetProcessorSpeed
,
738 kPMLastAggressivenessType
740 #define kMaxType (kPMLastAggressivenessType-1)
742 // SetAggressiveness values for the kPMPowerSource aggressiveness type
744 kIOPMInternalPower
= 1,
748 #define kIOREMSleepEnabledKey "REMSleepEnabled"
750 // Strings for deciphering the dictionary returned from IOPMCopyBatteryInfo
751 #define kIOBatteryInfoKey "IOBatteryInfo"
752 #define kIOBatteryCurrentChargeKey "Current"
753 #define kIOBatteryCapacityKey "Capacity"
754 #define kIOBatteryFlagsKey "Flags"
755 #define kIOBatteryVoltageKey "Voltage"
756 #define kIOBatteryAmperageKey "Amperage"
757 #define kIOBatteryCycleCountKey "Cycle Count"
760 kIOBatteryInstalled
= (1 << 2),
761 kIOBatteryCharge
= (1 << 1),
762 kIOBatteryChargerConnect
= (1 << 0)
765 // Private power management message indicating battery data has changed
766 // Indicates new data resides in the IORegistry
767 #define kIOPMMessageBatteryStatusHasChanged iokit_family_msg(sub_iokit_pmu, 0x100)
769 // Apple private Legacy messages for re-routing AutoWake and AutoPower messages to the PMU
770 // through newer user space IOPMSchedulePowerEvent API
771 #define kIOPMUMessageLegacyAutoWake iokit_family_msg(sub_iokit_pmu, 0x200)
772 #define kIOPMUMessageLegacyAutoPower iokit_family_msg(sub_iokit_pmu, 0x210)
774 // For use with IOPMPowerSource bFlags
775 #define IOPM_POWER_SOURCE_REV 2
777 kIOPMACInstalled
= kIOBatteryChargerConnect
,
778 kIOPMBatteryCharging
= kIOBatteryCharge
,
779 kIOPMBatteryInstalled
= kIOBatteryInstalled
,
780 kIOPMUPSInstalled
= (1<<3),
781 kIOPMBatteryAtWarn
= (1<<4),
782 kIOPMBatteryDepleted
= (1<<5),
783 kIOPMACnoChargeCapability
= (1<<6), // AC adapter cannot charge battery
784 kIOPMRawLowBattery
= (1<<7), // used only by Platform Expert
785 kIOPMForceLowSpeed
= (1<<8), // set by Platfm Expert, chk'd by Pwr Plugin
786 kIOPMClosedClamshell
= (1<<9), // set by PMU - reflects state of the clamshell
787 kIOPMClamshellStateOnWake
= (1<<10) // used only by Platform Expert
790 // **********************************************
791 // Internal power management data structures
792 // **********************************************
794 #if KERNEL && __cplusplus
798 kIOPowerEmergencyLevel
= 1000
803 kIOPMSuperclassPolicy1
804 #ifdef KERNEL_PRIVATE
805 , kIOPMActivityTickleTypeAdvisory
= 128
809 struct stateChangeNote
{
810 IOPMPowerFlags stateFlags
;
811 unsigned long stateNum
;
814 typedef struct stateChangeNote stateChangeNote
;
816 #endif /* KERNEL && __cplusplus */
817 struct IOPowerStateChangeNotification
{
819 unsigned long returnValue
;
820 unsigned long stateNumber
;
821 IOPMPowerFlags stateFlags
;
823 typedef struct IOPowerStateChangeNotification IOPowerStateChangeNotification
;
824 typedef IOPowerStateChangeNotification sleepWakeNote
;
826 /*! @struct IOPMSystemCapabilityChangeParameters
827 @abstract A structure describing a system capability change.
828 @discussion A system capability change is a system level transition from a set
829 of system capabilities to a new set of system capabilities. Power management
830 sends a <code>kIOMessageSystemCapabilityChange</code> message and provides
831 this structure as the message data (by reference) to
832 <code>gIOPriorityPowerStateInterest</code> clients when system capability
834 @field notifyRef An identifier for this message notification. Clients with pending
835 I/O can signal completion by calling <code>allowPowerChange()</code> with this
836 value as the argument. Clients that are able to process the notification
837 synchronously should ignore this field.
838 @field maxWaitForReply A return value to the caller indicating the maximum time in
839 microseconds to wait for the <code>allowPowerChange()</code> call. The default
840 value is zero, which indicates the client processing has finished, and power
841 management should not wait for an <code>allowPowerChange()</code> call.
842 @field changeFlags Flags will be set to indicate whether the notification precedes
843 the capability change (<code>kIOPMSystemCapabilityWillChange</code>), or after
844 the capability change has occurred (<code>kIOPMSystemCapabilityDidChange</code>).
845 @field __reserved1 Set to zero.
846 @field fromCapabilities The system capabilities at the start of the transition.
847 @field toCapabilities The system capabilities at the end of the transition.
848 @field __reserved2 Set to zero.
850 struct IOPMSystemCapabilityChangeParameters
{
852 uint32_t maxWaitForReply
;
853 uint32_t changeFlags
;
854 uint32_t __reserved1
;
855 uint32_t fromCapabilities
;
856 uint32_t toCapabilities
;
857 uint32_t __reserved2
[4];
860 /*! @enum IOPMSystemCapabilityChangeFlags
861 @constant kIOPMSystemCapabilityWillChange Indicates the system capability will change.
862 @constant kIOPMSystemCapabilityDidChange Indicates the system capability has changed.
865 kIOPMSystemCapabilityWillChange
= 0x01,
866 kIOPMSystemCapabilityDidChange
= 0x02
870 kIOPMSystemCapabilityCPU
= 0x01,
871 kIOPMSystemCapabilityGraphics
= 0x02,
872 kIOPMSystemCapabilityAudio
= 0x04,
873 kIOPMSystemCapabilityNetwork
= 0x08
876 #endif /* ! _IOKIT_IOPM_H */