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 | //Azi: keep it minimal for now.␊ |
33 | // Todo: check bootstruct.h, sl.h, platform.h, next; include bootstruct here??␊ |
34 | // don't include headers like libsaio.h on other headers?!␊ |
35 | ␊ |
36 | #include "saio_internal.h" // the only one needed by boot.h it self, afaics.␊ |
37 | ␊ |
38 | /*␊ |
39 | * Default names␊ |
40 | */␊ |
41 | #define kDefaultKernel␉␉"mach_kernel"␊ |
42 | ␊ |
43 | /*␊ |
44 | * Keys used in system Boot.plist␊ |
45 | */␊ |
46 | #define kGraphicsModeKey␉"Graphics Mode"␉␉// graphics.c␊ |
47 | #define kTextModeKey␉␉"Text Mode"␉␉␉// graphics.c␊ |
48 | #define kQuietBootKey␉␉"Quiet Boot"␉␉// boot.c␊ |
49 | #define kKernelFlagsKey␉␉"Kernel Flags"␉␉// options.c␊ |
50 | #define kMKextCacheKey␉␉"MKext Cache"␉␉// options.c␊ |
51 | #define kKernelNameKey␉␉"Kernel"␉␉␉// options.c␊ |
52 | #define kKernelCacheKey␉␉"Kernel Cache"␉␉// boot.c␊ |
53 | #define kBootDeviceKey␉␉"Boot Device"␉␉// options.c␊ |
54 | #define kTimeoutKey␉␉␉"Timeout"␉␉␉// options.c␊ |
55 | #define kRootDeviceKey␉␉"rd"␉␉␉␉// options.c␊ |
56 | #define kBootUUIDKey␉␉"boot-uuid"␉␉␉// options.c␊ |
57 | #define kHelperRootUUIDKey␉"Root UUID"␉␉␉// options.c␊ |
58 | #define kCDROMPromptKey␉␉"CD-ROM Prompt"␉␉// options.c␊ |
59 | #define kCDROMOptionKey␉␉"CD-ROM Option Key"␉// options.c␊ |
60 | #define kRescanPromptKey␉"Rescan Prompt"␉␉// boot.c␊ |
61 | #define kRescanKey␉␉ "Rescan"␉␉␉// boot.c␊ |
62 | #define kScanSingleDriveKey␉"Scan Single Drive"␉// boot.c␊ |
63 | #define kInstantMenuKey␉␉"Instant Menu"␉␉// boot.c␊ |
64 | #define kGUIKey␉␉␉␉"GUI"␉␉␉␉// boot.c␊ |
65 | #define kBootBannerKey␉␉"Boot Banner"␉␉// options.c␊ |
66 | #define kDebugInfoKey␉␉"DebugInfo"␉␉␉// gui.c, graphics.c␊ |
67 | #define kWaitForKeypressKey␉"Wait"␉␉␉␉// boot.c␊ |
68 | #define kExtensionsKey␉␉"kext"␉␉␉␉// drivers.c␊ |
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 kDSDTKey␉␉␉"DSDT"␉␉␉␉// acpi_patcher.c␊ |
75 | #define kDropSSDT␉␉␉"DropSSDT"␉␉␉// acpi_patcher.c␊ |
76 | #define kRestartFix␉␉␉"RestartFix" // acpi_patcher.c␊ |
77 | #define kGeneratePStates␉"GeneratePStates"␉// acpi_patcher.c␊ |
78 | #define kGenerateCStates␉"GenerateCStates"␉// acpi_patcher.c␊ |
79 | #define kEnableC4States␉␉"EnableC4State"␉␉// acpi_patcher.c␊ |
80 | #define kDeviceProperties␉"device-properties"␉// device_inject.c␊ |
81 | #define kHidePartition␉␉"Hide Partition"␉// disk.c␊ |
82 | #define kRenamePartition␉"Rename Partition"␉// disk.c␊ |
83 | #define kSMBIOSKey␉␉␉"SMBIOS"␉␉␉// fake_efi.c␊ |
84 | #define kSystemID␉␉␉"SystemId"␉␉␉// fake_efi.c␊ |
85 | #define kSystemType␉␉␉"SystemType"␉␉// fake_efi.c␊ |
86 | #define kUseNvidiaROM␉␉"UseNvidiaROM"␉␉// nvidia.c␊ |
87 | #define kVBIOS␉␉␉␉"VBIOS"␉␉␉␉// nvidia.c␊ |
88 | #define kPCIRootUID␉␉␉"PciRoot"␉␉␉// pci_root.c␊ |
89 | #define kEthernetBuiltIn␉"EthernetBuiltIn"␉// pci_setup.c␊ |
90 | #define kGraphicsEnabler␉"GraphicsEnabler"␉// pci_setup.c␊ |
91 | #define kForceHPET␉␉␉"ForceHPET"␉␉␉// pci_setup.c␊ |
92 | #define kUseMemDetect␉␉"UseMemDetect"␉ // platform.c␊ |
93 | #define kSMBIOSdefaults␉␉"SMBIOSdefaults"␉// smbios_patcher.c␊ |
94 | #define kUSBBusFix␉␉␉"USBBusFix"␉␉␉// usb.c␊ |
95 | #define kEHCIacquire␉␉"EHCIacquire"␉␉// usb.c␊ |
96 | #define kUHCIreset␉␉␉"UHCIreset"␉␉␉// usb.c␊ |
97 | #define kLegacyOff␉␉␉"USBLegacyOff"␉␉// usb.c␊ |
98 | #define kEHCIhard␉␉␉"EHCIhard"␉␉␉// usb.c␊ |
99 | #define kDefaultPartition␉"Default Partition"␉// sys.c␊ |
100 | #define kMD0Image␉␉␉"md0"␉␉␉␉// ramdisk.h␊ |
101 | #define kTestConfigKey␉␉"config"␉␉␉// stringTable.c␊ |
102 | #define kCanOverrideKey␉␉"CanOverride"␉␉// stringTable.c␊ |
103 | #define kAutoResolutionKey␉"AutoResolution"␉// boot.c␊ |
104 | #define kKPatcherKey␉␉"PatchKernel"␉␉// boot.c␊ |
105 | ␊ |
106 | /*␊ |
107 | * Flags to the booter and/or kernel - these end with "Flag".␊ |
108 | */␊ |
109 | #define kVerboseModeFlag␉"-v"␉␉␉␉// options.c␊ |
110 | #define kSafeModeFlag␉␉"-x"␉␉␉␉// options.c␊ |
111 | #define kIgnoreCachesFlag␉"-f"␉␉␉␉// options.c␊ |
112 | #define kIgnoreBootFileFlag␉"-F"␉␉␉␉// options.c␊ |
113 | #define kSingleUserModeFlag␉"-s"␉␉␉␉// options.c␊ |
114 | #define kArchI386Flag␉␉"32"␉␉␉␉// boot.c␊ |
115 | #define kLegacyModeFlag␉␉"-legacy"␉␉␉// boot.c␊ |
116 | #define kArchX86_64Flag␉␉"64"␉␉␉␉// boot.c␊ |
117 | ␊ |
118 | /*␊ |
119 | * Booter behavior control␊ |
120 | */␊ |
121 | #define kBootTimeout -1␊ |
122 | #define kCDBootTimeout 8␊ |
123 | ␊ |
124 | /*␊ |
125 | * A global set by boot() to record the device that the booter␊ |
126 | * was loaded from.␊ |
127 | */␊ |
128 | extern int gBIOSDev;␊ |
129 | extern long gBootMode;␊ |
130 | extern bool sysConfigValid;␊ |
131 | extern char bootBanner[];␊ |
132 | extern char bootPrompt[];␊ |
133 | extern bool gOverrideKernel;␊ |
134 | //extern char *gPlatformName; disabled␊ |
135 | extern char gMKextName[];␊ |
136 | extern char gMacOSVersion[];␊ |
137 | extern char gRootDevice[];␊ |
138 | extern bool gEnableCDROMRescan;␊ |
139 | extern bool gScanSingleDrive;␊ |
140 | extern bool useGUI;␊ |
141 | ␊ |
142 | /*␊ |
143 | * Boot Modes␊ |
144 | */␊ |
145 | enum {␊ |
146 | kBootModeNormal = 0,␊ |
147 | kBootModeSafe = 1,␊ |
148 | kBootModeSecure = 2,␊ |
149 | kBootModeQuiet = 4␊ |
150 | };␊ |
151 | ␊ |
152 | extern void initialize_runtime();␊ |
153 | extern void common_boot(int biosdev);␊ |
154 | ␊ |
155 | /*␊ |
156 | * usb.c␊ |
157 | */␊ |
158 | extern int usb_loop();␊ |
159 | ␊ |
160 | /*␊ |
161 | * graphics.c␊ |
162 | */␊ |
163 | extern void printVBEModeInfo();␊ |
164 | extern void setVideoMode(int mode, int drawgraphics);␊ |
165 | extern int getVideoMode();␊ |
166 | extern void spinActivityIndicator();␊ |
167 | extern void clearActivityIndicator();␊ |
168 | extern void drawColorRectangle( unsigned short x,␊ |
169 | unsigned short y,␊ |
170 | unsigned short width,␊ |
171 | unsigned short height,␊ |
172 | unsigned char colorIndex );␊ |
173 | extern void drawDataRectangle( unsigned short x,␊ |
174 | unsigned short y,␊ |
175 | unsigned short width,␊ |
176 | unsigned short height,␊ |
177 | unsigned char * data );␊ |
178 | extern int␊ |
179 | convertImage( unsigned short width,␊ |
180 | unsigned short height,␊ |
181 | const unsigned char *imageData,␊ |
182 | unsigned char **newImageData );␊ |
183 | extern char * decodeRLE( const void * rleData, int rleBlocks, int outBytes );␊ |
184 | extern void drawBootGraphics(void);␊ |
185 | extern void drawPreview(void *src, uint8_t * saveunder);␊ |
186 | extern int getVideoMode(void);␊ |
187 | extern void loadImageScale (void *input, int iw, int ih, int ip, void *output, int ow, int oh, int op, int or);␊ |
188 | ␊ |
189 | /*␊ |
190 | * drivers.c␊ |
191 | */␊ |
192 | extern long LoadDrivers(char * dirSpec);␊ |
193 | extern long DecodeKernel(void *binary, entry_t *rentry, char **raddr, int *rsize);␊ |
194 | ␊ |
195 | typedef long (*FileLoadDrivers_t)(char *dirSpec, long plugin);␊ |
196 | /*!␊ |
197 | Hookable function pointer called during the driver loading phase that␊ |
198 | allows other code to cause additional drivers to be loaded.␊ |
199 | */␊ |
200 | extern long (*LoadExtraDrivers_p)(FileLoadDrivers_t FileLoadDrivers_p);␊ |
201 | ␊ |
202 | /*␊ |
203 | * options.c␊ |
204 | */␊ |
205 | extern int getBootOptions(bool firstRun);␊ |
206 | extern int processBootOptions();␊ |
207 | extern int selectAlternateBootDevice(int bootdevice);␊ |
208 | extern bool promptForRescanOption(void);␊ |
209 | ␊ |
210 | void showHelp();␊ |
211 | void showTextFile();␊ |
212 | char *getMemoryInfoString();␊ |
213 | ␊ |
214 | typedef struct {␊ |
215 | char name[80];␊ |
216 | void * param;␊ |
217 | } MenuItem;␊ |
218 | ␊ |
219 | /*␊ |
220 | * lzss.c␊ |
221 | */␊ |
222 | extern int decompress_lzss(u_int8_t *dst, u_int8_t *src, u_int32_t srclen);␊ |
223 | ␊ |
224 | struct compressed_kernel_header {␊ |
225 | u_int32_t signature;␊ |
226 | u_int32_t compress_type;␊ |
227 | u_int32_t adler32;␊ |
228 | u_int32_t uncompressed_size;␊ |
229 | u_int32_t compressed_size;␊ |
230 | u_int32_t reserved[11];␊ |
231 | char platform_name[64];␊ |
232 | char root_path[256];␊ |
233 | u_int8_t data[0];␊ |
234 | };␊ |
235 | typedef struct compressed_kernel_header compressed_kernel_header;␊ |
236 | ␊ |
237 | /* resume.c */␊ |
238 | void HibernateBoot(char *boot_device);␊ |
239 | ␊ |
240 | /* bmdecompress.c */␊ |
241 | void * DecompressData(void *srcbase, int *dw, int *dh, int *bytesPerPixel);␊ |
242 | ␊ |
243 | #endif /* !__BOOT2_BOOT_H */␊ |
244 | |