]> git.saurik.com Git - apple/bootx.git/blob - bootx.tproj/include.subproj/sl.h
BootX-46.tar.gz
[apple/bootx.git] / bootx.tproj / include.subproj / sl.h
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
7 *
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
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
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.
22 *
23 * @APPLE_LICENSE_HEADER_END@
24 */
25 /*
26 * sl.h - Headers for configuring the Secondary Loader
27 *
28 * Copyright (c) 1998-2002 Apple Computer, Inc.
29 *
30 * DRI: Josh de Cesare
31 */
32
33 #ifndef _BOOTX_SL_H_
34 #define _BOOTX_SL_H_
35
36 #define kFailToBoot (1)
37
38 /*
39
40 Memory Map... Assumes 32 MB
41
42 Physical Address
43
44 Open Firmware Version 1x, 2x 3x
45 00000000 - 00003FFF : Exception Vectors
46 00004000 - 002FFFFF : Free Memory
47 00300000 - 004FFFFF : OF Image / Free Memory
48 00500000 - 01DFFFFF : Free Memory
49 01E00000 - 01FFFFFF : Free Memory / OF Image
50
51
52 Logical Address
53
54 00000000 - 00003FFF : Exception Vectors
55 00004000 - 013FFFFF : Kernel Image, Boot Struct and Drivers
56 01400000 - 01BFFFFF : File Load Area
57 01C00000 - 01CFFFFF : Secondary Loader Image
58 01D00000 - 01DFFFFF : Malloc Area
59 01E00000 - 01FFFFFF : Unused
60
61 To provide a consistant Logical Memory Usage between OF 1,2 and OF 3
62 the Logical Addresses 0x00300000 - 0x004FFFFF will be mapped to
63 Physical Address 0x01E00000 - 0x01FFFFFF and will be copied back
64 just before the kernel is loaded.
65
66
67 */
68
69 #define kVectorAddr (0x00000000)
70 #define kVectorSize (0x00004000)
71
72 // OF 3.x
73 #define kImageAddr (0x00004000)
74 #define kImageSize (0x013FC000)
75
76 // OF 1.x 2.x
77 #define kImageAddr0 (0x00004000)
78 #define kImageSize0 (0x002FC000)
79 #define kImageAddr1 (0x00300000)
80 #define kImageSize1 (0x00200000)
81 #define kImageAddr1Phys (0x01E00000)
82 #define kImageAddr2 (0x00500000)
83 #define kImageSize2 (0x00F00000)
84
85 #define kLoadAddr (0x01400000)
86 #define kLoadSize (0x00800000)
87
88 #define kMallocAddr (0x01D00000)
89 #define kMallocSize (0x00100000)
90
91 // Default Output Level
92 #define kOutputLevelOff (0)
93 #define kOutputLevelFull (16)
94
95 // OF versions
96 #define kOFVersion1x (0x01000000)
97 #define kOFVersion2x (0x02000000)
98 #define kOFVersion3x (0x03000000)
99
100 // Device Types
101 enum {
102 kUnknownDeviceType = 0,
103 kNetworkDeviceType,
104 kBlockDeviceType
105 };
106
107 // File Permissions and Types
108 enum {
109 kPermOtherExecute = 1 << 0,
110 kPermOtherWrite = 1 << 1,
111 kPermOtherRead = 1 << 2,
112 kPermGroupExecute = 1 << 3,
113 kPermGroupWrite = 1 << 4,
114 kPermGroupRead = 1 << 5,
115 kPermOwnerExecute = 1 << 6,
116 kPermOwnerWrite = 1 << 7,
117 kPermOwnerRead = 1 << 8,
118 kPermMask = 0x1FF,
119 kOwnerNotRoot = 1 << 9,
120 kFileTypeUnknown = 0x0 << 16,
121 kFileTypeFlat = 0x1 << 16,
122 kFileTypeDirectory = 0x2 << 16,
123 kFileTypeLink = 0x3 << 16,
124 kFileTypeMask = 0x3 << 16
125 };
126
127 // Key Numbers
128 #define kCommandKey (0x200)
129 #define kOptKey (0x201)
130 #define kShiftKey (0x202)
131 #define kControlKey (0x203)
132
133 // Mac OS X Booter Signature 'MOSX'
134 #define kMacOSXSignature (0x4D4F5358)
135
136 // Boot Modes
137 enum {
138 kBootModeNormal = 0,
139 kBootModeSafe,
140 kBootModeSecure
141 };
142
143 #include <sys/stat.h>
144 #include <sys/types.h>
145
146 #include <ci.h>
147 #include <sl_words.h>
148 #include <libclite.h>
149 #include <fs.h>
150 #include <boot_args.h>
151
152 // Externs for main.c
153 extern char *gVectorSaveAddr;
154 extern long gKernelEntryPoint;
155 extern long gDeviceTreeAddr;
156 extern long gDeviceTreeSize;
157 extern long gBootArgsAddr;
158 extern long gBootArgsSize;
159 extern long gSymbolTableAddr;
160 extern long gSymbolTableSize;
161
162 extern long gBootMode;
163 extern long gBootDeviceType;
164 extern long gBootFileType;
165 extern char gBootDevice[256];
166 extern char gBootFile[256];
167 extern char gRootDir[256];
168
169 extern char gTempStr[4096];
170
171 extern long *gDeviceTreeMMTmp;
172
173 extern long gOFVersion;
174
175 extern char *gKeyMap;
176
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
188 extern long GetDeviceType(char *devSpec);
189 extern long ConvertFileSpec(char *fileSpec, char *devSpec, char **filePath);
190 extern long MatchThis(CICell phandle, char *string);
191 extern void *AllocateBootXMemory(long size);
192 extern long AllocateKernelMemory(long size);
193 extern long AllocateMemoryRange(char *rangeName, long start, long length);
194 extern unsigned long Alder32(unsigned char *buffer, long length);
195
196 // Externs for macho.c
197 extern long DecodeMachO(void);
198
199 // Externs for elf.c
200 extern long DecodeElf(void);
201
202 // Externs for device_tree.c
203 extern long FlattenDeviceTree(void);
204 extern CICell SearchForNode(CICell ph, long top, char *prop, char *value);
205 extern CICell SearchForNodeMatching(CICell ph, long top, char *value);
206
207 // Externs for display.c
208 extern long InitDisplays(void);
209 extern long DrawSplashScreen(long stage);
210 extern long DrawFailedBootPicture(void);
211 extern void GetMainScreenPH(Boot_Video_Ptr video);
212
213 // Externs for drivers.c
214 extern long LoadDrivers(char *dirPath);
215
216 // Externs for config.c
217 extern long InitConfig(void);
218 extern long ParseConfigFile(char *addr);
219
220 #endif /* ! _BOOTX_SL_H_ */