Chameleon

Chameleon Svn Source Tree

Root/branches/ErmaC/Trunk/i386/boot2/boot.h

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

Archive Download this file

Revision: 2037