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 to map from a global system state to the desired device state.
100 typedef unsigned long IOPMPowerFlags
;
102 kIOPMPowerOn
= 0x00000002,
103 kIOPMDeviceUsable
= 0x00008000,
104 kIOPMLowPower
= 0x00010000,
105 kIOPMPreventIdleSleep
= 0x00000040,
106 kIOPMSleepCapability
= 0x00000004,
107 kIOPMRestartCapability
= 0x00000080,
108 kIOPMSleep
= 0x00000001,
109 kIOPMRestart
= 0x00000080,
110 kIOPMInitialDeviceState
= 0x00000100,
111 kIOPMRootDomainState
= 0x00000200
115 * Private IOPMPowerFlags
118 * Not for use with non-Apple drivers
119 * Their behavior is undefined
122 kIOPMClockNormal
= 0x0004,
123 kIOPMClockRunning
= 0x0008,
124 kIOPMPreventSystemSleep
= 0x0010,
126 kIOPMChildClamp
= 0x0080,
127 kIOPMChildClamp2
= 0x0200,
128 kIOPMNotPowerManaged
= 0x0800
132 * Deprecated IOPMPowerFlags
133 * Their behavior is undefined when used in IOPMPowerState
134 * Capability, InputPowerRequirement, or OutputPowerCharacter fields.
137 kIOPMMaxPerformance
= 0x4000,
138 kIOPMPassThrough
= 0x0100,
139 kIOPMAuxPowerOn
= 0x0020,
140 kIOPMNotAttainable
= 0x0001,
141 kIOPMContextRetained
= 0x2000,
142 kIOPMConfigRetained
= 0x1000,
143 kIOPMStaticPowerValid
= 0x0800,
144 kIOPMSoftSleep
= 0x0400,
145 kIOPMCapabilitiesMask
= kIOPMPowerOn
| kIOPMDeviceUsable
|
146 kIOPMMaxPerformance
| kIOPMContextRetained
|
147 kIOPMConfigRetained
| kIOPMSleepCapability
|
148 kIOPMRestartCapability
152 * Support for old names of IOPMPowerFlag constants
155 IOPMNotAttainable
= kIOPMNotAttainable
,
156 IOPMPowerOn
= kIOPMPowerOn
,
157 IOPMClockNormal
= kIOPMClockNormal
,
158 IOPMClockRunning
= kIOPMClockRunning
,
159 IOPMAuxPowerOn
= kIOPMAuxPowerOn
,
160 IOPMDeviceUsable
= kIOPMDeviceUsable
,
161 IOPMMaxPerformance
= kIOPMMaxPerformance
,
162 IOPMContextRetained
= kIOPMContextRetained
,
163 IOPMConfigRetained
= kIOPMConfigRetained
,
164 IOPMNotPowerManaged
= kIOPMNotPowerManaged
,
165 IOPMSoftSleep
= kIOPMSoftSleep
170 kIOPMNextHigherState
= 1,
171 kIOPMHighestState
= 2,
172 kIOPMNextLowerState
= 3,
177 IOPMNextHigherState
= kIOPMNextHigherState
,
178 IOPMHighestState
= kIOPMHighestState
,
179 IOPMNextLowerState
= kIOPMNextLowerState
,
180 IOPMLowestState
= kIOPMLowestState
183 // Internal commands used by power managment command queue
185 kIOPMBroadcastAggressiveness
= 1,
189 // Power consumption unknown value
191 kIOPMUnknown
= 0xFFFF
194 /*******************************************************************************
196 * Root Domain property keys of interest
198 ******************************************************************************/
200 /* AppleClamshellState
201 * reflects the state of the clamshell (lid) on a portable.
202 * It has a boolean value.
203 * true == clamshell is closed
204 * false == clamshell is open
205 * not present == no clamshell on this hardware
207 #define kAppleClamshellStateKey "AppleClamshellState"
209 /* AppleClamshellCausesSleep
210 * reflects the clamshell close behavior on a portable.
211 * It has a boolean value.
212 * true == system will sleep when clamshell is closed
213 * false == system will not sleep on clamshell close
214 * (typically external display mode)
215 * not present == no clamshell on this hardware
217 #define kAppleClamshellCausesSleepKey "AppleClamshellCausesSleep"
219 /* kIOPMSleepWakeUUIDKey
220 * Key refers to a CFStringRef that will uniquely identify
221 * a sleep/wake cycle for logging & tracking.
222 * The key becomes valid at the beginning of a sleep cycle - before we
223 * initiate any sleep/wake notifications.
224 * The key becomes invalid at the completion of a system wakeup. The
225 * property will not be present in the IOPMrootDomain's registry entry
226 * when it is invalid.
228 * See IOPMrootDomain notification kIOPMMessageSleepWakeUUIDChange
230 #define kIOPMSleepWakeUUIDKey "SleepWakeUUID"
232 /* kIOPMBootSessionUUIDKey
233 * Key refers to a CFStringRef that will uniquely identify
235 * The key becomes valid at boot time and remains valid
236 * till shutdown. The property value will remain same across
237 * sleep/wake/hibernate cycle.
239 #define kIOPMBootSessionUUIDKey "BootSessionUUID"
241 /* kIOPMDeepSleepEnabledKey
242 * Indicates the Deep Sleep enable state.
243 * It has a boolean value.
244 * true == Deep Sleep is enabled
245 * false == Deep Sleep is disabled
246 * not present == Deep Sleep is not supported on this hardware
248 #define kIOPMDeepSleepEnabledKey "Standby Enabled"
250 /* kIOPMDeepSleepDelayKey
251 * Key refers to a CFNumberRef that represents the delay in seconds before
252 * entering Deep Sleep state. The property is not present if Deep Sleep is
255 #define kIOPMDeepSleepDelayKey "Standby Delay"
257 /* kIOPMDestroyFVKeyOnStandbyKey
258 * Specifies if FileVault key can be stored when going to standby mode
259 * It has a boolean value,
260 * true == Destroy FV key when going to standby mode
261 * false == Retain FV key when going to standby mode
262 * not present == Retain FV key when going to standby mode
264 #define kIOPMDestroyFVKeyOnStandbyKey "DestroyFVKeyOnStandby"
266 /*******************************************************************************
268 * Properties that can control power management behavior
270 ******************************************************************************/
272 /* kIOPMResetPowerStateOnWakeKey
273 * If an IOService publishes this key with the value of kOSBooleanTrue,
274 * then PM will disregard the influence from changePowerStateToPriv() or
275 * any activity tickles that occurred before system sleep when resolving
276 * the initial device power state on wake. Influences from power children
277 * and changePowerStateTo() are not eliminated. At the earliest opportunity
278 * upon system wake, PM will query the driver for a new power state to be
279 * installed as the initial changePowerStateToPriv() influence, by calling
280 * initialPowerStateForDomainState() with both kIOPMRootDomainState and
281 * kIOPMPowerOn flags set. The default implementation will always return
282 * the lowest power state. Drivers can override this default behavior to
283 * immediately raise the power state when there are work blocked on the
284 * power change, and cannot afford to wait until the next activity tickle.
285 * This property should be statically added to a driver's plist or set at
286 * runtime before calling PMinit().
288 #define kIOPMResetPowerStateOnWakeKey "IOPMResetPowerStateOnWake"
290 /*******************************************************************************
292 * Driver PM Assertions
294 ******************************************************************************/
296 /* Driver Assertion bitfield description
297 * Driver PM assertions are defined by these bits.
300 /*! kIOPMDriverAssertionCPUBit
301 * When set, PM kernel will prefer to leave the CPU and core hardware
302 * running in "Dark Wake" state, instead of sleeping.
304 kIOPMDriverAssertionCPUBit
= 0x01,
306 /*! kIOPMDriverAssertionUSBExternalDeviceBit
307 * When set, driver is informing PM that an external USB device is attached.
309 kIOPMDriverAssertionUSBExternalDeviceBit
= 0x04,
311 /*! kIOPMDriverAssertionBluetoothHIDDevicePairedBit
312 * When set, driver is informing PM that a Bluetooth HID device is paired.
314 kIOPMDriverAssertionBluetoothHIDDevicePairedBit
= 0x08,
316 /*! kIOPMDriverAssertionExternalMediaMountedBit
317 * When set, driver is informing PM that an external media is mounted.
319 kIOPMDriverAssertionExternalMediaMountedBit
= 0x10,
321 /*! kIOPMDriverAssertionReservedBit5
322 * Reserved for Thunderbolt.
324 kIOPMDriverAssertionReservedBit5
= 0x20,
326 /*! kIOPMDriverAssertionPreventDisplaySleepBit
327 * When set, the display should remain powered on while the system's awake.
329 kIOPMDriverAssertionPreventDisplaySleepBit
= 0x40,
331 /*! kIOPMDriverAssertionReservedBit7
332 * Reserved for storage family.
334 kIOPMDriverAssertionReservedBit7
= 0x80,
336 /*! kIOPMDriverAssertionMagicPacketWakeEnabledBit
337 * When set, driver is informing PM that magic packet wake is enabled.
339 kIOPMDriverAssertionMagicPacketWakeEnabledBit
= 0x100,
341 /*! kIOPMDriverAssertionNetworkKeepAliveActiveBit
342 * When set, driver is informing PM that it is holding the network
343 * interface up to do TCPKeepAlive
345 kIOPMDriverAssertionNetworkKeepAliveActiveBit
= 0x200
348 /* kIOPMAssertionsDriverKey
349 * This kIOPMrootDomain key refers to a CFNumberRef property, containing
350 * a bitfield describing the aggregate PM assertion levels.
351 * Example: A value of 0 indicates that no driver has asserted anything.
352 * Or, a value of <link>kIOPMDriverAssertionCPUBit</link>
353 * indicates that a driver (or drivers) have asserted a need for CPU and video.
355 #define kIOPMAssertionsDriverKey "DriverPMAssertions"
357 /* kIOPMAssertionsDriverKey
358 * This kIOPMrootDomain key refers to a CFNumberRef property, containing
359 * a bitfield describing the aggregate PM assertion levels.
360 * Example: A value of 0 indicates that no driver has asserted anything.
361 * Or, a value of <link>kIOPMDriverAssertionCPUBit</link>
362 * indicates that a driver (or drivers) have asserted a need for CPU and video.
364 #define kIOPMAssertionsDriverDetailedKey "DriverPMAssertionsDetailed"
366 /*******************************************************************************
368 * Kernel Driver assertion detailed dictionary keys
370 * Keys decode the Array & dictionary data structure under IOPMrootDomain property
371 * kIOPMAssertionsDriverKey.
374 #define kIOPMDriverAssertionIDKey "ID"
375 #define kIOPMDriverAssertionCreatedTimeKey "CreatedTime"
376 #define kIOPMDriverAssertionModifiedTimeKey "ModifiedTime"
377 #define kIOPMDriverAssertionOwnerStringKey "Owner"
378 #define kIOPMDriverAssertionOwnerServiceKey "ServicePtr"
379 #define kIOPMDriverAssertionRegistryEntryIDKey "RegistryEntryID"
380 #define kIOPMDriverAssertionLevelKey "Level"
381 #define kIOPMDriverAssertionAssertedKey "Assertions"
383 /*******************************************************************************
385 * Root Domain general interest messages
387 * Available by registering for interest type 'gIOGeneralInterest'
390 ******************************************************************************/
392 /* kIOPMMessageClamshellStateChange
393 * Delivered as a general interest notification on the IOPMrootDomain
394 * IOPMrootDomain sends this message when state of either AppleClamshellState
395 * or AppleClamshellCausesSleep changes. If this clamshell change results in
396 * a sleep, the sleep will initiate soon AFTER delivery of this message.
397 * The state of both variables is encoded in a bitfield argument sent with
398 * the message. Check bits 0 and 1 using kClamshellStateBit & kClamshellSleepBit
401 kClamshellStateBit
= (1 << 0),
402 kClamshellSleepBit
= (1 << 1)
405 #define kIOPMMessageClamshellStateChange \
406 iokit_family_msg(sub_iokit_powermanagement, 0x100)
408 /* kIOPMMessageFeatureChange
409 * Delivered when the set of supported features ("Supported Features" dictionary
410 * under IOPMrootDomain registry) changes in some way. Typically addition or
411 * removal of a supported feature.
412 * RootDomain passes no argument with this message.
414 #define kIOPMMessageFeatureChange \
415 iokit_family_msg(sub_iokit_powermanagement, 0x110)
417 /* kIOPMMessageInflowDisableCancelled
418 * The battery has drained completely to its "Fully Discharged" state.
419 * If a user process has disabled battery inflow for battery
420 * calibration, we forcibly re-enable Inflow at this point.
421 * If inflow HAS been forcibly re-enabled, bit 0
422 * (kInflowForciblyEnabledBit) will be set.
425 kInflowForciblyEnabledBit
= (1 << 0)
428 /* kIOPMMessageInternalBatteryFullyDischarged
429 * The battery has drained completely to its "Fully Discharged" state.
431 #define kIOPMMessageInternalBatteryFullyDischarged \
432 iokit_family_msg(sub_iokit_powermanagement, 0x120)
434 /* kIOPMMessageSystemPowerEventOccurred
435 * Some major system thermal property has changed, and interested clients may
436 * modify their behavior.
438 #define kIOPMMessageSystemPowerEventOccurred \
439 iokit_family_msg(sub_iokit_powermanagement, 0x130)
441 /* kIOPMMessageSleepWakeUUIDChange
442 * Either a new SleepWakeUUID has been specified at the beginning of a sleep,
443 * or we're removing the existing property upon completion of a wakeup.
445 #define kIOPMMessageSleepWakeUUIDChange \
446 iokit_family_msg(sub_iokit_powermanagement, 0x140)
448 /* kIOPMMessageSleepWakeUUIDSet
449 * Argument accompanying the kIOPMMessageSleepWakeUUIDChange notification when
450 * a new UUID has been specified.
452 #define kIOPMMessageSleepWakeUUIDSet ((void *)1)
454 /* kIOPMMessageSleepWakeUUIDCleared
455 * Argument accompanying the kIOPMMessageSleepWakeUUIDChange notification when
456 * the current UUID has been removed.
458 #define kIOPMMessageSleepWakeUUIDCleared ((void *)0)
460 /*! kIOPMMessageDriverAssertionsChanged
461 * Sent when kernel PM driver assertions have changed.
463 #define kIOPMMessageDriverAssertionsChanged \
464 iokit_family_msg(sub_iokit_powermanagement, 0x150)
466 /*! kIOPMMessageDarkWakeThermalEmergency
467 * Sent when machine becomes unsustainably warm in DarkWake.
468 * Kernel PM might choose to put the machine back to sleep right after.
470 #define kIOPMMessageDarkWakeThermalEmergency \
471 iokit_family_msg(sub_iokit_powermanagement, 0x160)
473 /*******************************************************************************
475 * Power commands issued to root domain
476 * Use with IOPMrootDomain::receivePowerNotification()
478 * These commands are issued from system drivers only:
479 * ApplePMU, AppleSMU, IOGraphics, AppleACPIFamily
481 * TODO: deprecate kIOPMAllowSleep and kIOPMPreventSleep
482 ******************************************************************************/
484 kIOPMSleepNow
= (1<<0), // put machine to sleep now
485 kIOPMAllowSleep
= (1<<1), // allow idle sleep
486 kIOPMPreventSleep
= (1<<2), // do not allow idle sleep
487 kIOPMPowerButton
= (1<<3), // power button was pressed
488 kIOPMClamshellClosed
= (1<<4), // clamshell was closed
489 kIOPMPowerEmergency
= (1<<5), // battery dangerously low
490 kIOPMDisableClamshell
= (1<<6), // do not sleep on clamshell closure
491 kIOPMEnableClamshell
= (1<<7), // sleep on clamshell closure
492 kIOPMProcessorSpeedChange
= (1<<8), // change the processor speed
493 kIOPMOverTemp
= (1<<9), // system dangerously hot
494 kIOPMClamshellOpened
= (1<<10), // clamshell was opened
495 kIOPMDWOverTemp
= (1<<11) // DarkWake thermal limits exceeded.
499 /*******************************************************************************
501 * Power Management Return Codes
503 ******************************************************************************/
507 // Returned by driver's setPowerState(), powerStateWillChangeTo(),
508 // powerStateDidChangeTo(), or acknowledgeSetPowerState() to
509 // implicitly acknowledge power change upon function return.
513 kIOPMWillAckLater
= 1,
515 // Returned by requestPowerDomainState() to indicate
516 // unrecognized specification parameter.
517 kIOPMBadSpecification
= 4,
519 // Returned by requestPowerDomainState() to indicate
520 // no power state matches search specification.
521 kIOPMNoSuchState
= 5,
524 kIOPMCannotRaisePower
= 6,
527 kIOPMParameterError
= 7,
529 // Returned when power management state is accessed
530 // before driver has called PMinit().
531 kIOPMNotYetInitialized
= 8,
533 // And the old constants; deprecated
534 IOPMNoErr
= kIOPMNoErr
,
535 IOPMAckImplied
= kIOPMAckImplied
,
536 IOPMWillAckLater
= kIOPMWillAckLater
,
537 IOPMBadSpecification
= kIOPMBadSpecification
,
538 IOPMNoSuchState
= kIOPMNoSuchState
,
539 IOPMCannotRaisePower
= kIOPMCannotRaisePower
,
540 IOPMParameterError
= kIOPMParameterError
,
541 IOPMNotYetInitialized
= kIOPMNotYetInitialized
545 // IOPMPowerSource class descriptive strings
546 // Power Source state is published as properties to the IORegistry under these
548 #define kIOPMPSExternalConnectedKey "ExternalConnected"
549 #define kIOPMPSExternalChargeCapableKey "ExternalChargeCapable"
550 #define kIOPMPSBatteryInstalledKey "BatteryInstalled"
551 #define kIOPMPSIsChargingKey "IsCharging"
552 #define kIOPMFullyChargedKey "FullyCharged"
553 #define kIOPMPSAtWarnLevelKey "AtWarnLevel"
554 #define kIOPMPSAtCriticalLevelKey "AtCriticalLevel"
555 #define kIOPMPSCurrentCapacityKey "CurrentCapacity"
556 #define kIOPMPSMaxCapacityKey "MaxCapacity"
557 #define kIOPMPSDesignCapacityKey "DesignCapacity"
558 #define kIOPMPSTimeRemainingKey "TimeRemaining"
559 #define kIOPMPSAmperageKey "Amperage"
560 #define kIOPMPSVoltageKey "Voltage"
561 #define kIOPMPSCycleCountKey "CycleCount"
562 #define kIOPMPSMaxErrKey "MaxErr"
563 #define kIOPMPSAdapterInfoKey "AdapterInfo"
564 #define kIOPMPSLocationKey "Location"
565 #define kIOPMPSErrorConditionKey "ErrorCondition"
566 #define kIOPMPSManufacturerKey "Manufacturer"
567 #define kIOPMPSManufactureDateKey "ManufactureDate"
568 #define kIOPMPSModelKey "Model"
569 #define kIOPMPSSerialKey "Serial"
570 #define kIOPMDeviceNameKey "DeviceName"
571 #define kIOPMPSLegacyBatteryInfoKey "LegacyBatteryInfo"
572 #define kIOPMPSBatteryHealthKey "BatteryHealth"
573 #define kIOPMPSHealthConfidenceKey "HealthConfidence"
574 #define kIOPMPSCapacityEstimatedKey "CapacityEstimated"
575 #define kIOPMPSBatteryChargeStatusKey "ChargeStatus"
576 #define kIOPMPSBatteryTemperatureKey "Temperature"
577 #define kIOPMPSAdapterDetailsKey "AdapterDetails"
578 #define kIOPMPSChargerConfigurationKey "ChargerConfiguration"
580 // kIOPMPSBatteryChargeStatusKey may have one of the following values, or may have
581 // no value. If kIOPMBatteryChargeStatusKey has a NULL value (or no value) associated with it
582 // then charge is proceeding normally. If one of these battery charge status reasons is listed,
583 // then the charge may have been interrupted.
584 #define kIOPMBatteryChargeStatusTooHot "HighTemperature"
585 #define kIOPMBatteryChargeStatusTooCold "LowTemperature"
586 #define kIOPMBatteryChargeStatusTooHotOrCold "HighOrLowTemperature"
587 #define kIOPMBatteryChargeStatusGradient "BatteryTemperatureGradient"
589 // Definitions for battery location, in case of multiple batteries.
590 // A location of 0 is unspecified
591 // Location is undefined for single battery systems
593 kIOPMPSLocationLeft
= 1001,
594 kIOPMPSLocationRight
= 1002
597 // Battery quality health types, specified by BatteryHealth and HealthConfidence
598 // properties in an IOPMPowerSource battery kext.
600 kIOPMUndefinedValue
= 0,
606 // Keys for kIOPMPSAdapterDetailsKey dictionary
607 #define kIOPMPSAdapterDetailsIDKey "AdapterID"
608 #define kIOPMPSAdapterDetailsWattsKey "Watts"
609 #define kIOPMPSAdapterDetailsRevisionKey "AdapterRevision"
610 #define kIOPMPSAdapterDetailsSerialNumberKey "SerialNumber"
611 #define kIOPMPSAdapterDetailsFamilyKey "FamilyCode"
612 #define kIOPMPSAdapterDetailsAmperageKey "Amperage"
613 #define kIOPMPSAdapterDetailsDescriptionKey "Description"
614 #define kIOPMPSAdapterDetailsPMUConfigurationKey "PMUConfiguration"
616 // Battery's time remaining estimate is invalid this long (seconds) after a wake
617 #define kIOPMPSInvalidWakeSecondsKey "BatteryInvalidWakeSeconds"
619 // Battery must wait this long (seconds) after being completely charged before
620 // the battery is settled.
621 #define kIOPMPSPostChargeWaitSecondsKey "PostChargeWaitSeconds"
623 // Battery must wait this long (seconds) after being completely discharged
624 // before the battery is settled.
625 #define kIOPMPSPostDishargeWaitSecondsKey "PostDischargeWaitSeconds"
628 /* CPU Power Management status keys
629 * Pass as arguments to IOPMrootDomain::systemPowerEventOccurred
630 * Or as arguments to IOPMSystemPowerEventOccurred()
631 * Or to decode the dictionary obtained from IOPMCopyCPUPowerStatus()
632 * These keys reflect restrictions placed on the CPU by the system
633 * to bring the CPU's power consumption within allowable thermal and
638 /* kIOPMGraphicsPowerLimitsKey
639 * The key representing the dictionary of graphics 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 kIOPMGraphicsPowerLimitsKey "Graphics_Power_Limits"
645 /* kIOPMGraphicsPowerLimitPerformanceKey
646 * The key representing the percent of overall performance made available
647 * by the graphics chip as a percentage (integer 0 - 100).
649 #define kIOPMGraphicsPowerLimitPerformanceKey "Graphics_Power_Performance"
653 /* kIOPMCPUPowerLimitsKey
654 * The key representing the dictionary of CPU Power Limits.
655 * The dictionary contains the other kIOPMCPUPower keys & their associated
656 * values (e.g. Speed limit, Processor Count, and Schedule limits).
658 #define kIOPMCPUPowerLimitsKey "CPU_Power_Limits"
660 /* kIOPMCPUPowerLimitProcessorSpeedKey defines the speed & voltage limits placed
662 * Represented as a percentage (0-100) of maximum CPU speed.
664 #define kIOPMCPUPowerLimitProcessorSpeedKey "CPU_Speed_Limit"
666 /* kIOPMCPUPowerLimitProcessorCountKey reflects how many, if any, CPUs have been
667 * taken offline. Represented as an integer number of CPUs (0 - Max CPUs).
669 #define kIOPMCPUPowerLimitProcessorCountKey "CPU_Available_CPUs"
671 /* kIOPMCPUPowerLimitSchedulerTimeKey represents the percentage (0-100) of CPU time
672 * available. 100% at normal operation. The OS may limit this time for a percentage
675 #define kIOPMCPUPowerLimitSchedulerTimeKey "CPU_Scheduler_Limit"
678 /* Thermal Level Warning Key
679 * Indicates the thermal constraints placed on the system. This value may
680 * cause clients to action to consume fewer system resources.
681 * The value associated with this warning is defined by the platform.
683 #define kIOPMThermalLevelWarningKey "Thermal_Level_Warning"
685 /* Thermal Warning Level values
686 * kIOPMThermalLevelNormal - under normal operating conditions
687 * kIOPMThermalLevelDanger - thermal pressure may cause system slowdown
688 * kIOPMThermalLevelCritical - thermal conditions may cause imminent shutdown
690 * The platform may define additional thermal levels if necessary.
691 * Platform specific values are defined from 100 and above
694 kIOPMThermalLevelNormal
= 0,
695 kIOPMThermalLevelDanger
= 5,
696 kIOPMThermalLevelCritical
= 10,
698 kIOPMThermalLevelWarning
= 100,
699 kIOPMThermalLevelTrap
= 110,
701 kIOPMThermalLevelUnknown
= 255,
704 #define kIOPMThermalWarningLevelNormal kIOPMThermalLevelNormal
705 #define kIOPMThermalWarningLevelDanger kIOPMThermalLevelWarning
706 #define kIOPMThermalWarningLevelCrisis kIOPMThermalLevelCritical
708 // PM Settings Controller setting types
709 // Settings types used primarily with:
710 // IOPMrootDomain::registerPMSettingController
711 // The values are identical to the similarly named keys for use in user space
712 // PM settings work. Those keys are defined in IOPMLibPrivate.h.
713 #define kIOPMSettingWakeOnRingKey "Wake On Modem Ring"
714 #define kIOPMSettingRestartOnPowerLossKey "Automatic Restart On Power Loss"
715 #define kIOPMSettingWakeOnACChangeKey "Wake On AC Change"
716 #define kIOPMSettingSleepOnPowerButtonKey "Sleep On Power Button"
717 #define kIOPMSettingWakeOnClamshellKey "Wake On Clamshell Open"
718 #define kIOPMSettingReduceBrightnessKey "ReduceBrightness"
719 #define kIOPMSettingDisplaySleepUsesDimKey "Display Sleep Uses Dim"
720 #define kIOPMSettingTimeZoneOffsetKey "TimeZoneOffsetSeconds"
721 #define kIOPMSettingMobileMotionModuleKey "MobileMotionModule"
722 #define kIOPMSettingGraphicsSwitchKey "GPUSwitch"
724 // Setting controlling drivers can register to receive scheduled wake data
725 // Either in "CF seconds" type, or structured calendar data in a formatted
726 // IOPMCalendarStruct defined below.
727 #define kIOPMSettingAutoWakeSecondsKey "wake"
728 #define kIOPMSettingAutoWakeCalendarKey "WakeByCalendarDate"
729 #define kIOPMSettingAutoPowerSecondsKey "poweron"
730 #define kIOPMSettingAutoPowerCalendarKey "PowerByCalendarDate"
732 // Debug seconds auto wake
733 // Used by sleep cycling debug tools
734 #define kIOPMSettingDebugWakeRelativeKey "WakeRelativeToSleep"
735 #define kIOPMSettingDebugPowerRelativeKey "PowerRelativeToShutdown"
737 // Maintenance wake calendar.
738 #define kIOPMSettingMaintenanceWakeCalendarKey "MaintenanceWakeCalendarDate"
741 struct IOPMCalendarStruct
{
750 typedef struct IOPMCalendarStruct IOPMCalendarStruct
;
752 // SetAggressiveness types
754 kPMGeneralAggressiveness
= 0,
756 kPMMinutesToSpinDown
,
758 kPMEthernetWakeOnLANSettings
,
759 kPMSetProcessorSpeed
,
762 kPMLastAggressivenessType
764 #define kMaxType (kPMLastAggressivenessType-1)
766 // SetAggressiveness values for the kPMPowerSource aggressiveness type
768 kIOPMInternalPower
= 1,
772 #define kIOREMSleepEnabledKey "REMSleepEnabled"
774 // Strings for deciphering the dictionary returned from IOPMCopyBatteryInfo
775 #define kIOBatteryInfoKey "IOBatteryInfo"
776 #define kIOBatteryCurrentChargeKey "Current"
777 #define kIOBatteryCapacityKey "Capacity"
778 #define kIOBatteryFlagsKey "Flags"
779 #define kIOBatteryVoltageKey "Voltage"
780 #define kIOBatteryAmperageKey "Amperage"
781 #define kIOBatteryCycleCountKey "Cycle Count"
784 kIOBatteryInstalled
= (1 << 2),
785 kIOBatteryCharge
= (1 << 1),
786 kIOBatteryChargerConnect
= (1 << 0)
789 // Private power management message indicating battery data has changed
790 // Indicates new data resides in the IORegistry
791 #define kIOPMMessageBatteryStatusHasChanged iokit_family_msg(sub_iokit_pmu, 0x100)
793 // Apple private Legacy messages for re-routing AutoWake and AutoPower messages to the PMU
794 // through newer user space IOPMSchedulePowerEvent API
795 #define kIOPMUMessageLegacyAutoWake iokit_family_msg(sub_iokit_pmu, 0x200)
796 #define kIOPMUMessageLegacyAutoPower iokit_family_msg(sub_iokit_pmu, 0x210)
798 // For use with IOPMPowerSource bFlags
799 #define IOPM_POWER_SOURCE_REV 2
801 kIOPMACInstalled
= kIOBatteryChargerConnect
,
802 kIOPMBatteryCharging
= kIOBatteryCharge
,
803 kIOPMBatteryInstalled
= kIOBatteryInstalled
,
804 kIOPMUPSInstalled
= (1<<3),
805 kIOPMBatteryAtWarn
= (1<<4),
806 kIOPMBatteryDepleted
= (1<<5),
807 kIOPMACnoChargeCapability
= (1<<6), // AC adapter cannot charge battery
808 kIOPMRawLowBattery
= (1<<7), // used only by Platform Expert
809 kIOPMForceLowSpeed
= (1<<8), // set by Platfm Expert, chk'd by Pwr Plugin
810 kIOPMClosedClamshell
= (1<<9), // set by PMU - reflects state of the clamshell
811 kIOPMClamshellStateOnWake
= (1<<10) // used only by Platform Expert
814 // **********************************************
815 // Internal power management data structures
816 // **********************************************
818 #if KERNEL && __cplusplus
822 kIOPowerEmergencyLevel
= 1000
827 kIOPMSuperclassPolicy1
828 #ifdef KERNEL_PRIVATE
829 , kIOPMActivityTickleTypeAdvisory
= 128
833 struct stateChangeNote
{
834 IOPMPowerFlags stateFlags
;
835 unsigned long stateNum
;
838 typedef struct stateChangeNote stateChangeNote
;
840 #endif /* KERNEL && __cplusplus */
841 struct IOPowerStateChangeNotification
{
843 unsigned long returnValue
;
844 unsigned long stateNumber
;
845 IOPMPowerFlags stateFlags
;
847 typedef struct IOPowerStateChangeNotification IOPowerStateChangeNotification
;
848 typedef IOPowerStateChangeNotification sleepWakeNote
;
850 /*! @struct IOPMSystemCapabilityChangeParameters
851 @abstract A structure describing a system capability change.
852 @discussion A system capability change is a system level transition from a set
853 of system capabilities to a new set of system capabilities. Power management
854 sends a <code>kIOMessageSystemCapabilityChange</code> message and provides
855 this structure as the message data (by reference) to
856 <code>gIOPriorityPowerStateInterest</code> clients when system capability
858 @field notifyRef An identifier for this message notification. Clients with pending
859 I/O can signal completion by calling <code>allowPowerChange()</code> with this
860 value as the argument. Clients that are able to process the notification
861 synchronously should ignore this field.
862 @field maxWaitForReply A return value to the caller indicating the maximum time in
863 microseconds to wait for the <code>allowPowerChange()</code> call. The default
864 value is zero, which indicates the client processing has finished, and power
865 management should not wait for an <code>allowPowerChange()</code> call.
866 @field changeFlags Flags will be set to indicate whether the notification precedes
867 the capability change (<code>kIOPMSystemCapabilityWillChange</code>), or after
868 the capability change has occurred (<code>kIOPMSystemCapabilityDidChange</code>).
869 @field __reserved1 Set to zero.
870 @field fromCapabilities The system capabilities at the start of the transition.
871 @field toCapabilities The system capabilities at the end of the transition.
872 @field __reserved2 Set to zero.
874 struct IOPMSystemCapabilityChangeParameters
{
876 uint32_t maxWaitForReply
;
877 uint32_t changeFlags
;
878 uint32_t __reserved1
;
879 uint32_t fromCapabilities
;
880 uint32_t toCapabilities
;
881 uint32_t __reserved2
[4];
884 /*! @enum IOPMSystemCapabilityChangeFlags
885 @constant kIOPMSystemCapabilityWillChange Indicates the system capability will change.
886 @constant kIOPMSystemCapabilityDidChange Indicates the system capability has changed.
889 kIOPMSystemCapabilityWillChange
= 0x01,
890 kIOPMSystemCapabilityDidChange
= 0x02
894 kIOPMSystemCapabilityCPU
= 0x01,
895 kIOPMSystemCapabilityGraphics
= 0x02,
896 kIOPMSystemCapabilityAudio
= 0x04,
897 kIOPMSystemCapabilityNetwork
= 0x08
900 #endif /* ! _IOKIT_IOPM_H */