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 typedef unsigned long IOPMPowerFlags
;
96 kIOPMPowerOn
= 0x00000002,
97 kIOPMDeviceUsable
= 0x00008000,
98 kIOPMLowPower
= 0x00010000,
99 kIOPMPreventIdleSleep
= 0x00000040,
100 kIOPMSleepCapability
= 0x00000004,
101 kIOPMRestartCapability
= 0x00000080,
102 kIOPMSleep
= 0x00000001,
103 kIOPMRestart
= 0x00000080,
104 kIOPMInitialDeviceState
= 0x00000100
108 * Private IOPMPowerFlags
111 * Not for use with non-Apple drivers
112 * Their behavior is undefined
115 kIOPMClockNormal
= 0x0004,
116 kIOPMClockRunning
= 0x0008,
117 kIOPMPreventSystemSleep
= 0x0010,
119 kIOPMChildClamp
= 0x0080,
120 kIOPMChildClamp2
= 0x0200,
121 kIOPMNotPowerManaged
= 0x0800
125 * Deprecated IOPMPowerFlags
126 * Their behavior is undefined when used in IOPMPowerState
127 * Capability, InputPowerRequirement, or OutputPowerCharacter fields.
130 kIOPMMaxPerformance
= 0x4000,
131 kIOPMPassThrough
= 0x0100,
132 kIOPMAuxPowerOn
= 0x0020,
133 kIOPMNotAttainable
= 0x0001,
134 kIOPMContextRetained
= 0x2000,
135 kIOPMConfigRetained
= 0x1000,
136 kIOPMStaticPowerValid
= 0x0800,
137 kIOPMSoftSleep
= 0x0400,
138 kIOPMCapabilitiesMask
= kIOPMPowerOn
| kIOPMDeviceUsable
|
139 kIOPMMaxPerformance
| kIOPMContextRetained
|
140 kIOPMConfigRetained
| kIOPMSleepCapability
|
141 kIOPMRestartCapability
145 * Support for old names of IOPMPowerFlag constants
148 IOPMNotAttainable
= kIOPMNotAttainable
,
149 IOPMPowerOn
= kIOPMPowerOn
,
150 IOPMClockNormal
= kIOPMClockNormal
,
151 IOPMClockRunning
= kIOPMClockRunning
,
152 IOPMAuxPowerOn
= kIOPMAuxPowerOn
,
153 IOPMDeviceUsable
= kIOPMDeviceUsable
,
154 IOPMMaxPerformance
= kIOPMMaxPerformance
,
155 IOPMContextRetained
= kIOPMContextRetained
,
156 IOPMConfigRetained
= kIOPMConfigRetained
,
157 IOPMNotPowerManaged
= kIOPMNotPowerManaged
,
158 IOPMSoftSleep
= kIOPMSoftSleep
163 kIOPMNextHigherState
= 1,
164 kIOPMHighestState
= 2,
165 kIOPMNextLowerState
= 3,
170 IOPMNextHigherState
= kIOPMNextHigherState
,
171 IOPMHighestState
= kIOPMHighestState
,
172 IOPMNextLowerState
= kIOPMNextLowerState
,
173 IOPMLowestState
= kIOPMLowestState
176 // Internal commands used by power managment command queue
178 kIOPMBroadcastAggressiveness
= 1,
182 // Power consumption unknown value
184 kIOPMUnknown
= 0xFFFF
187 /*******************************************************************************
189 * Root Domain property keys of interest
191 ******************************************************************************/
193 /* AppleClamshellState
194 * reflects the state of the clamshell (lid) on a portable.
195 * It has a boolean value.
196 * true == clamshell is closed
197 * false == clamshell is open
198 * not present == no clamshell on this hardware
200 #define kAppleClamshellStateKey "AppleClamshellState"
202 /* AppleClamshellCausesSleep
203 * reflects the clamshell close behavior on a portable.
204 * It has a boolean value.
205 * true == system will sleep when clamshell is closed
206 * false == system will not sleep on clamshell close
207 * (typically external display mode)
208 * not present == no clamshell on this hardware
210 #define kAppleClamshellCausesSleepKey "AppleClamshellCausesSleep"
212 /* kIOPMSleepWakeUUIDKey
213 * Key refers to a CFStringRef that will uniquely identify
214 * a sleep/wake cycle for logging & tracking.
215 * The key becomes valid at the beginning of a sleep cycle - before we
216 * initiate any sleep/wake notifications.
217 * The key becomes invalid at the completion of a system wakeup. The
218 * property will not be present in the IOPMrootDomain's registry entry
219 * when it is invalid.
221 * See IOPMrootDomain notification kIOPMMessageSleepWakeUUIDChange
223 #define kIOPMSleepWakeUUIDKey "SleepWakeUUID"
225 /* kIOPMDeepSleepEnabledKey
226 * Indicates the Deep Sleep enable state.
227 * It has a boolean value.
228 * true == Deep Sleep is enabled
229 * false == Deep Sleep is disabled
230 * not present == Deep Sleep is not supported on this hardware
232 #define kIOPMDeepSleepEnabledKey "Standby Enabled"
234 /* kIOPMDeepSleepDelayKey
235 * Key refers to a CFNumberRef that represents the delay in seconds before
236 * entering Deep Sleep state. The property is not present if Deep Sleep is
239 #define kIOPMDeepSleepDelayKey "Standby Delay"
241 /* kIOPMDestroyFVKeyOnStandbyKey
242 * Specifies if FileVault key can be stored when going to standby mode
243 * It has a boolean value,
244 * true == Destroy FV key when going to standby mode
245 * false == Retain FV key when going to standby mode
246 * not present == Retain FV key when going to standby mode
248 #define kIOPMDestroyFVKeyOnStandbyKey "DestroyFVKeyOnStandby"
250 /*******************************************************************************
252 * Driver PM Assertions
254 ******************************************************************************/
256 /* Driver Assertion bitfield description
257 * Driver PM assertions are defined by these bits.
260 /*! kIOPMDriverAssertionCPUBit
261 * When set, PM kernel will prefer to leave the CPU and core hardware
262 * running in "Dark Wake" state, instead of sleeping.
264 kIOPMDriverAssertionCPUBit
= 0x01,
266 /*! kIOPMDriverAssertionUSBExternalDeviceBit
267 * When set, driver is informing PM that an external USB device is attached.
269 kIOPMDriverAssertionUSBExternalDeviceBit
= 0x04,
271 /*! kIOPMDriverAssertionBluetoothHIDDevicePairedBit
272 * When set, driver is informing PM that a Bluetooth HID device is paired.
274 kIOPMDriverAssertionBluetoothHIDDevicePairedBit
= 0x08,
276 /*! kIOPMDriverAssertionExternalMediaMountedBit
277 * When set, driver is informing PM that an external media is mounted.
279 kIOPMDriverAssertionExternalMediaMountedBit
= 0x10,
281 /*! kIOPMDriverAssertionReservedBit5
282 * Reserved for Thunderbolt.
284 kIOPMDriverAssertionReservedBit5
= 0x20,
286 /*! kIOPMDriverAssertionPreventDisplaySleepBit
287 * When set, the display should remain powered on while the system's awake.
289 kIOPMDriverAssertionPreventDisplaySleepBit
= 0x40,
291 kIOPMDriverAssertionReservedBit7
= 0x80
294 /* kIOPMAssertionsDriverKey
295 * This kIOPMrootDomain key refers to a CFNumberRef property, containing
296 * a bitfield describing the aggregate PM assertion levels.
297 * Example: A value of 0 indicates that no driver has asserted anything.
298 * Or, a value of <link>kIOPMDriverAssertionCPUBit</link>
299 * indicates that a driver (or drivers) have asserted a need fro CPU and video.
301 #define kIOPMAssertionsDriverKey "DriverPMAssertions"
303 /* kIOPMAssertionsDriverKey
304 * This kIOPMrootDomain key refers to a CFNumberRef property, containing
305 * a bitfield describing the aggregate PM assertion levels.
306 * Example: A value of 0 indicates that no driver has asserted anything.
307 * Or, a value of <link>kIOPMDriverAssertionCPUBit</link>
308 * indicates that a driver (or drivers) have asserted a need fro CPU and video.
310 #define kIOPMAssertionsDriverDetailedKey "DriverPMAssertionsDetailed"
312 /*******************************************************************************
314 * Kernel Driver assertion detailed dictionary keys
316 * Keys decode the Array & dictionary data structure under IOPMrootDomain property
317 * kIOPMAssertionsDriverKey.
320 #define kIOPMDriverAssertionIDKey "ID"
321 #define kIOPMDriverAssertionCreatedTimeKey "CreatedTime"
322 #define kIOPMDriverAssertionModifiedTimeKey "ModifiedTime"
323 #define kIOPMDriverAssertionOwnerStringKey "Owner"
324 #define kIOPMDriverAssertionOwnerServiceKey "ServicePtr"
325 #define kIOPMDriverAssertionLevelKey "Level"
326 #define kIOPMDriverAssertionAssertedKey "Assertions"
328 /*******************************************************************************
330 * Root Domain general interest messages
332 * Available by registering for interest type 'gIOGeneralInterest'
335 ******************************************************************************/
337 /* kIOPMMessageClamshellStateChange
338 * Delivered as a general interest notification on the IOPMrootDomain
339 * IOPMrootDomain sends this message when state of either AppleClamshellState
340 * or AppleClamshellCausesSleep changes. If this clamshell change results in
341 * a sleep, the sleep will initiate soon AFTER delivery of this message.
342 * The state of both variables is encoded in a bitfield argument sent with
343 * the message. Check bits 0 and 1 using kClamshellStateBit & kClamshellSleepBit
346 kClamshellStateBit
= (1 << 0),
347 kClamshellSleepBit
= (1 << 1)
350 #define kIOPMMessageClamshellStateChange \
351 iokit_family_msg(sub_iokit_powermanagement, 0x100)
353 /* kIOPMMessageFeatureChange
354 * Delivered when the set of supported features ("Supported Features" dictionary
355 * under IOPMrootDomain registry) changes in some way. Typically addition or
356 * removal of a supported feature.
357 * RootDomain passes no argument with this message.
359 #define kIOPMMessageFeatureChange \
360 iokit_family_msg(sub_iokit_powermanagement, 0x110)
362 /* kIOPMMessageInflowDisableCancelled
363 * The battery has drained completely to its "Fully Discharged" state.
364 * If a user process has disabled battery inflow for battery
365 * calibration, we forcibly re-enable Inflow at this point.
366 * If inflow HAS been forcibly re-enabled, bit 0
367 * (kInflowForciblyEnabledBit) will be set.
370 kInflowForciblyEnabledBit
= (1 << 0)
373 /* kIOPMMessageInternalBatteryFullyDischarged
374 * The battery has drained completely to its "Fully Discharged" state.
376 #define kIOPMMessageInternalBatteryFullyDischarged \
377 iokit_family_msg(sub_iokit_powermanagement, 0x120)
379 /* kIOPMMessageSystemPowerEventOccurred
380 * Some major system thermal property has changed, and interested clients may
381 * modify their behavior.
383 #define kIOPMMessageSystemPowerEventOccurred \
384 iokit_family_msg(sub_iokit_powermanagement, 0x130)
386 /* kIOPMMessageSleepWakeUUIDChange
387 * Either a new SleepWakeUUID has been specified at the beginning of a sleep,
388 * or we're removing the existing property upon completion of a wakeup.
390 #define kIOPMMessageSleepWakeUUIDChange \
391 iokit_family_msg(sub_iokit_powermanagement, 0x140)
393 /* kIOPMMessageSleepWakeUUIDSet
394 * Argument accompanying the kIOPMMessageSleepWakeUUIDChange notification when
395 * a new UUID has been specified.
397 #define kIOPMMessageSleepWakeUUIDSet ((void *)1)
399 /* kIOPMMessageSleepWakeUUIDCleared
400 * Argument accompanying the kIOPMMessageSleepWakeUUIDChange notification when
401 * the current UUID has been removed.
403 #define kIOPMMessageSleepWakeUUIDCleared ((void *)0)
405 /*! kIOPMMessageDriverAssertionsChanged
406 * Sent when kernel PM driver assertions have changed.
408 #define kIOPMMessageDriverAssertionsChanged \
409 iokit_family_msg(sub_iokit_powermanagement, 0x150)
411 /*******************************************************************************
413 * Power commands issued to root domain
414 * Use with IOPMrootDomain::receivePowerNotification()
416 * These commands are issued from system drivers only:
417 * ApplePMU, AppleSMU, IOGraphics, AppleACPIFamily
419 * TODO: deprecate kIOPMAllowSleep and kIOPMPreventSleep
420 ******************************************************************************/
422 kIOPMSleepNow
= (1<<0), // put machine to sleep now
423 kIOPMAllowSleep
= (1<<1), // allow idle sleep
424 kIOPMPreventSleep
= (1<<2), // do not allow idle sleep
425 kIOPMPowerButton
= (1<<3), // power button was pressed
426 kIOPMClamshellClosed
= (1<<4), // clamshell was closed
427 kIOPMPowerEmergency
= (1<<5), // battery dangerously low
428 kIOPMDisableClamshell
= (1<<6), // do not sleep on clamshell closure
429 kIOPMEnableClamshell
= (1<<7), // sleep on clamshell closure
430 kIOPMProcessorSpeedChange
= (1<<8), // change the processor speed
431 kIOPMOverTemp
= (1<<9), // system dangerously hot
432 kIOPMClamshellOpened
= (1<<10) // clamshell was opened
436 /*******************************************************************************
438 * Power Management Return Codes
440 ******************************************************************************/
444 // Returned by driver's setPowerState(), powerStateWillChangeTo(),
445 // powerStateDidChangeTo(), or acknowledgeSetPowerState() to
446 // implicitly acknowledge power change upon function return.
450 kIOPMWillAckLater
= 1,
452 // Returned by requestPowerDomainState() to indicate
453 // unrecognized specification parameter.
454 kIOPMBadSpecification
= 4,
456 // Returned by requestPowerDomainState() to indicate
457 // no power state matches search specification.
458 kIOPMNoSuchState
= 5,
461 kIOPMCannotRaisePower
= 6,
464 kIOPMParameterError
= 7,
466 // Returned when power management state is accessed
467 // before driver has called PMinit().
468 kIOPMNotYetInitialized
= 8,
470 // And the old constants; deprecated
471 IOPMNoErr
= kIOPMNoErr
,
472 IOPMAckImplied
= kIOPMAckImplied
,
473 IOPMWillAckLater
= kIOPMWillAckLater
,
474 IOPMBadSpecification
= kIOPMBadSpecification
,
475 IOPMNoSuchState
= kIOPMNoSuchState
,
476 IOPMCannotRaisePower
= kIOPMCannotRaisePower
,
477 IOPMParameterError
= kIOPMParameterError
,
478 IOPMNotYetInitialized
= kIOPMNotYetInitialized
482 // IOPMPowerSource class descriptive strings
483 // Power Source state is published as properties to the IORegistry under these
485 #define kIOPMPSExternalConnectedKey "ExternalConnected"
486 #define kIOPMPSExternalChargeCapableKey "ExternalChargeCapable"
487 #define kIOPMPSBatteryInstalledKey "BatteryInstalled"
488 #define kIOPMPSIsChargingKey "IsCharging"
489 #define kIOPMFullyChargedKey "FullyCharged"
490 #define kIOPMPSAtWarnLevelKey "AtWarnLevel"
491 #define kIOPMPSAtCriticalLevelKey "AtCriticalLevel"
492 #define kIOPMPSCurrentCapacityKey "CurrentCapacity"
493 #define kIOPMPSMaxCapacityKey "MaxCapacity"
494 #define kIOPMPSDesignCapacityKey "DesignCapacity"
495 #define kIOPMPSTimeRemainingKey "TimeRemaining"
496 #define kIOPMPSAmperageKey "Amperage"
497 #define kIOPMPSVoltageKey "Voltage"
498 #define kIOPMPSCycleCountKey "CycleCount"
499 #define kIOPMPSMaxErrKey "MaxErr"
500 #define kIOPMPSAdapterInfoKey "AdapterInfo"
501 #define kIOPMPSLocationKey "Location"
502 #define kIOPMPSErrorConditionKey "ErrorCondition"
503 #define kIOPMPSManufacturerKey "Manufacturer"
504 #define kIOPMPSManufactureDateKey "ManufactureDate"
505 #define kIOPMPSModelKey "Model"
506 #define kIOPMPSSerialKey "Serial"
507 #define kIOPMDeviceNameKey "DeviceName"
508 #define kIOPMPSLegacyBatteryInfoKey "LegacyBatteryInfo"
509 #define kIOPMPSBatteryHealthKey "BatteryHealth"
510 #define kIOPMPSHealthConfidenceKey "HealthConfidence"
511 #define kIOPMPSCapacityEstimatedKey "CapacityEstimated"
512 #define kIOPMPSBatteryChargeStatusKey "ChargeStatus"
513 #define kIOPMPSBatteryTemperatureKey "Temperature"
514 #define kIOPMPSAdapterDetailsKey "AdapterDetails"
515 #define kIOPMPSChargerConfigurationKey "ChargerConfiguration"
517 // kIOPMPSBatteryChargeStatusKey may have one of the following values, or may have
518 // no value. If kIOPMBatteryChargeStatusKey has a NULL value (or no value) associated with it
519 // then charge is proceeding normally. If one of these battery charge status reasons is listed,
520 // then the charge may have been interrupted.
521 #define kIOPMBatteryChargeStatusTooHot "HighTemperature"
522 #define kIOPMBatteryChargeStatusTooCold "LowTemperature"
523 #define kIOPMBatteryChargeStatusTooHotOrCold "HighOrLowTemperature"
524 #define kIOPMBatteryChargeStatusGradient "BatteryTemperatureGradient"
526 // Definitions for battery location, in case of multiple batteries.
527 // A location of 0 is unspecified
528 // Location is undefined for single battery systems
530 kIOPMPSLocationLeft
= 1001,
531 kIOPMPSLocationRight
= 1002
534 // Battery quality health types, specified by BatteryHealth and HealthConfidence
535 // properties in an IOPMPowerSource battery kext.
537 kIOPMUndefinedValue
= 0,
543 // Keys for kIOPMPSAdapterDetailsKey dictionary
544 #define kIOPMPSAdapterDetailsIDKey "AdapterID"
545 #define kIOPMPSAdapterDetailsWattsKey "Watts"
546 #define kIOPMPSAdapterDetailsRevisionKey "AdapterRevision"
547 #define kIOPMPSAdapterDetailsSerialNumberKey "SerialNumber"
548 #define kIOPMPSAdapterDetailsFamilyKey "FamilyCode"
549 #define kIOPMPSAdapterDetailsAmperageKey "Amperage"
550 #define kIOPMPSAdapterDetailsDescriptionKey "Description"
551 #define kIOPMPSAdapterDetailsPMUConfigurationKey "PMUConfiguration"
553 // Battery's time remaining estimate is invalid this long (seconds) after a wake
554 #define kIOPMPSInvalidWakeSecondsKey "BatteryInvalidWakeSeconds"
556 // Battery must wait this long (seconds) after being completely charged before
557 // the battery is settled.
558 #define kIOPMPSPostChargeWaitSecondsKey "PostChargeWaitSeconds"
560 // Battery must wait this long (seconds) after being completely discharged
561 // before the battery is settled.
562 #define kIOPMPSPostDishargeWaitSecondsKey "PostDischargeWaitSeconds"
565 /* CPU Power Management status keys
566 * Pass as arguments to IOPMrootDomain::systemPowerEventOccurred
567 * Or as arguments to IOPMSystemPowerEventOccurred()
568 * Or to decode the dictionary obtained from IOPMCopyCPUPowerStatus()
569 * These keys reflect restrictions placed on the CPU by the system
570 * to bring the CPU's power consumption within allowable thermal and
575 /* kIOPMGraphicsPowerLimitsKey
576 * The key representing the dictionary of graphics power limits.
577 * The dictionary contains the other kIOPMCPUPower keys & their associated
578 * values (e.g. Speed limit, Processor Count, and Schedule limits).
580 #define kIOPMGraphicsPowerLimitsKey "Graphics_Power_Limits"
582 /* kIOPMGraphicsPowerLimitPerformanceKey
583 * The key representing the percent of overall performance made available
584 * by the graphics chip as a percentage (integer 0 - 100).
586 #define kIOPMGraphicsPowerLimitPerformanceKey "Graphics_Power_Performance"
590 /* kIOPMCPUPowerLimitsKey
591 * The key representing the dictionary of CPU Power Limits.
592 * The dictionary contains the other kIOPMCPUPower keys & their associated
593 * values (e.g. Speed limit, Processor Count, and Schedule limits).
595 #define kIOPMCPUPowerLimitsKey "CPU_Power_Limits"
597 /* kIOPMCPUPowerLimitProcessorSpeedKey defines the speed & voltage limits placed
599 * Represented as a percentage (0-100) of maximum CPU speed.
601 #define kIOPMCPUPowerLimitProcessorSpeedKey "CPU_Speed_Limit"
603 /* kIOPMCPUPowerLimitProcessorCountKey reflects how many, if any, CPUs have been
604 * taken offline. Represented as an integer number of CPUs (0 - Max CPUs).
606 #define kIOPMCPUPowerLimitProcessorCountKey "CPU_Available_CPUs"
608 /* kIOPMCPUPowerLimitSchedulerTimeKey represents the percentage (0-100) of CPU time
609 * available. 100% at normal operation. The OS may limit this time for a percentage
612 #define kIOPMCPUPowerLimitSchedulerTimeKey "CPU_Scheduler_Limit"
615 /* Thermal Level Warning Key
616 * Indicates the thermal constraints placed on the system. This value may
617 * cause clients to action to consume fewer system resources.
618 * The value associated with this warning is defined by the platform.
620 #define kIOPMThermalLevelWarningKey "Thermal_Level_Warning"
622 /* Thermal Warning Level values
623 * kIOPMThermalWarningLevelNormal - under normal operating conditions
624 * kIOPMThermalWarningLevelDanger - thermal pressure may cause system slowdown
625 * kIOPMThermalWarningLevelCrisis - thermal conditions may cause imminent shutdown
627 * The platform may define additional thermal levels if necessary.
630 kIOPMThermalWarningLevelNormal
= 0,
631 kIOPMThermalWarningLevelDanger
= 5,
632 kIOPMThermalWarningLevelCrisis
= 10
636 // PM Settings Controller setting types
637 // Settings types used primarily with:
638 // IOPMrootDomain::registerPMSettingController
639 // The values are identical to the similarly named keys for use in user space
640 // PM settings work. Those keys are defined in IOPMLibPrivate.h.
641 #define kIOPMSettingWakeOnRingKey "Wake On Modem Ring"
642 #define kIOPMSettingRestartOnPowerLossKey "Automatic Restart On Power Loss"
643 #define kIOPMSettingWakeOnACChangeKey "Wake On AC Change"
644 #define kIOPMSettingSleepOnPowerButtonKey "Sleep On Power Button"
645 #define kIOPMSettingWakeOnClamshellKey "Wake On Clamshell Open"
646 #define kIOPMSettingReduceBrightnessKey "ReduceBrightness"
647 #define kIOPMSettingDisplaySleepUsesDimKey "Display Sleep Uses Dim"
648 #define kIOPMSettingTimeZoneOffsetKey "TimeZoneOffsetSeconds"
649 #define kIOPMSettingMobileMotionModuleKey "MobileMotionModule"
650 #define kIOPMSettingGraphicsSwitchKey "GPUSwitch"
652 // Setting controlling drivers can register to receive scheduled wake data
653 // Either in "CF seconds" type, or structured calendar data in a formatted
654 // IOPMCalendarStruct defined below.
655 #define kIOPMSettingAutoWakeSecondsKey "wake"
656 #define kIOPMSettingAutoWakeCalendarKey "WakeByCalendarDate"
657 #define kIOPMSettingAutoPowerSecondsKey "poweron"
658 #define kIOPMSettingAutoPowerCalendarKey "PowerByCalendarDate"
660 // Debug seconds auto wake
661 // Used by sleep cycling debug tools
662 #define kIOPMSettingDebugWakeRelativeKey "WakeRelativeToSleep"
663 #define kIOPMSettingDebugPowerRelativeKey "PowerRelativeToShutdown"
665 // Maintenance wake calendar.
666 #define kIOPMSettingMaintenanceWakeCalendarKey "MaintenanceWakeCalendarDate"
668 struct IOPMCalendarStruct
{
676 typedef struct IOPMCalendarStruct IOPMCalendarStruct
;
678 // SetAggressiveness types
680 kPMGeneralAggressiveness
= 0,
682 kPMMinutesToSpinDown
,
684 kPMEthernetWakeOnLANSettings
,
685 kPMSetProcessorSpeed
,
688 kPMLastAggressivenessType
690 #define kMaxType (kPMLastAggressivenessType-1)
692 // SetAggressiveness values for the kPMPowerSource aggressiveness type
694 kIOPMInternalPower
= 1,
698 #define kIOREMSleepEnabledKey "REMSleepEnabled"
700 // Strings for deciphering the dictionary returned from IOPMCopyBatteryInfo
701 #define kIOBatteryInfoKey "IOBatteryInfo"
702 #define kIOBatteryCurrentChargeKey "Current"
703 #define kIOBatteryCapacityKey "Capacity"
704 #define kIOBatteryFlagsKey "Flags"
705 #define kIOBatteryVoltageKey "Voltage"
706 #define kIOBatteryAmperageKey "Amperage"
707 #define kIOBatteryCycleCountKey "Cycle Count"
710 kIOBatteryInstalled
= (1 << 2),
711 kIOBatteryCharge
= (1 << 1),
712 kIOBatteryChargerConnect
= (1 << 0)
715 // Private power management message indicating battery data has changed
716 // Indicates new data resides in the IORegistry
717 #define kIOPMMessageBatteryStatusHasChanged iokit_family_msg(sub_iokit_pmu, 0x100)
719 // Apple private Legacy messages for re-routing AutoWake and AutoPower messages to the PMU
720 // through newer user space IOPMSchedulePowerEvent API
721 #define kIOPMUMessageLegacyAutoWake iokit_family_msg(sub_iokit_pmu, 0x200)
722 #define kIOPMUMessageLegacyAutoPower iokit_family_msg(sub_iokit_pmu, 0x210)
724 // For use with IOPMPowerSource bFlags
725 #define IOPM_POWER_SOURCE_REV 2
727 kIOPMACInstalled
= kIOBatteryChargerConnect
,
728 kIOPMBatteryCharging
= kIOBatteryCharge
,
729 kIOPMBatteryInstalled
= kIOBatteryInstalled
,
730 kIOPMUPSInstalled
= (1<<3),
731 kIOPMBatteryAtWarn
= (1<<4),
732 kIOPMBatteryDepleted
= (1<<5),
733 kIOPMACnoChargeCapability
= (1<<6), // AC adapter cannot charge battery
734 kIOPMRawLowBattery
= (1<<7), // used only by Platform Expert
735 kIOPMForceLowSpeed
= (1<<8), // set by Platfm Expert, chk'd by Pwr Plugin
736 kIOPMClosedClamshell
= (1<<9), // set by PMU - reflects state of the clamshell
737 kIOPMClamshellStateOnWake
= (1<<10) // used only by Platform Expert
740 // **********************************************
741 // Internal power management data structures
742 // **********************************************
744 #if KERNEL && __cplusplus
748 kIOPowerEmergencyLevel
= 1000
753 kIOPMSuperclassPolicy1
756 struct stateChangeNote
{
757 IOPMPowerFlags stateFlags
;
758 unsigned long stateNum
;
761 typedef struct stateChangeNote stateChangeNote
;
763 struct IOPowerStateChangeNotification
{
765 unsigned long returnValue
;
766 unsigned long stateNumber
;
767 IOPMPowerFlags stateFlags
;
769 typedef struct IOPowerStateChangeNotification IOPowerStateChangeNotification
;
770 typedef IOPowerStateChangeNotification sleepWakeNote
;
771 #endif /* KERNEL && __cplusplus */
773 /*! @struct IOPMSystemCapabilityChangeParameters
774 @abstract A structure describing a system capability change.
775 @discussion A system capability change is a system level transition from a set
776 of system capabilities to a new set of system capabilities. Power management
777 sends a <code>kIOMessageSystemCapabilityChange</code> message and provides
778 this structure as the message data (by reference) to
779 <code>gIOPriorityPowerStateInterest</code> clients when system capability
781 @field notifyRef An identifier for this message notification. Clients with pending
782 I/O can signal completion by calling <code>allowPowerChange()</code> with this
783 value as the argument. Clients that are able to process the notification
784 synchronously should ignore this field.
785 @field maxWaitForReply A return value to the caller indicating the maximum time in
786 microseconds to wait for the <code>allowPowerChange()</code> call. The default
787 value is zero, which indicates the client processing has finished, and power
788 management should not wait for an <code>allowPowerChange()</code> call.
789 @field changeFlags Flags will be set to indicate whether the notification precedes
790 the capability change (<code>kIOPMSystemCapabilityWillChange</code>), or after
791 the capability change has occurred (<code>kIOPMSystemCapabilityDidChange</code>).
792 @field __reserved1 Set to zero.
793 @field fromCapabilities The system capabilities at the start of the transition.
794 @field toCapabilities The system capabilities at the end of the transition.
795 @field __reserved2 Set to zero.
797 struct IOPMSystemCapabilityChangeParameters
{
799 uint32_t maxWaitForReply
;
800 uint32_t changeFlags
;
801 uint32_t __reserved1
;
802 uint32_t fromCapabilities
;
803 uint32_t toCapabilities
;
804 uint32_t __reserved2
[4];
807 /*! @enum IOPMSystemCapabilityChangeFlags
808 @constant kIOPMSystemCapabilityWillChange Indicates the system capability will change.
809 @constant kIOPMSystemCapabilityDidChange Indicates the system capability has changed.
812 kIOPMSystemCapabilityWillChange
= 0x01,
813 kIOPMSystemCapabilityDidChange
= 0x02
817 kIOPMSystemCapabilityCPU
= 0x01,
818 kIOPMSystemCapabilityGraphics
= 0x02,
819 kIOPMSystemCapabilityAudio
= 0x04,
820 kIOPMSystemCapabilityNetwork
= 0x08
823 #endif /* ! _IOKIT_IOPM_H */