]>
Commit | Line | Data |
---|---|---|
3a60a9f5 A |
1 | /* |
2 | * Copyright (c) 2004 Apple Computer, Inc. All rights reserved. | |
3 | * | |
2d21ac55 | 4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ |
3a60a9f5 | 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. | |
8f6c56a5 | 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. | |
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 | |
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. | |
8f6c56a5 | 25 | * |
2d21ac55 | 26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ |
3a60a9f5 A |
27 | */ |
28 | ||
29 | #include <stdint.h> | |
30 | ||
31 | #ifdef __cplusplus | |
32 | extern "C" { | |
33 | #endif | |
34 | ||
35 | #ifdef KERNEL | |
316670eb | 36 | #include <libkern/crypto/aes.h> |
6d2010ae | 37 | #include <uuid/uuid.h> |
5ba3f43e A |
38 | #include <kern/debug.h> |
39 | ||
40 | extern int kdb_printf(const char *format, ...) __printflike(1,2); | |
3a60a9f5 A |
41 | #endif |
42 | ||
316670eb A |
43 | #ifndef __IOKIT_IOHIBERNATEPRIVATE_H |
44 | #define __IOKIT_IOHIBERNATEPRIVATE_H | |
45 | ||
3a60a9f5 A |
46 | struct IOPolledFileExtent |
47 | { | |
48 | uint64_t start; | |
49 | uint64_t length; | |
50 | }; | |
51 | typedef struct IOPolledFileExtent IOPolledFileExtent; | |
52 | ||
53 | struct IOHibernateImageHeader | |
54 | { | |
55 | uint64_t imageSize; | |
56 | uint64_t image1Size; | |
57 | ||
6d2010ae A |
58 | uint32_t restore1CodePhysPage; |
59 | uint32_t reserved1; | |
60 | uint64_t restore1CodeVirt; | |
3a60a9f5 A |
61 | uint32_t restore1PageCount; |
62 | uint32_t restore1CodeOffset; | |
63 | uint32_t restore1StackOffset; | |
64 | ||
65 | uint32_t pageCount; | |
66 | uint32_t bitmapSize; | |
67 | ||
68 | uint32_t restore1Sum; | |
69 | uint32_t image1Sum; | |
70 | uint32_t image2Sum; | |
71 | ||
72 | uint32_t actualRestore1Sum; | |
73 | uint32_t actualImage1Sum; | |
74 | uint32_t actualImage2Sum; | |
75 | ||
76 | uint32_t actualUncompressedPages; | |
77 | uint32_t conflictCount; | |
78 | uint32_t nextFree; | |
79 | ||
80 | uint32_t signature; | |
81 | uint32_t processorFlags; | |
82 | ||
0c530ab8 A |
83 | uint32_t runtimePages; |
84 | uint32_t runtimePageCount; | |
b0d623f7 | 85 | uint64_t runtimeVirtualPages __attribute__ ((packed)); |
d1ecb069 A |
86 | |
87 | uint32_t performanceDataStart; | |
88 | uint32_t performanceDataSize; | |
3a60a9f5 | 89 | |
b0d623f7 A |
90 | uint64_t encryptStart __attribute__ ((packed)); |
91 | uint64_t machineSignature __attribute__ ((packed)); | |
3a60a9f5 A |
92 | |
93 | uint32_t previewSize; | |
94 | uint32_t previewPageListSize; | |
95 | ||
96 | uint32_t diag[4]; | |
97 | ||
6d2010ae A |
98 | uint32_t handoffPages; |
99 | uint32_t handoffPageCount; | |
100 | ||
0c530ab8 A |
101 | uint32_t systemTableOffset; |
102 | ||
b0d623f7 | 103 | uint32_t debugFlags; |
0b4c1975 | 104 | uint32_t options; |
316670eb | 105 | uint32_t sleepTime; |
db609669 | 106 | uint32_t compression; |
b0d623f7 | 107 | |
39236c6e A |
108 | uint32_t reserved[58]; // make sizeof == 512 |
109 | uint32_t booterTime0; | |
110 | uint32_t booterTime1; | |
111 | uint32_t booterTime2; | |
112 | ||
113 | uint32_t booterStart; | |
114 | uint32_t smcStart; | |
115 | uint32_t connectDisplayTime; | |
116 | uint32_t splashTime; | |
117 | uint32_t booterTime; | |
118 | uint32_t trampolineTime; | |
0b4c1975 A |
119 | |
120 | uint64_t encryptEnd __attribute__ ((packed)); | |
121 | uint64_t deviceBase __attribute__ ((packed)); | |
39236c6e | 122 | uint32_t deviceBlockSize; |
3a60a9f5 A |
123 | |
124 | uint32_t fileExtentMapSize; | |
125 | IOPolledFileExtent fileExtentMap[2]; | |
126 | }; | |
127 | typedef struct IOHibernateImageHeader IOHibernateImageHeader; | |
128 | ||
b0d623f7 A |
129 | enum |
130 | { | |
131 | kIOHibernateDebugRestoreLogs = 0x00000001 | |
132 | }; | |
3a60a9f5 | 133 | |
0b4c1975 A |
134 | // options & IOHibernateOptions property |
135 | enum | |
136 | { | |
137 | kIOHibernateOptionSSD = 0x00000001, | |
138 | kIOHibernateOptionColor = 0x00000002, | |
139 | kIOHibernateOptionProgress = 0x00000004, | |
140 | kIOHibernateOptionDarkWake = 0x00000008, | |
141 | }; | |
142 | ||
3a60a9f5 A |
143 | struct hibernate_bitmap_t |
144 | { | |
145 | uint32_t first_page; | |
146 | uint32_t last_page; | |
147 | uint32_t bitmapwords; | |
148 | uint32_t bitmap[0]; | |
149 | }; | |
150 | typedef struct hibernate_bitmap_t hibernate_bitmap_t; | |
151 | ||
152 | struct hibernate_page_list_t | |
153 | { | |
154 | uint32_t list_size; | |
155 | uint32_t page_count; | |
156 | uint32_t bank_count; | |
157 | hibernate_bitmap_t bank_bitmap[0]; | |
158 | }; | |
159 | typedef struct hibernate_page_list_t hibernate_page_list_t; | |
160 | ||
2d21ac55 A |
161 | #if defined(_AES_H) |
162 | ||
3a60a9f5 A |
163 | struct hibernate_cryptwakevars_t |
164 | { | |
3a60a9f5 | 165 | uint8_t aes_iv[AES_BLOCK_SIZE]; |
3a60a9f5 A |
166 | }; |
167 | typedef struct hibernate_cryptwakevars_t hibernate_cryptwakevars_t; | |
168 | ||
169 | struct hibernate_cryptvars_t | |
170 | { | |
3a60a9f5 A |
171 | uint8_t aes_iv[AES_BLOCK_SIZE]; |
172 | aes_ctx ctx; | |
3a60a9f5 A |
173 | }; |
174 | typedef struct hibernate_cryptvars_t hibernate_cryptvars_t; | |
175 | ||
2d21ac55 A |
176 | #endif /* defined(_AES_H) */ |
177 | ||
6d2010ae A |
178 | enum |
179 | { | |
180 | kIOHibernateHandoffType = 0x686f0000, | |
181 | kIOHibernateHandoffTypeEnd = kIOHibernateHandoffType + 0, | |
182 | kIOHibernateHandoffTypeGraphicsInfo = kIOHibernateHandoffType + 1, | |
183 | kIOHibernateHandoffTypeCryptVars = kIOHibernateHandoffType + 2, | |
184 | kIOHibernateHandoffTypeMemoryMap = kIOHibernateHandoffType + 3, | |
185 | kIOHibernateHandoffTypeDeviceTree = kIOHibernateHandoffType + 4, | |
186 | kIOHibernateHandoffTypeDeviceProperties = kIOHibernateHandoffType + 5, | |
187 | kIOHibernateHandoffTypeKeyStore = kIOHibernateHandoffType + 6, | |
188 | }; | |
189 | ||
190 | struct IOHibernateHandoff | |
191 | { | |
192 | uint32_t type; | |
193 | uint32_t bytecount; | |
194 | uint8_t data[]; | |
195 | }; | |
196 | typedef struct IOHibernateHandoff IOHibernateHandoff; | |
3a60a9f5 A |
197 | |
198 | enum | |
199 | { | |
200 | kIOHibernateProgressCount = 19, | |
201 | kIOHibernateProgressWidth = 7, | |
202 | kIOHibernateProgressHeight = 16, | |
203 | kIOHibernateProgressSpacing = 3, | |
204 | kIOHibernateProgressOriginY = 81, | |
205 | ||
206 | kIOHibernateProgressSaveUnderSize = 2*5+14*2, | |
207 | ||
208 | kIOHibernateProgressLightGray = 230, | |
209 | kIOHibernateProgressMidGray = 174, | |
210 | kIOHibernateProgressDarkGray = 92 | |
211 | }; | |
212 | ||
2d21ac55 A |
213 | enum |
214 | { | |
215 | kIOHibernatePostWriteSleep = 0, | |
216 | kIOHibernatePostWriteWake = 1, | |
217 | kIOHibernatePostWriteHalt = 2, | |
218 | kIOHibernatePostWriteRestart = 3 | |
219 | }; | |
220 | ||
221 | ||
3a60a9f5 A |
222 | struct hibernate_graphics_t |
223 | { | |
39037602 | 224 | uint64_t physicalAddress; // Base address of video memory |
0b4c1975 | 225 | int32_t gfxStatus; // EFI config restore status |
0c530ab8 A |
226 | uint32_t rowBytes; // Number of bytes per pixel row |
227 | uint32_t width; // Width | |
228 | uint32_t height; // Height | |
229 | uint32_t depth; // Pixel Depth | |
230 | ||
231 | uint8_t progressSaveUnder[kIOHibernateProgressCount][kIOHibernateProgressSaveUnderSize]; | |
3a60a9f5 A |
232 | }; |
233 | typedef struct hibernate_graphics_t hibernate_graphics_t; | |
234 | ||
235 | #define DECLARE_IOHIBERNATEPROGRESSALPHA \ | |
236 | static const uint8_t gIOHibernateProgressAlpha \ | |
237 | [kIOHibernateProgressHeight][kIOHibernateProgressWidth] = \ | |
238 | { \ | |
239 | { 0x00,0x63,0xd8,0xf0,0xd8,0x63,0x00 }, \ | |
240 | { 0x51,0xff,0xff,0xff,0xff,0xff,0x51 }, \ | |
241 | { 0xae,0xff,0xff,0xff,0xff,0xff,0xae }, \ | |
242 | { 0xc3,0xff,0xff,0xff,0xff,0xff,0xc3 }, \ | |
243 | { 0xc3,0xff,0xff,0xff,0xff,0xff,0xc3 }, \ | |
244 | { 0xc3,0xff,0xff,0xff,0xff,0xff,0xc3 }, \ | |
245 | { 0xc3,0xff,0xff,0xff,0xff,0xff,0xc3 }, \ | |
246 | { 0xc3,0xff,0xff,0xff,0xff,0xff,0xc3 }, \ | |
247 | { 0xc3,0xff,0xff,0xff,0xff,0xff,0xc3 }, \ | |
248 | { 0xc3,0xff,0xff,0xff,0xff,0xff,0xc3 }, \ | |
249 | { 0xc3,0xff,0xff,0xff,0xff,0xff,0xc3 }, \ | |
250 | { 0xc3,0xff,0xff,0xff,0xff,0xff,0xc3 }, \ | |
251 | { 0xc3,0xff,0xff,0xff,0xff,0xff,0xc3 }, \ | |
252 | { 0xae,0xff,0xff,0xff,0xff,0xff,0xae }, \ | |
253 | { 0x54,0xff,0xff,0xff,0xff,0xff,0x54 }, \ | |
254 | { 0x00,0x66,0xdb,0xf3,0xdb,0x66,0x00 } \ | |
255 | }; | |
256 | ||
316670eb A |
257 | struct hibernate_preview_t |
258 | { | |
259 | uint32_t imageCount; // Number of images | |
260 | uint32_t width; // Width | |
261 | uint32_t height; // Height | |
262 | uint32_t depth; // Pixel Depth | |
263 | uint32_t lockTime; // Lock time | |
264 | uint32_t reservedG[8]; // reserved | |
265 | uint32_t reservedK[8]; // reserved | |
266 | }; | |
267 | typedef struct hibernate_preview_t hibernate_preview_t; | |
268 | ||
39236c6e A |
269 | struct hibernate_statistics_t |
270 | { | |
271 | uint64_t image1Size; | |
272 | uint64_t imageSize; | |
273 | uint32_t image1Pages; | |
274 | uint32_t imagePages; | |
275 | uint32_t booterStart; | |
276 | uint32_t smcStart; | |
277 | uint32_t booterDuration; | |
278 | uint32_t booterConnectDisplayDuration; | |
279 | uint32_t booterSplashDuration; | |
280 | uint32_t booterDuration0; | |
281 | uint32_t booterDuration1; | |
282 | uint32_t booterDuration2; | |
283 | uint32_t trampolineDuration; | |
284 | uint32_t kernelImageReadDuration; | |
285 | ||
286 | uint32_t graphicsReadyTime; | |
287 | uint32_t wakeNotificationTime; | |
288 | uint32_t lockScreenReadyTime; | |
289 | uint32_t hidReadyTime; | |
290 | ||
291 | uint32_t wakeCapability; | |
292 | uint32_t resvA[15]; | |
293 | }; | |
294 | typedef struct hibernate_statistics_t hibernate_statistics_t; | |
295 | ||
296 | #define kIOSysctlHibernateStatistics "kern.hibernatestatistics" | |
297 | #define kIOSysctlHibernateGraphicsReady "kern.hibernategraphicsready" | |
298 | #define kIOSysctlHibernateWakeNotify "kern.hibernatewakenotification" | |
299 | #define kIOSysctlHibernateScreenReady "kern.hibernatelockscreenready" | |
300 | #define kIOSysctlHibernateHIDReady "kern.hibernatehidready" | |
301 | ||
3a60a9f5 A |
302 | #ifdef KERNEL |
303 | ||
304 | #ifdef __cplusplus | |
305 | ||
306 | void IOHibernateSystemInit(IOPMrootDomain * rootDomain); | |
307 | ||
308 | IOReturn IOHibernateSystemSleep(void); | |
3e170ce0 | 309 | void IOOpenDebugDataFile(const char *fname, uint64_t size); |
39037602 | 310 | void IOCloseDebugDataFile(); |
316670eb | 311 | IOReturn IOHibernateIOKitSleep(void); |
3a60a9f5 A |
312 | IOReturn IOHibernateSystemHasSlept(void); |
313 | IOReturn IOHibernateSystemWake(void); | |
5ba3f43e | 314 | IOReturn IOHibernateSystemPostWake(bool now); |
d190cdc3 | 315 | uint32_t IOHibernateWasScreenLocked(void); |
316670eb | 316 | void IOHibernateSetScreenLocked(uint32_t lockState); |
39236c6e | 317 | void IOHibernateSetWakeCapabilities(uint32_t capability); |
99c3a104 | 318 | void IOHibernateSystemRestart(void); |
3a60a9f5 A |
319 | |
320 | #endif /* __cplusplus */ | |
321 | ||
8a3053a0 A |
322 | void |
323 | vm_compressor_do_warmup(void); | |
324 | ||
fe8ab488 | 325 | |
3a60a9f5 | 326 | hibernate_page_list_t * |
db609669 | 327 | hibernate_page_list_allocate(boolean_t log); |
3a60a9f5 | 328 | |
39236c6e A |
329 | kern_return_t |
330 | hibernate_alloc_page_lists( | |
331 | hibernate_page_list_t ** page_list_ret, | |
332 | hibernate_page_list_t ** page_list_wired_ret, | |
333 | hibernate_page_list_t ** page_list_pal_ret); | |
334 | ||
3a60a9f5 A |
335 | kern_return_t |
336 | hibernate_setup(IOHibernateImageHeader * header, | |
0b4c1975 | 337 | boolean_t vmflush, |
39236c6e A |
338 | hibernate_page_list_t * page_list, |
339 | hibernate_page_list_t * page_list_wired, | |
340 | hibernate_page_list_t * page_list_pal); | |
341 | ||
3a60a9f5 A |
342 | kern_return_t |
343 | hibernate_teardown(hibernate_page_list_t * page_list, | |
99c3a104 A |
344 | hibernate_page_list_t * page_list_wired, |
345 | hibernate_page_list_t * page_list_pal); | |
3a60a9f5 | 346 | |
39037602 A |
347 | kern_return_t |
348 | hibernate_pin_swap(boolean_t begin); | |
349 | ||
3a60a9f5 A |
350 | kern_return_t |
351 | hibernate_processor_setup(IOHibernateImageHeader * header); | |
352 | ||
b0d623f7 A |
353 | void |
354 | hibernate_gobble_pages(uint32_t gobble_count, uint32_t free_page_time); | |
355 | void | |
356 | hibernate_free_gobble_pages(void); | |
357 | ||
db609669 A |
358 | void |
359 | hibernate_vm_lock_queues(void); | |
360 | void | |
361 | hibernate_vm_unlock_queues(void); | |
362 | ||
3a60a9f5 A |
363 | void |
364 | hibernate_vm_lock(void); | |
365 | void | |
366 | hibernate_vm_unlock(void); | |
5ba3f43e A |
367 | void |
368 | hibernate_vm_lock_end(void); | |
369 | boolean_t | |
370 | hibernate_vm_locks_are_safe(void); | |
3a60a9f5 | 371 | |
0c530ab8 | 372 | // mark pages not to be saved, based on VM system accounting |
3a60a9f5 A |
373 | void |
374 | hibernate_page_list_setall(hibernate_page_list_t * page_list, | |
375 | hibernate_page_list_t * page_list_wired, | |
6d2010ae | 376 | hibernate_page_list_t * page_list_pal, |
39236c6e A |
377 | boolean_t preflight, |
378 | boolean_t discard_all, | |
3a60a9f5 A |
379 | uint32_t * pagesOut); |
380 | ||
0c530ab8 A |
381 | // mark pages to be saved, or pages not to be saved but available |
382 | // for scratch usage during restore | |
3a60a9f5 A |
383 | void |
384 | hibernate_page_list_setall_machine(hibernate_page_list_t * page_list, | |
385 | hibernate_page_list_t * page_list_wired, | |
db609669 | 386 | boolean_t preflight, |
3a60a9f5 | 387 | uint32_t * pagesOut); |
0c530ab8 A |
388 | |
389 | // mark pages not to be saved and not for scratch usage during restore | |
390 | void | |
391 | hibernate_page_list_set_volatile( hibernate_page_list_t * page_list, | |
392 | hibernate_page_list_t * page_list_wired, | |
393 | uint32_t * pagesOut); | |
394 | ||
3a60a9f5 A |
395 | void |
396 | hibernate_page_list_discard(hibernate_page_list_t * page_list); | |
397 | ||
0b4c1975 A |
398 | int |
399 | hibernate_should_abort(void); | |
400 | ||
3a60a9f5 A |
401 | void |
402 | hibernate_set_page_state(hibernate_page_list_t * page_list, hibernate_page_list_t * page_list_wired, | |
403 | vm_offset_t ppnum, vm_offset_t count, uint32_t kind); | |
404 | ||
405 | void | |
406 | hibernate_page_bitset(hibernate_page_list_t * list, boolean_t set, uint32_t page); | |
0c530ab8 | 407 | |
3a60a9f5 A |
408 | boolean_t |
409 | hibernate_page_bittst(hibernate_page_list_t * list, uint32_t page); | |
410 | ||
0c530ab8 A |
411 | hibernate_bitmap_t * |
412 | hibernate_page_bitmap_pin(hibernate_page_list_t * list, uint32_t * page); | |
413 | ||
3a60a9f5 | 414 | uint32_t |
0c530ab8 | 415 | hibernate_page_bitmap_count(hibernate_bitmap_t * bitmap, uint32_t set, uint32_t page); |
3a60a9f5 | 416 | |
6d2010ae | 417 | uintptr_t |
3a60a9f5 A |
418 | hibernate_restore_phys_page(uint64_t src, uint64_t dst, uint32_t len, uint32_t procFlags); |
419 | ||
420 | void | |
421 | hibernate_machine_init(void); | |
2d21ac55 A |
422 | |
423 | uint32_t | |
3a60a9f5 A |
424 | hibernate_write_image(void); |
425 | ||
426 | long | |
7ddcb079 | 427 | hibernate_machine_entrypoint(uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4); |
3a60a9f5 | 428 | long |
7ddcb079 | 429 | hibernate_kernel_entrypoint(uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4); |
0c530ab8 A |
430 | void |
431 | hibernate_newruntime_map(void * map, vm_size_t map_size, | |
432 | uint32_t system_table_offset); | |
433 | ||
3a60a9f5 A |
434 | |
435 | extern uint32_t gIOHibernateState; | |
436 | extern uint32_t gIOHibernateMode; | |
b0d623f7 | 437 | extern uint32_t gIOHibernateDebugFlags; |
3a60a9f5 | 438 | extern uint32_t gIOHibernateFreeTime; // max time to spend freeing pages (ms) |
39037602 | 439 | extern boolean_t gIOHibernateStandbyDisabled; |
3a60a9f5 A |
440 | extern uint8_t gIOHibernateRestoreStack[]; |
441 | extern uint8_t gIOHibernateRestoreStackEnd[]; | |
442 | extern IOHibernateImageHeader * gIOHibernateCurrentHeader; | |
3a60a9f5 | 443 | |
5ba3f43e A |
444 | #define HIBLOGFROMPANIC(fmt, args...) \ |
445 | { if (kernel_debugger_entry_count) { kdb_printf(fmt, ## args); } } | |
446 | ||
3a60a9f5 | 447 | #define HIBLOG(fmt, args...) \ |
5ba3f43e | 448 | { if (kernel_debugger_entry_count) { kdb_printf(fmt, ## args); } else { kprintf(fmt, ## args); printf(fmt, ## args); } } |
3a60a9f5 A |
449 | |
450 | #define HIBPRINT(fmt, args...) \ | |
5ba3f43e A |
451 | { if (kernel_debugger_entry_count) { kdb_printf(fmt, ## args); } else { kprintf(fmt, ## args); } } |
452 | ||
3a60a9f5 A |
453 | |
454 | #endif /* KERNEL */ | |
455 | ||
456 | // gIOHibernateState, kIOHibernateStateKey | |
457 | enum | |
458 | { | |
459 | kIOHibernateStateInactive = 0, | |
460 | kIOHibernateStateHibernating = 1, /* writing image */ | |
461 | kIOHibernateStateWakingFromHibernate = 2 /* booted and restored image */ | |
462 | }; | |
463 | ||
464 | // gIOHibernateMode, kIOHibernateModeKey | |
465 | enum | |
466 | { | |
467 | kIOHibernateModeOn = 0x00000001, | |
468 | kIOHibernateModeSleep = 0x00000002, | |
469 | kIOHibernateModeEncrypt = 0x00000004, | |
3a60a9f5 | 470 | kIOHibernateModeDiscardCleanInactive = 0x00000008, |
2d21ac55 A |
471 | kIOHibernateModeDiscardCleanActive = 0x00000010, |
472 | kIOHibernateModeSwitch = 0x00000020, | |
0b4c1975 A |
473 | kIOHibernateModeRestart = 0x00000040, |
474 | kIOHibernateModeSSDInvert = 0x00000080, | |
db609669 | 475 | kIOHibernateModeFileResize = 0x00000100, |
3a60a9f5 A |
476 | }; |
477 | ||
478 | // IOHibernateImageHeader.signature | |
479 | enum | |
480 | { | |
481 | kIOHibernateHeaderSignature = 0x73696d65, | |
fe8ab488 A |
482 | kIOHibernateHeaderInvalidSignature = 0x7a7a7a7a, |
483 | kIOHibernateHeaderOpenSignature = 0xf1e0be9d, | |
484 | kIOHibernateHeaderDebugDataSignature = 0xfcddfcdd | |
3a60a9f5 A |
485 | }; |
486 | ||
487 | // kind for hibernate_set_page_state() | |
488 | enum | |
489 | { | |
490 | kIOHibernatePageStateFree = 0, | |
491 | kIOHibernatePageStateWiredSave = 1, | |
492 | kIOHibernatePageStateUnwiredSave = 2 | |
493 | }; | |
494 | ||
495 | #define kIOHibernateModeKey "Hibernate Mode" | |
496 | #define kIOHibernateFileKey "Hibernate File" | |
db609669 A |
497 | #define kIOHibernateFileMinSizeKey "Hibernate File Min" |
498 | #define kIOHibernateFileMaxSizeKey "Hibernate File Max" | |
3a60a9f5 A |
499 | #define kIOHibernateFreeRatioKey "Hibernate Free Ratio" |
500 | #define kIOHibernateFreeTimeKey "Hibernate Free Time" | |
501 | ||
502 | #define kIOHibernateStateKey "IOHibernateState" | |
503 | #define kIOHibernateFeatureKey "Hibernation" | |
504 | #define kIOHibernatePreviewBufferKey "IOPreviewBuffer" | |
505 | ||
316670eb | 506 | #ifndef kIOHibernatePreviewActiveKey |
2d21ac55 A |
507 | #define kIOHibernatePreviewActiveKey "IOHibernatePreviewActive" |
508 | // values for kIOHibernatePreviewActiveKey | |
509 | enum { | |
510 | kIOHibernatePreviewActive = 0x00000001, | |
511 | kIOHibernatePreviewUpdates = 0x00000002 | |
512 | }; | |
316670eb | 513 | #endif |
2d21ac55 | 514 | |
0b4c1975 A |
515 | #define kIOHibernateOptionsKey "IOHibernateOptions" |
516 | #define kIOHibernateGfxStatusKey "IOHibernateGfxStatus" | |
517 | enum { | |
518 | kIOHibernateGfxStatusUnknown = ((int32_t) 0xFFFFFFFF) | |
519 | }; | |
520 | ||
3a60a9f5 A |
521 | #define kIOHibernateBootImageKey "boot-image" |
522 | #define kIOHibernateBootImageKeyKey "boot-image-key" | |
523 | #define kIOHibernateBootSignatureKey "boot-signature" | |
524 | ||
525 | #define kIOHibernateMemorySignatureKey "memory-signature" | |
526 | #define kIOHibernateMemorySignatureEnvKey "mem-sig" | |
527 | #define kIOHibernateMachineSignatureKey "machine-signature" | |
528 | ||
0c530ab8 | 529 | #define kIOHibernateRTCVariablesKey "IOHibernateRTCVariables" |
6d2010ae | 530 | #define kIOHibernateSMCVariablesKey "IOHibernateSMCVariables" |
0c530ab8 | 531 | |
99c3a104 A |
532 | #define kIOHibernateBootSwitchVarsKey "boot-switch-vars" |
533 | ||
534 | #define kIOHibernateBootNoteKey "boot-note" | |
535 | ||
2d21ac55 | 536 | |
6d2010ae | 537 | #define kIOHibernateUseKernelInterpreter 0x80000000 |
2d21ac55 | 538 | |
316670eb A |
539 | enum |
540 | { | |
541 | kIOPreviewImageIndexDesktop = 0, | |
542 | kIOPreviewImageIndexLockScreen = 1, | |
543 | kIOPreviewImageCount = 2 | |
544 | }; | |
545 | ||
546 | enum | |
547 | { | |
548 | kIOScreenLockNoLock = 1, | |
549 | kIOScreenLockUnlocked = 2, | |
550 | kIOScreenLockLocked = 3, | |
551 | kIOScreenLockFileVaultDialog = 4, | |
552 | }; | |
553 | ||
d190cdc3 A |
554 | #define kIOScreenLockStateKey "IOScreenLockState" |
555 | #define kIOBooterScreenLockStateKey "IOBooterScreenLockState" | |
316670eb A |
556 | |
557 | #endif /* ! __IOKIT_IOHIBERNATEPRIVATE_H */ | |
558 | ||
3a60a9f5 A |
559 | #ifdef __cplusplus |
560 | } | |
561 | #endif |