1 | /* |
2 | * Copyright (c) 2002-2020 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_IOPMPRIVATE_H |
29 | #define _IOKIT_IOPMPRIVATE_H |
30 | |
31 | #include <IOKit/pwr_mgt/IOPM.h> |
32 | |
33 | /* @constant kIOPMEventTypeIntermediateFlag |
34 | * @abstract This bit indicates the event is an intermediate event |
35 | * which must occur within a major system power event. |
36 | */ |
37 | #define kIOPMEventTypeIntermediateFlag 0x10000000 |
38 | |
39 | /* @enum SystemEventTypes |
40 | * @abstract Potential system events logged in the system event record. |
41 | */ |
42 | enum { |
43 | kIOPMEventTypeUndefined = 0, |
44 | |
45 | /* Event types mark driver events |
46 | */ |
47 | kIOPMEventTypeSetPowerStateImmediate = 1001, |
48 | kIOPMEventTypeSetPowerStateDelayed = 1002, |
49 | kIOPMEventTypePSWillChangeTo = 1003, |
50 | kIOPMEventTypePSDidChangeTo = 1004, |
51 | kIOPMEventTypeAppResponse = 1005, |
52 | |
53 | |
54 | /* Start and stop event types bracket major |
55 | * system power management events. |
56 | */ |
57 | kIOPMEventTypeSleep = 2001, |
58 | kIOPMEventTypeSleepDone = 2002, |
59 | kIOPMEventTypeWake = 3001, |
60 | kIOPMEventTypeWakeDone = 3002, |
61 | kIOPMEventTypeDoze = 4001, |
62 | kIOPMEventTypeDozeDone = 4002, |
63 | kIOPMEventTypeUUIDSet = 6001, |
64 | kIOPMEventTypeUUIDClear = 6002, |
65 | |
66 | /* Intermediate events that may only occur within the bounds |
67 | * of a major system event (between the event's initiation and its "done event".) |
68 | * e.g. chronologically kIOPMEventTypeSleep may be followed by one or more |
69 | * intermediate events, which then must be followed by kIOPMEventTypeSleepDone. |
70 | * |
71 | * The intermediate events below will always occur in a Sleep or Wake event, and may |
72 | * or may not occur for any of the other events. |
73 | */ |
74 | kIOPMEventTypeAppNotificationsFinished = 501 | kIOPMEventTypeIntermediateFlag, |
75 | kIOPMEventTypeDriverNotificationsFinished = 502 | kIOPMEventTypeIntermediateFlag, |
76 | kIOPMEventTypeCalTimeChange = 503 | kIOPMEventTypeIntermediateFlag |
77 | }; |
78 | |
79 | /***************************************************************************** |
80 | * |
81 | * Private Root Domain general interest messages |
82 | * |
83 | * Check IOPM.h when adding new messages to avoid conflict. |
84 | * |
85 | *****************************************************************************/ |
86 | |
87 | /* kIOPMMessageUserIsActiveChanged |
88 | * User became active or inactive. Message sent after the kIOPMUserIsActiveKey |
89 | * property was updated with a new value. |
90 | */ |
91 | #define kIOPMMessageUserIsActiveChanged \ |
92 | iokit_family_msg(sub_iokit_powermanagement, 0x400) |
93 | |
94 | /* |
95 | * Private IOMessage notifications shared between kernel and userspace PM policy |
96 | */ |
97 | #define kIOPMMessageLastCallBeforeSleep \ |
98 | iokit_family_msg(sub_iokit_powermanagement, 0x410) |
99 | |
100 | #define kIOPMMessageIdleSleepPreventers \ |
101 | iokit_family_msg(sub_iokit_powermanagement, 0x420) |
102 | |
103 | #define kIOPMMessageSystemSleepPreventers \ |
104 | iokit_family_msg(sub_iokit_powermanagement, 0x430) |
105 | |
106 | #define kIOPMMessageLaunchBootSpinDump \ |
107 | iokit_family_msg(sub_iokit_powermanagement, 0x440) |
108 | |
109 | #define kIOPMMessageProModeStateChange \ |
110 | iokit_family_msg(sub_iokit_powermanagement, 0x450) |
111 | |
112 | #define kIOPMMessageRequestUserActive \ |
113 | iokit_family_msg(sub_iokit_powermanagement, 0x460) |
114 | |
115 | /* @enum SystemSleepReasons |
116 | * @abstract The potential causes for system sleep as logged in the system event record. |
117 | */ |
118 | enum { |
119 | kIOPMSleepReasonClamshell = 101, |
120 | kIOPMSleepReasonPowerButton = 102, |
121 | kIOPMSleepReasonSoftware = 103, |
122 | kIOPMSleepReasonOSSwitchHibernate = 104, |
123 | kIOPMSleepReasonIdle = 105, |
124 | kIOPMSleepReasonLowPower = 106, |
125 | kIOPMSleepReasonThermalEmergency = 107, |
126 | kIOPMSleepReasonMaintenance = 108, |
127 | kIOPMSleepReasonSleepServiceExit = 109, |
128 | kIOPMSleepReasonDarkWakeThermalEmergency = 110, |
129 | kIOPMSleepReasonNotificationWakeExit = 111 |
130 | }; |
131 | |
132 | /* |
133 | * Possible C-string sleep reasons found under kRootDomainSleepReasonsKey |
134 | */ |
135 | #define kIOPMClamshellSleepKey "Clamshell Sleep" |
136 | #define kIOPMPowerButtonSleepKey "Power Button Sleep" |
137 | #define kIOPMSoftwareSleepKey "Software Sleep" |
138 | #define kIOPMOSSwitchHibernationKey "OS Switch Sleep" |
139 | #define kIOPMIdleSleepKey "Idle Sleep" |
140 | #define kIOPMLowPowerSleepKey "Low Power Sleep" |
141 | #define kIOPMThermalEmergencySleepKey "Thermal Emergency Sleep" |
142 | #define kIOPMSleepServiceExitKey "Sleep Service Back to Sleep" |
143 | #define kIOPMDarkWakeThermalEmergencyKey "Dark Wake Thermal Emergency" |
144 | #define kIOPMNotificationWakeExitKey "Notification Wake Back to Sleep" |
145 | |
146 | #define kIOPMPSRestrictedModeKey "RestrictedMode" |
147 | |
148 | // Private keys for kIOPMPSAdapterDetailsKey dictionary |
149 | #define kIOPMPSAdapterDetailsIsWirelessKey "IsWireless" |
150 | |
151 | #pragma mark Stray Bitfields |
152 | // Private power commands issued to root domain |
153 | // bits 0-7 in IOPM.h |
154 | |
155 | enum { |
156 | kIOPMSetValue = (1<<16), |
157 | // don't sleep on clamshell closure on a portable with AC connected |
158 | kIOPMSetDesktopMode = (1<<17), |
159 | // set state of AC adaptor connected |
160 | kIOPMSetACAdaptorConnected = (1<<18) |
161 | }; |
162 | |
163 | /*****************************************************************************/ |
164 | /*****************************************************************************/ |
165 | |
166 | /* |
167 | * PM notification types |
168 | */ |
169 | |
170 | /*! @constant kIOPMSleepServiceScheduleImmediate |
171 | * |
172 | * Setting type used in calls to IOPMrootDomain::registerPMSettingController |
173 | * Use this type between powerd and IOKit.framework |
174 | * |
175 | */ |
176 | #define kIOPMSleepServiceScheduleImmediate "SleepServiceImmediate" |
177 | |
178 | /*! @constant kIOPMSettingSleepServiceScheduleImmediate |
179 | * |
180 | * Setting type used in calls to IOPMrootDomain::registerPMSettingController |
181 | * Use this type between xnu and AppleRTC |
182 | */ |
183 | #define kIOPMSettingSleepServiceWakeCalendarKey "SleepServiceWakeCalendarKey" |
184 | |
185 | /*! @constant kIOPMCalendarWakeTypes |
186 | * |
187 | * These are valid values for IOPM.h:IOPMCalendarStruct->selector |
188 | */ |
189 | enum { |
190 | kPMCalendarTypeInvalid = 0, |
191 | kPMCalendarTypeMaintenance = 1, |
192 | kPMCalendarTypeSleepService = 2 |
193 | }; |
194 | |
195 | |
196 | /* @constant kIOPMStateConsoleShutdown |
197 | * @abstract Notification of GUI shutdown state available to kexts. |
198 | * @discussion This type can be passed as arguments to registerPMSettingController() |
199 | * to receive callbacks. |
200 | */ |
201 | #define kIOPMStateConsoleShutdown "ConsoleShutdown" |
202 | |
203 | /* @enum ShutdownValues |
204 | * @abstract Potential values shared with key kIOPMStateConsoleShutdown |
205 | */ |
206 | enum { |
207 | /* @constant kIOPMStateConsoleShutdownNone |
208 | * @abstract System shutdown (or restart) hasn't started; system is ON. |
209 | * @discussion Next state: 2 |
210 | */ |
211 | kIOPMStateConsoleShutdownNone = 1, |
212 | /* @constant kIOPMStateConsoleShutdownPossible |
213 | * @abstract User has been presented with the option to shutdown or restart. Shutdown may be cancelled. |
214 | * @discussion Next state may be: 1, 4 |
215 | */ |
216 | kIOPMStateConsoleShutdownPossible = 2, |
217 | /* @constant kIOPMStateConsoleShutdownUnderway |
218 | * @abstract Shutdown or restart is proceeding. It may still be cancelled. |
219 | * @discussion Next state may be: 1, 4. This state is currently unused. |
220 | */ |
221 | kIOPMStateConsoleShutdownUnderway = 3, |
222 | /* @constant kIOPMStateConsoleShutdownCertain |
223 | * @abstract Shutdown is in progress and irrevocable. |
224 | * @discussion State remains 4 until power is removed from CPU. |
225 | */ |
226 | kIOPMStateConsoleShutdownCertain = 4, |
227 | /* @constant kIOPMStateConsoleSULogoutInitiated |
228 | Indicates that LoginWindow has initiated a software update restart. |
229 | The next logout will not immediately lead to a shutdown. |
230 | */ |
231 | kIOPMStateConsoleSULogoutInitiated = 5 |
232 | }; |
233 | |
234 | /* @constant kIOPMSettingSilentRunningKey |
235 | * @abstract Notification of silent running mode changes to kexts. |
236 | * @discussion This key can be passed as an argument to registerPMSettingController() |
237 | * and also identifies the type of PMSetting notification callback. |
238 | */ |
239 | #define kIOPMSettingSilentRunningKey "SilentRunning" |
240 | #define kIOPMFeatureSilentRunningKey kIOPMSettingSilentRunningKey |
241 | |
242 | /* @enum SilentRunningFlags |
243 | * @abstract The kIOPMSettingSilentRunningKey notification provides an OSNumber |
244 | * object with a value described by the following flags. |
245 | */ |
246 | enum { |
247 | kIOPMSilentRunningModeOn = 0x00000001 |
248 | }; |
249 | |
250 | /* @constant kIOPMSettingLowLatencyAudioModeKey |
251 | * @abstract Notification about low latency activity in the system available to kexts. |
252 | * @discussion This type can be passed as arguments to registerPMSettingController() |
253 | * to receive callbacks. |
254 | */ |
255 | #define kIOPMSettingLowLatencyAudioModeKey "LowLatencyAudioMode" |
256 | |
257 | /*****************************************************************************/ |
258 | /*****************************************************************************/ |
259 | |
260 | /* PM Statistics - event indices |
261 | * These are arguments to IOPMrootDomain::pmStatsRecordEvent(). |
262 | */ |
263 | enum { |
264 | kIOPMStatsHibernateImageWrite = 1, |
265 | kIOPMStatsHibernateImageRead, |
266 | kIOPMStatsDriversNotify, |
267 | kIOPMStatsApplicationNotify, |
268 | kIOPMStatsLateDriverAcknowledge, |
269 | kIOPMStatsLateAppAcknowledge, |
270 | |
271 | // To designate if you're specifying the start or stop end of |
272 | // each of the above events, do a bitwise OR of the appropriate |
273 | // Start/Stop flag and pass the result to IOPMrootDomain to record |
274 | // the event. |
275 | kIOPMStatsEventStartFlag = (1 << 24), |
276 | kIOPMStatsEventStopFlag = (1 << 25) |
277 | }; |
278 | |
279 | // Keys for IOPMrootDomain registry properties |
280 | #define kIOPMSleepStatisticsKey "SleepStatistics" |
281 | #define kIOPMSleepStatisticsAppsKey "AppStatistics" |
282 | #define kIOPMIdleSleepPreventersKey "IdleSleepPreventers" |
283 | #define kIOPMSystemSleepPreventersKey "SystemSleepPreventers" |
284 | #define kIOPMIdleSleepPreventersWithIDKey "IdleSleepPreventersWithID" |
285 | #define kIOPMSystemSleepPreventersWithIDKey "SystemSleepPreventersWithID" |
286 | |
287 | // Application response statistics |
288 | #define kIOPMStatsNameKey "Name" |
289 | #define kIOPMStatsPIDKey "Pid" |
290 | #define kIOPMStatsTimeMSKey "TimeMS" |
291 | #define kIOPMStatsApplicationResponseTypeKey "ResponseType" |
292 | #define kIOPMStatsMessageTypeKey "MessageType" |
293 | #define kIOPMStatsPowerCapabilityKey "PowerCaps" |
294 | #define kIOPMStatsSystemTransitionKey "TransitionType" |
295 | |
296 | // PM Statistics: potential values for the key kIOPMStatsApplicationResponseTypeKey |
297 | // entry in the application results array. |
298 | #define kIOPMStatsResponseTimedOut "ResponseTimedOut" |
299 | #define kIOPMStatsResponseCancel "ResponseCancel" |
300 | #define kIOPMStatsResponseSlow "ResponseSlow" |
301 | #define kIOPMStatsResponsePrompt "ResponsePrompt" |
302 | #define kIOPMStatsDriverPSChangeSlow "DriverPSChangeSlow" |
303 | |
304 | struct PMStatsBounds{ |
305 | uint64_t start; |
306 | uint64_t stop; |
307 | }; |
308 | typedef struct { |
309 | |
310 | struct PMStatsBounds hibWrite; |
311 | struct PMStatsBounds hibRead; |
312 | // bounds driverNotifySleep; |
313 | // bounds driverNotifyWake; |
314 | // bounds appNotifySleep; |
315 | // bounds appNotifyWake; |
316 | // OSDictionary *tardyApps; |
317 | // OSDictionary *tardyDrivers; |
318 | } PMStatsStruct; |
319 | |
320 | /*****************************************************************************/ |
321 | |
322 | /* PM RootDomain tracePoints |
323 | * |
324 | * In the sleep/wake process, we expect the sleep trace points to proceed |
325 | * in increasing order. Once sleep begins with code kIOPMTracePointSleepStarted, |
326 | * we expect sleep to continue in a monotonically increasing order of tracepoints |
327 | * to kIOPMTracePointSystemLoginwindowPhase. After trace point SystemLoginWindowPhase, |
328 | * the system will return to kIOPMTracePointSystemUp. |
329 | * |
330 | * If the trace point decreases (instead of increasing) before reaching kIOPMTracePointSystemUp, |
331 | * that indicates that the sleep process was cancelled. The cancel reason shall be indicated |
332 | * in the cancel tracepoint. (TBD) |
333 | */ |
334 | |
335 | enum { |
336 | /* When kTracePointSystemUp is the latest tracePoint, |
337 | * the system is awake. It is not asleep, sleeping, or waking. |
338 | * |
339 | * Phase begins: At boot, at completion of wake from sleep, |
340 | * immediately following kIOPMTracePointSystemLoginwindowPhase. |
341 | * Phase ends: When a sleep attempt is initiated. |
342 | */ |
343 | kIOPMTracePointSystemUp = 0, |
344 | |
345 | /* When kIOPMTracePointSleepStarted is the latest tracePoint, |
346 | * sleep has been initiated. |
347 | * |
348 | * Phase begins: At initiation of system sleep (idle or forced). |
349 | * Phase ends: PM starts to notify applications of system sleep. |
350 | */ |
351 | kIOPMTracePointSleepStarted = 0x10, |
352 | |
353 | /* When kIOPMTracePointSleepApplications is the latest tracePoint, |
354 | * a system sleep has been initiated and PM waits for responses |
355 | * from notified applications. |
356 | * |
357 | * Phase begins: Begin to asynchronously fire kIOMessageSystemWillSleep |
358 | * notifications, and also kIOMessageCanSystemSleep for the idle sleep case. |
359 | * Phase ends: When PM has received all application responses. |
360 | */ |
361 | kIOPMTracePointSleepApplications = 0x11, |
362 | |
363 | /* When kIOPMTracePointSleepPriorityClients is the latest tracePoint, |
364 | * PM is notifying priority clients and in-kernel system capability |
365 | * clients, and waiting for any asynchronous completions. |
366 | * |
367 | * Phase begins: Synchronous delivery of kIOMessageSystemWillSleep notifications. |
368 | * Phase ends: All notified clients have acknowledged. |
369 | */ |
370 | kIOPMTracePointSleepPriorityClients = 0x12, |
371 | |
372 | /* When kIOPMTracePointSleepWillChangeInterests is the latest tracePoint, |
373 | * PM is calling powerStateWillChangeTo() on interested drivers of root domain. |
374 | * |
375 | * Phase begins: Dispatch a callout thread to call interested drivers. |
376 | * Phase ends: Callout thread work done, and acknowledgePowerChange() called |
377 | * by drivers that indicated asynchronous completion. |
378 | */ |
379 | kIOPMTracePointSleepWillChangeInterests = 0x13, |
380 | |
381 | /* When kIOPMTracePointSleepPowerPlaneDrivers is the latest tracePoint, |
382 | * PM is directing power plane drivers to power off in leaf-to-root order. |
383 | * |
384 | * Phase begins: Root domain informs its power children that it will drop to |
385 | * sleep state. This has a cascade effect and triggers all drivers in |
386 | * the power plane to transition to a lower power state if necessary. |
387 | * Phase ends: All power transitions in response to the root domain power |
388 | * change have completed. |
389 | */ |
390 | kIOPMTracePointSleepPowerPlaneDrivers = 0x14, |
391 | |
392 | /* When kIOPMTracePointSleepDidChangeInterests is the latest tracePoint, |
393 | * PM is calling powerStateDidChangeTo() on interested drivers of root domain. |
394 | * |
395 | * Phase begins: Dispatch a callout thread to call interested drivers. |
396 | * Phase ends: Callout thread work done, and acknowledgePowerChange() called |
397 | * by drivers that indicated asynchronous completion. |
398 | */ |
399 | kIOPMTracePointSleepDidChangeInterests = 0x15, |
400 | |
401 | /* When kIOPMTracePointSleepCapabilityClients is the latest tracePoint, |
402 | * PM is notifying system capability clients about system sleep. |
403 | * |
404 | * Phase begins: Send kIOMessageSystemCapabilityChange notifications to inform |
405 | * capability clients that system has lost all capabilities. |
406 | * Phase ends: Finished sending notifications. |
407 | */ |
408 | kIOPMTracePointSleepCapabilityClients = 0x16, |
409 | |
410 | /* When kIOPMTracePointSleepPlatformActions is the latest tracePoint, |
411 | * PM is calling drivers that have registered a platform sleep action. |
412 | */ |
413 | kIOPMTracePointSleepPlatformActions = 0x17, |
414 | |
415 | /* When kIOPMTracePointSleepCPUs is the latest tracePoint, |
416 | * PM is shutting down all non-boot processors. |
417 | * |
418 | * Phase begins: Shutdown all non-boot processors. |
419 | * Phase ends: Reduced to only the boot processor running. |
420 | */ |
421 | kIOPMTracePointSleepCPUs = 0x18, |
422 | |
423 | /* When kIOPMTracePointSleepPlatformDriver is the latest tracePoint, |
424 | * PM is executing platform dependent code to prepare for system sleep. |
425 | */ |
426 | kIOPMTracePointSleepPlatformDriver = 0x19, |
427 | |
428 | /* When kIOPMTracePointHibernate is the latest tracePoint, |
429 | * PM is writing the hibernate image to disk. |
430 | */ |
431 | kIOPMTracePointHibernate = 0x1a, |
432 | |
433 | /* When kIOPMTracePointSystemSleep is the latest tracePoint, |
434 | * PM has recorded the final trace point before the hardware platform |
435 | * enters sleep state, or low level wakeup is underway - such as restoring |
436 | * the hibernate image from disk. |
437 | * |
438 | * Note: If a system is asleep and then loses power, and it does not have a |
439 | * hibernate image to restore from (e.g. hibernatemode = 0), then OS X will |
440 | * interpret this power loss as a failure in kIOPMTracePointSystemSleep. |
441 | * |
442 | * Phase begins: Before the OS directs the hardware to enter sleep state. |
443 | * Phase ends: Control returns to the OS on wake, but before recording the first |
444 | * wake trace point. |
445 | */ |
446 | kIOPMTracePointSystemSleep = 0x1f, |
447 | |
448 | /* When kIOPMTracePointWakePlatformDriver is the latest tracePoint, |
449 | * PM is executing platform dependent code to prepare for system wake. |
450 | */ |
451 | kIOPMTracePointWakePlatformDriver = 0x21, |
452 | |
453 | /* When kIOPMTracePointWakePlatformActions is the latest tracePoint, |
454 | * PM is calling drivers that have registered a platform wake action. |
455 | */ |
456 | kIOPMTracePointWakePlatformActions = 0x22, |
457 | |
458 | /* When kIOPMTracePointWakeCPUs is the latest tracePoint, |
459 | * PM is bringing all non-boot processors online. |
460 | */ |
461 | kIOPMTracePointWakeCPUs = 0x23, |
462 | |
463 | /* When kIOPMTracePointWakeWillPowerOnClients is the latest tracePoint, |
464 | * PM is sending kIOMessageSystemWillPowerOn to both kernel clients and |
465 | * applications. PM also notifies system capability clients about the |
466 | * proposed capability change. |
467 | * |
468 | * Phase begins: Send kIOMessageSystemWillPowerOn and |
469 | * kIOMessageSystemCapabilityChange notifications. |
470 | * Phase ends: Finished sending notifications. |
471 | */ |
472 | kIOPMTracePointWakeWillPowerOnClients = 0x24, |
473 | |
474 | /* When kIOPMTracePointWakeWillChangeInterests is the latest tracePoint, |
475 | * PM is calling powerStateWillChangeTo() on interested drivers of root domain. |
476 | * |
477 | * Phase begins: Dispatch a callout thread to call interested drivers. |
478 | * Phase ends: Callout thread work done, and acknowledgePowerChange() called |
479 | * by drivers that indicated asynchronous completion. |
480 | */ |
481 | kIOPMTracePointWakeWillChangeInterests = 0x25, |
482 | |
483 | /* When kIOPMTracePointWakeDidChangeInterests is the latest tracePoint, |
484 | * PM is calling powerStateDidChangeTo() on interested drivers of root domain. |
485 | * |
486 | * Phase begins: Dispatch a callout thread to call interested drivers. |
487 | * Phase ends: Callout thread work done, and acknowledgePowerChange() called |
488 | * by drivers that indicated asynchronous completion. |
489 | */ |
490 | kIOPMTracePointWakeDidChangeInterests = 0x26, |
491 | |
492 | /* When kIOPMTracePointWakePowerPlaneDrivers is the latest tracePoint, |
493 | * PM is directing power plane drivers to power up in root-to-leaf order. |
494 | * |
495 | * Phase begins: Root domain informs its power children that it transitioned |
496 | * to ON state. This has a cascade effect and triggers all drivers in |
497 | * the power plane to re-evaluate and potentially change power state. |
498 | * Phase ends: All power transitions in response to the root domain power |
499 | * change have completed. |
500 | */ |
501 | kIOPMTracePointWakePowerPlaneDrivers = 0x27, |
502 | |
503 | /* When kIOPMTracePointWakeCapabilityClients is the latest tracePoint, |
504 | * PM is notifying system capability clients about system wake, and waiting |
505 | * for any asynchronous completions. |
506 | * |
507 | * Phase begins: Inform capability clients that system has gained capabilities. |
508 | * Phase ends: All notified clients have acknowledged. |
509 | */ |
510 | kIOPMTracePointWakeCapabilityClients = 0x28, |
511 | |
512 | /* When kIOPMTracePointWakeApplications is the latest tracePoint, |
513 | * System CPU is powered, PM has powered on each driver. |
514 | * |
515 | * Phase begins: Send asynchronous kIOMessageSystemHasPoweredOn notifications. |
516 | * Phase ends: Finished sending asynchronous notifications. |
517 | */ |
518 | kIOPMTracePointWakeApplications = 0x29, |
519 | |
520 | /* kIOPMTracePointSystemLoginwindowPhase |
521 | * This phase represents a several minute window after the system has powered on. |
522 | * Higher levels of system diagnostics are in a heightened state of alert in this phase, |
523 | * in case any user errors occurred that we could not detect in software. |
524 | * |
525 | * Phase begins: After IOPMrootDomain sends kIOMessageSystemHasPoweredOn message. |
526 | * Phase ends: When loginwindow calls IOPMSleepWakeSetUUID(NULL) the system shall |
527 | * be considered awake and usable. The next phase shall be kIOPMTracePointSystemUp. |
528 | */ |
529 | kIOPMTracePointSystemLoginwindowPhase = 0x30, |
530 | |
531 | /* When kIOPMTracePointDarkWakeEntry is the latest tracePoint, |
532 | * PM has started a transition from full wake to dark wake. |
533 | * |
534 | * Phase begins: Start transition to dark wake. |
535 | * Phase ends: System in dark wake. Before recording kIOPMTracePointSystemUp. |
536 | */ |
537 | kIOPMTracePointDarkWakeEntry = 0x31, |
538 | |
539 | /* When kIOPMTracePointDarkWakeExit is the latest tracePoint, |
540 | * PM has started a transition from dark wake to full wake. |
541 | * |
542 | * Phase begins: Start transition to full wake. |
543 | * Phase ends: System in full wake. Before recording kIOPMTracePointSystemUp. |
544 | */ |
545 | kIOPMTracePointDarkWakeExit = 0x32 |
546 | }; |
547 | |
548 | /*****************************************************************************/ |
549 | |
550 | /* |
551 | * Component wake progress keys |
552 | * |
553 | * Certain components have the ability to log their wake progress with |
554 | * root domain using the keys provided below. |
555 | * |
556 | * LoginWindow - 4 bits |
557 | * CoreDisplay - 8 bits |
558 | * CoreGraphics - 8 bits |
559 | * |
560 | * These bits are stored with the trace phase that gets logged to |
561 | * the RTC register. |
562 | */ |
563 | |
564 | // Values that should be passed in to IOPMLogWakeProgress |
565 | enum { |
566 | kIOPMLoginWindowProgress = 1, |
567 | kIOPMCoreDisplayProgress = 2, |
568 | kIOPMCoreGraphicsProgress = 3 |
569 | }; |
570 | |
571 | enum { |
572 | kIOPMLoginWindowProgressMask = 0x0f, |
573 | kIOPMCoreDisplayProgressMask = 0xff, |
574 | kIOPMCoreGraphicsProgressMask = 0xff |
575 | }; |
576 | |
577 | /* |
578 | * kIOPMLoginWindowProgressKey - identifies PM debug data specific to LoginWindow |
579 | * for use with IOPMrootDomain. Only 4 bits of data are allotted. |
580 | */ |
581 | #define kIOPMLoginWindowProgressKey "LoginWindowProgress" |
582 | |
583 | /* |
584 | * kIOPMCoreDisplayProgressKey - identifies PM debug data specific to CoreDisplay |
585 | * for use with IOPMrootDomain. Only 8 bits of data are allotted. |
586 | */ |
587 | #define kIOPMCoreDisplayProgressKey "CoreDisplayProgress" |
588 | |
589 | /* |
590 | * kIOPMCoreGraphicsProgressKey - identifies PM debug data specific to CoreGraphics |
591 | * for use with IOPMrootDomain. Only 8 bits of data are allotted. |
592 | */ |
593 | #define kIOPMCoreGraphicsProgressKey "CoreGraphicsProgress" |
594 | |
595 | // For PM internal use only - key to locate sleep failure results within SCDynamicStore. |
596 | #define kIOPMDynamicStoreSleepFailureKey "SleepFailure" |
597 | |
598 | /*****************************************************************************/ |
599 | |
600 | // For IOPMLibPrivate.h |
601 | #define kIOPMSleepWakeFailureKey "PMFailurePhase" |
602 | #define kIOPMSleepWakeFailureCodeKey "PMStatusCode" |
603 | #define kIOPMSleepWakeFailureLoginKey "LWFailurePhase" |
604 | #define kIOPMSleepWakeFailureUUIDKey "UUID" |
605 | #define kIOPMSleepWakeFailureDateKey "Date" |
606 | #define kIOPMSleepWakeWdogRebootKey "SWWdogTriggeredRestart" |
607 | #define kIOPMSleepWakeWdogLogsValidKey "SWWdogLogsValid" |
608 | |
609 | /***************************************************************************** |
610 | * |
611 | * Root Domain private property keys |
612 | * |
613 | *****************************************************************************/ |
614 | |
615 | /* kIOPMFeatureAutoPowerOffKey |
616 | * Feature published if Auto Power Off is supported |
617 | */ |
618 | #define kIOPMFeatureAutoPowerOffKey "AutoPowerOff" |
619 | |
620 | /* kIOPMAutoPowerOffEnabledKey |
621 | * Indicates if Auto Power Off is enabled. |
622 | * It has a boolean value. |
623 | * true == Auto Power Off is enabled |
624 | * false == Auto Power Off is disabled |
625 | * not present == Auto Power Off is not supported on this hardware |
626 | */ |
627 | #define kIOPMAutoPowerOffEnabledKey "AutoPowerOff Enabled" |
628 | |
629 | /* kIOPMAutoPowerOffDelayKey |
630 | * Key refers to a CFNumberRef that represents the delay in seconds before |
631 | * entering the Auto Power Off state. The property is not present if Auto |
632 | * Power Off is unsupported. |
633 | */ |
634 | #define kIOPMAutoPowerOffDelayKey "AutoPowerOff Delay" |
635 | |
636 | /* kIOPMAutoPowerOffTimerKey |
637 | * Key refers to a CFNumberRef that indicates the time in seconds until the |
638 | * expiration of the Auto Power Off delay period. This value should be used |
639 | * to program a wake alarm before system sleep. |
640 | */ |
641 | #define kIOPMAutoPowerOffTimerKey "AutoPowerOff Timer" |
642 | |
643 | /* kIOPMDeepSleepTimerKey |
644 | * Key refers to a CFNumberRef that indicates the time in seconds until the |
645 | * expiration of the Standby delay period. This value should be used |
646 | * to program a wake alarm before system sleep. |
647 | */ |
648 | #define kIOPMDeepSleepTimerKey "Standby Timer" |
649 | |
650 | /* kIOPMUserWakeAlarmScheduledKey |
651 | * Key refers to a boolean value that indicates if an user alarm was scheduled |
652 | * or pending. |
653 | */ |
654 | #define kIOPMUserWakeAlarmScheduledKey "UserWakeAlarmScheduled" |
655 | |
656 | /* kIOPMDeepIdleSupportedKey |
657 | * Presence of this key indicates Deep Idle is supported on this platform. |
658 | * Key will always refer to a value of kOSBooleanTrue. |
659 | */ |
660 | #define kIOPMDeepIdleSupportedKey "IOPMDeepIdleSupported" |
661 | |
662 | /* kIOPMUserTriggeredFullWakeKey |
663 | * Key refers to a boolean value that indicates if the first full wake since |
664 | * last system sleep was triggered by the local user. This property is set |
665 | * before the initial full wake transition, and removed after powering down |
666 | * drivers for system sleep. |
667 | */ |
668 | #define kIOPMUserTriggeredFullWakeKey "IOPMUserTriggeredFullWake" |
669 | |
670 | /* kIOPMUserIsActiveKey |
671 | * Key refers to a boolean value that indicates if the user is active. |
672 | */ |
673 | #define kIOPMUserIsActiveKey "IOPMUserIsActive" |
674 | |
675 | /* kIOPMDriverWakeEventsKey |
676 | * Key refers to a property that should only be examined by powerd. |
677 | */ |
678 | #define kIOPMDriverWakeEventsKey "IOPMDriverWakeEvents" |
679 | |
680 | /***************************************************************************** |
681 | * |
682 | * IOPMDriverWakeEvents dictionary keys |
683 | * |
684 | *****************************************************************************/ |
685 | |
686 | #define kIOPMWakeEventTimeKey "Time" |
687 | #define kIOPMWakeEventFlagsKey "Flags" |
688 | #define kIOPMWakeEventReasonKey "Reason" |
689 | #define kIOPMWakeEventDetailsKey "Details" |
690 | |
691 | /* kIOPMFeatureProModeKey |
692 | * Feature published if ProMode is supported |
693 | */ |
694 | #define kIOPMFeatureProModeKey "ProMode" |
695 | |
696 | /***************************************************************************** |
697 | * |
698 | * Wake event flags reported to IOPMrootDomain::claimSystemWakeEvent() |
699 | * |
700 | *****************************************************************************/ |
701 | |
702 | #define kIOPMWakeEventSource 0x00000001 |
703 | |
704 | /***************************************************************************** |
705 | * |
706 | * AOT defs |
707 | * |
708 | *****************************************************************************/ |
709 | |
710 | // signals the device should wake up to user space running |
711 | #define kIOPMWakeEventAOTExit 0x00000002 |
712 | |
713 | // will start a 400 ms timer before sleeping |
714 | #define kIOPMWakeEventAOTPossibleExit 0x00000004 |
715 | |
716 | // signals the device should wake up to user space running |
717 | #define kIOPMWakeEventAOTConfirmedPossibleExit 0x00000008 |
718 | |
719 | // signals the device should go back to AOT |
720 | #define kIOPMWakeEventAOTRejectedPossibleExit 0x00000010 |
721 | |
722 | // signals the device should go back to AOT |
723 | #define kIOPMWakeEventAOTExpiredPossibleExit 0x00000020 |
724 | |
725 | #define kIOPMWakeEventAOTFlags \ |
726 | (kIOPMWakeEventAOTExit \ |
727 | | kIOPMWakeEventAOTPossibleExit \ |
728 | | kIOPMWakeEventAOTConfirmedPossibleExit \ |
729 | | kIOPMWakeEventAOTRejectedPossibleExit \ |
730 | | kIOPMWakeEventAOTExpiredPossibleExit) |
731 | |
732 | #define kIOPMWakeEventAOTPossibleFlags \ |
733 | (kIOPMWakeEventAOTPossibleExit \ |
734 | | kIOPMWakeEventAOTConfirmedPossibleExit \ |
735 | | kIOPMWakeEventAOTRejectedPossibleExit \ |
736 | | kIOPMWakeEventAOTExpiredPossibleExit) |
737 | |
738 | #define kIOPMWakeEventAOTPerCycleFlags \ |
739 | (kIOPMWakeEventAOTPossibleExit \ |
740 | | kIOPMWakeEventAOTRejectedPossibleExit \ |
741 | | kIOPMWakeEventAOTExpiredPossibleExit) |
742 | |
743 | #define kIOPMWakeEventAOTExitFlags \ |
744 | (kIOPMWakeEventAOTExit \ |
745 | | kIOPMWakeEventAOTConfirmedPossibleExit) |
746 | |
747 | enum { |
748 | kIOPMAOTModeMask = 0x000000ff, |
749 | kIOPMAOTModeEnable = 0x00000001, |
750 | kIOPMAOTModeCycle = 0x00000002, |
751 | kIOPMAOTModeAddEventFlags = 0x00000004, |
752 | kIOPMAOTModeRespectTimers = 0x00000008, |
753 | kIOPMAOTModeDefault = (kIOPMAOTModeEnable | kIOPMAOTModeAddEventFlags | kIOPMAOTModeRespectTimers) |
754 | }; |
755 | |
756 | enum { |
757 | kIOPMAOTMetricsKernelWakeCountMax = 24 |
758 | }; |
759 | |
760 | struct IOPMAOTMetrics |
761 | { |
762 | uint32_t sleepCount; |
763 | uint32_t possibleCount; |
764 | uint32_t confirmedPossibleCount; |
765 | uint32_t rejectedPossibleCount; |
766 | uint32_t expiredPossibleCount; |
767 | uint32_t noTimeSetCount; |
768 | uint32_t rtcAlarmsCount; |
769 | uint32_t softwareRequestCount; |
770 | uint64_t totalTime; |
771 | |
772 | char kernelWakeReason[kIOPMAOTMetricsKernelWakeCountMax][64]; |
773 | // 54:10 secs:ms calendar time |
774 | uint64_t kernelSleepTime[kIOPMAOTMetricsKernelWakeCountMax]; |
775 | uint64_t kernelWakeTime[kIOPMAOTMetricsKernelWakeCountMax]; |
776 | }; |
777 | |
778 | #define kIOPMAOTPowerKey "aot-power" |
779 | |
780 | /***************************************************************************** |
781 | * |
782 | * Dark Wake |
783 | * |
784 | *****************************************************************************/ |
785 | |
786 | /* An OSNumber property set on a power managed driver that the root domain |
787 | * will use as the driver's max power state while system is in dark wake. |
788 | * This property should be set prior to the driver joining the PM tree. |
789 | */ |
790 | #define kIOPMDarkWakeMaxPowerStateKey "IOPMDarkWakeMaxPowerState" |
791 | |
792 | /***************************************************************************** |
793 | * |
794 | * System Sleep Policy |
795 | * |
796 | *****************************************************************************/ |
797 | |
798 | #define kIOPMSystemSleepPolicySignature 0x54504c53 |
799 | #define kIOPMSystemSleepPolicyVersion 2 |
800 | |
801 | /*! |
802 | * @defined kIOPMSystemSleepTypeKey |
803 | * @abstract Indicates the type of system sleep. |
804 | * @discussion An OSNumber property of root domain that describes the type |
805 | * of system sleep. This property is set after notifying priority sleep/wake |
806 | * clients, but before informing interested drivers and shutting down power |
807 | * plane drivers. On a hibernate abort or failure, this property will not be |
808 | * updated and will indicate the failed sleep type. |
809 | */ |
810 | #define kIOPMSystemSleepTypeKey "IOPMSystemSleepType" |
811 | |
812 | struct IOPMSystemSleepPolicyVariables |
813 | { |
814 | uint32_t signature; // kIOPMSystemSleepPolicySignature |
815 | uint32_t version; // kIOPMSystemSleepPolicyVersion |
816 | |
817 | uint64_t currentCapability; // current system capability bits |
818 | uint64_t highestCapability; // highest system capability bits |
819 | |
820 | uint64_t sleepFactors; // sleep factor bits |
821 | uint32_t sleepReason; // kIOPMSleepReason* |
822 | uint32_t sleepPhase; // identify the sleep phase |
823 | uint32_t hibernateMode; // current hibernate mode |
824 | |
825 | uint32_t standbyDelay; // standby delay in seconds |
826 | uint32_t standbyTimer; // standby timer in seconds |
827 | uint32_t poweroffDelay; // auto-poweroff delay in seconds |
828 | uint32_t scheduledAlarms; // bitmask of scheduled alarm types |
829 | uint32_t poweroffTimer; // auto-poweroff timer in seconds |
830 | |
831 | uint32_t reserved[49]; // pad sizeof 256 bytes |
832 | }; |
833 | |
834 | enum { |
835 | kIOPMAlarmBitDebugWake = 0x01, |
836 | kIOPMAlarmBitCalendarWake = 0x02, |
837 | kIOPMAlarmBitMaintenanceWake = 0x04, |
838 | kIOPMAlarmBitSleepServiceWake = 0x08 |
839 | }; |
840 | |
841 | enum { |
842 | kIOPMSleepPhase0 = 0, |
843 | kIOPMSleepPhase1, |
844 | kIOPMSleepPhase2 |
845 | }; |
846 | |
847 | // Sleep Factor Mask / Bits |
848 | enum { |
849 | kIOPMSleepFactorSleepTimerWake = 0x00000001ULL, |
850 | kIOPMSleepFactorLidOpen = 0x00000002ULL, |
851 | kIOPMSleepFactorACPower = 0x00000004ULL, |
852 | kIOPMSleepFactorBatteryLow = 0x00000008ULL, |
853 | kIOPMSleepFactorStandbyNoDelay = 0x00000010ULL, |
854 | kIOPMSleepFactorStandbyForced = 0x00000020ULL, |
855 | kIOPMSleepFactorStandbyDisabled = 0x00000040ULL, |
856 | kIOPMSleepFactorUSBExternalDevice = 0x00000080ULL, |
857 | kIOPMSleepFactorBluetoothHIDDevice = 0x00000100ULL, |
858 | kIOPMSleepFactorExternalMediaMounted = 0x00000200ULL, |
859 | kIOPMSleepFactorThunderboltDevice = 0x00000400ULL, |
860 | kIOPMSleepFactorRTCAlarmScheduled = 0x00000800ULL, |
861 | kIOPMSleepFactorMagicPacketWakeEnabled = 0x00001000ULL, |
862 | kIOPMSleepFactorHibernateForced = 0x00010000ULL, |
863 | kIOPMSleepFactorAutoPowerOffDisabled = 0x00020000ULL, |
864 | kIOPMSleepFactorAutoPowerOffForced = 0x00040000ULL, |
865 | kIOPMSleepFactorExternalDisplay = 0x00080000ULL, |
866 | kIOPMSleepFactorNetworkKeepAliveActive = 0x00100000ULL, |
867 | kIOPMSleepFactorLocalUserActivity = 0x00200000ULL, |
868 | kIOPMSleepFactorHibernateFailed = 0x00400000ULL, |
869 | kIOPMSleepFactorThermalWarning = 0x00800000ULL, |
870 | kIOPMSleepFactorDisplayCaptured = 0x01000000ULL |
871 | }; |
872 | |
873 | // System Sleep Types |
874 | enum { |
875 | kIOPMSleepTypeInvalid = 0, |
876 | kIOPMSleepTypeAbortedSleep = 1, |
877 | kIOPMSleepTypeNormalSleep = 2, |
878 | kIOPMSleepTypeSafeSleep = 3, |
879 | kIOPMSleepTypeHibernate = 4, |
880 | kIOPMSleepTypeStandby = 5, |
881 | kIOPMSleepTypePowerOff = 6, |
882 | kIOPMSleepTypeDeepIdle = 7, |
883 | kIOPMSleepTypeLast = 8 |
884 | }; |
885 | |
886 | // System Sleep Flags |
887 | enum { |
888 | kIOPMSleepFlagDisableHibernateAbort = 0x00000001, |
889 | kIOPMSleepFlagDisableUSBWakeEvents = 0x00000002, |
890 | kIOPMSleepFlagDisableBatlowAssertion = 0x00000004, |
891 | kIOPMSleepFlagDisableS4WakeSources = 0x00000008 |
892 | }; |
893 | |
894 | // System Wake Events |
895 | enum { |
896 | kIOPMWakeEventLidOpen = 0x00000001, |
897 | kIOPMWakeEventLidClose = 0x00000002, |
898 | kIOPMWakeEventACAttach = 0x00000004, |
899 | kIOPMWakeEventACDetach = 0x00000008, |
900 | kIOPMWakeEventCDInsert = 0x00000010, |
901 | kIOPMWakeEventCDEject = 0x00000020, |
902 | kIOPMWakeEventHPDAttach = 0x00000040, |
903 | kIOPMWakeEventHPDDetach = 0x00000080, |
904 | kIOPMWakeEventPowerButton = 0x00000100, |
905 | kIOPMWakeEventG3PowerOn = 0x00000200, |
906 | kIOPMWakeEventUserPME = 0x00000400, |
907 | kIOPMWakeEventSleepTimer = 0x00000800, |
908 | kIOPMWakeEventBatteryLow = 0x00001000, |
909 | kIOPMWakeEventDarkPME = 0x00002000, |
910 | kIOPMWakeEventWifi = 0x00004000, |
911 | kIOPMWakeEventRTCSystem = 0x00008000, // Maintenance RTC wake |
912 | kIOPMWakeEventUSBCPlugin = 0x00010000, // USB-C Plugin |
913 | kIOPMWakeEventHID = 0x00020000, |
914 | kIOPMWakeEventBluetooth = 0x00040000, |
915 | kIOPMWakeEventDFR = 0x00080000, |
916 | kIOPMWakeEventSD = 0x00100000, // SD card |
917 | kIOPMWakeEventLANWake = 0x00200000, // Wake on Lan |
918 | kIOPMWakeEventLANPlugin = 0x00400000, // Ethernet media sense |
919 | kIOPMWakeEventThunderbolt = 0x00800000, |
920 | kIOPMWakeEventRTCUser = 0x01000000, // User requested RTC wake |
921 | }; |
922 | |
923 | /*! |
924 | * @defined kIOPMSystemSleepParametersKey |
925 | * @abstract Sleep parameters describing the upcoming sleep |
926 | * @discussion Root domain updates this OSData property before system sleep |
927 | * to pass sleep parameters to the platform driver. Some of the parameters |
928 | * are based on the chosen entry in the system sleep policy table. |
929 | */ |
930 | #define kIOPMSystemSleepParametersKey "IOPMSystemSleepParameters" |
931 | #define kIOPMSystemSleepParametersVersion 2 |
932 | |
933 | struct IOPMSystemSleepParameters |
934 | { |
935 | uint16_t version; |
936 | uint16_t reserved1; |
937 | uint32_t sleepType; |
938 | uint32_t sleepFlags; |
939 | uint32_t ecWakeEvents; |
940 | uint32_t ecWakeTimer; |
941 | uint32_t ecPoweroffTimer; |
942 | uint32_t reserved2[10]; |
943 | } __attribute__((packed)); |
944 | |
945 | |
946 | /* |
947 | * Sleep Wake debug buffer header |
948 | */ |
949 | typedef struct { |
950 | uint32_t signature; |
951 | uint32_t alloc_size; |
952 | uint32_t crc; /* CRC for spindump & following data.*/ |
953 | uint32_t spindump_offset; /* Offset at which spindump offset is stored */ |
954 | uint32_t spindump_size; |
955 | uint8_t is_osx_watchdog; |
956 | |
957 | /* All members from UUID onwards are saved into log file */ |
958 | char UUID[44]; |
959 | char spindump_status[24]; /* stackshot status*/ |
960 | char PMStatusCode[32]; |
961 | char reason[32]; |
962 | } swd_hdr; |
963 | |
964 | |
965 | #define SWD_HDR_SIGNATURE 0xdeb8da2a |
966 | |
967 | #define SWD_STACKSHOT_SIZE (40*PAGE_SIZE) |
968 | #define SWD_COMPRESSED_BUFSIZE (5*PAGE_SIZE) |
969 | #define SWD_ZLIB_BUFSIZE (10*PAGE_SIZE) |
970 | #define SWD_STACKSHOT_VAR_PREFIX "sleepwake_diags" |
971 | |
972 | #define SWD_SPINDUMP_SIZE (256*1024) |
973 | #define SWD_INITIAL_SPINDUMP_SIZE ((SWD_SPINDUMP_SIZE/2)-sizeof(swd_hdr)) |
974 | #define SWD_MAX_STACKSHOTS (10) |
975 | |
976 | /* Bits in swd_flags */ |
977 | #define SWD_WDOG_ENABLED 0x01 |
978 | #define SWD_BOOT_BY_SW_WDOG 0x02 |
979 | #define SWD_BOOT_BY_OSX_WDOG 0x04 |
980 | #define SWD_VALID_LOGS 0x08 |
981 | #define SWD_LOGS_IN_FILE 0x10 |
982 | #define SWD_LOGS_IN_MEM 0x20 |
983 | #define SWD_PWR_BTN_STACKSHOT 0x30 |
984 | |
985 | #define SWD_DATA_CRC_ERROR 0x010000 |
986 | #define SWD_BUF_SIZE_ERROR 0x020000 |
987 | #define SWD_HDR_SIZE_ERROR 0x040000 |
988 | #define SWD_FILEOP_ERROR 0x080000 |
989 | #define SWD_HDR_SIGNATURE_ERROR 0x100000 |
990 | #define SWD_INTERNAL_FAILURE 0x200000 |
991 | |
992 | |
993 | /* Filenames associated with the stackshots/logs generated by the SWD */ |
994 | #define kOSWatchdogStacksFilename "/var/log/OSXWatchdogStacks.gz" |
995 | #define kOSWatchdogFailureStringFile "/var/log/OSWatchdogFailureString.txt" |
996 | #define kSleepWakeStacksFilename "/var/log/SleepWakeStacks.gz" |
997 | #define kSleepWakeFailureStringFile "/var/log/SleepWakeFailureString.txt" |
998 | |
999 | |
1000 | /* RootDomain IOReporting channels */ |
1001 | #define kSleepCntChID IOREPORT_MAKEID('S','l','e','e','p','C','n','t') |
1002 | #define kDarkWkCntChID IOREPORT_MAKEID('G','U','I','W','k','C','n','t') |
1003 | #define kUserWkCntChID IOREPORT_MAKEID('D','r','k','W','k','C','n','t') |
1004 | |
1005 | /* |
1006 | * kAssertDelayChID - Histogram of time elapsed before assertion after wake. |
1007 | */ |
1008 | #define kAssertDelayBcktCnt 11 |
1009 | #define kAssertDelayBcktSize 3 |
1010 | #define kAssertDelayChID IOREPORT_MAKEID('r','d','A','s','r','t','D','l') |
1011 | |
1012 | /* |
1013 | * kSleepDelaysChID - Histogram of time taken to put system to sleep |
1014 | */ |
1015 | #define kSleepDelaysBcktCnt 13 |
1016 | #define kSleepDelaysBcktSize 10 |
1017 | #define kSleepDelaysChID IOREPORT_MAKEID('r','d','S','l','p','D','l','y') |
1018 | |
1019 | /* Sleep Options/settings */ |
1020 | #define kSleepOptionDisplayCapturedModeKey "DisplayCapturedMode" |
1021 | |
1022 | |
1023 | #if defined(KERNEL) && defined(__cplusplus) |
1024 | |
1025 | /*! |
1026 | * @defined kIOPMInstallSystemSleepPolicyHandlerKey |
1027 | * @abstract Name of the platform function to install a sleep policy handler. |
1028 | * @discussion Pass to IOPMrootDomain::callPlatformFunction(), with a pointer |
1029 | * to the C-function handler at param1, and an optional target at param2, to |
1030 | * register a sleep policy handler. Only a single sleep policy handler can |
1031 | * be installed. |
1032 | */ |
1033 | #define kIOPMInstallSystemSleepPolicyHandlerKey \ |
1034 | "IOPMInstallSystemSleepPolicyHandler" |
1035 | |
1036 | typedef IOReturn (*IOPMSystemSleepPolicyHandler)( |
1037 | void * target, |
1038 | const IOPMSystemSleepPolicyVariables * vars, |
1039 | IOPMSystemSleepParameters * params ); |
1040 | |
1041 | #endif /* KERNEL */ |
1042 | |
1043 | /***************************************************************************** |
1044 | * |
1045 | * Performance Warning |
1046 | * |
1047 | *****************************************************************************/ |
1048 | |
1049 | /* Performance Warning Key |
1050 | * Key for performance warning event published using IOPMrootDomain:: |
1051 | * systemPowerEventOccurred() |
1052 | */ |
1053 | #define kIOPMPerformanceWarningKey "Performance_Warning" |
1054 | |
1055 | /* Performance warning values */ |
1056 | enum { |
1057 | kIOPMPerformanceNormal = 0, |
1058 | kIOPMPerformanceWarning = 100 |
1059 | }; |
1060 | |
1061 | |
1062 | #endif /* _IOKIT_IOPMPRIVATE_H */ |
1063 | |