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