]>
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); | |
3e170ce0 | 313 | void IOOpenDebugDataFile(const char *fname, uint64_t size); |
39037602 | 314 | void IOCloseDebugDataFile(); |
316670eb | 315 | IOReturn IOHibernateIOKitSleep(void); |
3a60a9f5 A |
316 | IOReturn IOHibernateSystemHasSlept(void); |
317 | IOReturn IOHibernateSystemWake(void); | |
5ba3f43e | 318 | IOReturn IOHibernateSystemPostWake(bool now); |
d190cdc3 | 319 | uint32_t IOHibernateWasScreenLocked(void); |
316670eb | 320 | void IOHibernateSetScreenLocked(uint32_t lockState); |
39236c6e | 321 | void IOHibernateSetWakeCapabilities(uint32_t capability); |
99c3a104 | 322 | void IOHibernateSystemRestart(void); |
3a60a9f5 A |
323 | |
324 | #endif /* __cplusplus */ | |
325 | ||
8a3053a0 A |
326 | void |
327 | vm_compressor_do_warmup(void); | |
328 | ||
fe8ab488 | 329 | |
3a60a9f5 | 330 | hibernate_page_list_t * |
db609669 | 331 | hibernate_page_list_allocate(boolean_t log); |
3a60a9f5 | 332 | |
a39ff7e2 | 333 | kern_return_t |
39236c6e A |
334 | hibernate_alloc_page_lists( |
335 | hibernate_page_list_t ** page_list_ret, | |
336 | hibernate_page_list_t ** page_list_wired_ret, | |
337 | hibernate_page_list_t ** page_list_pal_ret); | |
338 | ||
a39ff7e2 | 339 | kern_return_t |
3a60a9f5 | 340 | hibernate_setup(IOHibernateImageHeader * header, |
0b4c1975 | 341 | boolean_t vmflush, |
39236c6e A |
342 | hibernate_page_list_t * page_list, |
343 | hibernate_page_list_t * page_list_wired, | |
344 | hibernate_page_list_t * page_list_pal); | |
345 | ||
a39ff7e2 | 346 | kern_return_t |
3a60a9f5 | 347 | hibernate_teardown(hibernate_page_list_t * page_list, |
99c3a104 A |
348 | hibernate_page_list_t * page_list_wired, |
349 | hibernate_page_list_t * page_list_pal); | |
3a60a9f5 | 350 | |
a39ff7e2 | 351 | kern_return_t |
39037602 A |
352 | hibernate_pin_swap(boolean_t begin); |
353 | ||
a39ff7e2 | 354 | kern_return_t |
3a60a9f5 A |
355 | hibernate_processor_setup(IOHibernateImageHeader * header); |
356 | ||
b0d623f7 A |
357 | void |
358 | hibernate_gobble_pages(uint32_t gobble_count, uint32_t free_page_time); | |
359 | void | |
360 | hibernate_free_gobble_pages(void); | |
361 | ||
db609669 A |
362 | void |
363 | hibernate_vm_lock_queues(void); | |
364 | void | |
365 | hibernate_vm_unlock_queues(void); | |
366 | ||
3a60a9f5 A |
367 | void |
368 | hibernate_vm_lock(void); | |
369 | void | |
370 | hibernate_vm_unlock(void); | |
5ba3f43e A |
371 | void |
372 | hibernate_vm_lock_end(void); | |
373 | boolean_t | |
374 | hibernate_vm_locks_are_safe(void); | |
3a60a9f5 | 375 | |
0c530ab8 | 376 | // mark pages not to be saved, based on VM system accounting |
3a60a9f5 A |
377 | void |
378 | hibernate_page_list_setall(hibernate_page_list_t * page_list, | |
379 | hibernate_page_list_t * page_list_wired, | |
6d2010ae | 380 | hibernate_page_list_t * page_list_pal, |
a39ff7e2 | 381 | boolean_t preflight, |
39236c6e | 382 | boolean_t discard_all, |
3a60a9f5 A |
383 | uint32_t * pagesOut); |
384 | ||
a39ff7e2 | 385 | // mark pages to be saved, or pages not to be saved but available |
0c530ab8 | 386 | // for scratch usage during restore |
3a60a9f5 A |
387 | void |
388 | hibernate_page_list_setall_machine(hibernate_page_list_t * page_list, | |
389 | hibernate_page_list_t * page_list_wired, | |
db609669 | 390 | boolean_t preflight, |
3a60a9f5 | 391 | uint32_t * pagesOut); |
0c530ab8 A |
392 | |
393 | // mark pages not to be saved and not for scratch usage during restore | |
394 | void | |
395 | hibernate_page_list_set_volatile( hibernate_page_list_t * page_list, | |
396 | hibernate_page_list_t * page_list_wired, | |
397 | uint32_t * pagesOut); | |
398 | ||
3a60a9f5 A |
399 | void |
400 | hibernate_page_list_discard(hibernate_page_list_t * page_list); | |
401 | ||
0b4c1975 A |
402 | int |
403 | hibernate_should_abort(void); | |
404 | ||
3a60a9f5 A |
405 | void |
406 | hibernate_set_page_state(hibernate_page_list_t * page_list, hibernate_page_list_t * page_list_wired, | |
407 | vm_offset_t ppnum, vm_offset_t count, uint32_t kind); | |
408 | ||
a39ff7e2 | 409 | void |
3a60a9f5 | 410 | hibernate_page_bitset(hibernate_page_list_t * list, boolean_t set, uint32_t page); |
0c530ab8 | 411 | |
a39ff7e2 | 412 | boolean_t |
3a60a9f5 A |
413 | hibernate_page_bittst(hibernate_page_list_t * list, uint32_t page); |
414 | ||
0c530ab8 A |
415 | hibernate_bitmap_t * |
416 | hibernate_page_bitmap_pin(hibernate_page_list_t * list, uint32_t * page); | |
417 | ||
3a60a9f5 | 418 | uint32_t |
0c530ab8 | 419 | hibernate_page_bitmap_count(hibernate_bitmap_t * bitmap, uint32_t set, uint32_t page); |
3a60a9f5 | 420 | |
a39ff7e2 | 421 | uintptr_t |
3a60a9f5 A |
422 | hibernate_restore_phys_page(uint64_t src, uint64_t dst, uint32_t len, uint32_t procFlags); |
423 | ||
424 | void | |
425 | hibernate_machine_init(void); | |
2d21ac55 A |
426 | |
427 | uint32_t | |
3a60a9f5 A |
428 | hibernate_write_image(void); |
429 | ||
430 | long | |
7ddcb079 | 431 | hibernate_machine_entrypoint(uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4); |
3a60a9f5 | 432 | long |
7ddcb079 | 433 | hibernate_kernel_entrypoint(uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4); |
0c530ab8 | 434 | void |
a39ff7e2 | 435 | hibernate_newruntime_map(void * map, vm_size_t map_size, |
0c530ab8 A |
436 | uint32_t system_table_offset); |
437 | ||
3a60a9f5 A |
438 | |
439 | extern uint32_t gIOHibernateState; | |
440 | extern uint32_t gIOHibernateMode; | |
b0d623f7 | 441 | extern uint32_t gIOHibernateDebugFlags; |
3a60a9f5 | 442 | extern uint32_t gIOHibernateFreeTime; // max time to spend freeing pages (ms) |
39037602 | 443 | extern boolean_t gIOHibernateStandbyDisabled; |
3a60a9f5 A |
444 | extern uint8_t gIOHibernateRestoreStack[]; |
445 | extern uint8_t gIOHibernateRestoreStackEnd[]; | |
446 | extern IOHibernateImageHeader * gIOHibernateCurrentHeader; | |
3a60a9f5 | 447 | |
5ba3f43e A |
448 | #define HIBLOGFROMPANIC(fmt, args...) \ |
449 | { if (kernel_debugger_entry_count) { kdb_printf(fmt, ## args); } } | |
450 | ||
3a60a9f5 | 451 | #define HIBLOG(fmt, args...) \ |
5ba3f43e | 452 | { if (kernel_debugger_entry_count) { kdb_printf(fmt, ## args); } else { kprintf(fmt, ## args); printf(fmt, ## args); } } |
3a60a9f5 A |
453 | |
454 | #define HIBPRINT(fmt, args...) \ | |
5ba3f43e A |
455 | { if (kernel_debugger_entry_count) { kdb_printf(fmt, ## args); } else { kprintf(fmt, ## args); } } |
456 | ||
3a60a9f5 A |
457 | |
458 | #endif /* KERNEL */ | |
459 | ||
460 | // gIOHibernateState, kIOHibernateStateKey | |
461 | enum | |
462 | { | |
463 | kIOHibernateStateInactive = 0, | |
464 | kIOHibernateStateHibernating = 1, /* writing image */ | |
465 | kIOHibernateStateWakingFromHibernate = 2 /* booted and restored image */ | |
466 | }; | |
467 | ||
468 | // gIOHibernateMode, kIOHibernateModeKey | |
469 | enum | |
470 | { | |
471 | kIOHibernateModeOn = 0x00000001, | |
472 | kIOHibernateModeSleep = 0x00000002, | |
473 | kIOHibernateModeEncrypt = 0x00000004, | |
3a60a9f5 | 474 | kIOHibernateModeDiscardCleanInactive = 0x00000008, |
2d21ac55 A |
475 | kIOHibernateModeDiscardCleanActive = 0x00000010, |
476 | kIOHibernateModeSwitch = 0x00000020, | |
0b4c1975 A |
477 | kIOHibernateModeRestart = 0x00000040, |
478 | kIOHibernateModeSSDInvert = 0x00000080, | |
db609669 | 479 | kIOHibernateModeFileResize = 0x00000100, |
3a60a9f5 A |
480 | }; |
481 | ||
482 | // IOHibernateImageHeader.signature | |
483 | enum | |
484 | { | |
485 | kIOHibernateHeaderSignature = 0x73696d65, | |
fe8ab488 A |
486 | kIOHibernateHeaderInvalidSignature = 0x7a7a7a7a, |
487 | kIOHibernateHeaderOpenSignature = 0xf1e0be9d, | |
488 | kIOHibernateHeaderDebugDataSignature = 0xfcddfcdd | |
3a60a9f5 A |
489 | }; |
490 | ||
491 | // kind for hibernate_set_page_state() | |
492 | enum | |
493 | { | |
494 | kIOHibernatePageStateFree = 0, | |
495 | kIOHibernatePageStateWiredSave = 1, | |
496 | kIOHibernatePageStateUnwiredSave = 2 | |
497 | }; | |
498 | ||
499 | #define kIOHibernateModeKey "Hibernate Mode" | |
500 | #define kIOHibernateFileKey "Hibernate File" | |
db609669 A |
501 | #define kIOHibernateFileMinSizeKey "Hibernate File Min" |
502 | #define kIOHibernateFileMaxSizeKey "Hibernate File Max" | |
3a60a9f5 A |
503 | #define kIOHibernateFreeRatioKey "Hibernate Free Ratio" |
504 | #define kIOHibernateFreeTimeKey "Hibernate Free Time" | |
505 | ||
506 | #define kIOHibernateStateKey "IOHibernateState" | |
507 | #define kIOHibernateFeatureKey "Hibernation" | |
508 | #define kIOHibernatePreviewBufferKey "IOPreviewBuffer" | |
509 | ||
316670eb | 510 | #ifndef kIOHibernatePreviewActiveKey |
2d21ac55 A |
511 | #define kIOHibernatePreviewActiveKey "IOHibernatePreviewActive" |
512 | // values for kIOHibernatePreviewActiveKey | |
513 | enum { | |
514 | kIOHibernatePreviewActive = 0x00000001, | |
515 | kIOHibernatePreviewUpdates = 0x00000002 | |
516 | }; | |
316670eb | 517 | #endif |
2d21ac55 | 518 | |
0b4c1975 A |
519 | #define kIOHibernateOptionsKey "IOHibernateOptions" |
520 | #define kIOHibernateGfxStatusKey "IOHibernateGfxStatus" | |
521 | enum { | |
522 | kIOHibernateGfxStatusUnknown = ((int32_t) 0xFFFFFFFF) | |
523 | }; | |
524 | ||
3a60a9f5 A |
525 | #define kIOHibernateBootImageKey "boot-image" |
526 | #define kIOHibernateBootImageKeyKey "boot-image-key" | |
527 | #define kIOHibernateBootSignatureKey "boot-signature" | |
528 | ||
529 | #define kIOHibernateMemorySignatureKey "memory-signature" | |
530 | #define kIOHibernateMemorySignatureEnvKey "mem-sig" | |
531 | #define kIOHibernateMachineSignatureKey "machine-signature" | |
532 | ||
0c530ab8 | 533 | #define kIOHibernateRTCVariablesKey "IOHibernateRTCVariables" |
6d2010ae | 534 | #define kIOHibernateSMCVariablesKey "IOHibernateSMCVariables" |
0c530ab8 | 535 | |
99c3a104 A |
536 | #define kIOHibernateBootSwitchVarsKey "boot-switch-vars" |
537 | ||
538 | #define kIOHibernateBootNoteKey "boot-note" | |
539 | ||
2d21ac55 | 540 | |
6d2010ae | 541 | #define kIOHibernateUseKernelInterpreter 0x80000000 |
2d21ac55 | 542 | |
316670eb A |
543 | enum |
544 | { | |
a39ff7e2 A |
545 | kIOPreviewImageIndexDesktop = 0, |
546 | kIOPreviewImageIndexLockScreen = 1, | |
316670eb A |
547 | kIOPreviewImageCount = 2 |
548 | }; | |
549 | ||
550 | enum | |
551 | { | |
552 | kIOScreenLockNoLock = 1, | |
553 | kIOScreenLockUnlocked = 2, | |
554 | kIOScreenLockLocked = 3, | |
555 | kIOScreenLockFileVaultDialog = 4, | |
a39ff7e2 | 556 | }; |
316670eb | 557 | |
d190cdc3 A |
558 | #define kIOScreenLockStateKey "IOScreenLockState" |
559 | #define kIOBooterScreenLockStateKey "IOBooterScreenLockState" | |
316670eb A |
560 | |
561 | #endif /* ! __IOKIT_IOHIBERNATEPRIVATE_H */ | |
562 | ||
3a60a9f5 A |
563 | #ifdef __cplusplus |
564 | } | |
565 | #endif |