1 | /*␊ |
2 | * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.␊ |
3 | *␊ |
4 | * ␊ |
5 | * This file contains Original Code and/or Modifications of Original Code␊ |
6 | * as defined in and that are subject to the Apple Public Source License␊ |
7 | * Version 2.0 (the 'License'). You may not use this file except in␊ |
8 | * compliance with the License. The rights granted to you under the License␊ |
9 | * may not be used to create, or enable the creation or redistribution of,␊ |
10 | * unlawful or unlicensed copies of an Apple operating system, or to␊ |
11 | * circumvent, violate, or enable the circumvention or violation of, any␊ |
12 | * terms of an Apple operating system software license agreement.␊ |
13 | * ␊ |
14 | * Please obtain a copy of the License at␊ |
15 | * http://www.opensource.apple.com/apsl/ and read it before using this file.␊ |
16 | * ␊ |
17 | * The Original Code and all software distributed under the License are␊ |
18 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER␊ |
19 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,␊ |
20 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,␊ |
21 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.␊ |
22 | * Please see the License for the specific language governing rights and␊ |
23 | * limitations under the License.␊ |
24 | * ␊ |
25 | */␊ |
26 | #ifndef _PEXPERT_I386_BOOT_H␊ |
27 | #define _PEXPERT_I386_BOOT_H␊ |
28 | ␊ |
29 | #include <stdint.h>␊ |
30 | ␊ |
31 | /*␊ |
32 | * What the booter leaves behind for the kernel.␊ |
33 | */␊ |
34 | ␊ |
35 | /*␊ |
36 | * Types of boot driver that may be loaded by the booter.␊ |
37 | */␊ |
38 | enum {␊ |
39 | kBootDriverTypeInvalid = 0,␊ |
40 | kBootDriverTypeKEXT = 1,␊ |
41 | kBootDriverTypeMKEXT = 2␊ |
42 | };␊ |
43 | ␊ |
44 | enum {␊ |
45 | kEfiReservedMemoryType␉= 0,␊ |
46 | kEfiLoaderCode␉␉= 1,␊ |
47 | kEfiLoaderData␉␉= 2,␊ |
48 | kEfiBootServicesCode␉= 3,␊ |
49 | kEfiBootServicesData␉= 4,␊ |
50 | kEfiRuntimeServicesCode␉= 5,␊ |
51 | kEfiRuntimeServicesData␉= 6,␊ |
52 | kEfiConventionalMemory␉= 7,␊ |
53 | kEfiUnusableMemory␉␉= 8,␊ |
54 | kEfiACPIReclaimMemory␉= 9,␊ |
55 | kEfiACPIMemoryNVS␉␉= 10,␊ |
56 | kEfiMemoryMappedIO␉␉= 11,␊ |
57 | kEfiMemoryMappedIOPortSpace = 12,␊ |
58 | kEfiPalCode␉␉␉= 13,␊ |
59 | kEfiMaxMemoryType␉␉= 14␊ |
60 | };␊ |
61 | ␊ |
62 | /*␊ |
63 | * Memory range descriptor.␊ |
64 | */␊ |
65 | typedef struct EfiMemoryRange {␊ |
66 | uint32_t Type;␊ |
67 | uint32_t Pad;␊ |
68 | uint64_t PhysicalStart;␊ |
69 | uint64_t VirtualStart;␊ |
70 | uint64_t NumberOfPages;␊ |
71 | uint64_t Attribute;␊ |
72 | } EfiMemoryRange;␊ |
73 | ␊ |
74 | #define BOOT_LINE_LENGTH 1024␊ |
75 | #define BOOT_STRING_LEN BOOT_LINE_LENGTH␊ |
76 | ␊ |
77 | /*␊ |
78 | * Video information.. ␊ |
79 | */␊ |
80 | ␊ |
81 | struct Boot_Video␊ |
82 | {␊ |
83 | ␉uint32_t␉v_baseAddr;␉/* Base address of video memory */␊ |
84 | ␉uint32_t␉v_display;␉/* Display Code (if Applicable */␊ |
85 | ␉uint32_t␉v_rowBytes;␉/* Number of bytes per pixel row */␊ |
86 | ␉uint32_t␉v_width;␉/* Width */␊ |
87 | ␉uint32_t␉v_height;␉/* Height */␊ |
88 | ␉uint32_t␉v_depth;␉/* Pixel Depth */␊ |
89 | };␊ |
90 | ␊ |
91 | typedef struct Boot_Video␉Boot_Video;␊ |
92 | ␊ |
93 | /* Values for v_display */␊ |
94 | ␊ |
95 | #define GRAPHICS_MODE␉␉␉1␊ |
96 | #define FB_TEXT_MODE␉␉␉2␊ |
97 | ␊ |
98 | /* Boot argument structure - passed into Mach kernel at boot time.␊ |
99 | * "Revision" can be incremented for compatible changes␊ |
100 | */␊ |
101 | // Lion␊ |
102 | #define kBootArgsRevision␉␉0␊ |
103 | #define kBootArgsVersion␉␉2␊ |
104 | ␊ |
105 | // Snow Leopard and older␊ |
106 | #define kBootArgsPreLionRevision␉6␊ |
107 | #define kBootArgsPreLionVersion␉␉1␊ |
108 | ␊ |
109 | /* Snapshot constants of previous revisions that are supported */␊ |
110 | ␊ |
111 | #define kBootArgsEfiMode32␉␉32␊ |
112 | #define kBootArgsEfiMode64␉␉64␊ |
113 | ␊ |
114 | typedef struct boot_args_pre_lion␊ |
115 | {␊ |
116 | uint16_t Revision;␉/* Revision of boot_args structure */␊ |
117 | uint16_t Version;␉/* Version of boot_args structure */␊ |
118 | ␊ |
119 | char CommandLine[BOOT_LINE_LENGTH];␉/* Passed in command line */␊ |
120 | ␊ |
121 | uint32_t MemoryMap; /* Physical address of memory map */␊ |
122 | uint32_t MemoryMapSize;␊ |
123 | uint32_t MemoryMapDescriptorSize;␊ |
124 | uint32_t MemoryMapDescriptorVersion;␊ |
125 | ␊ |
126 | Boot_Video␉Video;␉␉/* Video Information */␊ |
127 | ␊ |
128 | uint32_t deviceTreeP;␉ /* Physical address of flattened device tree */␊ |
129 | uint32_t deviceTreeLength; /* Length of flattened tree */␊ |
130 | ␊ |
131 | uint32_t kaddr; /* Physical address of beginning of kernel text */␊ |
132 | uint32_t ksize; /* Size of combined kernel text+data+efi */␊ |
133 | ␊ |
134 | uint32_t efiRuntimeServicesPageStart; /* physical address of defragmented runtime pages */␊ |
135 | uint32_t efiRuntimeServicesPageCount;␊ |
136 | ␊ |
137 | uint32_t efiSystemTable; /* physical address of system table in runtime area */␊ |
138 | ␊ |
139 | uint8_t efiMode; /* 32 = 32-bit, 64 = 64-bit */␊ |
140 | uint8_t __reserved1[3];␊ |
141 | uint32_t __reserved2[1];␊ |
142 | uint32_t performanceDataStart; /* physical address of log */␊ |
143 | uint32_t performanceDataSize;␊ |
144 | uint64_t efiRuntimeServicesVirtualPageStart; /* virtual address of defragmented runtime pages */␊ |
145 | uint32_t __reserved3[2];␊ |
146 | ␊ |
147 | } boot_args_pre_lion;␊ |
148 | ␊ |
149 | /* Bitfields for boot_args->flags */␊ |
150 | #define kBootArgsFlagRebootOnPanic (1 << 0)␊ |
151 | #define kBootArgsFlagHiDPI (1 << 1)␊ |
152 | ␊ |
153 | typedef struct boot_args␊ |
154 | {␊ |
155 | uint16_t Revision;␉/* Revision of boot_args structure */␊ |
156 | uint16_t Version;␉/* Version of boot_args structure */␊ |
157 | ␊ |
158 | uint8_t efiMode; /* 32 = 32-bit, 64 = 64-bit */␊ |
159 | uint8_t debugMode; /* Bit field with behavior changes */␊ |
160 | uint16_t flags;␊ |
161 | ␊ |
162 | char CommandLine[BOOT_LINE_LENGTH];␉/* Passed in command line */␊ |
163 | ␊ |
164 | uint32_t MemoryMap; /* Physical address of memory map */␊ |
165 | uint32_t MemoryMapSize;␊ |
166 | uint32_t MemoryMapDescriptorSize;␊ |
167 | uint32_t MemoryMapDescriptorVersion;␊ |
168 | ␊ |
169 | Boot_Video␉Video;␉␉/* Video Information */␊ |
170 | ␊ |
171 | uint32_t deviceTreeP;␉ /* Physical address of flattened device tree */␊ |
172 | uint32_t deviceTreeLength; /* Length of flattened tree */␊ |
173 | ␊ |
174 | uint32_t kaddr; /* Physical address of beginning of kernel text */␊ |
175 | uint32_t ksize; /* Size of combined kernel text+data+efi */␊ |
176 | ␊ |
177 | uint32_t efiRuntimeServicesPageStart; /* physical address of defragmented runtime pages */␊ |
178 | uint32_t efiRuntimeServicesPageCount;␊ |
179 | uint64_t efiRuntimeServicesVirtualPageStart; /* virtual address of defragmented runtime pages */␊ |
180 | ␊ |
181 | uint32_t efiSystemTable; /* physical address of system table in runtime area */␊ |
182 | uint8_t __reserved1[2];␊ |
183 | uint32_t __reserved2;␊ |
184 | uint32_t performanceDataStart; /* physical address of log */␊ |
185 | uint32_t performanceDataSize;␊ |
186 | ␊ |
187 | uint32_t keyStoreDataStart; /* physical address of key store data */␊ |
188 | uint32_t keyStoreDataSize;␊ |
189 | uint64_t␉bootMemStart;␊ |
190 | uint64_t␉bootMemSize;␊ |
191 | uint64_t PhysicalMemorySize;␊ |
192 | uint64_t FSBFrequency;␊ |
193 | uint32_t __reserved4[734];␊ |
194 | ␊ |
195 | } boot_args;␊ |
196 | ␊ |
197 | extern char gMacOSVersion[8];␊ |
198 | ␊ |
199 | #endif /* _PEXPERT_I386_BOOT_H */␊ |
200 | |