Chameleon

Chameleon Svn Source Tree

Root/trunk/i386/libsaio/bootargs.h

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 */
40enum {
41 kBootDriverTypeInvalid = 0,
42 kBootDriverTypeKEXT = 1,
43 kBootDriverTypeMKEXT = 2
44};
45
46enum {
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 */
67typedef 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
83struct Boot_Video {
84uint32_tv_baseAddr;/* Base address of video memory */
85uint32_tv_display;/* Display Code (if Applicable */
86uint32_tv_rowBytes;/* Number of bytes per pixel row */
87uint32_tv_width;/* Width */
88uint32_tv_height;/* Height */
89uint32_tv_depth;/* Pixel Depth */
90};
91typedef struct Boot_VideoBoot_Video;
92
93/* Values for v_display */
94
95#define GRAPHICS_MODE1
96#define FB_TEXT_MODE2
97
98
99/* Struct describing an image passed in by the booter */
100struct boot_icon_element {
101 unsigned int width;
102 unsigned int height;
103 int y_offset_from_center;
104 unsigned int data_size;
105 unsigned int __reserved1[4];
106 unsigned char data[0];
107};
108typedef struct boot_icon_element boot_icon_element;
109
110/* Boot argument structure - passed into Mach kernel at boot time.
111 * "Revision" can be incremented for compatible changes
112 */
113// Lion
114#define kBootArgsRevision0
115#define kBootArgsVersion2
116
117// Snow Leopard and older
118#define kBootArgsLegacyVersion1
119#define kBootArgsLegacyRevision6
120
121/* Snapshot constants of previous revisions that are supported */
122#define kBootArgsVersion11
123#define kBootArgsVersion22
124#define kBootArgsRevision2_00
125
126#define kBootArgsEfiMode32 32
127#define kBootArgsEfiMode64 64
128
129/* Bitfields for boot_args->flags */
130#define kBootArgsFlagRebootOnPanic(1 << 0)
131#define kBootArgsFlagHiDPI(1 << 1)
132#define kBootArgsFlagBlack(1 << 2)
133#define kBootArgsFlagCSRActiveConfig(1 << 3)
134#define kBootArgsFlagCSRConfigMode(1 << 4)
135#define kBootArgsFlagCSRBoot(1 << 5)
136#define kBootArgsFlagBlackBg(1 << 6)
137#define kBootArgsFlagLoginUI(1 << 7)
138#define kBootArgsFlagInstallUI(1 << 8)
139
140/* Rootless configuration flags */
141// http://www.idelta.info/archives/kext-to-check-sip-rootless-status-on-el-capitan/
142#define CSR_ALLOW_UNTRUSTED_KEXTS(1 << 0) /* Allow untrusted kexts */
143#define CSR_ALLOW_UNRESTRICTED_FS(1 << 1) /* Allow unrestricted file system. */
144#define CSR_ALLOW_TASK_FOR_PID(1 << 2) /* Allow test_for_pid() */
145#define CSR_ALLOW_KERNEL_DEBUGGER(1 << 3)
146#define CSR_ALLOW_APPLE_INTERNAL(1 << 4)
147#define CSR_ALLOW_UNRESTRICTED_DTRACE(1 << 5) /* Allow unrestricted dtrace */
148#define CSR_ALLOW_UNRESTRICTED_NVRAM(1 << 6) /* Allow unrestricted NVRAM */
149#define CSR_ALLOW_DEVICE_CONFIGURATION(1 << 7) /* Allow device configuration */
150#define CSR_ALLOW_ANY_RECOVERY_OS(1 << 8)
151
152#define CSR_VALID_FLAGS (CSR_ALLOW_UNTRUSTED_KEXTS | \
153CSR_ALLOW_UNRESTRICTED_FS | \
154CSR_ALLOW_TASK_FOR_PID | \
155CSR_ALLOW_KERNEL_DEBUGGER | \
156CSR_ALLOW_APPLE_INTERNAL | \
157CSR_ALLOW_UNRESTRICTED_DTRACE | \
158CSR_ALLOW_UNRESTRICTED_NVRAM | \
159CSR_ALLOW_DEVICE_CONFIGURATION | \
160CSR_ALLOW_ANY_RECOVERY_OS)
161
162typedef struct boot_args
163{
164 uint16_t Revision;/* Revision of boot_args structure */
165 uint16_t Version;/* Version of boot_args structure */
166
167 uint8_t efiMode; /* 32 means 32-bit mode, 64 means 64-bit mode */
168 uint8_t debugMode; /* Bit field with behavior changes */
169 uint16_t flags;
170
171 char CommandLine[BOOT_LINE_LENGTH];/* Passed in command line */
172
173 uint32_t MemoryMap; /* Physical address of memory map */
174 uint32_t MemoryMapSize;
175 uint32_t MemoryMapDescriptorSize;
176 uint32_t MemoryMapDescriptorVersion;
177
178 Boot_VideoVideo;/* Video Information */
179
180 uint32_t deviceTreeP; /* Physical address of flattened device tree */
181 uint32_t deviceTreeLength; /* Length of flattened tree */
182
183 uint32_t kaddr; /* Physical address of beginning of kernel text */
184 uint32_t ksize; /* Size of combined kernel text+data+efi */
185
186 uint32_t efiRuntimeServicesPageStart; /* physical address of defragmented runtime pages */
187 uint32_t efiRuntimeServicesPageCount;
188 uint64_t efiRuntimeServicesVirtualPageStart; /* virtual address of defragmented runtime pages */
189
190 uint32_t efiSystemTable; /* physical address of system table in runtime area */
191 uint32_t kslide;
192
193 uint32_t performanceDataStart; /* physical address of log */
194 uint32_t performanceDataSize;
195
196 uint32_t keyStoreDataStart; /* physical address of key store data */
197 uint32_t keyStoreDataSize;
198 uint64_tbootMemStart;
199 uint64_tbootMemSize;
200 uint64_t PhysicalMemorySize;
201 uint64_t FSBFrequency;
202
203 uint64_t pciConfigSpaceBaseAddress;
204 uint32_t pciConfigSpaceStartBusNumber;
205 uint32_t pciConfigSpaceEndBusNumber;
206
207 uint32_t csrActiveConfig;
208 uint32_t csrCapabilities;
209 uint32_t boot_SMC_plimit;
210 uint16_tbootProgressMeterStart;
211 uint16_tbootProgressMeterEnd;
212 uint32_t __reserved4[726];
213
214} boot_args;
215
216typedef struct boot_args_legacy
217{
218 uint16_t Revision;/* Revision of boot_args structure */
219 uint16_t Version;/* Version of boot_args structure */
220
221 char CommandLine[BOOT_LINE_LENGTH];/* Passed in command line */
222
223 uint32_t MemoryMap; /* Physical address of memory map */
224 uint32_t MemoryMapSize;
225 uint32_t MemoryMapDescriptorSize;
226 uint32_t MemoryMapDescriptorVersion;
227
228 Boot_VideoVideo;/* Video Information */
229
230 uint32_t deviceTreeP; /* Physical address of flattened device tree */
231 uint32_t deviceTreeLength; /* Length of flattened tree */
232
233 uint32_t kaddr; /* Physical address of beginning of kernel text */
234 uint32_t ksize; /* Size of combined kernel text+data+efi */
235
236 uint32_t efiRuntimeServicesPageStart; /* physical address of defragmented runtime pages */
237 uint32_t efiRuntimeServicesPageCount;
238
239 uint32_t efiSystemTable; /* physical address of system table in runtime area */
240
241 uint8_t efiMode; /* 32 means 32-bit mode, 64 means 64-bit mode */
242 uint8_t __reserved1[3];
243 uint32_t __reserved2[1];
244 uint32_t performanceDataStart; /* physical address of log */
245 uint32_t performanceDataSize;
246 uint64_t efiRuntimeServicesVirtualPageStart; /* virtual address of defragmented runtime pages */
247 uint32_t __reserved3[2];
248
249} boot_args_legacy;
250
251#endif /* _PEXPERT_I386_BOOT_H */
252

Archive Download this file

Revision: HEAD