]> git.saurik.com Git - apple/xnu.git/blob - iokit/Kernel/IOHibernateInternal.h
04b5fd3eb92ab6b0ae47c08486931b5289649e92
[apple/xnu.git] / iokit / Kernel / IOHibernateInternal.h
1 /*
2 * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22
23 #include <stdint.h>
24
25 #ifdef __cplusplus
26
27 enum { kIOHibernateAESKeySize = 128 }; /* bits */
28
29 struct IOHibernateVars
30 {
31 hibernate_page_list_t * page_list;
32 hibernate_page_list_t * page_list_wired;
33 class IOBufferMemoryDescriptor * ioBuffer;
34 class IOBufferMemoryDescriptor * srcBuffer;
35 class IOMemoryDescriptor * previewBuffer;
36 OSData * previewData;
37 OSData * fileExtents;
38 OSObject * saveBootDevice;
39
40 struct IOPolledFileIOVars * fileVars;
41 vm_offset_t videoMapping;
42 vm_size_t videoAllocSize;
43 vm_size_t videoMapSize;
44 uint8_t haveFastBoot;
45 uint8_t saveBootAudioVolume;
46 uint8_t wiredCryptKey[kIOHibernateAESKeySize / 8];
47 uint8_t cryptKey[kIOHibernateAESKeySize / 8];
48 };
49 typedef struct IOHibernateVars IOHibernateVars;
50
51
52 struct IOPolledFileIOVars
53 {
54 struct kern_direct_file_io_ref_t * fileRef;
55 class OSArray * pollers;
56 IOByteCount blockSize;
57 uint8_t * buffer;
58 IOByteCount bufferSize;
59 IOByteCount bufferLimit;
60 IOByteCount bufferOffset;
61 IOByteCount bufferHalf;
62 IOByteCount extentRemaining;
63 IOByteCount lastRead;
64 uint64_t block0;
65 uint64_t position;
66 uint64_t extentPosition;
67 uint64_t encryptStart;
68 IOPolledFileExtent * extentMap;
69 IOPolledFileExtent * currentExtent;
70 bool io;
71 IOReturn ioStatus;
72 };
73 typedef struct IOPolledFileIOVars IOPolledFileIOVars;
74
75 #endif /* __cplusplus */
76
77 enum
78 {
79 kIOHibernateTagSignature = 0x53000000,
80 kIOHibernateTagLength = 0x00001fff,
81 };
82
83 #ifdef __cplusplus
84 extern "C"
85 #endif /* __cplusplus */
86 uint32_t
87 hibernate_sum(uint8_t *buf, int32_t len);
88
89 extern vm_offset_t sectHIBB;
90 extern int sectSizeHIB;
91 extern vm_offset_t sectDATAB;
92 extern int sectSizeDATA;
93
94 extern vm_offset_t gIOHibernateWakeMap; // ppnum
95 extern vm_size_t gIOHibernateWakeMapSize;
96