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