Chameleon

Chameleon Svn Source Tree

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

Archive Download this file

Revision: 2238