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