Chameleon

Chameleon Svn Source Tree

Root/branches/slice/trunkM/i386/include/IOKit/pwr_mgt/IOPM.h

1/*
2 * Copyright (c) 1998-2005 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
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.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
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.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28#ifndef _IOKIT_IOPM_H
29#define _IOKIT_IOPM_H
30
31#include <IOKit/IOTypes.h>
32#include <IOKit/IOMessage.h>
33#include <IOKit/IOReturn.h>
34
35#ifdef __ppc__
36#include <IOKit/pwr_mgt/IOPMDeprecated.h>
37#endif
38
39/*! @header IOPM.h
40 @abstract Defines power management constants and keys used by both in-kernel and user space power management.
41 @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.
42
43 Most of the constants defined in IOPM.h are deprecated or for Apple internal use only, and are not elaborated on in headerdoc.
44*/
45
46enum {
47 kIOPMMaxPowerStates = 10,
48 IOPMMaxPowerStates = kIOPMMaxPowerStates
49};
50
51/*! @enum IOPMPowerFlags
52 @abstract Bits are used in defining capabilityFlags, inputPowerRequirements, and outputPowerCharacter in the IOPMPowerState structure.
53 @discussion These bits may be bitwise-OR'd together in the IOPMPowerState capabilityFlags field, the outputPowerCharacter field, and/or the inputPowerRequirement field.
54
55 The comments clearly mark whether each flag should be used in the capabilityFlags field, outputPowerCharacter field, and inputPowerRequirement field, or all three.
56
57 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.
58
59 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.
60
61 @constant kIOPMPowerOn Indicates the device is on, requires power, and provides power. Useful as a: Capability, InputPowerRequirement, OutputPowerCharacter
62
63 @constant kIOPMDeviceUsable Indicates the device is usable in this state. Useful only as a Capability
64
65 @constant kIOPMLowPower
66 Indicates device is in a low power state. May be bitwis-OR'd together
67 with kIOPMDeviceUsable flag, to indicate the device is still usable.
68
69 A device with a capability of kIOPMLowPower may:
70 Require either 0 or kIOPMPowerOn from its power parent
71 Offer either kIOPMLowPower, kIOPMPowerOn, or 0 (no power at all)
72 to its power plane children.
73
74 Useful only as a Capability, although USB drivers should consult USB family documentation for other valid circumstances to use the kIOPMLowPower bit.
75
76 @constant kIOPMPreventIdleSleep
77 In the capability field of a power state, disallows idle system sleep while the device is in that state.
78
79 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.
80
81 Useful only as a Capability.
82
83 @constant kIOPMSleepCapability
84 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.
85
86 @constant kIOPMRestartCapability
87 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
89 @constant kIOPMSleep
90 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
92 @constant kIOPMRestart
93 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.
94*/
95typedef unsigned long IOPMPowerFlags;
96enum {
97 kIOPMPowerOn = 0x00000002,
98 kIOPMDeviceUsable = 0x00008000,
99 kIOPMLowPower = 0x00010000,
100 kIOPMPreventIdleSleep = 0x00000040,
101 kIOPMSleepCapability = 0x00000004,
102 kIOPMRestartCapability = 0x00000080,
103 kIOPMSleep = 0x00000001,
104 kIOPMRestart = 0x00000080
105};
106
107/*
108 * Private IOPMPowerFlags
109 *
110 * For Apple use only
111 * Not for use with non-Apple drivers
112 * Their behavior is undefined
113 */
114enum {
115 kIOPMClockNormal = 0x0004,
116 kIOPMClockRunning = 0x0008,
117 kIOPMPreventSystemSleep = 0x0010,
118 kIOPMDoze = 0x0400,
119 kIOPMChildClamp = 0x0080,
120 kIOPMChildClamp2 = 0x0200,
121 kIOPMNotPowerManaged = 0x0800
122};
123
124
125/*
126 * Deprecated IOPMPowerFlags
127 * Their behavior is undefined when used in IOPMPowerState
128 * Capability, InputPowerRequirement, or OutputPowerCharacter fields.
129 */
130enum {
131 kIOPMMaxPerformance = 0x4000,
132 kIOPMPassThrough = 0x0100,
133 kIOPMAuxPowerOn = 0x0020,
134 kIOPMNotAttainable = 0x0001,
135 kIOPMContextRetained = 0x2000,
136 kIOPMConfigRetained = 0x1000,
137 kIOPMStaticPowerValid = 0x0800,
138 kIOPMSoftSleep = 0x0400,
139 kIOPMCapabilitiesMask = kIOPMPowerOn | kIOPMDeviceUsable |
140 kIOPMMaxPerformance | kIOPMContextRetained |
141 kIOPMConfigRetained | kIOPMSleepCapability |
142 kIOPMRestartCapability
143};
144
145/*
146 * Support for old names of IOPMPowerFlag constants
147 */
148enum {
149 IOPMNotAttainable = kIOPMNotAttainable,
150 IOPMPowerOn = kIOPMPowerOn,
151 IOPMClockNormal = kIOPMClockNormal,
152 IOPMClockRunning = kIOPMClockRunning,
153 IOPMAuxPowerOn = kIOPMAuxPowerOn,
154 IOPMDeviceUsable = kIOPMDeviceUsable,
155 IOPMMaxPerformance = kIOPMMaxPerformance,
156 IOPMContextRetained = kIOPMContextRetained,
157 IOPMConfigRetained = kIOPMConfigRetained,
158 IOPMNotPowerManaged = kIOPMNotPowerManaged,
159 IOPMSoftSleep = kIOPMSoftSleep
160};
161
162
163enum {
164 kIOPMNextHigherState = 1,
165 kIOPMHighestState = 2,
166 kIOPMNextLowerState = 3,
167 kIOPMLowestState = 4
168};
169
170enum {
171 IOPMNextHigherState = kIOPMNextHigherState,
172 IOPMHighestState = kIOPMHighestState,
173 IOPMNextLowerState = kIOPMNextLowerState,
174 IOPMLowestState = kIOPMLowestState
175};
176
177// Internal commands used by power managment command queue
178enum {
179 kIOPMBroadcastAggressiveness = 1,
180 kIOPMUnidleDevice
181};
182
183// Power consumption unknown value
184enum {
185 kIOPMUnknown = 0xFFFF
186};
187
188/*******************************************************************************
189 *
190 * Root Domain property keys of interest
191 *
192 ******************************************************************************/
193
194/* AppleClamshellState
195 * reflects the state of the clamshell (lid) on a portable.
196 * It has a boolean value.
197 * true == clamshell is closed
198 * false == clamshell is open
199 * not present == no clamshell on this hardware
200 */
201#define kAppleClamshellStateKey "AppleClamshellState"
202
203/* AppleClamshellCausesSleep
204 * reflects the clamshell close behavior on a portable.
205 * It has a boolean value.
206 * true == system will sleep when clamshell is closed
207 * false == system will not sleep on clamshell close
208 * (typically external display mode)
209 * not present == no clamshell on this hardware
210 */
211#define kAppleClamshellCausesSleepKey "AppleClamshellCausesSleep"
212
213/* kIOPMSleepWakeUUIDKey
214 * Key refers to a CFStringRef that will uniquely identify
215 * a sleep/wake cycle for logging & tracking.
216 * The key becomes valid at the beginning of a sleep cycle - before we
217 * initiate any sleep/wake notifications.
218 * The key becomes invalid at the completion of a system wakeup. The
219 * property will not be present in the IOPMrootDomain's registry entry
220 * when it is invalid.
221 *
222 * See IOPMrootDomain notification kIOPMMessageSleepWakeUUIDChange
223 */
224 #define kIOPMSleepWakeUUIDKey "SleepWakeUUID"
225
226/*******************************************************************************
227 *
228 * Root Domain general interest messages
229 *
230 * Available by registering for interest type 'gIOGeneralInterest'
231 * on IOPMrootDomain.
232 *
233 ******************************************************************************/
234
235/* kIOPMMessageClamshellStateChange
236 * Delivered as a general interest notification on the IOPMrootDomain
237 * IOPMrootDomain sends this message when state of either AppleClamshellState
238 * or AppleClamshellCausesSleep changes. If this clamshell change results in
239 * a sleep, the sleep will initiate soon AFTER delivery of this message.
240 * The state of both variables is encoded in a bitfield argument sent with
241 * the message. Check bits 0 and 1 using kClamshellStateBit & kClamshellSleepBit
242 */
243enum {
244 kClamshellStateBit = (1 << 0),
245 kClamshellSleepBit = (1 << 1)
246};
247
248#define kIOPMMessageClamshellStateChange \
249 iokit_family_msg(sub_iokit_powermanagement, 0x100)
250
251/* kIOPMMessageFeatureChange
252 * Delivered when the set of supported features ("Supported Features" dictionary
253 * under IOPMrootDomain registry) changes in some way. Typically addition or
254 * removal of a supported feature.
255 * RootDomain passes no argument with this message.
256 */
257#define kIOPMMessageFeatureChange \
258 iokit_family_msg(sub_iokit_powermanagement, 0x110)
259
260/* kIOPMMessageInflowDisableCancelled
261 * The battery has drained completely to its "Fully Discharged" state.
262 * If a user process has disabled battery inflow for battery
263 * calibration, we forcibly re-enable Inflow at this point.
264 * If inflow HAS been forcibly re-enabled, bit 0
265 * (kInflowForciblyEnabledBit) will be set.
266 */
267enum {
268 kInflowForciblyEnabledBit = (1 << 0)
269};
270
271/* kIOPMMessageInternalBatteryFullyDischarged
272 * The battery has drained completely to its "Fully Discharged" state.
273 */
274#define kIOPMMessageInternalBatteryFullyDischarged \
275 iokit_family_msg(sub_iokit_powermanagement, 0x120)
276
277/* kIOPMMessageSystemPowerEventOccurred
278 * Some major system thermal property has changed, and interested clients may
279 * modify their behavior.
280 */
281#define kIOPMMessageSystemPowerEventOccurred \
282 iokit_family_msg(sub_iokit_powermanagement, 0x130)
283
284/* kIOPMMessageSleepWakeUUIDChange
285 * Either a new SleepWakeUUID has been specified at the beginning of a sleep,
286 * or we're removing the existing property upon completion of a wakeup.
287 */
288#define kIOPMMessageSleepWakeUUIDChange \
289 iokit_family_msg(sub_iokit_powermanagement, 0x140)
290
291/* kIOPMMessageSleepWakeUUIDSet
292 * Argument accompanying the kIOPMMessageSleepWakeUUIDChange notification when
293 * a new UUID has been specified.
294 */
295#define kIOPMMessageSleepWakeUUIDSet ((void *)1)
296
297/* kIOPMMessageSleepWakeUUIDCleared
298 * Argument accompanying the kIOPMMessageSleepWakeUUIDChange notification when
299 * the current UUID has been removed.
300 */
301#define kIOPMMessageSleepWakeUUIDCleared ((void *)0)
302
303/*******************************************************************************
304 *
305 * Power commands issued to root domain
306 * Use with IOPMrootDomain::receivePowerNotification()
307 *
308 * These commands are issued from system drivers only:
309 * ApplePMU, AppleSMU, IOGraphics, AppleACPIFamily
310 *
311 ******************************************************************************/
312enum {
313 kIOPMSleepNow = (1<<0), // put machine to sleep now
314 kIOPMAllowSleep = (1<<1), // allow idle sleep
315 kIOPMPreventSleep = (1<<2), // do not allow idle sleep
316 kIOPMPowerButton = (1<<3), // power button was pressed
317 kIOPMClamshellClosed = (1<<4), // clamshell was closed
318 kIOPMPowerEmergency = (1<<5), // battery dangerously low
319 kIOPMDisableClamshell = (1<<6), // do not sleep on clamshell closure
320 kIOPMEnableClamshell = (1<<7), // sleep on clamshell closure
321 kIOPMProcessorSpeedChange = (1<<8), // change the processor speed
322 kIOPMOverTemp = (1<<9), // system dangerously hot
323 kIOPMClamshellOpened = (1<<10) // clamshell was opened
324};
325
326
327/*******************************************************************************
328 *
329 * Power Management Return Codes
330 *
331 ******************************************************************************/
332enum {
333 kIOPMNoErr = 0,
334
335 // Returned by driver's setPowerState(), powerStateWillChangeTo(),
336 // powerStateDidChangeTo(), or acknowledgeSetPowerState() to
337 // implicitly acknowledge power change upon function return.
338 kIOPMAckImplied = 0,
339
340 // Deprecated
341 kIOPMWillAckLater = 1,
342
343 // Returned by requestPowerDomainState() to indicate
344 // unrecognized specification parameter.
345 kIOPMBadSpecification = 4,
346
347 // Returned by requestPowerDomainState() to indicate
348 // no power state matches search specification.
349 kIOPMNoSuchState = 5,
350
351 // Deprecated
352 kIOPMCannotRaisePower = 6,
353
354 // Deprecated
355 kIOPMParameterError = 7,
356
357 // Returned when power management state is accessed
358 // before driver has called PMinit().
359 kIOPMNotYetInitialized = 8,
360
361 // And the old constants; deprecated
362 IOPMNoErr = kIOPMNoErr,
363 IOPMAckImplied = kIOPMAckImplied,
364 IOPMWillAckLater = kIOPMWillAckLater,
365 IOPMBadSpecification = kIOPMBadSpecification,
366 IOPMNoSuchState = kIOPMNoSuchState,
367 IOPMCannotRaisePower = kIOPMCannotRaisePower,
368 IOPMParameterError = kIOPMParameterError,
369 IOPMNotYetInitialized = kIOPMNotYetInitialized
370};
371
372
373// IOPMPowerSource class descriptive strings
374// Power Source state is published as properties to the IORegistry under these
375// keys.
376#define kIOPMPSExternalConnectedKey "ExternalConnected"
377#define kIOPMPSExternalChargeCapableKey "ExternalChargeCapable"
378#define kIOPMPSBatteryInstalledKey "BatteryInstalled"
379#define kIOPMPSIsChargingKey "IsCharging"
380#define kIOPMFullyChargedKey "FullyCharged"
381#define kIOPMPSAtWarnLevelKey "AtWarnLevel"
382#define kIOPMPSAtCriticalLevelKey "AtCriticalLevel"
383#define kIOPMPSCurrentCapacityKey "CurrentCapacity"
384#define kIOPMPSMaxCapacityKey "MaxCapacity"
385#define kIOPMPSDesignCapacityKey "DesignCapacity"
386#define kIOPMPSTimeRemainingKey "TimeRemaining"
387#define kIOPMPSAmperageKey "Amperage"
388#define kIOPMPSVoltageKey "Voltage"
389#define kIOPMPSCycleCountKey "CycleCount"
390#define kIOPMPSMaxErrKey "MaxErr"
391#define kIOPMPSAdapterInfoKey "AdapterInfo"
392#define kIOPMPSLocationKey "Location"
393#define kIOPMPSErrorConditionKey "ErrorCondition"
394#define kIOPMPSManufacturerKey "Manufacturer"
395#define kIOPMPSManufactureDateKey "ManufactureDate"
396#define kIOPMPSModelKey "Model"
397#define kIOPMPSSerialKey "Serial"
398#define kIOPMDeviceNameKey "DeviceName"
399#define kIOPMPSLegacyBatteryInfoKey "LegacyBatteryInfo"
400#define kIOPMPSBatteryHealthKey "BatteryHealth"
401#define kIOPMPSHealthConfidenceKey "HealthConfidence"
402#define kIOPMPSCapacityEstimatedKey "CapacityEstimated"
403#define kIOPMPSBatteryChargeStatusKey "ChargeStatus"
404#define kIOPMPSBatteryTemperatureKey "Temperature"
405
406// kIOPMPSBatteryChargeStatusKey may have one of the following values, or may have
407// no value. If kIOPMBatteryChargeStatusKey has a NULL value (or no value) associated with it
408// then charge is proceeding normally. If one of these battery charge status reasons is listed,
409// then the charge may have been interrupted.
410#define kIOPMBatteryChargeStatusTooHot "HighTemperature"
411#define kIOPMBatteryChargeStatusTooCold "LowTemperature"
412#define kIOPMBatteryChargeStatusGradient "BatteryTemperatureGradient"
413
414// Definitions for battery location, in case of multiple batteries.
415// A location of 0 is unspecified
416// Location is undefined for single battery systems
417enum {
418 kIOPMPSLocationLeft = 1001,
419 kIOPMPSLocationRight = 1002
420};
421
422// Battery quality health types, specified by BatteryHealth and HealthConfidence
423// properties in an IOPMPowerSource battery kext.
424enum {
425 kIOPMUndefinedValue = 0,
426 kIOPMPoorValue = 1,
427 kIOPMFairValue = 2,
428 kIOPMGoodValue = 3
429};
430
431// Battery's time remaining estimate is invalid this long (seconds) after a wake
432#define kIOPMPSInvalidWakeSecondsKey "BatteryInvalidWakeSeconds"
433
434// Battery must wait this long (seconds) after being completely charged before
435// the battery is settled.
436#define kIOPMPSPostChargeWaitSecondsKey "PostChargeWaitSeconds"
437
438// Battery must wait this long (seconds) after being completely discharged
439// before the battery is settled.
440#define kIOPMPSPostDishargeWaitSecondsKey "PostDischargeWaitSeconds"
441
442
443/* CPU Power Management status keys
444 * Pass as arguments to IOPMrootDomain::systemPowerEventOccurred
445 * Or as arguments to IOPMSystemPowerEventOccurred()
446 * Or to decode the dictionary obtained from IOPMCopyCPUPowerStatus()
447 * These keys reflect restrictions placed on the CPU by the system
448 * to bring the CPU's power consumption within allowable thermal and
449 * power constraints.
450 */
451
452
453/* kIOPMGraphicsPowerLimitsKey
454 * The key representing the dictionary of graphics power limits.
455 * The dictionary contains the other kIOPMCPUPower keys & their associated
456 * values (e.g. Speed limit, Processor Count, and Schedule limits).
457 */
458#define kIOPMGraphicsPowerLimitsKey "Graphics_Power_Limits"
459
460/* kIOPMGraphicsPowerLimitPerformanceKey
461 * The key representing the percent of overall performance made available
462 * by the graphics chip as a percentage (integer 0 - 100).
463 */
464#define kIOPMGraphicsPowerLimitPerformanceKey "Graphics_Power_Performance"
465
466
467
468/* kIOPMCPUPowerLimitsKey
469 * The key representing the dictionary of CPU Power Limits.
470 * The dictionary contains the other kIOPMCPUPower keys & their associated
471 * values (e.g. Speed limit, Processor Count, and Schedule limits).
472 */
473#define kIOPMCPUPowerLimitsKey "CPU_Power_Limits"
474
475/* kIOPMCPUPowerLimitProcessorSpeedKey defines the speed & voltage limits placed
476 * on the CPU.
477 * Represented as a percentage (0-100) of maximum CPU speed.
478 */
479#define kIOPMCPUPowerLimitProcessorSpeedKey "CPU_Speed_Limit"
480
481/* kIOPMCPUPowerLimitProcessorCountKey reflects how many, if any, CPUs have been
482 * taken offline. Represented as an integer number of CPUs (0 - Max CPUs).
483 */
484#define kIOPMCPUPowerLimitProcessorCountKey "CPU_Available_CPUs"
485
486/* kIOPMCPUPowerLimitSchedulerTimeKey represents the percentage (0-100) of CPU time
487 * available. 100% at normal operation. The OS may limit this time for a percentage
488 * less than 100%.
489 */
490#define kIOPMCPUPowerLimitSchedulerTimeKey "CPU_Scheduler_Limit"
491
492
493/* Thermal Level Warning Key
494 * Indicates the thermal constraints placed on the system. This value may
495 * cause clients to action to consume fewer system resources.
496 * The value associated with this warning is defined by the platform.
497 */
498#define kIOPMThermalLevelWarningKey "Thermal_Level_Warning"
499
500/* Thermal Warning Level values
501 * kIOPMThermalWarningLevelNormal - under normal operating conditions
502 * kIOPMThermalWarningLevelDanger - thermal pressure may cause system slowdown
503 * kIOPMThermalWarningLevelCrisis - thermal conditions may cause imminent shutdown
504 *
505 * The platform may define additional thermal levels if necessary.
506 */
507enum {
508 kIOPMThermalWarningLevelNormal = 0,
509 kIOPMThermalWarningLevelDanger = 5,
510 kIOPMThermalWarningLevelCrisis = 10
511};
512
513
514// PM Settings Controller setting types
515// Settings types used primarily with:
516// IOPMrootDomain::registerPMSettingController
517// The values are identical to the similarly named keys for use in user space
518// PM settings work. Those keys are defined in IOPMLibPrivate.h.
519#define kIOPMSettingWakeOnRingKey "Wake On Modem Ring"
520#define kIOPMSettingRestartOnPowerLossKey "Automatic Restart On Power Loss"
521#define kIOPMSettingWakeOnACChangeKey "Wake On AC Change"
522#define kIOPMSettingSleepOnPowerButtonKey "Sleep On Power Button"
523#define kIOPMSettingWakeOnClamshellKey "Wake On Clamshell Open"
524#define kIOPMSettingReduceBrightnessKey "ReduceBrightness"
525#define kIOPMSettingDisplaySleepUsesDimKey "Display Sleep Uses Dim"
526#define kIOPMSettingTimeZoneOffsetKey "TimeZoneOffsetSeconds"
527#define kIOPMSettingMobileMotionModuleKey "MobileMotionModule"
528#define kIOPMSettingGraphicsSwitchKey "GPUSwitch"
529
530// Setting controlling drivers can register to receive scheduled wake data
531// Either in "CF seconds" type, or structured calendar data in a formatted
532// IOPMCalendarStruct defined below.
533#define kIOPMSettingAutoWakeSecondsKey "wake"
534#define kIOPMSettingAutoWakeCalendarKey "WakeByCalendarDate"
535#define kIOPMSettingAutoPowerSecondsKey "poweron"
536#define kIOPMSettingAutoPowerCalendarKey "PowerByCalendarDate"
537
538// Debug seconds auto wake
539// Used by sleep cycling debug tools
540#define kIOPMSettingDebugWakeRelativeKey "WakeRelativeToSleep"
541#define kIOPMSettingDebugPowerRelativeKey "PowerRelativeToShutdown"
542
543// Maintenance wake calendar.
544#define kIOPMSettingMaintenanceWakeCalendarKey "MaintenanceWakeCalendarDate"
545
546struct IOPMCalendarStruct {
547 UInt32 year;
548 UInt8 month;
549 UInt8 day;
550 UInt8 hour;
551 UInt8 minute;
552 UInt8 second;
553};
554typedef struct IOPMCalendarStruct IOPMCalendarStruct;
555
556// SetAggressiveness types
557enum {
558 kPMGeneralAggressiveness = 0,
559 kPMMinutesToDim,
560 kPMMinutesToSpinDown,
561 kPMMinutesToSleep,
562 kPMEthernetWakeOnLANSettings,
563 kPMSetProcessorSpeed,
564 kPMPowerSource,
565 kPMMotionSensor,
566 kPMLastAggressivenessType
567};
568#define kMaxType (kPMLastAggressivenessType-1)
569
570// SetAggressiveness values for the kPMPowerSource aggressiveness type
571enum {
572 kIOPMInternalPower = 1,
573 kIOPMExternalPower
574};
575
576#define kIOREMSleepEnabledKey "REMSleepEnabled"
577
578// Strings for deciphering the dictionary returned from IOPMCopyBatteryInfo
579#define kIOBatteryInfoKey "IOBatteryInfo"
580#define kIOBatteryCurrentChargeKey "Current"
581#define kIOBatteryCapacityKey "Capacity"
582#define kIOBatteryFlagsKey "Flags"
583#define kIOBatteryVoltageKey "Voltage"
584#define kIOBatteryAmperageKey "Amperage"
585#define kIOBatteryCycleCountKey "Cycle Count"
586
587enum {
588 kIOBatteryInstalled = (1 << 2),
589 kIOBatteryCharge = (1 << 1),
590 kIOBatteryChargerConnect = (1 << 0)
591};
592
593
594// Private power management message indicating battery data has changed
595// Indicates new data resides in the IORegistry
596#define kIOPMMessageBatteryStatusHasChanged iokit_family_msg(sub_iokit_pmu, 0x100)
597
598// Apple private Legacy messages for re-routing AutoWake and AutoPower messages to the PMU
599// through newer user space IOPMSchedulePowerEvent API
600#define kIOPMUMessageLegacyAutoWake iokit_family_msg(sub_iokit_pmu, 0x200)
601#define kIOPMUMessageLegacyAutoPower iokit_family_msg(sub_iokit_pmu, 0x210)
602
603// For use with IOPMPowerSource bFlags
604#define IOPM_POWER_SOURCE_REV 2
605enum {
606 kIOPMACInstalled = kIOBatteryChargerConnect,
607 kIOPMBatteryCharging = kIOBatteryCharge,
608 kIOPMBatteryInstalled = kIOBatteryInstalled,
609 kIOPMUPSInstalled = (1<<3),
610 kIOPMBatteryAtWarn = (1<<4),
611 kIOPMBatteryDepleted = (1<<5),
612 kIOPMACnoChargeCapability = (1<<6), // AC adapter cannot charge battery
613 kIOPMRawLowBattery = (1<<7), // used only by Platform Expert
614 kIOPMForceLowSpeed = (1<<8), // set by Platfm Expert, chk'd by Pwr Plugin
615 kIOPMClosedClamshell = (1<<9), // set by PMU - reflects state of the clamshell
616 kIOPMClamshellStateOnWake = (1<<10) // used only by Platform Expert
617};
618
619
620// **********************************************
621// Internal power management data structures
622// **********************************************
623
624#if KERNEL && __cplusplus
625class IOService;
626
627enum {
628 kIOPowerEmergencyLevel = 1000
629};
630
631enum {
632 kIOPMSubclassPolicy,
633 kIOPMSuperclassPolicy1
634};
635
636struct stateChangeNote{
637 IOPMPowerFlags stateFlags;
638 unsigned long stateNum;
639 void * powerRef;
640};
641typedef struct stateChangeNote stateChangeNote;
642
643struct IOPowerStateChangeNotification {
644 void * powerRef;
645 unsigned long returnValue;
646 unsigned long stateNumber;
647 IOPMPowerFlags stateFlags;
648};
649typedef struct IOPowerStateChangeNotification IOPowerStateChangeNotification;
650typedef IOPowerStateChangeNotification sleepWakeNote;
651#endif /* KERNEL && __cplusplus */
652
653#endif /* ! _IOKIT_IOPM_H */
654
655

Archive Download this file

Revision: 1171