]>
Commit | Line | Data |
---|---|---|
04fee52e A |
1 | /* |
2 | * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
db839b1d | 6 | * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. |
04fee52e | 7 | * |
db839b1d A |
8 | * This file contains Original Code and/or Modifications of Original Code |
9 | * as defined in and that are subject to the Apple Public Source License | |
10 | * Version 2.0 (the 'License'). You may not use this file except in | |
11 | * compliance with the License. Please obtain a copy of the License at | |
12 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
13 | * file. | |
14 | * | |
15 | * The Original Code and all software distributed under the License are | |
16 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
04fee52e A |
17 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
18 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
db839b1d A |
19 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
20 | * Please see the License for the specific language governing rights and | |
21 | * limitations under the License. | |
04fee52e A |
22 | * |
23 | * @APPLE_LICENSE_HEADER_END@ | |
24 | */ | |
25 | /* | |
26 | * sl.h - Headers for configuring the Secondary Loader | |
27 | * | |
71019aa0 | 28 | * Copyright (c) 1998-2003 Apple Computer, Inc. |
04fee52e A |
29 | * |
30 | * DRI: Josh de Cesare | |
31 | */ | |
32 | ||
33 | #ifndef _BOOTX_SL_H_ | |
34 | #define _BOOTX_SL_H_ | |
35 | ||
36 | #define kFailToBoot (1) | |
37 | ||
04fee52e A |
38 | /* |
39 | ||
71019aa0 | 40 | Memory Map: assumes 96 MB |
04fee52e A |
41 | |
42 | Physical Address | |
43 | ||
71019aa0 A |
44 | Open Firmware Version 3x, 4x, ... |
45 | 00000000 - 00003FFF : Exception Vectors | |
46 | 00004000 - 057FFFFF : Free Memory | |
47 | 05800000 - 05FFFFFF : OF Image | |
04fee52e A |
48 | |
49 | ||
50 | Logical Address | |
51 | ||
52 | 00000000 - 00003FFF : Exception Vectors | |
71019aa0 A |
53 | 00004000 - 03FFFFFF : Kernel Image, Boot Struct and Drivers |
54 | 04000000 - 04FFFFFF : File Load Area | |
55 | 05000000 - 053FFFFF : FS Cache | |
56 | 05400000 - 055FFFFF : Malloc Zone | |
57 | 05600000 - 057FFFFF : BootX Image | |
58 | 05800000 - 05FFFFFF : Unused | |
04fee52e A |
59 | |
60 | */ | |
61 | ||
62 | #define kVectorAddr (0x00000000) | |
63 | #define kVectorSize (0x00004000) | |
64 | ||
65 | // OF 3.x | |
66 | #define kImageAddr (0x00004000) | |
71019aa0 | 67 | #define kImageSize (0x03FFC000) |
04fee52e A |
68 | |
69 | // OF 1.x 2.x | |
70 | #define kImageAddr0 (0x00004000) | |
71 | #define kImageSize0 (0x002FC000) | |
72 | #define kImageAddr1 (0x00300000) | |
73 | #define kImageSize1 (0x00200000) | |
71019aa0 | 74 | #define kImageAddr1Phys (0x05800000) |
04fee52e | 75 | #define kImageAddr2 (0x00500000) |
71019aa0 | 76 | #define kImageSize2 (0x03B00000) |
04fee52e | 77 | |
71019aa0 A |
78 | #define kLoadAddr (0x04000000) |
79 | #define kLoadSize (0x01000000) | |
04fee52e | 80 | |
71019aa0 A |
81 | #define kFSCacheAddr (0x05000000) |
82 | #define kFSCacheSize (0x00400000) | |
83 | ||
84 | #define kMallocAddr (0x05400000) | |
85 | #define kMallocSize (0x00200000) | |
04fee52e A |
86 | |
87 | // Default Output Level | |
88 | #define kOutputLevelOff (0) | |
89 | #define kOutputLevelFull (16) | |
90 | ||
91 | // OF versions | |
92 | #define kOFVersion1x (0x01000000) | |
93 | #define kOFVersion2x (0x02000000) | |
94 | #define kOFVersion3x (0x03000000) | |
71019aa0 | 95 | #define kOFVersion4x (0x04000000) |
04fee52e A |
96 | |
97 | // Device Types | |
98 | enum { | |
99 | kUnknownDeviceType = 0, | |
100 | kNetworkDeviceType, | |
101 | kBlockDeviceType | |
102 | }; | |
103 | ||
366defd1 | 104 | // File Permissions and Types |
04fee52e | 105 | enum { |
366defd1 A |
106 | kPermOtherExecute = 1 << 0, |
107 | kPermOtherWrite = 1 << 1, | |
108 | kPermOtherRead = 1 << 2, | |
109 | kPermGroupExecute = 1 << 3, | |
110 | kPermGroupWrite = 1 << 4, | |
111 | kPermGroupRead = 1 << 5, | |
112 | kPermOwnerExecute = 1 << 6, | |
113 | kPermOwnerWrite = 1 << 7, | |
114 | kPermOwnerRead = 1 << 8, | |
115 | kPermMask = 0x1FF, | |
116 | kOwnerNotRoot = 1 << 9, | |
117 | kFileTypeUnknown = 0x0 << 16, | |
118 | kFileTypeFlat = 0x1 << 16, | |
119 | kFileTypeDirectory = 0x2 << 16, | |
120 | kFileTypeLink = 0x3 << 16, | |
121 | kFileTypeMask = 0x3 << 16 | |
04fee52e A |
122 | }; |
123 | ||
124 | // Key Numbers | |
125 | #define kCommandKey (0x200) | |
126 | #define kOptKey (0x201) | |
127 | #define kShiftKey (0x202) | |
128 | #define kControlKey (0x203) | |
129 | ||
130 | // Mac OS X Booter Signature 'MOSX' | |
131 | #define kMacOSXSignature (0x4D4F5358) | |
132 | ||
366defd1 A |
133 | // Boot Modes |
134 | enum { | |
135 | kBootModeNormal = 0, | |
136 | kBootModeSafe, | |
137 | kBootModeSecure | |
138 | }; | |
04fee52e | 139 | |
366defd1 A |
140 | #include <sys/stat.h> |
141 | #include <sys/types.h> | |
04fee52e A |
142 | |
143 | #include <ci.h> | |
144 | #include <sl_words.h> | |
145 | #include <libclite.h> | |
146 | #include <fs.h> | |
147 | #include <boot_args.h> | |
148 | ||
149 | // Externs for main.c | |
150 | extern char *gVectorSaveAddr; | |
151 | extern long gKernelEntryPoint; | |
152 | extern long gDeviceTreeAddr; | |
153 | extern long gDeviceTreeSize; | |
154 | extern long gBootArgsAddr; | |
155 | extern long gBootArgsSize; | |
156 | extern long gSymbolTableAddr; | |
157 | extern long gSymbolTableSize; | |
158 | ||
366defd1 | 159 | extern long gBootMode; |
04fee52e A |
160 | extern long gBootDeviceType; |
161 | extern long gBootFileType; | |
b1faa321 | 162 | extern char gHaveKernelCache; |
04fee52e A |
163 | extern char gBootDevice[256]; |
164 | extern char gBootFile[256]; | |
04fee52e A |
165 | |
166 | extern char gTempStr[4096]; | |
167 | ||
168 | extern long *gDeviceTreeMMTmp; | |
169 | ||
170 | extern long gOFVersion; | |
171 | ||
172 | extern char *gKeyMap; | |
173 | ||
71019aa0 A |
174 | extern long gRootAddrCells; |
175 | extern long gRootSizeCells; | |
176 | ||
04fee52e A |
177 | extern CICell gChosenPH; |
178 | extern CICell gOptionsPH; | |
179 | extern CICell gScreenPH; | |
180 | extern CICell gMemoryMapPH; | |
181 | extern CICell gStdOutPH; | |
182 | ||
183 | extern CICell gMMUIH; | |
184 | extern CICell gMemoryIH; | |
185 | extern CICell gStdOutIH; | |
186 | extern CICell gKeyboardIH; | |
187 | ||
71019aa0 | 188 | extern long ThinFatBinary(void **binary, unsigned long *length); |
04fee52e A |
189 | extern long GetDeviceType(char *devSpec); |
190 | extern long ConvertFileSpec(char *fileSpec, char *devSpec, char **filePath); | |
191 | extern long MatchThis(CICell phandle, char *string); | |
192 | extern void *AllocateBootXMemory(long size); | |
193 | extern long AllocateKernelMemory(long size); | |
194 | extern long AllocateMemoryRange(char *rangeName, long start, long length); | |
195 | extern unsigned long Alder32(unsigned char *buffer, long length); | |
196 | ||
197 | // Externs for macho.c | |
71019aa0 A |
198 | extern long ThinFatBinaryMachO(void **binary, unsigned long *length); |
199 | extern long DecodeMachO(void *binary); | |
04fee52e A |
200 | |
201 | // Externs for elf.c | |
71019aa0 A |
202 | extern long ThinFatBinaryElf(void **binary, unsigned long *length); |
203 | extern long DecodeElf(void *binary); | |
04fee52e A |
204 | |
205 | // Externs for device_tree.c | |
206 | extern long FlattenDeviceTree(void); | |
207 | extern CICell SearchForNode(CICell ph, long top, char *prop, char *value); | |
208 | extern CICell SearchForNodeMatching(CICell ph, long top, char *value); | |
209 | ||
210 | // Externs for display.c | |
211 | extern long InitDisplays(void); | |
366defd1 A |
212 | extern long DrawSplashScreen(long stage); |
213 | extern long DrawFailedBootPicture(void); | |
04fee52e A |
214 | extern void GetMainScreenPH(Boot_Video_Ptr video); |
215 | ||
216 | // Externs for drivers.c | |
217 | extern long LoadDrivers(char *dirPath); | |
218 | ||
219 | // Externs for config.c | |
220 | extern long InitConfig(void); | |
221 | extern long ParseConfigFile(char *addr); | |
222 | ||
b1faa321 A |
223 | // Externs for lzss.c |
224 | extern int decompress_lzss(u_int8_t *dst, u_int8_t *src, u_int32_t srclen); | |
225 | ||
04fee52e | 226 | #endif /* ! _BOOTX_SL_H_ */ |