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