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