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 | //Azi:␊ |
33 | // Todo: don't include headers like boot.h on other headers, unless...!␊ |
34 | // move keys to the headers of the files they're in, if they have it!?␊ |
35 | // check header wrappers...␊ |
36 | ␊ |
37 | //#include "saio_internal.h" // the only one needed by boot.h it self.␊ |
38 | #include "bootstruct.h"␊ |
39 | ␊ |
40 | /*␊ |
41 | * Default names - these end with "Name" (easier to sort them).␊ |
42 | */␊ |
43 | #define kDefaultKernelName␉"mach_kernel"␊ |
44 | #define kDefaultThemeName␉"Default"␊ |
45 | /*␊ |
46 | #define kDefaultBootPlistName␉"com.apple.Boot.plist"␊ |
47 | #define kDefaultDSDTName␉␉"dsdt.aml"␊ |
48 | #define kDefaultSMBIOSName␉␉"smbios.plist"␊ |
49 | #define kDefaultRamdiskName␉␉"Preboot.dmg"␊ |
50 | ???*/␊ |
51 | ␊ |
52 | /*␊ |
53 | * Default paths?????␊ |
54 | */␊ |
55 | ␊ |
56 | /*␊ |
57 | * Undeclared (or undeclared here)␊ |
58 | */␊ |
59 | /*␊ |
60 | "-checkers" gui.c, getValFK;␊ |
61 | "biosdev" mboot.c, getValFBK␊ |
62 | "timeout" mboot.c, getValFBK␊ |
63 | "partno" mboot.c, getValFBK␊ |
64 | "DumpSPD" spd.c, getBollFK␊ |
65 | */␊ |
66 | ␊ |
67 | /*␊ |
68 | * Keys used in system Boot.plist - these end with "Key".␊ |
69 | */␊ |
70 | //␉␉identifier␉␉␉ string␉␉␉␉ location␉␉␉␉type␉␉␉␉␉comment␊ |
71 | #define kTextModeKey␉␉ "Text Mode"␉␉ // graphics.c␉␉␉getNumberArraiFP␉␉- default 80x25 - kFlag - does it work??␊ |
72 | //#define kProductVersionKey␉ "ProductVersion"␉ // options.c␉␉␉getValFK␉␉␉- (boot.c on trunk) - reverted␊ |
73 | #define kDefaultPartitionKey "Default Partition" // sys.c␉␉␉␉getStringFK␊ |
74 | #define kHidePartitionKey␉ "Hide Partition"␉ // disk.c␉␉␉␉getValFK␊ |
75 | #define kRenamePartitionKey␉ "Rename Partition"␉ // disk.c␉␉␉␉getStringFK␊ |
76 | #define kInstantMenuKey␉␉ "Instant Menu"␉␉ // boot.c␉␉␉␉getBoolFK␊ |
77 | #define kQuietBootKey␉␉ "Quiet Boot"␉␉ // boot.c␉␉␉␉getBoolFK␉␉␉␉- kFlag␊ |
78 | #define kTimeoutKey␉␉␉ "Timeout"␉␉␉ // options.c␉␉␉getIntFK␊ |
79 | #define kThemeNameKey␉␉ "Theme"␉␉␉ // gui.c␉␉␉␉getValFK␊ |
80 | #define kGUIKey␉␉␉␉ "GUI"␉␉␉␉ // boot.c␉␉␉␉getBoolFK␊ |
81 | #define kBootBannerKey␉␉ "Boot Banner"␉␉ // options.c␉␉␉getBoolFK␊ |
82 | #define kDebugInfoKey␉␉ "DebugInfo"␉␉ // gui.c, graphics.c␉getBoolFK␊ |
83 | #define kRescanPromptKey␉ "Rescan Prompt"␉ // boot.c␉␉␉␉getBoolFK␉␉␉␉- cdrom only - firstrun␊ |
84 | #define kRescanKey␉␉ "Rescan"␉␉␉ // boot.c␉␉␉␉getBoolFK␉␉␉␉- cdrom only?? - firstrun␊ |
85 | #define kCDROMPromptKey␉␉ "CD-ROM Prompt"␉ // options.c␉␉␉getValFK␉␉␉␉- internal??␊ |
86 | #define kCDROMOptionKey␉␉ "CD-ROM Option Key" // options.c␉␉␉getIntFK␉␉␉␉- internal?? (F8)␊ |
87 | #define kScanSingleDriveKey␉ "Scan Single Drive" // boot.c␉␉␉␉getBoolFK␊ |
88 | #define kDevicePropertiesKey "device-properties" // device_inject.c␉␉getValFK␉␉␉␉- here because ??␊ |
89 | #define kWaitForKeypressKey␉ "Wait"␉␉␉␉ // boot.c␉␉␉␉getBoolFK␊ |
90 | #define kAltConfigKey␉␉ "config"␉␉␉ // stringTable.c␉␉getValFK␉␉␉␉- kFlag - hum.. handle like kFlag??␊ |
91 | #define kCanOverrideKey␉␉ "CanOverride"␉␉ // stringTable.c␉␉getBoolFK␊ |
92 | #define kRootDeviceKey␉␉ "rd"␉␉␉␉ // options.c␉␉␉processBootArg␉␉␉- kFlag␊ |
93 | #define kBootDeviceKey␉␉ "Boot Device"␉␉ // options.c␉␉␉getValFK␉␉␉␉- kFlag/option??????␊ |
94 | #define kBootUUIDKey␉␉ "boot-uuid"␉␉ // options.c␉␉␉processBootArg␉␉␉- kFlag␊ |
95 | #define kHelperRootUUIDKey␉ "Root UUID"␉␉ // options.c␉␉␉getValFK␊ |
96 | #define kArchKey␉␉␉ "arch"␉␉␉␉ // boot.c␉␉␉␉getValFK␉␉␉␉- kFlag␊ |
97 | #define kKernelNameKey␉␉ "Kernel"␉␉␉ // options.c␉␉␉getValFK␊ |
98 | #define kKernelCacheKey␉␉ "Kernel Cache"␉␉ // boot.c␉␉␉␉getValFK␉␉␉␉- kFlag␊ |
99 | #define kKernelFlagsKey␉␉ "Kernel Flags"␉␉ // options.c␉␉␉getValFK␊ |
100 | #define kKPatcherKey␉␉ "PatchKernel"␉␉ // kernel_patcher.c␉getBoolFK␊ |
101 | #define kAltExtensionsKey␉ "kext"␉␉␉␉ // drivers.c␉␉␉getValFK␊ |
102 | #define kMKextCacheKey␉␉ "MKext Cache"␉␉ // options.c␉␉␉getValFK␉␉␉␉- kFlag␊ |
103 | #define kMD0ImageKey␉␉ "md0"␉␉␉␉ // ramdisk.c␉␉␉getValFK␊ |
104 | #define kWakeKey␉␉␉ "Wake"␉␉␉␉ // boot.c␉␉␉␉getBoolFK␊ |
105 | #define kForceWakeKey␉␉ "ForceWake"␉␉ // boot.c␉␉␉␉getBoolFK␊ |
106 | #define kWakeKeyImageKey␉ "WakeImage"␉␉ // boot.c␉␉␉␉getValFK␊ |
107 | #define kUseAtiROMKey␉␉ "UseAtiROM"␉␉ // ati.c␉␉␉␉getBoolFK␊ |
108 | #define kUseNvidiaROMKey␉ "UseNvidiaROM"␉␉ // nvidia.c␉␉␉getBoolFK␊ |
109 | #define kVBIOSKey␉␉␉ "VBIOS"␉␉␉ // nvidia.c␉␉␉getBoolFK␊ |
110 | #define kGraphicsModeKey␉ "Graphics Mode"␉ // graphics.c␉␉␉getNumberArraiFP␉␉- kFlag␊ |
111 | #define kAutoResolutionKey␉ "AutoResolution"␉ // boot.c␉␉␉␉getBoolFK␊ |
112 | #define kGraphicsEnablerKey␉ "GraphicsEnabler"␉ // GraphicsEnabler.c␉getBoolFK␊ |
113 | #define kLegacyLogoKey␉␉ "Legacy Logo"␉␉ // gui.c␉␉␉␉getBoolFK␊ |
114 | #define kDSDTKey␉␉␉ "DSDT"␉␉␉␉ // acpi_patcher.c␉␉getValFK␊ |
115 | #define kDropSSDTKey␉␉ "DropSSDT"␉␉␉ // acpi_patcher.c␉␉getBoolFK␊ |
116 | #define kRestartFixKey␉␉ "RestartFix" // acpi_patcher.c␉␉getBoolFK␊ |
117 | #define kGeneratePStatesKey␉ "GeneratePStates"␉ // acpi_patcher.c␉␉getBoolFK␊ |
118 | #define kGenerateCStatesKey␉ "GenerateCStates"␉ // acpi_patcher.c␉␉getBoolFK␊ |
119 | #define kEnableC4StatesKey␉ "EnableC4State"␉ // acpi_patcher.c␉␉getBoolFK␊ |
120 | #define kUseMemDetectKey␉ "UseMemDetect"␉ // platform.c␉␉␉getBoolFK␊ |
121 | #define kSMBIOSdefaultsKey␉ "SMBIOSdefaults"␉ // smbios_patcher.c␉getBoolFK␊ |
122 | #define kSMBIOSKey␉␉␉ "SMBIOS"␉␉␉ // fake_efi.c␉␉␉getValFK␊ |
123 | #define kSystemIDKey␉␉ "SystemId"␉␉␉ // fake_efi.c␉␉␉getStringFK␉␉␉␉- change to SystemID?␊ |
124 | #define kSystemTypeKey␉␉ "SystemType"␉␉ // fake_efi.c␉␉␉getStringFK␊ |
125 | #define kPCIRootUIDKey␉␉ "PciRoot"␉␉␉ // pci_root.c␉␉␉getValFK␊ |
126 | #define kEthernetBuiltInKey␉ "EthernetBuiltIn"␉ // pci_setup.c␉␉␉getBoolFK␊ |
127 | #define kForceHPETKey␉␉ "ForceHPET"␉␉ // pci_setup.c␉␉␉getBoolFK␊ |
128 | #define kUSBBusFixKey␉␉ "USBBusFix"␉␉ // usb.c␉␉␉␉getBoolFK␊ |
129 | #define kEHCIacquireKey␉␉ "EHCIacquire"␉␉ // usb.c␉␉␉␉getBoolFK␊ |
130 | #define kEHCIhardKey␉␉ "EHCIhard"␉␉␉ // usb.c␉␉␉␉getBoolFK␉␉␉␉- ??␊ |
131 | #define kUHCIresetKey␉␉ "UHCIreset"␉␉ // usb.c␉␉␉␉getBoolFK␊ |
132 | #define kLegacyOffKey␉␉ "USBLegacyOff"␉␉ // usb.c␉␉␉␉getBoolFK␊ |
133 | ␊ |
134 | /*␊ |
135 | * Flags to the booter and/or kernel - these end with "Flag".␊ |
136 | */␊ |
137 | //␉␉identifier␉␉␉ string␉␉␉␉ location␉␉␉␉type␉␉␉␉␉comment␊ |
138 | #define kVerboseModeFlag␉ "-v"␉␉␉␉ // options.c␉␉␉getValFK␉␉␉␉- kFlag␊ |
139 | #define kSafeModeFlag␉␉ "-x"␉␉␉␉ // options.c␉␉␉getValFBootK & getValFK - ?? - kFlag␊ |
140 | #define kIgnoreCachesFlag␉ "-f"␉␉␉␉ // options.c␉␉␉getValFK␉␉␉␉- kFlag␊ |
141 | #define kIgnoreBootFileFlag␉ "-F"␉␉␉␉ // options.c␉␉␉getValFBootK␉␉␉- kFlag␊ |
142 | #define kSingleUserModeFlag␉ "-s"␉␉␉␉ // options.c␉␉␉getValFK␉␉␉␉- kFlag␊ |
143 | ␊ |
144 | /*␊ |
145 | * Booter behavior control␊ |
146 | */␊ |
147 | #define kBootTimeout -1␊ |
148 | #define kCDBootTimeout 8␊ |
149 | ␊ |
150 | /*␊ |
151 | * A global set by boot() to record the device that the booter␊ |
152 | * was loaded from.␊ |
153 | */␊ |
154 | extern int gBIOSDev;␊ |
155 | extern long gBootMode;␊ |
156 | extern bool sysConfigValid;␊ |
157 | extern char bootBanner[];␊ |
158 | extern char bootPrompt[];␊ |
159 | extern bool gOverrideKernel;␊ |
160 | //extern char *gPlatformName; disabled␊ |
161 | extern char gMKextName[];␊ |
162 | extern char gMacOSVersion[];␊ |
163 | extern char gRootDevice[];␊ |
164 | extern bool gEnableCDROMRescan;␊ |
165 | extern bool gScanSingleDrive;␊ |
166 | extern bool useGUI;␊ |
167 | ␊ |
168 | /*␊ |
169 | * Boot Modes␊ |
170 | */␊ |
171 | enum {␊ |
172 | kBootModeNormal = 0,␊ |
173 | kBootModeSafe = 1,␊ |
174 | kBootModeSecure = 2,␊ |
175 | kBootModeQuiet = 4␊ |
176 | };␊ |
177 | ␊ |
178 | extern void initialize_runtime();␊ |
179 | extern void common_boot(int biosdev);␊ |
180 | ␊ |
181 | /*␊ |
182 | * usb.c␊ |
183 | */␊ |
184 | extern int usb_loop();␊ |
185 | ␊ |
186 | /*␊ |
187 | * graphics.c␊ |
188 | */␊ |
189 | extern void printVBEModeInfo();␊ |
190 | extern void setVideoMode(int mode, int drawgraphics);␊ |
191 | extern int getVideoMode();␊ |
192 | extern void spinActivityIndicator();␊ |
193 | extern void clearActivityIndicator();␊ |
194 | extern void drawColorRectangle( unsigned short x,␊ |
195 | unsigned short y,␊ |
196 | unsigned short width,␊ |
197 | unsigned short height,␊ |
198 | unsigned char colorIndex );␊ |
199 | extern void drawDataRectangle( unsigned short x,␊ |
200 | unsigned short y,␊ |
201 | unsigned short width,␊ |
202 | unsigned short height,␊ |
203 | unsigned char * data );␊ |
204 | extern int␊ |
205 | convertImage( unsigned short width,␊ |
206 | unsigned short height,␊ |
207 | const unsigned char *imageData,␊ |
208 | unsigned char **newImageData );␊ |
209 | extern char * decodeRLE( const void * rleData, int rleBlocks, int outBytes );␊ |
210 | extern void drawBootGraphics(void);␊ |
211 | extern void drawPreview(void *src, uint8_t * saveunder);␊ |
212 | extern int getVideoMode(void);␊ |
213 | extern void loadImageScale (void *input, int iw, int ih, int ip, void *output, int ow, int oh, int op, int or);␊ |
214 | ␊ |
215 | /*␊ |
216 | * drivers.c␊ |
217 | */␊ |
218 | extern long LoadDrivers(char * dirSpec);␊ |
219 | extern long DecodeKernel(void *binary, entry_t *rentry, char **raddr, int *rsize);␊ |
220 | ␊ |
221 | typedef long (*FileLoadDrivers_t)(char *dirSpec, long plugin);␊ |
222 | /*!␊ |
223 | Hookable function pointer called during the driver loading phase that␊ |
224 | allows other code to cause additional drivers to be loaded.␊ |
225 | */␊ |
226 | extern long (*LoadExtraDrivers_p)(FileLoadDrivers_t FileLoadDrivers_p);␊ |
227 | ␊ |
228 | /*␊ |
229 | * options.c␊ |
230 | */␊ |
231 | extern int getBootOptions(bool firstRun);␊ |
232 | extern int processBootOptions();␊ |
233 | extern int selectAlternateBootDevice(int bootdevice);␊ |
234 | extern bool promptForRescanOption(void);␊ |
235 | ␊ |
236 | void showHelp();␊ |
237 | void showTextFile();␊ |
238 | char *getMemoryInfoString();␊ |
239 | ␊ |
240 | typedef struct {␊ |
241 | char name[80];␊ |
242 | void * param;␊ |
243 | } MenuItem;␊ |
244 | ␊ |
245 | /*␊ |
246 | * lzss.c␊ |
247 | */␊ |
248 | extern int decompress_lzss(u_int8_t *dst, u_int8_t *src, u_int32_t srclen);␊ |
249 | ␊ |
250 | struct compressed_kernel_header {␊ |
251 | u_int32_t signature;␊ |
252 | u_int32_t compress_type;␊ |
253 | u_int32_t adler32;␊ |
254 | u_int32_t uncompressed_size;␊ |
255 | u_int32_t compressed_size;␊ |
256 | u_int32_t reserved[11];␊ |
257 | char platform_name[64];␊ |
258 | char root_path[256];␊ |
259 | u_int8_t data[0];␊ |
260 | };␊ |
261 | typedef struct compressed_kernel_header compressed_kernel_header;␊ |
262 | ␊ |
263 | /* resume.c */␊ |
264 | void HibernateBoot(char *boot_device);␊ |
265 | ␊ |
266 | /* bmdecompress.c */␊ |
267 | void * DecompressData(void *srcbase, int *dw, int *dh, int *bytesPerPixel);␊ |
268 | ␊ |
269 | #endif /* !__BOOT2_BOOT_H */␊ |
270 | |