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