1 | /*␊ |
2 | * Copyright (c) 1999-2003 Apple Computer, Inc. All rights reserved.␊ |
3 | *␊ |
4 | * @APPLE_LICENSE_HEADER_START@␊ |
5 | * ␊ |
6 | * Portions Copyright (c) 1999-2003 Apple Computer, Inc. All Rights␊ |
7 | * Reserved. This file contains Original Code and/or Modifications of␊ |
8 | * Original Code as defined in and that are subject to the Apple Public␊ |
9 | * Source License Version 2.0 (the "License"). You may not use this file␊ |
10 | * except in compliance with the License. Please obtain a copy of the␊ |
11 | * License at http://www.apple.com/publicsource and read it before using␊ |
12 | * this file.␊ |
13 | * ␊ |
14 | * The Original Code and all software distributed under the License are␊ |
15 | * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER␊ |
16 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,␊ |
17 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,␊ |
18 | * FITNESS FOR A PARTICULAR PURPOSE OR NON- INFRINGEMENT. Please see the␊ |
19 | * License for the specific language governing rights and limitations␊ |
20 | * under the License.␊ |
21 | * ␊ |
22 | * @APPLE_LICENSE_HEADER_END@␊ |
23 | */␊ |
24 | /*␊ |
25 | * Copyright 1994 NeXT Computer, Inc.␊ |
26 | * All rights reserved.␊ |
27 | */␊ |
28 | ␊ |
29 | #ifndef __BOOT2_BOOT_H␊ |
30 | #define __BOOT2_BOOT_H␊ |
31 | ␊ |
32 | //#include "saio_internal.h" // the only one needed by boot.h it self.␊ |
33 | #include "bootstruct.h"␊ |
34 | ␊ |
35 | /*␊ |
36 | * Default names - these end with "Name" (easier to sort them).␊ |
37 | */␊ |
38 | #define kDefaultKernelName␉"mach_kernel"␊ |
39 | #define kDefaultThemeName␉"Default" // revert?␊ |
40 | /*␊ |
41 | #define kDefaultBootPlistName␉"com.apple.Boot.plist"␊ |
42 | #define kDefaultDSDTName␉␉"dsdt.aml"␊ |
43 | #define kDefaultSMBIOSName␉␉"smbios.plist"␊ |
44 | #define kDefaultRamdiskName␉␉"Preboot.dmg"␊ |
45 | ???*/␊ |
46 | ␊ |
47 | /*␊ |
48 | * Default paths?????␊ |
49 | */␊ |
50 | ␊ |
51 | /*␊ |
52 | * Undeclared (or undeclared here)␊ |
53 | ␊ |
54 | "ProductVersion" - options.c (boot.c on trunk) - getValFK␊ |
55 | ␊ |
56 | "biosdev" mboot.c, getValFBK␊ |
57 | "timeout" mboot.c, getValFBK␊ |
58 | "partno" mboot.c, getValFBK␊ |
59 | ␊ |
60 | "-checkers" gui.c, getValFK;␊ |
61 | ␊ |
62 | "DumpSPD" spd.c, getBollFK - seems unsed***␊ |
63 | */␊ |
64 | ␊ |
65 | /*␊ |
66 | * gone to modules:␊ |
67 | ␊ |
68 | //#define kGraphicsEnablerKey␉"GraphicsEnabler"␉// GraphicsEnabler.c␉getBoolFK␊ |
69 | //#define kUseAtiROMKey␉␉␉"UseAtiROM"␉␉␉// ati.c␉␉␉␉getBoolFK ?? modules␊ |
70 | //#define kAtiConfigKey␉␉␉"AtiConfig"␉␉␉// ati.c␉␉␉␉getStringFK␊ |
71 | //#define kATYbinimageKey␉␉"ATYbinimage"␉␉// ati.c␉␉␉␉getBoolFK␊ |
72 | //#define kUseNvidiaROMKey␉␉"UseNvidiaROM"␉␉// nvidia.c␉␉␉␉getBoolFK␊ |
73 | //#define kVBIOSKey␉␉␉␉"VBIOS"␉␉␉␉// nvidia.c␉␉␉␉getBoolFK␊ |
74 | ␊ |
75 | //#define kUseMemDetectKey␉␉"UseMemDetect"␉␉// platform.c␉␉␉getBoolFK␊ |
76 | */␊ |
77 | ␊ |
78 | /*␊ |
79 | separate into:␊ |
80 | - internal use (change these to "blablabla")␊ |
81 | ␊ |
82 | - kernel & booter flags/arguments␊ |
83 | ␉- no good at boot prompt␊ |
84 | ␉- good at boot prompt␊ |
85 | ␉␊ |
86 | - booter options/patches␊ |
87 | */␊ |
88 | ␊ |
89 | /*␊ |
90 | * Keys used in system Boot.plist - these end with "Key".␊ |
91 | */␊ |
92 | //␉␉identifier␉␉␉ string␉␉␉␉ location␉␉␉␉type␉␉␉␉␉comment␊ |
93 | #define kTextModeKey␉␉ "Text Mode"␉␉ // graphics.c␉␉␉getNumberArraiFP␉␉- default 80x25 - kFlag - does it work??␊ |
94 | ␊ |
95 | #define kDefaultPartitionKey "Default Partition" // sys.c␉␉␉␉getStringFK␊ |
96 | #define kHidePartitionKey␉ "Hide Partition"␉ // disk.c␉␉␉␉getValFK␊ |
97 | #define kRenamePartitionKey␉ "Rename Partition"␉ // disk.c␉␉␉␉getStringFK␊ |
98 | ␊ |
99 | #define kInstantMenuKey␉␉ "Instant Menu"␉␉ // boot.c␉␉␉␉getBoolFK␊ |
100 | #define kQuietBootKey␉␉ "Quiet Boot"␉␉ // boot.c␉␉␉␉getBoolFK␉␉␉␉- kFlag␊ |
101 | #define kTimeoutKey␉␉␉ "Timeout"␉␉␉ // options.c␉␉␉getIntFK␊ |
102 | #define kThemeNameKey␉␉ "Theme"␉␉␉ // gui.c␉␉␉␉getValFK␊ |
103 | #define kGUIKey␉␉␉␉ "GUI"␉␉␉␉ // boot.c␉␉␉␉getBoolFK␊ |
104 | #define kBootBannerKey␉␉ "Boot Banner"␉␉ // options.c␉␉␉getBoolFK␊ |
105 | #define kLegacyLogoKey␉␉ "Legacy Logo"␉␉ // gui.c␉␉␉␉getBoolFK␉␉␉␉- revert?␊ |
106 | #define kDebugInfoKey␉␉ "DebugInfo"␉␉ // gui.c, graphics.c␉getBoolFK␊ |
107 | #define kRescanPromptKey␉ "Rescan Prompt"␉ // boot.c␉␉␉␉getBoolFK␉␉␉␉- cdrom only - firstrun␊ |
108 | #define kRescanKey␉␉ "Rescan"␉␉␉ // boot.c␉␉␉␉getBoolFK␉␉␉␉- cdrom only?? - firstrun␊ |
109 | #define kCDROMPromptKey␉␉ "CD-ROM Prompt"␉ // options.c␉␉␉getValFK␉␉␉␉- internal??␊ |
110 | #define kCDROMOptionKey␉␉ "CD-ROM Option Key" // options.c␉␉␉getIntFK␉␉␉␉- internal?? (F8)␊ |
111 | #define kScanSingleDriveKey␉ "Scan Single Drive" // boot.c␉␉␉␉getBoolFK␊ |
112 | #define kDevicePropertiesKey "device-properties" // device_inject.c␉␉getValFK␊ |
113 | #define kWaitForKeypressKey␉ "Wait"␉␉␉␉ // boot.c␉␉␉␉getBoolFK␊ |
114 | #define kAltConfigKey␉␉ "config"␉␉␉ // stringTable.c␉␉getValFK␉␉␉␉- kFlag - hum.. handle like kFlag??␊ |
115 | #define kCanOverrideKey␉␉ "CanOverride"␉␉ // stringTable.c␉␉getBoolFK␉␉␉␉- remember -F ***␊ |
116 | #define kRootDeviceKey␉␉ "rd"␉␉␉␉ // options.c␉␉␉processBootArg␉␉␉- kFlag␊ |
117 | #define kBootDeviceKey␉␉ "Boot Device"␉␉ // options.c␉␉␉getValFK␉␉␉␉- kFlag/option??????␊ |
118 | #define kBootUUIDKey␉␉ "boot-uuid"␉␉ // options.c␉␉␉processBootArg␉␉␉- kFlag␊ |
119 | #define kHelperRootUUIDKey␉ "Root UUID"␉␉ // options.c␉␉␉getValFK␉␉␉␉- kFlag␊ |
120 | #define kArchKey␉␉␉ "arch"␉␉␉␉ // boot.c␉␉␉␉getValFK␉␉␉␉- kFlag - after all,␊ |
121 | // it's to be passed via "kernel Flags" ?? - "man com.apple.Boot.plist"␊ |
122 | #define kKernelNameKey␉␉ "Kernel"␉␉␉ // options.c␉␉␉getValFK␉␉␉␉- kFlag*** bFlag ?␊ |
123 | #define kKernelCacheKey␉␉ "Kernel Cache"␉␉ // boot.c␉␉␉␉getValFK␉␉␉␉- kFlag␊ |
124 | #define kKernelFlagsKey␉␉ "Kernel Flags"␉␉ // options.c␉␉␉getValFK␉␉␉␉- kFlags***␊ |
125 | #define kUseKCKey␉␉␉ "UseKC"␉␉␉ // boot.c␉␉␉␉getBoolFK␉␉␉␉- testing***␊ |
126 | ␊ |
127 | #define kKPatcherKey␉␉ "PatchKernel"␉␉ // kernel_patcher.c␉getBoolFK␊ |
128 | #define kAltExtensionsKey␉ "kext"␉␉␉␉ // drivers.c␉␉␉getValFK␊ |
129 | #define kMKextCacheKey␉␉ "MKext Cache"␉␉ // options.c␉␉␉getValFK␉␉␉␉- kFlag␊ |
130 | #define kMD0ImageKey␉␉ "md0"␉␉␉␉ // ramdisk.c␉␉␉getValFK␊ |
131 | #define kWakeKey␉␉␉ "Wake"␉␉␉␉ // boot.c␉␉␉␉getBoolFK␊ |
132 | #define kForceWakeKey␉␉ "ForceWake"␉␉ // boot.c␉␉␉␉getBoolFK␊ |
133 | #define kWakeKeyImageKey␉ "WakeImage"␉␉ // boot.c␉␉␉␉getValFK␉␉␉␉- location???␊ |
134 | #define kGraphicsModeKey␉ "Graphics Mode"␉ // graphics.c␉␉␉getNumberArraiFP␉␉- kFlag␊ |
135 | #define kAutoResolutionKey␉ "AutoResolution"␉ // boot.c␉␉␉␉getBoolFK␊ |
136 | ␊ |
137 | #define kDSDTKey␉␉␉ "DSDT"␉␉␉␉ // acpi_patcher.c␉␉getValFK␊ |
138 | #define kDropSSDTKey␉␉ "DropSSDT"␉␉␉ // acpi_patcher.c␉␉getBoolFK␊ |
139 | #define kRestartFixKey␉␉ "RestartFix" // acpi_patcher.c␉␉getBoolFK␉␉␉␉- revert to true?␊ |
140 | #define kGeneratePStatesKey␉ "GeneratePStates"␉ // acpi_patcher.c␉␉getBoolFK␊ |
141 | #define kGenerateCStatesKey␉ "GenerateCStates"␉ // acpi_patcher.c␉␉getBoolFK␊ |
142 | #define kEnableC2StatesKey␉ "EnableC2State"␉ // acpi_patcher.c␉␉getBoolFK␊ |
143 | #define kEnableC3StatesKey␉ "EnableC3State"␉ // acpi_patcher.c␉␉getBoolFK␊ |
144 | #define kEnableC4StatesKey␉ "EnableC4State"␉ // acpi_patcher.c␉␉getBoolFK␊ |
145 | ␊ |
146 | #define kSMBIOSdefaultsKey␉ "SMBIOSdefaults"␉ // smbios_patcher.c␉getBoolFK␊ |
147 | #define kSMBIOSKey␉␉␉ "SMBIOS"␉␉␉ // fake_efi.c␉␉␉getValFK␊ |
148 | //Azi: should this be changed to "SystemID"? BootHelp.txt matches SystemId␊ |
149 | // cleaned obsolete comments on fake_efi.c, lines 500/508 & 608.␊ |
150 | // fixed CHANGES file, lines 39/40.␊ |
151 | #define kSystemIDKey␉␉ "SystemId"␉␉␉ // fake_efi.c␉␉␉getStringFK␊ |
152 | #define kSystemTypeKey␉␉ "SystemType"␉␉ // fake_efi.c␉␉␉getStringFK␊ |
153 | #define kPCIRootUIDKey␉␉ "PciRoot"␉␉␉ // pci_root.c␉␉␉getValFK␊ |
154 | #define kEthernetBuiltInKey␉ "EthernetBuiltIn"␉ // pci_setup.c␉␉␉getBoolFK␊ |
155 | #define kForceHPETKey␉␉ "ForceHPET"␉␉ // pci_setup.c␉␉␉getBoolFK␊ |
156 | #define kUSBBusFixKey␉␉ "USBBusFix"␉␉ // usb.c␉␉␉␉getBoolFK␉␉␉␉- trouble! - USBLegacyOff + the other = hang␊ |
157 | #define kEHCIacquireKey␉␉ "EHCIacquire"␉␉ // usb.c␉␉␉␉getBoolFK␊ |
158 | #define kEHCIhardKey␉␉ "EHCIhard"␉␉␉ // usb.c␉␉␉␉getBoolFK␉␉␉␉- ??␊ |
159 | #define kUHCIresetKey␉␉ "UHCIreset"␉␉ // usb.c␉␉␉␉getBoolFK␊ |
160 | #define kLegacyOffKey␉␉ "USBLegacyOff"␉␉ // usb.c␉␉␉␉getBoolFK␊ |
161 | #define kBusRatioKey␉␉ "busratio"␉␉␉ // cpu.c␉␉␉␉getValFK␊ |
162 | ␊ |
163 | /*␊ |
164 | * Flags to the booter and/or kernel - these end with "Flag".␊ |
165 | */␊ |
166 | //␉␉identifier␉␉␉ string␉␉␉␉ location␉␉␉␉type␉␉␉␉␉comment␊ |
167 | #define kVerboseModeFlag␉ "-v"␉␉␉␉ // options.c␉␉␉getValFK␉␉␉␉- kFlag␊ |
168 | #define kSafeModeFlag␉␉ "-x"␉␉␉␉ // options.c␉␉␉getValFBootK & getValFK - ?? - kFlag␊ |
169 | #define kIgnoreCachesFlag␉ "-f"␉␉␉␉ // options.c␉␉␉getValFK␉␉␉␉- kFlag␊ |
170 | #define kIgnoreBootFileFlag␉ "-F"␉␉␉␉ // options.c␉␉␉getValFBootK␉␉␉- kFlag␊ |
171 | #define kSingleUserModeFlag␉ "-s"␉␉␉␉ // options.c␉␉␉getValFK␉␉␉␉- kFlag␊ |
172 | ␊ |
173 | /*␊ |
174 | * Booter behavior control␊ |
175 | */␊ |
176 | #define kBootTimeout␉␉ -1␊ |
177 | #define kCDBootTimeout␉␉ 8␊ |
178 | ␊ |
179 | enum {␊ |
180 | ␉kBackspaceKey␉␉= 0x08,␊ |
181 | ␉kTabKey␉␉␉␉= 0x09,␊ |
182 | ␉kReturnKey␉␉␉= '\r',␊ |
183 | ␉kEscapeKey␉␉␉= 0x1b,␊ |
184 | ␉kUpArrowkey␉␉␉= 0x4800,␊ |
185 | ␉kDownArrowkey␉␉= 0x5000,␊ |
186 | ␉kASCIIKeyMask␉␉= 0x7f,␊ |
187 | ␉kF2Key␉␉␉␉= 0x3c00, //Azi:autoresolution␊ |
188 | ␉kF5Key␉␉␉␉= 0x3f00,␊ |
189 | ␉kF10Key␉␉␉␉= 0x4400␊ |
190 | };␊ |
191 | ␊ |
192 | /*␊ |
193 | * A global set by boot() to record the device that the booter␊ |
194 | * was loaded from.␊ |
195 | */␊ |
196 | extern int gBIOSDev;␊ |
197 | extern long gBootMode;␊ |
198 | extern bool sysConfigValid;␊ |
199 | extern char bootBanner[];␊ |
200 | extern char bootPrompt[];␊ |
201 | extern bool gOverrideKernel;␊ |
202 | extern char *gPlatformName; // disabled ??␊ |
203 | extern char gMKextName[];␊ |
204 | extern char gRootDevice[];␊ |
205 | extern bool gEnableCDROMRescan;␊ |
206 | extern bool gScanSingleDrive;␊ |
207 | extern bool useGUI;␊ |
208 | ␊ |
209 | /*␊ |
210 | * Boot Modes␊ |
211 | */␊ |
212 | enum {␊ |
213 | kBootModeNormal = 0,␊ |
214 | kBootModeSafe = 1,␊ |
215 | kBootModeSecure = 2,␊ |
216 | kBootModeQuiet = 4␊ |
217 | };␊ |
218 | ␊ |
219 | extern void initialize_runtime();␊ |
220 | extern void common_boot(int biosdev);␊ |
221 | ␊ |
222 | /*␊ |
223 | * usb.c␊ |
224 | */␊ |
225 | extern int usb_loop();␊ |
226 | ␊ |
227 | /*␊ |
228 | * graphics.c␊ |
229 | */␊ |
230 | extern void printVBEModeInfo();␊ |
231 | extern void setVideoMode(int mode, int drawgraphics);␊ |
232 | extern int getVideoMode();␊ |
233 | extern void spinActivityIndicator();␊ |
234 | extern void clearActivityIndicator();␊ |
235 | extern void drawColorRectangle( unsigned short x,␊ |
236 | unsigned short y,␊ |
237 | unsigned short width,␊ |
238 | unsigned short height,␊ |
239 | unsigned char colorIndex );␊ |
240 | extern void drawDataRectangle( unsigned short x,␊ |
241 | unsigned short y,␊ |
242 | unsigned short width,␊ |
243 | unsigned short height,␊ |
244 | unsigned char * data );␊ |
245 | extern int␊ |
246 | convertImage( unsigned short width,␊ |
247 | unsigned short height,␊ |
248 | const unsigned char *imageData,␊ |
249 | unsigned char **newImageData );␊ |
250 | extern char * decodeRLE( const void * rleData, int rleBlocks, int outBytes );␊ |
251 | extern void drawBootGraphics(void);␊ |
252 | extern void drawPreview(void *src, uint8_t * saveunder);␊ |
253 | extern int getVideoMode(void);␊ |
254 | extern void loadImageScale (void *input, int iw, int ih, int ip, void *output, int ow, int oh, int op, int or);␊ |
255 | ␊ |
256 | /*␊ |
257 | * drivers.c␊ |
258 | */␊ |
259 | extern long LoadDrivers(char * dirSpec);␊ |
260 | extern long DecodeKernel(void *binary, entry_t *rentry, char **raddr, int *rsize);␊ |
261 | ␊ |
262 | typedef long (*FileLoadDrivers_t)(char *dirSpec, long plugin);␊ |
263 | /*!␊ |
264 | Hookable function pointer called during the driver loading phase that␊ |
265 | allows other code to cause additional drivers to be loaded.␊ |
266 | */␊ |
267 | extern long (*LoadExtraDrivers_p)(FileLoadDrivers_t FileLoadDrivers_p);␊ |
268 | ␊ |
269 | /*␊ |
270 | * options.c␊ |
271 | */␊ |
272 | extern int getBootOptions(bool firstRun);␊ |
273 | extern int processBootOptions();␊ |
274 | extern int selectAlternateBootDevice(int bootdevice);␊ |
275 | extern bool promptForRescanOption(void);␊ |
276 | ␊ |
277 | void showHelp();␊ |
278 | void showTextFile();␊ |
279 | char *getMemoryInfoString();␊ |
280 | ␊ |
281 | typedef struct {␊ |
282 | char name[80];␊ |
283 | void * param;␊ |
284 | } MenuItem;␊ |
285 | ␊ |
286 | /*␊ |
287 | * lzss.c␊ |
288 | */␊ |
289 | extern int decompress_lzss(u_int8_t *dst, u_int8_t *src, u_int32_t srclen);␊ |
290 | ␊ |
291 | struct compressed_kernel_header {␊ |
292 | u_int32_t signature;␊ |
293 | u_int32_t compress_type;␊ |
294 | u_int32_t adler32;␊ |
295 | u_int32_t uncompressed_size;␊ |
296 | u_int32_t compressed_size;␊ |
297 | u_int32_t reserved[11];␊ |
298 | char platform_name[64];␊ |
299 | char root_path[256];␊ |
300 | u_int8_t data[0];␊ |
301 | };␊ |
302 | typedef struct compressed_kernel_header compressed_kernel_header;␊ |
303 | ␊ |
304 | /* resume.c */␊ |
305 | void HibernateBoot(char *boot_device);␊ |
306 | ␊ |
307 | /* bmdecompress.c */␊ |
308 | void * DecompressData(void *srcbase, int *dw, int *dh, int *bytesPerPixel);␊ |
309 | ␊ |
310 | #endif /* !__BOOT2_BOOT_H */␊ |
311 | |