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