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