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 karch␉␉␉␉"arch"␉␉␉␉/* boot.c */␊ |
54 | #define kProductVersion␉␉"ProductVersion"␉/* boot.c */␊ |
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 kInsantMenuKey␉␉"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 | #define kDSDT␉␉␉␉"DSDT"␉␉␉␉/* acpi_patcher.c */␊ |
79 | #define kDropSSDT␉␉␉"DropSSDT"␉␉␉/* acpi_patcher.c */␊ |
80 | #define kRestartFix␉␉␉"RestartFix"␉␉/* acpi_patcher.c */␊ |
81 | #define kGeneratePStates␉"GeneratePStates"␉/* acpi_patcher.c */␊ |
82 | #define kGenerateCStates␉"GenerateCStates"␉/* acpi_patcher.c */␊ |
83 | #define kCSTUsingSystemIO␉"CSTUsingSystemIO"␉/* acpi_patcher.c */␊ |
84 | #define kEnableC2State␉␉"EnableC2State"␉␉/* acpi_patcher.c */␊ |
85 | #define kEnableC3State␉␉"EnableC3State"␉␉/* acpi_patcher.c */␊ |
86 | #define kEnableC4State␉␉"EnableC4State"␉␉/* acpi_patcher.c */␊ |
87 | ␊ |
88 | #define kWake␉␉␉␉"Wake"␉␉␉␉/* boot.c */␊ |
89 | #define kForceWake␉␉␉"ForceWake"␉␉␉/* boot.c */␊ |
90 | #define kWakeImage␉␉␉"WakeImage"␉␉␉/* boot.c */␊ |
91 | ␊ |
92 | #define kbusratio␉␉␉"busratio"␉␉␉/* cpu.c */␊ |
93 | ␊ |
94 | #define kDeviceProperties␉"device-properties"␉/* device_inject.c */␊ |
95 | ␊ |
96 | #define kHidePartition␉␉"Hide Partition"␉/* disk.c */␊ |
97 | #define kRenamePartition␉"Rename Partition"␉/* disk.c */␊ |
98 | #define kDefaultPartition␉"Default Partition"␉/* sys.c */␊ |
99 | ␊ |
100 | #define kSMBIOSKey␉␉␉"SMBIOS"␉␉␉/* fake_efi.c */␊ |
101 | #define kSMBIOSdefaults␉␉"SMBIOSdefaults"␉/* smbios_patcher.c */␊ |
102 | #define kSystemID␉␉␉"SystemId"␉␉␉/* fake_efi.c */␊ |
103 | #define kSystemType␉␉␉"SystemType"␉␉/* fake_efi.c */␊ |
104 | ␊ |
105 | #define kUseMemDetect␉␉"UseMemDetect"␉ /* platform.c */␊ |
106 | ␊ |
107 | #define kPCIRootUID␉␉␉"PCIRootUID"␉␉/* pci_root.c */␊ |
108 | ␊ |
109 | #define kUseAtiROM␉␉␉"UseAtiROM"␉␉␉/* ati.c */␊ |
110 | #define kAtiConfig␉␉␉"AtiConfig"␉␉␉/* ati.c */␊ |
111 | #define kATYbinimage␉␉"ATYbinimage"␉␉/* ati.c */␊ |
112 | ␊ |
113 | #define kUseNvidiaROM␉␉"UseNvidiaROM"␉␉/* nvidia.c */␊ |
114 | #define kVBIOS␉␉␉␉"VBIOS"␉␉␉␉/* nvidia.c */␊ |
115 | #define kDcfg0␉␉␉␉"display_0"␉␉␉/* nvidia.c */␊ |
116 | #define kDcfg1␉␉␉␉"display_1"␉␉␉/* nvidia.c */␊ |
117 | ␊ |
118 | #define kEthernetBuiltIn␉"EthernetBuiltIn"␉/* pci_setup.c */␊ |
119 | #define kGraphicsEnabler␉"GraphicsEnabler"␉/* pci_setup.c */␊ |
120 | #define kForceHPET␉␉␉"ForceHPET"␉␉␉/* pci_setup.c */␊ |
121 | ␊ |
122 | #define kMD0Image␉␉␉"md0"␉␉␉␉/* ramdisk.h */␊ |
123 | ␊ |
124 | #define kUSBBusFix␉␉␉"USBBusFix"␉␉␉/* usb.c */␊ |
125 | #define kEHCIacquire␉␉"EHCIacquire"␉␉/* usb.c */␊ |
126 | #define kUHCIreset␉␉␉"UHCIreset"␉␉␉/* usb.c */␊ |
127 | #define kLegacyOff␉␉␉"USBLegacyOff"␉␉/* usb.c */␊ |
128 | #define kEHCIhard␉␉␉"EHCIhard"␉␉␉/* usb.c */␊ |
129 | ␊ |
130 | /*␊ |
131 | * Flags to the booter or kernel␊ |
132 | */␊ |
133 | #define kVerboseModeFlag␉"-v"␊ |
134 | #define kSafeModeFlag␉␉"-x"␊ |
135 | #define kIgnoreCachesFlag␉"-f"␊ |
136 | #define kIgnoreBootFileFlag␉"-F"␊ |
137 | #define kSingleUserModeFlag␉"-s"␊ |
138 | ␊ |
139 | /*␊ |
140 | * Booter behavior control␊ |
141 | */␊ |
142 | #define kBootTimeout -1␊ |
143 | #define kCDBootTimeout 8␊ |
144 | ␊ |
145 | /*␊ |
146 | * A global set by boot() to record the device that the booter␊ |
147 | * was loaded from.␊ |
148 | */␊ |
149 | extern int gBIOSDev;␊ |
150 | extern long gBootMode;␊ |
151 | extern bool sysConfigValid;␊ |
152 | extern char bootBanner[];␊ |
153 | extern char bootPrompt[];␊ |
154 | extern bool gOverrideKernel;␊ |
155 | extern char *gPlatformName;␊ |
156 | extern char gMKextName[];␊ |
157 | extern char gRootDevice[];␊ |
158 | extern bool gEnableCDROMRescan;␊ |
159 | extern bool gScanSingleDrive;␊ |
160 | extern bool useGUI;␊ |
161 | //Slice␊ |
162 | extern char gMacOSVersion[];␊ |
163 | extern int bvCount; ␊ |
164 | extern void *gRootPCIDev;␊ |
165 | extern void* gPlatform;␊ |
166 | extern void* gBootOrder;␊ |
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 LoadExtraDrivers(char * dirSpec);␊ |
219 | extern long LoadDrivers(char * dirSpec);␊ |
220 | extern long DecodeKernel(void *binary, entry_t *rentry, char **raddr, int *rsize);␊ |
221 | ␊ |
222 | typedef long (*FileLoadDrivers_t)(char *dirSpec, long plugin);␊ |
223 | /*!␊ |
224 | Hookable function pointer called during the driver loading phase that␊ |
225 | allows other code to cause additional drivers to be loaded.␊ |
226 | */␊ |
227 | extern long (*LoadExtraDrivers_p)(FileLoadDrivers_t FileLoadDrivers_p);␊ |
228 | ␊ |
229 | /*␊ |
230 | * options.c␊ |
231 | */␊ |
232 | extern int getBootOptions(bool firstRun);␊ |
233 | extern int processBootOptions();␊ |
234 | extern int selectAlternateBootDevice(int bootdevice);␊ |
235 | extern bool promptForRescanOption(void);␊ |
236 | ␊ |
237 | void showHelp();␊ |
238 | void showTextFile();␊ |
239 | char *getMemoryInfoString();␊ |
240 | ␊ |
241 | typedef struct {␊ |
242 | char name[80];␊ |
243 | void * param;␊ |
244 | } MenuItem;␊ |
245 | ␊ |
246 | /*␊ |
247 | * lzss.c␊ |
248 | */␊ |
249 | extern int decompress_lzss(u_int8_t *dst, u_int8_t *src, u_int32_t srclen);␊ |
250 | ␊ |
251 | struct compressed_kernel_header {␊ |
252 | u_int32_t signature;␊ |
253 | u_int32_t compress_type;␊ |
254 | u_int32_t adler32;␊ |
255 | u_int32_t uncompressed_size;␊ |
256 | u_int32_t compressed_size;␊ |
257 | u_int32_t reserved[11];␊ |
258 | char platform_name[64];␊ |
259 | char root_path[256];␊ |
260 | u_int8_t data[0];␊ |
261 | };␊ |
262 | typedef struct compressed_kernel_header compressed_kernel_header;␊ |
263 | ␊ |
264 | /* resume.c */␊ |
265 | void HibernateBoot(char *boot_device);␊ |
266 | ␊ |
267 | /* bmdecompress.c */␊ |
268 | void * DecompressData(void *srcbase, int *dw, int *dh, int *bytesPerPixel);␊ |
269 | ␊ |
270 | #endif /* !__BOOT2_BOOT_H */␊ |
271 | |