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 "libsaio.h"␊ |
33 | /*␊ |
34 | * Paths used by chameleon␊ |
35 | */␊ |
36 | ␊ |
37 | //kernel cache␊ |
38 | #define kDefaultCachePathLeo "/System/Library/Caches/com.apple.kernelcaches/"␊ |
39 | #define kDefaultCachePathSnow "/System/Library/Caches/com.apple.kext.caches/Startup/"␊ |
40 | ␊ |
41 | // Lion installer␊ |
42 | #define kLionInstallerDataFolder "/Mac OS X Install Data/"␊ |
43 | #define kLionInstallerPlist kLionInstallerDataFolder "com.apple.Boot.plist"␊ |
44 | ␊ |
45 | /*␊ |
46 | * Keys used in system Boot.plist␊ |
47 | */␊ |
48 | #define kGraphicsModeKey␉"Graphics Mode"␊ |
49 | #define kTextModeKey␉␉"Text Mode"␊ |
50 | #define kQuietBootKey␉␉"Quiet Boot"␊ |
51 | #define kKernelFlagsKey␉␉"Kernel Flags"␊ |
52 | #define kKernelArchKey␉␉"Kernel Architecture"␊ |
53 | #define kMKextCacheKey␉␉"MKext Cache"␊ |
54 | #define kKernelNameKey␉␉"Kernel"␊ |
55 | #define kKernelCacheKey␉␉"Kernel Cache"␊ |
56 | #define kUseKernelCache␉␉"UseKernelCache"␉/* boot.c */␊ |
57 | #define kBootDeviceKey␉␉"Boot Device"␊ |
58 | #define kTimeoutKey␉␉"Timeout"␊ |
59 | #define kRootDeviceKey␉␉"rd"␊ |
60 | #define kBootUUIDKey␉␉"boot-uuid"␊ |
61 | #define kHelperRootUUIDKey␉"Root UUID"␊ |
62 | #define kPlatformKey␉␉"platform"␊ |
63 | #define kACPIKey␉␉"acpi"␊ |
64 | #define kCDROMPromptKey␉␉"CD-ROM Prompt"␊ |
65 | #define kCDROMOptionKey␉␉"CD-ROM Option Key"␊ |
66 | #define kRescanPromptKey␉"Rescan Prompt"␊ |
67 | #define kRescanKey␉␉"Rescan"␊ |
68 | #define kScanSingleDriveKey␉"Scan Single Drive"␊ |
69 | #define kInstantMenuKey␉␉"Instant Menu"␊ |
70 | #define kDefaultKernel␉␉"mach_kernel"␊ |
71 | #define kGUIKey␉␉␉"GUI"␊ |
72 | #define kBootBannerKey␉␉"Boot Banner"␊ |
73 | #define kShowInfoKey␉␉"ShowInfo"␉␉// gui.c␊ |
74 | #define kWaitForKeypressKey␉"Wait"␊ |
75 | ␊ |
76 | /* AsereBLN: added these keys */␊ |
77 | #define kUseAtiROM␉␉"UseAtiROM"␉␉/* ati.c */␊ |
78 | #define kWake␉␉␉"Wake"␉␉␉/* boot.c */␊ |
79 | #define kForceWake␉␉"ForceWake"␉␉/* boot.c */␊ |
80 | #define kWakeImage␉␉"WakeImage"␉␉/* boot.c */␊ |
81 | #define kProductVersion␉␉"ProductVersion"␉/* boot.c */␊ |
82 | #define karch␉␉␉"arch"␉␉␉/* boot.c */␊ |
83 | #define kDSDT␉␉␉"DSDT"␉␉␉/* acpi_patcher.c */␊ |
84 | #define kDropSSDT␉␉"DropSSDT"␉␉/* acpi_patcher.c */␊ |
85 | #define kDeviceProperties␉"device-properties"␉/* device_inject.c */␊ |
86 | #define kHidePartition␉␉"Hide Partition"␉/* disk.c */␊ |
87 | #define kRenamePartition␉"Rename Partition"␉/* disk.c */␊ |
88 | #define kSMBIOSKey␉␉"SMBIOS"␉␉/* fake_efi.c */␊ |
89 | #define kSystemID␉␉"SystemId"␉␉/* fake_efi.c */␊ |
90 | #define kSystemType␉␉"SystemType"␉␉/* fake_efi.c */␊ |
91 | #define kUseNvidiaROM␉␉"UseNvidiaROM"␉␉/* nvidia.c */␊ |
92 | #define kVBIOS␉␉␉"VBIOS"␉␉␉/* nvidia.c */␊ |
93 | #define kPCIRootUID␉␉"PCIRootUID"␉␉/* pci_root.c */␊ |
94 | #define kEthernetBuiltIn␉"EthernetBuiltIn"␉/* pci_setup.c */␊ |
95 | #define kGraphicsEnabler␉"GraphicsEnabler"␉/* pci_setup.c */␊ |
96 | #define kForceHPET␉␉"ForceHPET"␉␉/* pci_setup.c */␊ |
97 | #define kUseMemDetect␉␉"UseMemDetect"␉␉/* platform.c */␊ |
98 | #define kSMBIOSdefaults␉␉"SMBIOSdefaults"␉/* smbios_patcher.c */␊ |
99 | #define kUSBBusFix␉␉"USBBusFix"␉␉/* usb.c */␊ |
100 | #define kEHCIacquire␉␉"EHCIacquire"␉␉/* usb.c */␊ |
101 | #define kUHCIreset␉␉"UHCIreset"␉␉/* usb.c */␊ |
102 | #define kEHCIhard␉␉"EHCIhard"␉␉/* usb.c */␊ |
103 | #define kDefaultPartition␉"Default Partition"␉/* sys.c */␊ |
104 | ␊ |
105 | /* Duvel300: added this */␊ |
106 | #define kRestartFix␉␉"RestartFix"␉␉/* acpi_patcher.c */␊ |
107 | ␊ |
108 | /* Slice: added this */␊ |
109 | #define kPS2RestartFix␉␉"PS2RestartFix"␉␉/* acpi_patcher.c */␊ |
110 | ␊ |
111 | /* Signal64: added this key */␊ |
112 | #define kLegacyOff␉␉"USBLegacyOff"␉␉/* usb.c */␊ |
113 | ␊ |
114 | /* Lebidou: added this key */␊ |
115 | ␊ |
116 | ␊ |
117 | /* Meklort: added this key */␊ |
118 | #define kMD0Image␉␉"md0"␉␉␉/* ramdisk.h */␊ |
119 | ␊ |
120 | /* Andyvand: added these keys */␊ |
121 | //#define kSSDT␉␉␉"SSDT"␉␉␉/* acpi_patcher.c */␊ |
122 | //#define kHPET␉␉␉"HPET"␉␉␉/* acpi_patcher.c */␊ |
123 | //#define kSBST␉␉␉"SBST"␉␉␉/* acpi_patcher.c */␊ |
124 | //#define kECDT␉␉␉"ECDT"␉␉␉/* acpi_patcher.c */␊ |
125 | //#define kASFT␉␉␉"ASFT"␉␉␉/* acpi_patcher.c */␊ |
126 | //#define kDMAR␉␉␉"DMAR"␉␉␉/* acpi_patcher.c */␊ |
127 | //#define kFADT␉␉␉"FADT"␉␉␉/* acpi_patcher.c */␊ |
128 | //#define kAPIC␉␉␉"APIC"␉␉␉/* acpi_patcher.c */␊ |
129 | //#define kMCFG␉␉␉"MCFG"␉␉␉/* acpi_patcher.c */␊ |
130 | //#define kOEMDSDT␉␉"oemDSDT"␉␉/* acpi_patcher.c */␊ |
131 | //#define kOEMSSDT␉␉"oemSSDT"␉␉/* acpi_patcher.c */␊ |
132 | //#define kOEMHPET␉␉"oemHPET"␉␉/* acpi_patcher.c */␊ |
133 | //#define kOEMSBST␉␉"oemSBST"␉␉/* acpi_patcher.c */␊ |
134 | //#define kOEMECDT␉␉"oemECDT"␉␉/* acpi_patcher.c */␊ |
135 | //#define kOEMASFT␉␉"oemASFT"␉␉/* acpi_patcher.c */␊ |
136 | //#define kOEMDMAR␉␉"oemDMAR"␉␉/* acpi_patcher.c */␊ |
137 | //#define kOEMFADT␉␉"oemFADT"␉␉/* acpi_patcher.c */␊ |
138 | //#define kOEMAPIC␉␉"oemAPIC"␉␉/* acpi_patcher.c */␊ |
139 | //#define kOEMMCFG␉␉"oemMCFG"␉␉/* acpi_patcher.c */␊ |
140 | //#define kDropHPET␉␉"DropHPET"␉␉/* acpi_patcher.c */␊ |
141 | //#define kDropSLIC␉␉"DropSLIC"␉␉/* acpi_patcher.c */␊ |
142 | //#define kDropSBST␉␉"DropSBST"␉␉/* acpi_patcher.c */␊ |
143 | //#define kDropECDT␉␉"DropECDT"␉␉/* acpi_patcher.c */␊ |
144 | //#define kDropASFT␉␉"DropASFT"␉␉/* acpi_patcher.c */␊ |
145 | //#define kDropDMAR␉␉"DropDMAR"␉␉/* acpi_patcher.c */␊ |
146 | //#define kUpdateACPI␉␉"UpdateACPI"␉␉/* acpi_patcher.c */␊ |
147 | ␊ |
148 | /* Mojodojo: added these keys */␊ |
149 | #define kGeneratePStates␉"GeneratePStates"␉/* acpi_patcher.c */␊ |
150 | #define kGenerateCStates␉"GenerateCStates"␉/* acpi_patcher.c */␊ |
151 | #define kCSTUsingSystemIO␉"CSTUsingSystemIO"␉/* acpi_patcher.c */␊ |
152 | #define kEnableC2State␉␉"EnableC2State"␉␉/* acpi_patcher.c */␊ |
153 | #define kEnableC3State␉␉"EnableC3State"␉␉/* acpi_patcher.c */␊ |
154 | #define kEnableC4State␉␉"EnableC4State"␉␉/* acpi_patcher.c */␊ |
155 | /* valv: added these keys */␊ |
156 | #define kbusratio␉␉"busratio"␉␉/* cpu.c */␊ |
157 | #define kDcfg0␉␉␉"display_0"␉␉/* nvidia.c */␊ |
158 | #define kDcfg1␉␉␉"display_1"␉␉/* nvidia.c */␊ |
159 | ␊ |
160 | /* Kabyl: added these keys */␊ |
161 | ␊ |
162 | #define kAtiConfig␉␉"AtiConfig"␉␉/* ati.c */␊ |
163 | #define kAtiPorts␉␉"AtiPorts"␉␉/* ati.c */␊ |
164 | #define kATYbinimage␉␉"ATYbinimage"␉␉/* ati.c */␊ |
165 | ␊ |
166 | /* cosmo1: added these keys */␊ |
167 | #define kEnableHDMIAudio␉"EnableHDMIAudio"␉/*ati.c && nvidia.c */␊ |
168 | ␊ |
169 | /*␊ |
170 | * Flags to the booter or kernel␊ |
171 | */␊ |
172 | #define kVerboseModeFlag␉"-v"␊ |
173 | #define kSafeModeFlag␉␉"-x"␊ |
174 | #define kIgnoreCachesFlag␉"-f"␊ |
175 | #define kIgnoreBootFileFlag␉"-F"␊ |
176 | #define kSingleUserModeFlag␉"-s"␊ |
177 | ␊ |
178 | /*␊ |
179 | * Booter behavior control␊ |
180 | */␊ |
181 | #define kBootTimeout -1␊ |
182 | #define kCDBootTimeout 8␊ |
183 | ␊ |
184 | /*␊ |
185 | * A global set by boot() to record the device that the booter␊ |
186 | * was loaded from.␊ |
187 | */␊ |
188 | #define ROOT_DEVICE_SIZE 512␊ |
189 | extern int gBIOSDev;␊ |
190 | extern long gBootMode;␊ |
191 | extern bool sysConfigValid;␊ |
192 | extern char bootBanner[];␊ |
193 | extern char bootPrompt[];␊ |
194 | extern bool gOverrideKernel;␊ |
195 | extern char *gPlatformName;␊ |
196 | extern char gMKextName[];␊ |
197 | extern char gRootDevice[];␊ |
198 | extern bool gEnableCDROMRescan;␊ |
199 | extern bool gScanSingleDrive;␊ |
200 | extern bool useGUI;␊ |
201 | ␊ |
202 | extern void *gRootPCIDev;␊ |
203 | ␊ |
204 | extern uint16_t vgaVendor;;␊ |
205 | ␊ |
206 | /*␊ |
207 | * Boot Modes␊ |
208 | */␊ |
209 | enum {␊ |
210 | kBootModeNormal = 0,␊ |
211 | kBootModeSafe = 1,␊ |
212 | kBootModeSecure = 2,␊ |
213 | kBootModeQuiet = 4␊ |
214 | };␊ |
215 | ␊ |
216 | extern void initialize_runtime();␊ |
217 | extern void common_boot(int biosdev);␊ |
218 | ␊ |
219 | /*␊ |
220 | * usb.c␊ |
221 | */␊ |
222 | extern int usb_loop();␊ |
223 | ␊ |
224 | /*␊ |
225 | * graphics.c␊ |
226 | */␊ |
227 | extern void printVBEModeInfo();␊ |
228 | extern void setVideoMode(int mode, int drawgraphics);␊ |
229 | extern int getVideoMode();␊ |
230 | extern void spinActivityIndicator();␊ |
231 | extern void clearActivityIndicator();␊ |
232 | extern void drawColorRectangle(␊ |
233 | unsigned short x,␊ |
234 | unsigned short y,␊ |
235 | unsigned short width,␊ |
236 | unsigned short height,␊ |
237 | unsigned char colorIndex␊ |
238 | );␊ |
239 | extern void drawDataRectangle(␊ |
240 | unsigned short x,␊ |
241 | unsigned short y,␊ |
242 | unsigned short width,␊ |
243 | unsigned short height,␊ |
244 | unsigned char * data␊ |
245 | );␊ |
246 | extern int␊ |
247 | convertImage( unsigned short width,␊ |
248 | unsigned short height,␊ |
249 | const unsigned char *imageData,␊ |
250 | unsigned char **newImageData );␊ |
251 | extern char * decodeRLE( const void * rleData, int rleBlocks, int outBytes );␊ |
252 | extern void drawBootGraphics(void);␊ |
253 | extern void drawPreview(void *src, uint8_t * saveunder);␊ |
254 | extern int getVideoMode(void);␊ |
255 | extern void loadImageScale (void *input, int iw, int ih, int ip, void *output, int ow, int oh, int op, int or);␊ |
256 | ␊ |
257 | /*␊ |
258 | * drivers.c␊ |
259 | */␊ |
260 | extern long LoadExtraDrivers(char * dirSpec);␊ |
261 | extern long LoadDrivers(char * dirSpec);␊ |
262 | extern long DecodeKernel(void *binary, entry_t *rentry, char **raddr, int *rsize);␊ |
263 | ␊ |
264 | typedef long (*FileLoadDrivers_t)(char *dirSpec, long plugin);␊ |
265 | /*!␊ |
266 | Hookable function pointer called during the driver loading phase that␊ |
267 | allows other code to cause additional drivers to be loaded.␊ |
268 | */␊ |
269 | extern long (*LoadExtraDrivers_p)(FileLoadDrivers_t FileLoadDrivers_p);␊ |
270 | ␊ |
271 | /*␊ |
272 | * options.c␊ |
273 | */␊ |
274 | extern char gBootUUIDString[];␊ |
275 | ␊ |
276 | extern int getBootOptions(bool firstRun);␊ |
277 | extern int processBootOptions();␊ |
278 | extern int selectAlternateBootDevice(int bootdevice);␊ |
279 | extern bool promptForRescanOption(void);␊ |
280 | ␊ |
281 | void showHelp();␊ |
282 | void showTextFile();␊ |
283 | char *getMemoryInfoString();␊ |
284 | ␊ |
285 | typedef struct {␊ |
286 | char name[80];␊ |
287 | void * param;␊ |
288 | } MenuItem;␊ |
289 | ␊ |
290 | /*␊ |
291 | * lzss.c␊ |
292 | */␊ |
293 | extern int decompress_lzss(u_int8_t *dst, u_int8_t *src, u_int32_t srclen);␊ |
294 | ␊ |
295 | struct compressed_kernel_header {␊ |
296 | u_int32_t signature;␊ |
297 | u_int32_t compress_type;␊ |
298 | u_int32_t adler32;␊ |
299 | u_int32_t uncompressed_size;␊ |
300 | u_int32_t compressed_size;␊ |
301 | u_int32_t reserved[11];␊ |
302 | char platform_name[64];␊ |
303 | char root_path[256];␊ |
304 | u_int8_t data[0];␊ |
305 | };␊ |
306 | typedef struct compressed_kernel_header compressed_kernel_header;␊ |
307 | ␊ |
308 | /* resume.c */␊ |
309 | void HibernateBoot(char *boot_device);␊ |
310 | ␊ |
311 | /* bmdecompress.c */␊ |
312 | void * DecompressData(void *srcbase, int *dw, int *dh, int *bytesPerPixel);␊ |
313 | ␊ |
314 | #endif /* !__BOOT2_BOOT_H */␊ |
315 | |