Chameleon

Chameleon Svn Source Tree

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

Archive Download this file

Revision: 2263