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