]> git.saurik.com Git - apple/bootx.git/blob - bootx.tproj/include.subproj/sl.h
ecaba857261a1064a3ecaedda12b2b072f6a692c
[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 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22 /*
23 * sl.h - Headers for configuring the Secondary Loader
24 *
25 * Copyright (c) 1998-2000 Apple Computer, Inc.
26 *
27 * DRI: Josh de Cesare
28 */
29
30 #ifndef _BOOTX_SL_H_
31 #define _BOOTX_SL_H_
32
33 #define kFailToBoot (1)
34
35 #if ! defined(kMacOSXServer)
36 #define kMacOSXServer (0)
37 #endif
38
39 /*
40
41 Memory Map... Assumes 32 MB
42
43 Physical Address
44
45 Open Firmware Version 1x, 2x 3x
46 00000000 - 00003FFF : Exception Vectors
47 00004000 - 002FFFFF : Free Memory
48 00300000 - 004FFFFF : OF Image / Free Memory
49 00500000 - 01DFFFFF : Free Memory
50 01E00000 - 01FFFFFF : Free Memory / OF Image
51
52
53 Logical Address
54
55 00000000 - 00003FFF : Exception Vectors
56 00004000 - 013FFFFF : Kernal Image, Boot Struct and Drivers
57 01400000 - 01BFFFFF : File Load Area
58 01C00000 - 01CFFFFF : Secondary Loader Image
59 01D00000 - 01DFFFFF : Malloc Area
60 01E00000 - 01FFFFFF : Unused
61
62 To provide a consistant Logical Memory Usage between OF 1,2 and OF 3
63 the Logical Addresses 0x00300000 - 0x004FFFFF will be mapped to
64 Physical Address 0x01E00000 - 0x01FFFFFF and will be copied back
65 just before the kernel is loaded.
66
67
68 */
69
70 #define kVectorAddr (0x00000000)
71 #define kVectorSize (0x00004000)
72
73 // OF 3.x
74 #define kImageAddr (0x00004000)
75 #define kImageSize (0x013FC000)
76
77 // OF 1.x 2.x
78 #define kImageAddr0 (0x00004000)
79 #define kImageSize0 (0x002FC000)
80 #define kImageAddr1 (0x00300000)
81 #define kImageSize1 (0x00200000)
82 #define kImageAddr1Phys (0x01E00000)
83 #define kImageAddr2 (0x00500000)
84 #define kImageSize2 (0x00F00000)
85
86 #define kLoadAddr (0x01400000)
87 #define kLoadSize (0x00800000)
88
89 #define kMallocAddr (0x01D00000)
90 #define kMallocSize (0x00100000)
91
92 // Default Output Level
93 #define kOutputLevelOff (0)
94 #define kOutputLevelFull (16)
95
96 // OF versions
97 #define kOFVersion1x (0x01000000)
98 #define kOFVersion2x (0x02000000)
99 #define kOFVersion3x (0x03000000)
100
101 // Device Types
102 enum {
103 kUnknownDeviceType = 0,
104 kNetworkDeviceType,
105 kBlockDeviceType
106 };
107
108 // File Type
109 enum {
110 kUnknownFileType = 0,
111 kFlatFileType,
112 kDirectoryFileType,
113 kLinkFileType
114 };
115
116 // Key Numbers
117 #define kCommandKey (0x200)
118 #define kOptKey (0x201)
119 #define kShiftKey (0x202)
120 #define kControlKey (0x203)
121
122 // Mac OS X Booter Signature 'MOSX'
123 #define kMacOSXSignature (0x4D4F5358)
124
125
126 #include <bsd/sys/types.h>
127
128 #include <ci.h>
129 #include <sl_words.h>
130 #include <libclite.h>
131 #include <fs.h>
132 #include <boot_args.h>
133
134 // Externs for main.c
135 extern char *gVectorSaveAddr;
136 extern long gKernelEntryPoint;
137 extern long gDeviceTreeAddr;
138 extern long gDeviceTreeSize;
139 extern long gBootArgsAddr;
140 extern long gBootArgsSize;
141 extern long gSymbolTableAddr;
142 extern long gSymbolTableSize;
143
144 extern long gBootDeviceType;
145 extern long gBootFileType;
146 extern char gBootDevice[256];
147 extern char gBootFile[256];
148 extern char gRootDir[256];
149
150 extern char gTempStr[4096];
151
152 extern long *gDeviceTreeMMTmp;
153
154 extern long gOFVersion;
155
156 extern char *gKeyMap;
157
158 extern CICell gChosenPH;
159 extern CICell gOptionsPH;
160 extern CICell gScreenPH;
161 extern CICell gMemoryMapPH;
162 extern CICell gStdOutPH;
163
164 extern CICell gMMUIH;
165 extern CICell gMemoryIH;
166 extern CICell gStdOutIH;
167 extern CICell gKeyboardIH;
168
169 extern long GetDeviceType(char *devSpec);
170 extern long ConvertFileSpec(char *fileSpec, char *devSpec, char **filePath);
171 extern long MatchThis(CICell phandle, char *string);
172 extern void *AllocateBootXMemory(long size);
173 extern long AllocateKernelMemory(long size);
174 extern long AllocateMemoryRange(char *rangeName, long start, long length);
175 extern unsigned long Alder32(unsigned char *buffer, long length);
176
177 // Externs for macho.c
178 extern long DecodeMachO(void);
179
180 // Externs for elf.c
181 extern long DecodeElf(void);
182
183 // Externs for device_tree.c
184 extern long FlattenDeviceTree(void);
185 extern CICell SearchForNode(CICell ph, long top, char *prop, char *value);
186 extern CICell SearchForNodeMatching(CICell ph, long top, char *value);
187
188 // Externs for display.c
189 extern long InitDisplays(void);
190 extern long LoadDisplayDrivers(void);
191 extern long DrawSplashScreen(void);
192 extern long DrawBrokenSystemFolder(void);
193 extern void GetMainScreenPH(Boot_Video_Ptr video);
194
195 // Externs for drivers.c
196 extern long LoadDrivers(char *dirPath);
197
198 // Externs for config.c
199 extern long InitConfig(void);
200 extern long ParseConfigFile(char *addr);
201
202 // Externs for PEFSupport.c
203 extern unsigned long GetSymbolFromPEF(char *name, char *pef,
204 void *desc, long descSize);
205
206 #endif /* ! _BOOTX_SL_H_ */