]>
Commit | Line | Data |
---|---|---|
1c79356b | 1 | /* |
0c530ab8 | 2 | * Copyright (c) 1998-2005 Apple Computer, Inc. All rights reserved. |
1c79356b | 3 | * |
2d21ac55 | 4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ |
0a7de745 | 5 | * |
2d21ac55 A |
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. | |
0a7de745 | 14 | * |
2d21ac55 A |
15 | * Please obtain a copy of the License at |
16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. | |
0a7de745 | 17 | * |
2d21ac55 A |
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 | |
8f6c56a5 A |
20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
2d21ac55 A |
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. | |
0a7de745 | 25 | * |
2d21ac55 | 26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ |
1c79356b A |
27 | */ |
28 | #ifndef _IOKIT_IOPM_H | |
29 | #define _IOKIT_IOPM_H | |
30 | ||
0c530ab8 A |
31 | #include <IOKit/IOTypes.h> |
32 | #include <IOKit/IOMessage.h> | |
33 | #include <IOKit/IOReturn.h> | |
34 | ||
2d21ac55 | 35 | /*! @header IOPM.h |
0a7de745 A |
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. | |
38 | * | |
39 | * Most of the constants defined in IOPM.h are deprecated or for Apple internal use only, and are not elaborated on in headerdoc. | |
40 | */ | |
0c530ab8 A |
41 | |
42 | enum { | |
0a7de745 A |
43 | kIOPMMaxPowerStates = 10, |
44 | IOPMMaxPowerStates = kIOPMMaxPowerStates | |
0c530ab8 | 45 | }; |
1c79356b | 46 | |
2d21ac55 | 47 | /*! @enum IOPMPowerFlags |
0a7de745 A |
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. | |
50 | * | |
51 | * The comments clearly mark whether each flag should be used in the capabilityFlags field, outputPowerCharacter field, and inputPowerRequirement field, or all three. | |
52 | * | |
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. | |
54 | * | |
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. | |
56 | * | |
57 | * @constant kIOPMPowerOn Indicates the device is on, requires power, and provides power. Useful as a: Capability, InputPowerRequirement, OutputPowerCharacter | |
58 | * | |
59 | * @constant kIOPMDeviceUsable Indicates the device is usable in this state. Useful only as a Capability | |
60 | * | |
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. | |
64 | * | |
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. | |
69 | * | |
70 | * Useful only as a Capability, although USB drivers should consult USB family documentation for other valid circumstances to use the kIOPMLowPower bit. | |
71 | * | |
72 | * @constant kIOPMPreventIdleSleep | |
73 | * In the capability field of a power state, disallows idle system sleep while the device is in that state. | |
74 | * | |
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. | |
76 | * | |
77 | * Useful only as a Capability. | |
78 | * | |
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. | |
81 | * | |
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. | |
84 | * | |
85 | * @constant kIOPMSleep | |
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. | |
87 | * | |
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. | |
90 | * | |
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>. | |
93 | * | |
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. | |
99 | */ | |
1c79356b | 100 | typedef unsigned long IOPMPowerFlags; |
0b4e3aa0 | 101 | enum { |
0a7de745 A |
102 | kIOPMPowerOn = 0x00000002, |
103 | kIOPMDeviceUsable = 0x00008000, | |
104 | kIOPMLowPower = 0x00010000, | |
cb323159 | 105 | #if PRIVATE |
cb323159 A |
106 | kIOPMAOTPower = 0x00020000, |
107 | kIOPMAOTCapability = kIOPMAOTPower, | |
cb323159 | 108 | #endif /* PRIVATE */ |
0a7de745 A |
109 | kIOPMPreventIdleSleep = 0x00000040, |
110 | kIOPMSleepCapability = 0x00000004, | |
111 | kIOPMRestartCapability = 0x00000080, | |
112 | kIOPMSleep = 0x00000001, | |
113 | kIOPMRestart = 0x00000080, | |
114 | kIOPMInitialDeviceState = 0x00000100, | |
115 | kIOPMRootDomainState = 0x00000200 | |
2d21ac55 A |
116 | }; |
117 | ||
118 | /* | |
119 | * Private IOPMPowerFlags | |
120 | * | |
121 | * For Apple use only | |
122 | * Not for use with non-Apple drivers | |
123 | * Their behavior is undefined | |
124 | */ | |
125 | enum { | |
0a7de745 A |
126 | kIOPMClockNormal = 0x0004, |
127 | kIOPMClockRunning = 0x0008, | |
128 | kIOPMPreventSystemSleep = 0x0010, | |
129 | kIOPMDoze = 0x0400, | |
130 | kIOPMChildClamp = 0x0080, | |
131 | kIOPMChildClamp2 = 0x0200, | |
132 | kIOPMNotPowerManaged = 0x0800 | |
2d21ac55 A |
133 | }; |
134 | ||
2d21ac55 A |
135 | /* |
136 | * Deprecated IOPMPowerFlags | |
137 | * Their behavior is undefined when used in IOPMPowerState | |
138 | * Capability, InputPowerRequirement, or OutputPowerCharacter fields. | |
139 | */ | |
140 | enum { | |
0a7de745 A |
141 | kIOPMMaxPerformance = 0x4000, |
142 | kIOPMPassThrough = 0x0100, | |
143 | kIOPMAuxPowerOn = 0x0020, | |
144 | kIOPMNotAttainable = 0x0001, | |
145 | kIOPMContextRetained = 0x2000, | |
146 | kIOPMConfigRetained = 0x1000, | |
147 | kIOPMStaticPowerValid = 0x0800, | |
148 | kIOPMSoftSleep = 0x0400, | |
149 | kIOPMCapabilitiesMask = kIOPMPowerOn | kIOPMDeviceUsable | | |
150 | kIOPMMaxPerformance | kIOPMContextRetained | | |
151 | kIOPMConfigRetained | kIOPMSleepCapability | | |
152 | kIOPMRestartCapability | |
0b4e3aa0 A |
153 | }; |
154 | ||
2d21ac55 A |
155 | /* |
156 | * Support for old names of IOPMPowerFlag constants | |
157 | */ | |
0b4e3aa0 | 158 | enum { |
0a7de745 A |
159 | IOPMNotAttainable = kIOPMNotAttainable, |
160 | IOPMPowerOn = kIOPMPowerOn, | |
161 | IOPMClockNormal = kIOPMClockNormal, | |
162 | IOPMClockRunning = kIOPMClockRunning, | |
163 | IOPMAuxPowerOn = kIOPMAuxPowerOn, | |
164 | IOPMDeviceUsable = kIOPMDeviceUsable, | |
165 | IOPMMaxPerformance = kIOPMMaxPerformance, | |
166 | IOPMContextRetained = kIOPMContextRetained, | |
167 | IOPMConfigRetained = kIOPMConfigRetained, | |
168 | IOPMNotPowerManaged = kIOPMNotPowerManaged, | |
169 | IOPMSoftSleep = kIOPMSoftSleep | |
0b4e3aa0 A |
170 | }; |
171 | ||
172 | ||
173 | enum { | |
0a7de745 A |
174 | kIOPMNextHigherState = 1, |
175 | kIOPMHighestState = 2, | |
176 | kIOPMNextLowerState = 3, | |
177 | kIOPMLowestState = 4 | |
0b4e3aa0 A |
178 | }; |
179 | ||
180 | enum { | |
0a7de745 A |
181 | IOPMNextHigherState = kIOPMNextHigherState, |
182 | IOPMHighestState = kIOPMHighestState, | |
183 | IOPMNextLowerState = kIOPMNextLowerState, | |
184 | IOPMLowestState = kIOPMLowestState | |
0b4e3aa0 | 185 | }; |
1c79356b | 186 | |
0c530ab8 A |
187 | // Internal commands used by power managment command queue |
188 | enum { | |
0a7de745 A |
189 | kIOPMBroadcastAggressiveness = 1, |
190 | kIOPMUnidleDevice | |
0b4e3aa0 A |
191 | }; |
192 | ||
0c530ab8 A |
193 | // Power consumption unknown value |
194 | enum { | |
0a7de745 | 195 | kIOPMUnknown = 0xFFFF |
1c79356b A |
196 | }; |
197 | ||
0c530ab8 A |
198 | /******************************************************************************* |
199 | * | |
200 | * Root Domain property keys of interest | |
201 | * | |
202 | ******************************************************************************/ | |
203 | ||
0a7de745 | 204 | /* AppleClamshellState |
0c530ab8 A |
205 | * reflects the state of the clamshell (lid) on a portable. |
206 | * It has a boolean value. | |
207 | * true == clamshell is closed | |
208 | * false == clamshell is open | |
209 | * not present == no clamshell on this hardware | |
210 | */ | |
211 | #define kAppleClamshellStateKey "AppleClamshellState" | |
212 | ||
0a7de745 A |
213 | /* AppleClamshellCausesSleep |
214 | * reflects the clamshell close behavior on a portable. | |
0c530ab8 A |
215 | * It has a boolean value. |
216 | * true == system will sleep when clamshell is closed | |
0a7de745 | 217 | * false == system will not sleep on clamshell close |
0c530ab8 A |
218 | * (typically external display mode) |
219 | * not present == no clamshell on this hardware | |
220 | */ | |
221 | #define kAppleClamshellCausesSleepKey "AppleClamshellCausesSleep" | |
222 | ||
b0d623f7 A |
223 | /* kIOPMSleepWakeUUIDKey |
224 | * Key refers to a CFStringRef that will uniquely identify | |
225 | * a sleep/wake cycle for logging & tracking. | |
226 | * The key becomes valid at the beginning of a sleep cycle - before we | |
227 | * initiate any sleep/wake notifications. | |
228 | * The key becomes invalid at the completion of a system wakeup. The | |
229 | * property will not be present in the IOPMrootDomain's registry entry | |
230 | * when it is invalid. | |
0a7de745 | 231 | * |
b0d623f7 A |
232 | * See IOPMrootDomain notification kIOPMMessageSleepWakeUUIDChange |
233 | */ | |
6d2010ae | 234 | #define kIOPMSleepWakeUUIDKey "SleepWakeUUID" |
0b4c1975 | 235 | |
39236c6e A |
236 | /* kIOPMBootSessionUUIDKey |
237 | * Key refers to a CFStringRef that will uniquely identify | |
238 | * a boot cycle. | |
0a7de745 A |
239 | * The key becomes valid at boot time and remains valid |
240 | * till shutdown. The property value will remain same across | |
39236c6e A |
241 | * sleep/wake/hibernate cycle. |
242 | */ | |
243 | #define kIOPMBootSessionUUIDKey "BootSessionUUID" | |
244 | ||
0b4c1975 A |
245 | /* kIOPMDeepSleepEnabledKey |
246 | * Indicates the Deep Sleep enable state. | |
247 | * It has a boolean value. | |
248 | * true == Deep Sleep is enabled | |
249 | * false == Deep Sleep is disabled | |
250 | * not present == Deep Sleep is not supported on this hardware | |
251 | */ | |
060df5ea | 252 | #define kIOPMDeepSleepEnabledKey "Standby Enabled" |
0b4c1975 A |
253 | |
254 | /* kIOPMDeepSleepDelayKey | |
255 | * Key refers to a CFNumberRef that represents the delay in seconds before | |
d9a64523 A |
256 | * entering Deep Sleep state when on battery power and when remaining |
257 | * battery capacity is below a particular threshold (e.g., 50%.) The | |
258 | * property is not present if Deep Sleep is unsupported. | |
0b4c1975 | 259 | */ |
060df5ea | 260 | #define kIOPMDeepSleepDelayKey "Standby Delay" |
0b4c1975 | 261 | |
d9a64523 A |
262 | /* kIOPMDeepSleepDelayHighKey |
263 | * Key refers to a CFNumberRef that represents the delay in seconds before | |
264 | * entering Deep Sleep state. This is used instead of the value specified by | |
265 | * kIOPMDeepSleepDelayKey if the remaining battery capacity is above a | |
266 | * particular threshold (e.g. 50%) or on AC power. The property is not | |
267 | * present if Deep Sleep is unsupported. | |
268 | */ | |
269 | #define kIOPMDeepSleepDelayHighKey "High Standby Delay" | |
270 | ||
271 | /* kIOPMLowBatteryThresholdKey | |
272 | * Key refers to a CFNumberRef that represents the threshold used to choose | |
273 | * between the normal deep sleep delay and the high deep sleep delay (as a | |
274 | * percentage of total battery capacity remaining.) The property is not | |
275 | * present if Deep Sleep is unsupported. | |
276 | */ | |
277 | #define kIOPMStandbyBatteryThresholdKey "Standby Battery Threshold" | |
278 | ||
6d2010ae A |
279 | /* kIOPMDestroyFVKeyOnStandbyKey |
280 | * Specifies if FileVault key can be stored when going to standby mode | |
281 | * It has a boolean value, | |
282 | * true == Destroy FV key when going to standby mode | |
283 | * false == Retain FV key when going to standby mode | |
284 | * not present == Retain FV key when going to standby mode | |
0b4c1975 | 285 | */ |
99c3a104 | 286 | #define kIOPMDestroyFVKeyOnStandbyKey "DestroyFVKeyOnStandby" |
0b4c1975 | 287 | |
bd504ef0 A |
288 | /******************************************************************************* |
289 | * | |
290 | * Properties that can control power management behavior | |
291 | * | |
292 | ******************************************************************************/ | |
293 | ||
294 | /* kIOPMResetPowerStateOnWakeKey | |
295 | * If an IOService publishes this key with the value of kOSBooleanTrue, | |
296 | * then PM will disregard the influence from changePowerStateToPriv() or | |
297 | * any activity tickles that occurred before system sleep when resolving | |
298 | * the initial device power state on wake. Influences from power children | |
299 | * and changePowerStateTo() are not eliminated. At the earliest opportunity | |
300 | * upon system wake, PM will query the driver for a new power state to be | |
301 | * installed as the initial changePowerStateToPriv() influence, by calling | |
302 | * initialPowerStateForDomainState() with both kIOPMRootDomainState and | |
303 | * kIOPMPowerOn flags set. The default implementation will always return | |
304 | * the lowest power state. Drivers can override this default behavior to | |
305 | * immediately raise the power state when there are work blocked on the | |
306 | * power change, and cannot afford to wait until the next activity tickle. | |
307 | * This property should be statically added to a driver's plist or set at | |
308 | * runtime before calling PMinit(). | |
309 | */ | |
310 | #define kIOPMResetPowerStateOnWakeKey "IOPMResetPowerStateOnWake" | |
311 | ||
0b4c1975 A |
312 | /******************************************************************************* |
313 | * | |
314 | * Driver PM Assertions | |
315 | * | |
316 | ******************************************************************************/ | |
317 | ||
318 | /* Driver Assertion bitfield description | |
319 | * Driver PM assertions are defined by these bits. | |
320 | */ | |
321 | enum { | |
0a7de745 A |
322 | /*! kIOPMDriverAssertionCPUBit |
323 | * When set, PM kernel will prefer to leave the CPU and core hardware | |
324 | * running in "Dark Wake" state, instead of sleeping. | |
325 | */ | |
326 | kIOPMDriverAssertionCPUBit = 0x01, | |
327 | ||
cb323159 A |
328 | /*! kIOPMDriverAssertionPreventSystemIdleSleepBit |
329 | * When set, the system should not idle sleep. This does not prevent | |
330 | * demand sleep. | |
331 | */ | |
332 | kIOPMDriverAssertionPreventSystemIdleSleepBit = 0x02, | |
333 | ||
0a7de745 A |
334 | /*! kIOPMDriverAssertionUSBExternalDeviceBit |
335 | * When set, driver is informing PM that an external USB device is attached. | |
336 | */ | |
337 | kIOPMDriverAssertionUSBExternalDeviceBit = 0x04, | |
338 | ||
339 | /*! kIOPMDriverAssertionBluetoothHIDDevicePairedBit | |
340 | * When set, driver is informing PM that a Bluetooth HID device is paired. | |
341 | */ | |
342 | kIOPMDriverAssertionBluetoothHIDDevicePairedBit = 0x08, | |
343 | ||
344 | /*! kIOPMDriverAssertionExternalMediaMountedBit | |
345 | * When set, driver is informing PM that an external media is mounted. | |
346 | */ | |
347 | kIOPMDriverAssertionExternalMediaMountedBit = 0x10, | |
348 | ||
349 | /*! kIOPMDriverAssertionReservedBit5 | |
350 | * Reserved for Thunderbolt. | |
351 | */ | |
352 | kIOPMDriverAssertionReservedBit5 = 0x20, | |
353 | ||
354 | /*! kIOPMDriverAssertionPreventDisplaySleepBit | |
355 | * When set, the display should remain powered on while the system's awake. | |
356 | */ | |
357 | kIOPMDriverAssertionPreventDisplaySleepBit = 0x40, | |
358 | ||
359 | /*! kIOPMDriverAssertionReservedBit7 | |
360 | * Reserved for storage family. | |
361 | */ | |
362 | kIOPMDriverAssertionReservedBit7 = 0x80, | |
363 | ||
364 | /*! kIOPMDriverAssertionMagicPacketWakeEnabledBit | |
365 | * When set, driver is informing PM that magic packet wake is enabled. | |
366 | */ | |
367 | kIOPMDriverAssertionMagicPacketWakeEnabledBit = 0x100, | |
368 | ||
369 | /*! kIOPMDriverAssertionNetworkKeepAliveActiveBit | |
370 | * When set, driver is informing PM that it is holding the network | |
371 | * interface up to do TCPKeepAlive | |
372 | */ | |
373 | kIOPMDriverAssertionNetworkKeepAliveActiveBit = 0x200 | |
0b4c1975 A |
374 | }; |
375 | ||
0a7de745 A |
376 | /* kIOPMAssertionsDriverKey |
377 | * This kIOPMrootDomain key refers to a CFNumberRef property, containing | |
378 | * a bitfield describing the aggregate PM assertion levels. | |
379 | * Example: A value of 0 indicates that no driver has asserted anything. | |
380 | * Or, a value of <link>kIOPMDriverAssertionCPUBit</link> | |
381 | * indicates that a driver (or drivers) have asserted a need for CPU and video. | |
382 | */ | |
0b4c1975 A |
383 | #define kIOPMAssertionsDriverKey "DriverPMAssertions" |
384 | ||
0a7de745 A |
385 | /* kIOPMAssertionsDriverKey |
386 | * This kIOPMrootDomain key refers to a CFNumberRef property, containing | |
387 | * a bitfield describing the aggregate PM assertion levels. | |
388 | * Example: A value of 0 indicates that no driver has asserted anything. | |
389 | * Or, a value of <link>kIOPMDriverAssertionCPUBit</link> | |
390 | * indicates that a driver (or drivers) have asserted a need for CPU and video. | |
391 | */ | |
0b4c1975 A |
392 | #define kIOPMAssertionsDriverDetailedKey "DriverPMAssertionsDetailed" |
393 | ||
394 | /******************************************************************************* | |
395 | * | |
396 | * Kernel Driver assertion detailed dictionary keys | |
397 | * | |
0a7de745 | 398 | * Keys decode the Array & dictionary data structure under IOPMrootDomain property |
0b4c1975 A |
399 | * kIOPMAssertionsDriverKey. |
400 | * | |
401 | */ | |
402 | #define kIOPMDriverAssertionIDKey "ID" | |
403 | #define kIOPMDriverAssertionCreatedTimeKey "CreatedTime" | |
404 | #define kIOPMDriverAssertionModifiedTimeKey "ModifiedTime" | |
405 | #define kIOPMDriverAssertionOwnerStringKey "Owner" | |
406 | #define kIOPMDriverAssertionOwnerServiceKey "ServicePtr" | |
39236c6e | 407 | #define kIOPMDriverAssertionRegistryEntryIDKey "RegistryEntryID" |
0b4c1975 A |
408 | #define kIOPMDriverAssertionLevelKey "Level" |
409 | #define kIOPMDriverAssertionAssertedKey "Assertions" | |
b0d623f7 | 410 | |
0c530ab8 A |
411 | /******************************************************************************* |
412 | * | |
413 | * Root Domain general interest messages | |
414 | * | |
0a7de745 A |
415 | * Available by registering for interest type 'gIOGeneralInterest' |
416 | * on IOPMrootDomain. | |
b0d623f7 | 417 | * |
0c530ab8 A |
418 | ******************************************************************************/ |
419 | ||
420 | /* kIOPMMessageClamshellStateChange | |
421 | * Delivered as a general interest notification on the IOPMrootDomain | |
422 | * IOPMrootDomain sends this message when state of either AppleClamshellState | |
423 | * or AppleClamshellCausesSleep changes. If this clamshell change results in | |
424 | * a sleep, the sleep will initiate soon AFTER delivery of this message. | |
425 | * The state of both variables is encoded in a bitfield argument sent with | |
426 | * the message. Check bits 0 and 1 using kClamshellStateBit & kClamshellSleepBit | |
427 | */ | |
428 | enum { | |
0a7de745 A |
429 | kClamshellStateBit = (1 << 0), |
430 | kClamshellSleepBit = (1 << 1) | |
0c530ab8 A |
431 | }; |
432 | ||
433 | #define kIOPMMessageClamshellStateChange \ | |
0a7de745 | 434 | iokit_family_msg(sub_iokit_powermanagement, 0x100) |
0c530ab8 A |
435 | |
436 | /* kIOPMMessageFeatureChange | |
437 | * Delivered when the set of supported features ("Supported Features" dictionary | |
438 | * under IOPMrootDomain registry) changes in some way. Typically addition or | |
439 | * removal of a supported feature. | |
440 | * RootDomain passes no argument with this message. | |
441 | */ | |
442 | #define kIOPMMessageFeatureChange \ | |
0a7de745 | 443 | iokit_family_msg(sub_iokit_powermanagement, 0x110) |
0c530ab8 A |
444 | |
445 | /* kIOPMMessageInflowDisableCancelled | |
0a7de745 A |
446 | * The battery has drained completely to its "Fully Discharged" state. |
447 | * If a user process has disabled battery inflow for battery | |
0c530ab8 A |
448 | * calibration, we forcibly re-enable Inflow at this point. |
449 | * If inflow HAS been forcibly re-enabled, bit 0 | |
450 | * (kInflowForciblyEnabledBit) will be set. | |
451 | */ | |
4452a7af | 452 | enum { |
0a7de745 | 453 | kInflowForciblyEnabledBit = (1 << 0) |
4452a7af A |
454 | }; |
455 | ||
4a3eedf9 | 456 | /* kIOPMMessageInternalBatteryFullyDischarged |
0a7de745 | 457 | * The battery has drained completely to its "Fully Discharged" state. |
4a3eedf9 | 458 | */ |
0c530ab8 | 459 | #define kIOPMMessageInternalBatteryFullyDischarged \ |
0a7de745 | 460 | iokit_family_msg(sub_iokit_powermanagement, 0x120) |
0c530ab8 | 461 | |
4a3eedf9 A |
462 | /* kIOPMMessageSystemPowerEventOccurred |
463 | * Some major system thermal property has changed, and interested clients may | |
464 | * modify their behavior. | |
465 | */ | |
466 | #define kIOPMMessageSystemPowerEventOccurred \ | |
0a7de745 | 467 | iokit_family_msg(sub_iokit_powermanagement, 0x130) |
4a3eedf9 | 468 | |
b0d623f7 A |
469 | /* kIOPMMessageSleepWakeUUIDChange |
470 | * Either a new SleepWakeUUID has been specified at the beginning of a sleep, | |
471 | * or we're removing the existing property upon completion of a wakeup. | |
472 | */ | |
473 | #define kIOPMMessageSleepWakeUUIDChange \ | |
0a7de745 A |
474 | iokit_family_msg(sub_iokit_powermanagement, 0x140) |
475 | ||
b0d623f7 | 476 | /* kIOPMMessageSleepWakeUUIDSet |
0a7de745 | 477 | * Argument accompanying the kIOPMMessageSleepWakeUUIDChange notification when |
b0d623f7 A |
478 | * a new UUID has been specified. |
479 | */ | |
480 | #define kIOPMMessageSleepWakeUUIDSet ((void *)1) | |
481 | ||
482 | /* kIOPMMessageSleepWakeUUIDCleared | |
0a7de745 | 483 | * Argument accompanying the kIOPMMessageSleepWakeUUIDChange notification when |
b0d623f7 A |
484 | * the current UUID has been removed. |
485 | */ | |
cb323159 | 486 | #define kIOPMMessageSleepWakeUUIDCleared ((void *)NULL) |
0c530ab8 | 487 | |
0b4c1975 A |
488 | /*! kIOPMMessageDriverAssertionsChanged |
489 | * Sent when kernel PM driver assertions have changed. | |
490 | */ | |
491 | #define kIOPMMessageDriverAssertionsChanged \ | |
0a7de745 | 492 | iokit_family_msg(sub_iokit_powermanagement, 0x150) |
0b4c1975 | 493 | |
316670eb A |
494 | /*! kIOPMMessageDarkWakeThermalEmergency |
495 | * Sent when machine becomes unsustainably warm in DarkWake. | |
496 | * Kernel PM might choose to put the machine back to sleep right after. | |
497 | */ | |
498 | #define kIOPMMessageDarkWakeThermalEmergency \ | |
0a7de745 | 499 | iokit_family_msg(sub_iokit_powermanagement, 0x160) |
316670eb | 500 | |
0c530ab8 A |
501 | /******************************************************************************* |
502 | * | |
503 | * Power commands issued to root domain | |
4a3eedf9 | 504 | * Use with IOPMrootDomain::receivePowerNotification() |
0c530ab8 A |
505 | * |
506 | * These commands are issued from system drivers only: | |
507 | * ApplePMU, AppleSMU, IOGraphics, AppleACPIFamily | |
508 | * | |
6d2010ae | 509 | * TODO: deprecate kIOPMAllowSleep and kIOPMPreventSleep |
0c530ab8 | 510 | ******************************************************************************/ |
1c79356b | 511 | enum { |
0a7de745 A |
512 | kIOPMSleepNow = (1 << 0),// put machine to sleep now |
513 | kIOPMAllowSleep = (1 << 1),// allow idle sleep | |
514 | kIOPMPreventSleep = (1 << 2),// do not allow idle sleep | |
515 | kIOPMPowerButton = (1 << 3),// power button was pressed | |
516 | kIOPMClamshellClosed = (1 << 4),// clamshell was closed | |
517 | kIOPMPowerEmergency = (1 << 5),// battery dangerously low | |
518 | kIOPMDisableClamshell = (1 << 6),// do not sleep on clamshell closure | |
519 | kIOPMEnableClamshell = (1 << 7),// sleep on clamshell closure | |
520 | kIOPMProcessorSpeedChange = (1 << 8),// change the processor speed | |
521 | kIOPMOverTemp = (1 << 9),// system dangerously hot | |
522 | kIOPMClamshellOpened = (1 << 10),// clamshell was opened | |
cb323159 | 523 | kIOPMDWOverTemp = (1 << 11),// DarkWake thermal limits exceeded. |
94ff46dc A |
524 | kIOPMPowerButtonUp = (1 << 12),// Power button up |
525 | kIOPMProModeEngaged = (1 << 13),// Fans entered 'ProMode' | |
526 | kIOPMProModeDisengaged = (1 << 14) // Fans exited 'ProMode' | |
1c79356b A |
527 | }; |
528 | ||
4a3eedf9 | 529 | |
0c530ab8 A |
530 | /******************************************************************************* |
531 | * | |
532 | * Power Management Return Codes | |
533 | * | |
534 | ******************************************************************************/ | |
1c79356b | 535 | enum { |
0a7de745 A |
536 | kIOPMNoErr = 0, |
537 | ||
538 | // Returned by driver's setPowerState(), powerStateWillChangeTo(), | |
539 | // powerStateDidChangeTo(), or acknowledgeSetPowerState() to | |
540 | // implicitly acknowledge power change upon function return. | |
541 | kIOPMAckImplied = 0, | |
542 | ||
543 | // Deprecated | |
544 | kIOPMWillAckLater = 1, | |
545 | ||
546 | // Returned by requestPowerDomainState() to indicate | |
547 | // unrecognized specification parameter. | |
548 | kIOPMBadSpecification = 4, | |
549 | ||
550 | // Returned by requestPowerDomainState() to indicate | |
551 | // no power state matches search specification. | |
552 | kIOPMNoSuchState = 5, | |
553 | ||
554 | // Deprecated | |
555 | kIOPMCannotRaisePower = 6, | |
556 | ||
557 | // Deprecated | |
558 | kIOPMParameterError = 7, | |
559 | ||
560 | // Returned when power management state is accessed | |
561 | // before driver has called PMinit(). | |
562 | kIOPMNotYetInitialized = 8, | |
563 | ||
564 | // And the old constants; deprecated | |
565 | IOPMNoErr = kIOPMNoErr, | |
566 | IOPMAckImplied = kIOPMAckImplied, | |
567 | IOPMWillAckLater = kIOPMWillAckLater, | |
568 | IOPMBadSpecification = kIOPMBadSpecification, | |
569 | IOPMNoSuchState = kIOPMNoSuchState, | |
570 | IOPMCannotRaisePower = kIOPMCannotRaisePower, | |
571 | IOPMParameterError = kIOPMParameterError, | |
572 | IOPMNotYetInitialized = kIOPMNotYetInitialized | |
0c530ab8 A |
573 | }; |
574 | ||
575 | ||
576 | // IOPMPowerSource class descriptive strings | |
0a7de745 | 577 | // Power Source state is published as properties to the IORegistry under these |
0c530ab8 A |
578 | // keys. |
579 | #define kIOPMPSExternalConnectedKey "ExternalConnected" | |
580 | #define kIOPMPSExternalChargeCapableKey "ExternalChargeCapable" | |
581 | #define kIOPMPSBatteryInstalledKey "BatteryInstalled" | |
582 | #define kIOPMPSIsChargingKey "IsCharging" | |
583 | #define kIOPMFullyChargedKey "FullyCharged" | |
584 | #define kIOPMPSAtWarnLevelKey "AtWarnLevel" | |
585 | #define kIOPMPSAtCriticalLevelKey "AtCriticalLevel" | |
586 | #define kIOPMPSCurrentCapacityKey "CurrentCapacity" | |
587 | #define kIOPMPSMaxCapacityKey "MaxCapacity" | |
588 | #define kIOPMPSDesignCapacityKey "DesignCapacity" | |
589 | #define kIOPMPSTimeRemainingKey "TimeRemaining" | |
590 | #define kIOPMPSAmperageKey "Amperage" | |
591 | #define kIOPMPSVoltageKey "Voltage" | |
592 | #define kIOPMPSCycleCountKey "CycleCount" | |
593 | #define kIOPMPSMaxErrKey "MaxErr" | |
594 | #define kIOPMPSAdapterInfoKey "AdapterInfo" | |
595 | #define kIOPMPSLocationKey "Location" | |
596 | #define kIOPMPSErrorConditionKey "ErrorCondition" | |
597 | #define kIOPMPSManufacturerKey "Manufacturer" | |
598 | #define kIOPMPSManufactureDateKey "ManufactureDate" | |
599 | #define kIOPMPSModelKey "Model" | |
600 | #define kIOPMPSSerialKey "Serial" | |
601 | #define kIOPMDeviceNameKey "DeviceName" | |
602 | #define kIOPMPSLegacyBatteryInfoKey "LegacyBatteryInfo" | |
603 | #define kIOPMPSBatteryHealthKey "BatteryHealth" | |
604 | #define kIOPMPSHealthConfidenceKey "HealthConfidence" | |
cb323159 | 605 | #define kIOPMPSCapacityEstimatedKey "CapacityEstimated" |
cf7d32b8 | 606 | #define kIOPMPSBatteryChargeStatusKey "ChargeStatus" |
593a1d5f | 607 | #define kIOPMPSBatteryTemperatureKey "Temperature" |
0a7de745 A |
608 | #define kIOPMPSAdapterDetailsKey "AdapterDetails" |
609 | #define kIOPMPSChargerConfigurationKey "ChargerConfiguration" | |
cf7d32b8 | 610 | |
b0d623f7 | 611 | // kIOPMPSBatteryChargeStatusKey may have one of the following values, or may have |
cf7d32b8 A |
612 | // no value. If kIOPMBatteryChargeStatusKey has a NULL value (or no value) associated with it |
613 | // then charge is proceeding normally. If one of these battery charge status reasons is listed, | |
614 | // then the charge may have been interrupted. | |
615 | #define kIOPMBatteryChargeStatusTooHot "HighTemperature" | |
616 | #define kIOPMBatteryChargeStatusTooCold "LowTemperature" | |
0a7de745 | 617 | #define kIOPMBatteryChargeStatusTooHotOrCold "HighOrLowTemperature" |
cf7d32b8 | 618 | #define kIOPMBatteryChargeStatusGradient "BatteryTemperatureGradient" |
0c530ab8 A |
619 | |
620 | // Definitions for battery location, in case of multiple batteries. | |
621 | // A location of 0 is unspecified | |
622 | // Location is undefined for single battery systems | |
623 | enum { | |
0a7de745 A |
624 | kIOPMPSLocationLeft = 1001, |
625 | kIOPMPSLocationRight = 1002 | |
5d5c5d0d A |
626 | }; |
627 | ||
0c530ab8 A |
628 | // Battery quality health types, specified by BatteryHealth and HealthConfidence |
629 | // properties in an IOPMPowerSource battery kext. | |
5d5c5d0d | 630 | enum { |
0a7de745 A |
631 | kIOPMUndefinedValue = 0, |
632 | kIOPMPoorValue = 1, | |
633 | kIOPMFairValue = 2, | |
634 | kIOPMGoodValue = 3 | |
4452a7af A |
635 | }; |
636 | ||
6d2010ae | 637 | // Keys for kIOPMPSAdapterDetailsKey dictionary |
0a7de745 A |
638 | #define kIOPMPSAdapterDetailsIDKey "AdapterID" |
639 | #define kIOPMPSAdapterDetailsWattsKey "Watts" | |
640 | #define kIOPMPSAdapterDetailsRevisionKey "AdapterRevision" | |
641 | #define kIOPMPSAdapterDetailsSerialNumberKey "SerialNumber" | |
642 | #define kIOPMPSAdapterDetailsFamilyKey "FamilyCode" | |
cb323159 | 643 | #define kIOPMPSAdapterDetailsAmperageKey "Current" |
0a7de745 | 644 | #define kIOPMPSAdapterDetailsDescriptionKey "Description" |
6d2010ae | 645 | #define kIOPMPSAdapterDetailsPMUConfigurationKey "PMUConfiguration" |
cb323159 A |
646 | #define kIOPMPSAdapterDetailsVoltage "Voltage" |
647 | #define kIOPMPSAdapterDetailsSourceIDKey "Source" | |
648 | #define kIOPMPSAdapterDetailsErrorFlagsKey "ErrorFlags" | |
649 | #define kIOPMPSAdapterDetailsSharedSourceKey "SharedSource" | |
0a7de745 | 650 | #define kIOPMPSAdapterDetailsCloakedKey "CloakedSource" |
6d2010ae | 651 | |
5ba3f43e A |
652 | // values for kIOPSPowerAdapterFamilyKey |
653 | enum { | |
0a7de745 A |
654 | kIOPSFamilyCodeDisconnected = 0, |
655 | kIOPSFamilyCodeUnsupported = kIOReturnUnsupported, | |
656 | kIOPSFamilyCodeFirewire = iokit_family_err(sub_iokit_firewire, 0), | |
657 | kIOPSFamilyCodeUSBHost = iokit_family_err(sub_iokit_usb, 0), | |
658 | kIOPSFamilyCodeUSBHostSuspended = iokit_family_err(sub_iokit_usb, 1), | |
659 | kIOPSFamilyCodeUSBDevice = iokit_family_err(sub_iokit_usb, 2), | |
660 | kIOPSFamilyCodeUSBAdapter = iokit_family_err(sub_iokit_usb, 3), | |
661 | kIOPSFamilyCodeUSBChargingPortDedicated = iokit_family_err(sub_iokit_usb, 4), | |
662 | kIOPSFamilyCodeUSBChargingPortDownstream = iokit_family_err(sub_iokit_usb, 5), | |
663 | kIOPSFamilyCodeUSBChargingPort = iokit_family_err(sub_iokit_usb, 6), | |
664 | kIOPSFamilyCodeUSBUnknown = iokit_family_err(sub_iokit_usb, 7), | |
665 | kIOPSFamilyCodeUSBCBrick = iokit_family_err(sub_iokit_usb, 8), | |
666 | kIOPSFamilyCodeUSBCTypeC = iokit_family_err(sub_iokit_usb, 9), | |
667 | kIOPSFamilyCodeUSBCPD = iokit_family_err(sub_iokit_usb, 10), | |
668 | kIOPSFamilyCodeAC = iokit_family_err(sub_iokit_pmu, 0), | |
669 | kIOPSFamilyCodeExternal = iokit_family_err(sub_iokit_pmu, 1), | |
670 | kIOPSFamilyCodeExternal2 = iokit_family_err(sub_iokit_pmu, 2), | |
671 | kIOPSFamilyCodeExternal3 = iokit_family_err(sub_iokit_pmu, 3), | |
672 | kIOPSFamilyCodeExternal4 = iokit_family_err(sub_iokit_pmu, 4), | |
673 | kIOPSFamilyCodeExternal5 = iokit_family_err(sub_iokit_pmu, 5), | |
f427ee49 | 674 | kIOPSFamilyCodeExternal6 = iokit_family_err(sub_iokit_pmu, 6), |
c3c9b80d | 675 | kIOPSFamilyCodeExternal7 = iokit_family_err(sub_iokit_pmu, 7), |
5ba3f43e A |
676 | }; |
677 | ||
a39ff7e2 A |
678 | // values for kIOPMPSAdapterDetailsErrorFlagsKey |
679 | enum { | |
0a7de745 A |
680 | kIOPSAdapterErrorFlagNoErrors = 0, |
681 | kIOPSAdapterErrorFlagInsufficientAvailablePower = (1 << 1), | |
682 | kIOPSAdapterErrorFlagForeignObjectDetected = (1 << 2), | |
683 | kIOPSAdapterErrorFlagDeviceNeedsToBeRepositioned = (1 << 3), | |
a39ff7e2 A |
684 | }; |
685 | ||
0c530ab8 A |
686 | // Battery's time remaining estimate is invalid this long (seconds) after a wake |
687 | #define kIOPMPSInvalidWakeSecondsKey "BatteryInvalidWakeSeconds" | |
688 | ||
689 | // Battery must wait this long (seconds) after being completely charged before | |
690 | // the battery is settled. | |
691 | #define kIOPMPSPostChargeWaitSecondsKey "PostChargeWaitSeconds" | |
692 | ||
0a7de745 | 693 | // Battery must wait this long (seconds) after being completely discharged |
0c530ab8 A |
694 | // before the battery is settled. |
695 | #define kIOPMPSPostDishargeWaitSecondsKey "PostDischargeWaitSeconds" | |
696 | ||
697 | ||
4a3eedf9 A |
698 | /* CPU Power Management status keys |
699 | * Pass as arguments to IOPMrootDomain::systemPowerEventOccurred | |
700 | * Or as arguments to IOPMSystemPowerEventOccurred() | |
701 | * Or to decode the dictionary obtained from IOPMCopyCPUPowerStatus() | |
702 | * These keys reflect restrictions placed on the CPU by the system | |
0a7de745 | 703 | * to bring the CPU's power consumption within allowable thermal and |
4a3eedf9 A |
704 | * power constraints. |
705 | */ | |
706 | ||
707 | ||
708 | /* kIOPMGraphicsPowerLimitsKey | |
709 | * The key representing the dictionary of graphics power limits. | |
710 | * The dictionary contains the other kIOPMCPUPower keys & their associated | |
711 | * values (e.g. Speed limit, Processor Count, and Schedule limits). | |
712 | */ | |
713 | #define kIOPMGraphicsPowerLimitsKey "Graphics_Power_Limits" | |
714 | ||
715 | /* kIOPMGraphicsPowerLimitPerformanceKey | |
716 | * The key representing the percent of overall performance made available | |
717 | * by the graphics chip as a percentage (integer 0 - 100). | |
718 | */ | |
719 | #define kIOPMGraphicsPowerLimitPerformanceKey "Graphics_Power_Performance" | |
720 | ||
721 | ||
722 | ||
723 | /* kIOPMCPUPowerLimitsKey | |
724 | * The key representing the dictionary of CPU Power Limits. | |
725 | * The dictionary contains the other kIOPMCPUPower keys & their associated | |
726 | * values (e.g. Speed limit, Processor Count, and Schedule limits). | |
727 | */ | |
728 | #define kIOPMCPUPowerLimitsKey "CPU_Power_Limits" | |
729 | ||
0a7de745 | 730 | /* kIOPMCPUPowerLimitProcessorSpeedKey defines the speed & voltage limits placed |
4a3eedf9 A |
731 | * on the CPU. |
732 | * Represented as a percentage (0-100) of maximum CPU speed. | |
733 | */ | |
734 | #define kIOPMCPUPowerLimitProcessorSpeedKey "CPU_Speed_Limit" | |
735 | ||
736 | /* kIOPMCPUPowerLimitProcessorCountKey reflects how many, if any, CPUs have been | |
737 | * taken offline. Represented as an integer number of CPUs (0 - Max CPUs). | |
738 | */ | |
739 | #define kIOPMCPUPowerLimitProcessorCountKey "CPU_Available_CPUs" | |
740 | ||
0a7de745 | 741 | /* kIOPMCPUPowerLimitSchedulerTimeKey represents the percentage (0-100) of CPU time |
4a3eedf9 A |
742 | * available. 100% at normal operation. The OS may limit this time for a percentage |
743 | * less than 100%. | |
744 | */ | |
745 | #define kIOPMCPUPowerLimitSchedulerTimeKey "CPU_Scheduler_Limit" | |
746 | ||
747 | ||
748 | /* Thermal Level Warning Key | |
0a7de745 | 749 | * Indicates the thermal constraints placed on the system. This value may |
4a3eedf9 A |
750 | * cause clients to action to consume fewer system resources. |
751 | * The value associated with this warning is defined by the platform. | |
752 | */ | |
753 | #define kIOPMThermalLevelWarningKey "Thermal_Level_Warning" | |
754 | ||
755 | /* Thermal Warning Level values | |
a1c7dba1 A |
756 | * kIOPMThermalLevelNormal - under normal operating conditions |
757 | * kIOPMThermalLevelDanger - thermal pressure may cause system slowdown | |
758 | * kIOPMThermalLevelCritical - thermal conditions may cause imminent shutdown | |
4a3eedf9 A |
759 | * |
760 | * The platform may define additional thermal levels if necessary. | |
a1c7dba1 | 761 | * Platform specific values are defined from 100 and above |
4a3eedf9 A |
762 | */ |
763 | enum { | |
0a7de745 A |
764 | kIOPMThermalLevelNormal = 0, |
765 | kIOPMThermalLevelDanger = 5, | |
766 | kIOPMThermalLevelCritical = 10, | |
a1c7dba1 | 767 | |
0a7de745 A |
768 | kIOPMThermalLevelWarning = 100, |
769 | kIOPMThermalLevelTrap = 110, | |
a1c7dba1 | 770 | |
0a7de745 | 771 | kIOPMThermalLevelUnknown = 255, |
4a3eedf9 A |
772 | }; |
773 | ||
a1c7dba1 A |
774 | #define kIOPMThermalWarningLevelNormal kIOPMThermalLevelNormal |
775 | #define kIOPMThermalWarningLevelDanger kIOPMThermalLevelWarning | |
776 | #define kIOPMThermalWarningLevelCrisis kIOPMThermalLevelCritical | |
0c530ab8 A |
777 | |
778 | // PM Settings Controller setting types | |
779 | // Settings types used primarily with: | |
780 | // IOPMrootDomain::registerPMSettingController | |
781 | // The values are identical to the similarly named keys for use in user space | |
782 | // PM settings work. Those keys are defined in IOPMLibPrivate.h. | |
783 | #define kIOPMSettingWakeOnRingKey "Wake On Modem Ring" | |
784 | #define kIOPMSettingRestartOnPowerLossKey "Automatic Restart On Power Loss" | |
785 | #define kIOPMSettingWakeOnACChangeKey "Wake On AC Change" | |
786 | #define kIOPMSettingSleepOnPowerButtonKey "Sleep On Power Button" | |
787 | #define kIOPMSettingWakeOnClamshellKey "Wake On Clamshell Open" | |
788 | #define kIOPMSettingReduceBrightnessKey "ReduceBrightness" | |
789 | #define kIOPMSettingDisplaySleepUsesDimKey "Display Sleep Uses Dim" | |
790 | #define kIOPMSettingTimeZoneOffsetKey "TimeZoneOffsetSeconds" | |
791 | #define kIOPMSettingMobileMotionModuleKey "MobileMotionModule" | |
593a1d5f | 792 | #define kIOPMSettingGraphicsSwitchKey "GPUSwitch" |
94ff46dc A |
793 | #define kIOPMSettingProModeControl "ProModeControl" |
794 | #define kIOPMSettingProModeDefer "ProModeDefer" | |
0c530ab8 A |
795 | |
796 | // Setting controlling drivers can register to receive scheduled wake data | |
797 | // Either in "CF seconds" type, or structured calendar data in a formatted | |
798 | // IOPMCalendarStruct defined below. | |
799 | #define kIOPMSettingAutoWakeSecondsKey "wake" | |
800 | #define kIOPMSettingAutoWakeCalendarKey "WakeByCalendarDate" | |
801 | #define kIOPMSettingAutoPowerSecondsKey "poweron" | |
802 | #define kIOPMSettingAutoPowerCalendarKey "PowerByCalendarDate" | |
803 | ||
804 | // Debug seconds auto wake | |
805 | // Used by sleep cycling debug tools | |
806 | #define kIOPMSettingDebugWakeRelativeKey "WakeRelativeToSleep" | |
807 | #define kIOPMSettingDebugPowerRelativeKey "PowerRelativeToShutdown" | |
808 | ||
b0d623f7 A |
809 | // Maintenance wake calendar. |
810 | #define kIOPMSettingMaintenanceWakeCalendarKey "MaintenanceWakeCalendarDate" | |
811 | ||
7ddcb079 | 812 | |
0c530ab8 | 813 | struct IOPMCalendarStruct { |
0a7de745 A |
814 | UInt32 year; |
815 | UInt8 month; | |
816 | UInt8 day; | |
817 | UInt8 hour; | |
818 | UInt8 minute; | |
819 | UInt8 second; | |
820 | UInt8 selector; | |
0c530ab8 A |
821 | }; |
822 | typedef struct IOPMCalendarStruct IOPMCalendarStruct; | |
4452a7af | 823 | |
0c530ab8 | 824 | // SetAggressiveness types |
1c79356b | 825 | enum { |
0a7de745 A |
826 | kPMGeneralAggressiveness = 0, |
827 | kPMMinutesToDim, | |
828 | kPMMinutesToSpinDown, | |
829 | kPMMinutesToSleep, | |
830 | kPMEthernetWakeOnLANSettings, | |
831 | kPMSetProcessorSpeed, | |
832 | kPMPowerSource, | |
833 | kPMMotionSensor, | |
834 | kPMLastAggressivenessType | |
1c79356b | 835 | }; |
91447636 | 836 | #define kMaxType (kPMLastAggressivenessType-1) |
1c79356b | 837 | |
9bccf70c A |
838 | // SetAggressiveness values for the kPMPowerSource aggressiveness type |
839 | enum { | |
0a7de745 A |
840 | kIOPMInternalPower = 1, |
841 | kIOPMExternalPower | |
9bccf70c A |
842 | }; |
843 | ||
0c530ab8 | 844 | #define kIOREMSleepEnabledKey "REMSleepEnabled" |
1c79356b | 845 | |
55e303ae | 846 | // Strings for deciphering the dictionary returned from IOPMCopyBatteryInfo |
0c530ab8 A |
847 | #define kIOBatteryInfoKey "IOBatteryInfo" |
848 | #define kIOBatteryCurrentChargeKey "Current" | |
849 | #define kIOBatteryCapacityKey "Capacity" | |
850 | #define kIOBatteryFlagsKey "Flags" | |
851 | #define kIOBatteryVoltageKey "Voltage" | |
852 | #define kIOBatteryAmperageKey "Amperage" | |
853 | #define kIOBatteryCycleCountKey "Cycle Count" | |
d52fe63f | 854 | |
1c79356b | 855 | enum { |
0a7de745 A |
856 | kIOBatteryInstalled = (1 << 2), |
857 | kIOBatteryCharge = (1 << 1), | |
858 | kIOBatteryChargerConnect = (1 << 0) | |
1c79356b A |
859 | }; |
860 | ||
55e303ae A |
861 | // Private power management message indicating battery data has changed |
862 | // Indicates new data resides in the IORegistry | |
863 | #define kIOPMMessageBatteryStatusHasChanged iokit_family_msg(sub_iokit_pmu, 0x100) | |
864 | ||
865 | // Apple private Legacy messages for re-routing AutoWake and AutoPower messages to the PMU | |
866 | // through newer user space IOPMSchedulePowerEvent API | |
867 | #define kIOPMUMessageLegacyAutoWake iokit_family_msg(sub_iokit_pmu, 0x200) | |
0c530ab8 | 868 | #define kIOPMUMessageLegacyAutoPower iokit_family_msg(sub_iokit_pmu, 0x210) |
d52fe63f A |
869 | |
870 | // For use with IOPMPowerSource bFlags | |
871 | #define IOPM_POWER_SOURCE_REV 2 | |
872 | enum { | |
0a7de745 A |
873 | kIOPMACInstalled = kIOBatteryChargerConnect, |
874 | kIOPMBatteryCharging = kIOBatteryCharge, | |
875 | kIOPMBatteryInstalled = kIOBatteryInstalled, | |
876 | kIOPMUPSInstalled = (1 << 3), | |
877 | kIOPMBatteryAtWarn = (1 << 4), | |
878 | kIOPMBatteryDepleted = (1 << 5), | |
879 | kIOPMACnoChargeCapability = (1 << 6), // AC adapter cannot charge battery | |
880 | kIOPMRawLowBattery = (1 << 7), // used only by Platform Expert | |
881 | kIOPMForceLowSpeed = (1 << 8), // set by Platfm Expert, chk'd by Pwr Plugin | |
882 | kIOPMClosedClamshell = (1 << 9), // set by PMU - reflects state of the clamshell | |
883 | kIOPMClamshellStateOnWake = (1 << 10) // used only by Platform Expert | |
d52fe63f A |
884 | }; |
885 | ||
55e303ae A |
886 | // ********************************************** |
887 | // Internal power management data structures | |
888 | // ********************************************** | |
1c79356b A |
889 | |
890 | #if KERNEL && __cplusplus | |
891 | class IOService; | |
892 | ||
893 | enum { | |
0a7de745 | 894 | kIOPowerEmergencyLevel = 1000 |
1c79356b A |
895 | }; |
896 | ||
897 | enum { | |
0a7de745 A |
898 | kIOPMSubclassPolicy, |
899 | kIOPMSuperclassPolicy1 | |
db609669 | 900 | #ifdef KERNEL_PRIVATE |
0a7de745 | 901 | , kIOPMActivityTickleTypeAdvisory = 128 |
db609669 | 902 | #endif |
1c79356b A |
903 | }; |
904 | ||
6d2010ae | 905 | struct stateChangeNote { |
0a7de745 A |
906 | IOPMPowerFlags stateFlags; |
907 | unsigned long stateNum; | |
908 | void * powerRef; | |
1c79356b A |
909 | }; |
910 | typedef struct stateChangeNote stateChangeNote; | |
911 | ||
7ddcb079 | 912 | #endif /* KERNEL && __cplusplus */ |
0b4e3aa0 | 913 | struct IOPowerStateChangeNotification { |
0a7de745 A |
914 | void * powerRef; |
915 | unsigned long returnValue; | |
916 | unsigned long stateNumber; | |
917 | IOPMPowerFlags stateFlags; | |
1c79356b | 918 | }; |
0b4e3aa0 A |
919 | typedef struct IOPowerStateChangeNotification IOPowerStateChangeNotification; |
920 | typedef IOPowerStateChangeNotification sleepWakeNote; | |
1c79356b | 921 | |
6d2010ae | 922 | /*! @struct IOPMSystemCapabilityChangeParameters |
0a7de745 A |
923 | * @abstract A structure describing a system capability change. |
924 | * @discussion A system capability change is a system level transition from a set | |
925 | * of system capabilities to a new set of system capabilities. Power management | |
926 | * sends a <code>kIOMessageSystemCapabilityChange</code> message and provides | |
927 | * this structure as the message data (by reference) to | |
928 | * <code>gIOPriorityPowerStateInterest</code> clients when system capability | |
929 | * changes. | |
930 | * @field notifyRef An identifier for this message notification. Clients with pending | |
931 | * I/O can signal completion by calling <code>allowPowerChange()</code> with this | |
932 | * value as the argument. Clients that are able to process the notification | |
933 | * synchronously should ignore this field. | |
934 | * @field maxWaitForReply A return value to the caller indicating the maximum time in | |
935 | * microseconds to wait for the <code>allowPowerChange()</code> call. The default | |
936 | * value is zero, which indicates the client processing has finished, and power | |
937 | * management should not wait for an <code>allowPowerChange()</code> call. | |
938 | * @field changeFlags Flags will be set to indicate whether the notification precedes | |
939 | * the capability change (<code>kIOPMSystemCapabilityWillChange</code>), or after | |
940 | * the capability change has occurred (<code>kIOPMSystemCapabilityDidChange</code>). | |
941 | * @field __reserved1 Set to zero. | |
942 | * @field fromCapabilities The system capabilities at the start of the transition. | |
943 | * @field toCapabilities The system capabilities at the end of the transition. | |
944 | * @field __reserved2 Set to zero. | |
6d2010ae A |
945 | */ |
946 | struct IOPMSystemCapabilityChangeParameters { | |
0a7de745 A |
947 | uint32_t notifyRef; |
948 | uint32_t maxWaitForReply; | |
949 | uint32_t changeFlags; | |
950 | uint32_t __reserved1; | |
951 | uint32_t fromCapabilities; | |
952 | uint32_t toCapabilities; | |
953 | uint32_t __reserved2[4]; | |
6d2010ae A |
954 | }; |
955 | ||
956 | /*! @enum IOPMSystemCapabilityChangeFlags | |
0a7de745 A |
957 | * @constant kIOPMSystemCapabilityWillChange Indicates the system capability will change. |
958 | * @constant kIOPMSystemCapabilityDidChange Indicates the system capability has changed. | |
959 | */ | |
6d2010ae | 960 | enum { |
0a7de745 A |
961 | kIOPMSystemCapabilityWillChange = 0x01, |
962 | kIOPMSystemCapabilityDidChange = 0x02 | |
6d2010ae | 963 | }; |
1c79356b | 964 | |
6d2010ae | 965 | enum { |
0a7de745 A |
966 | kIOPMSystemCapabilityCPU = 0x01, |
967 | kIOPMSystemCapabilityGraphics = 0x02, | |
968 | kIOPMSystemCapabilityAudio = 0x04, | |
969 | kIOPMSystemCapabilityNetwork = 0x08 | |
6d2010ae A |
970 | }; |
971 | ||
972 | #endif /* ! _IOKIT_IOPM_H */ |