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
154/*
155 * Flags to the booter or kernel
156 */
157#define kVerboseModeFlag"-v"
158#define kSafeModeFlag"-x"
159#define kIgnoreCachesFlag"-f"
160#define kIgnoreBootFileFlag"-F"
161#define kSingleUserModeFlag"-s"
162
163/*
164 * Booter behavior control
165 */
166#define kBootTimeout -1
167#define kCDBootTimeout 8
168
169/*
170 * A global set by boot() to record the device that the booter was loaded from.
171 */
172#define ROOT_DEVICE_SIZE 512
173extern int gBIOSDev;
174extern long gBootMode;
175extern bool sysConfigValid;
176extern char bootBanner[];
177extern char bootPrompt[];
178extern bool gOverrideKernel;
179extern char *gPlatformName;
180extern char gMKextName[];
181extern char gRootDevice[];
182extern bool gEnableCDROMRescan;
183extern bool gScanSingleDrive;
184extern bool useGUI;
185
186/*
187 * Boot Modes
188 */
189enum {
190 kBootModeNormal = 0,
191 kBootModeSafe = 1,
192 kBootModeSecure = 2,
193 kBootModeQuiet = 4
194};
195
196extern void initialize_runtime();
197extern void common_boot(int biosdev);
198
199/*
200 * usb.c
201 */
202extern int usb_loop();
203
204/*
205 * graphics.c
206 */
207extern void printVBEModeInfo();
208extern void setVideoMode(int mode, int drawgraphics);
209extern int getVideoMode();
210extern void spinActivityIndicator();
211extern void clearActivityIndicator();
212extern void drawColorRectangle( unsigned short x,
213 unsigned short y,
214 unsigned short width,
215 unsigned short height,
216 unsigned char colorIndex );
217extern void drawDataRectangle( unsigned short x,
218 unsigned short y,
219 unsigned short width,
220 unsigned short height,
221 unsigned char * data );
222extern int
223convertImage( unsigned short width,
224 unsigned short height,
225 const unsigned char *imageData,
226 unsigned char **newImageData );
227extern char * decodeRLE( const void * rleData, int rleBlocks, int outBytes );
228extern void drawBootGraphics(void);
229extern void drawPreview(void *src, uint8_t * saveunder);
230extern int getVideoMode(void);
231extern void loadImageScale (void *input, int iw, int ih, int ip, void *output, int ow, int oh, int op, int or);
232
233/*
234 * drivers.c
235 */
236extern long LoadExtraDrivers(char * dirSpec);
237extern long LoadDrivers(char * dirSpec);
238extern long DecodeKernel(void *binary, entry_t *rentry, char **raddr, int *rsize);
239
240typedef long (*FileLoadDrivers_t)(char *dirSpec, long plugin);
241/*!
242 Hookable function pointer called during the driver loading phase that
243 allows other code to cause additional drivers to be loaded.
244 */
245extern long (*LoadExtraDrivers_p)(FileLoadDrivers_t FileLoadDrivers_p);
246
247/*
248 * options.c
249 */
250extern char gBootUUIDString[];
251
252extern int getBootOptions(bool firstRun);
253extern int processBootOptions();
254extern int selectAlternateBootDevice(int bootdevice);
255extern bool promptForRescanOption(void);
256
257void showHelp();
258void showTextFile();
259char *getMemoryInfoString();
260
261typedef struct {
262 char name[80];
263 void * param;
264} MenuItem;
265
266/*
267 * lzss.c
268 */
269extern int decompress_lzss(u_int8_t *dst, u_int8_t *src, u_int32_t srclen);
270
271struct compressed_kernel_header {
272 u_int32_t signature;
273 u_int32_t compress_type;
274 u_int32_t adler32;
275 u_int32_t uncompressed_size;
276 u_int32_t compressed_size;
277 u_int32_t reserved[11];
278 char platform_name[64];
279 char root_path[256];
280 u_int8_t data[0];
281};
282typedef struct compressed_kernel_header compressed_kernel_header;
283
284/* resume.c */
285void HibernateBoot(char *boot_device);
286
287/* bmdecompress.c */
288void * DecompressData(void *srcbase, int *dw, int *dh, int *bytesPerPixel);
289
290#endif /* !__BOOT2_BOOT_H */
291

Archive Download this file

Revision: 2259