Chameleon

Chameleon Svn Source Tree

Root/branches/ErmaC/Enoch/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// OS X Versions
33#define ELCAPITAN checkOSVersion("10.11") // El Capitan
34#define YOSEMITE checkOSVersion("10.10") // Yosemite
35#define MAVERICKS checkOSVersion("10.9") // Mavericks
36#define MOUNTAIN_LION checkOSVersion("10.8") // Mountain Lion
37#define LION checkOSVersion("10.7") // Lion
38#define SNOW_LEOPARD checkOSVersion("10.6") // Snow Leopard
39#define LEOPARD checkOSVersion("10.5") // Leopard
40#define TIGER checkOSVersion("10.4") // Tiger
41
42/*
43 * Paths used by chameleon
44 */
45
46// kernel cache
47#define kDefaultCachePathLeo"/System/Library/Caches/com.apple.kernelcaches/"
48#define kDefaultCachePathSnow"/System/Library/Caches/com.apple.kext.caches/Startup/"
49
50// Lion installer
51#define kLionInstallerDataFolder"/Mac OS X Install Data/"
52#define kLionInstallerPlistkLionInstallerDataFolder "com.apple.Boot.plist"
53
54// Mountain Lion installer
55#define kMLionInstallerDataFolder"/OS X Install Data/"
56#define kMLionInstallerPlistkMLionInstallerDataFolder "com.apple.Boot.plist"
57
58//kernel path
59#define kDefaultKernelPathPreYos"/"
60#define kDefaultKernelPathForYos"/System/Library/Kernels/" //for Yosemite and El Capitan
61
62/*
63 * Keys used in system Boot.plist
64 */
65#define kGraphicsModeKey"Graphics Mode"
66#define kTextModeKey"Text Mode"
67#define kQuietBootKey"Quiet Boot"
68#define kKernelFlagsKey"Kernel Flags"
69#define kKernelArchKey"Kernel Architecture"
70#define kMKextCacheKey"MKext Cache"
71#define kKernelNameKey"Kernel"
72#define kKernelCacheKey"Kernel Cache"
73#define kUseKernelCache"UseKernelCache"/* boot.c */
74#define kBootDeviceKey"Boot Device"
75#define kTimeoutKey"Timeout"
76#define kRootDeviceKey"rd"
77#define kBootUUIDKey"boot-uuid"
78#define kHelperRootUUIDKey"Root UUID"
79#define kPlatformKey"platform"
80#define kACPIKey"acpi"
81#define kCDROMPromptKey"CD-ROM Prompt"
82#define kCDROMOptionKey"CD-ROM Option Key"
83#define kRescanPromptKey"Rescan Prompt"
84#define kRescanKey"Rescan"
85#define kScanSingleDriveKey"Scan Single Drive"
86#define kInstantMenuKey"Instant Menu"
87#define kDefaultKernel"mach_kernel"
88#define kOSXKernel"kernel"// Yosemite+
89#define kGUIKey"GUI"
90#define kBootBannerKey"Boot Banner"
91#define kShowInfoKey"ShowInfo"// gui.c
92#define kWaitForKeypressKey"Wait"
93
94/* AsereBLN: added these keys */
95#define kUseAtiROM"UseAtiROM"/* ati.c */
96#define kWake"Wake"/* boot.c */
97#define kForceWake"ForceWake"/* boot.c */
98#define kWakeImage"WakeImage"/* boot.c */
99#define kProductVersion"ProductVersion"/* boot.c */
100#define karch"arch"/* boot.c */
101#define kDSDT"DSDT"/* acpi_patcher.c */
102#define kDropSSDT"DropSSDT"/* acpi_patcher.c */
103#define kDeviceProperties"device-properties"/* device_inject.c */
104#define kHidePartition"Hide Partition"/* disk.c */
105#define kRenamePartition"Rename Partition"/* disk.c */
106#define kSMBIOSKey"SMBIOS"/* fake_efi.c */
107//#define kSystemID"SystemId"/* fake_efi.c */
108#define kSystemType"SystemType"/* fake_efi.c */
109#define kUseNvidiaROM"UseNvidiaROM"/* nvidia.c */
110#define kVBIOS"VBIOS"/* nvidia.c && ati.c */
111#define kPCIRootUID"PCIRootUID"/* pci_root.c */
112#define kEthernetBuiltIn"EthernetBuiltIn"/* networking.c */
113#define kGraphicsEnabler"GraphicsEnabler"/* pci_setup.c */
114#define kForceHPET"ForceHPET"/* pci_setup.c */
115#define kUseMemDetect"UseMemDetect"/* platform.c */
116#define kSMBIOSdefaults"SMBIOSdefaults"/* smbios_patcher.c */
117#define kUSBBusFix"USBBusFix"/* usb.c */
118#define kEHCIacquire"EHCIacquire"/* usb.c */
119#define kUHCIreset"UHCIreset"/* usb.c */
120#define kEHCIhard"EHCIhard"/* usb.c */
121#define kDefaultPartition"Default Partition"/* sys.c */
122
123/* Zenith432: added this key */
124#define kXHCILegacyOff"XHCILegacyOff"/* usb.c */
125
126/* Duvel300: added this key */
127#define kRestartFix"RestartFix"/* acpi_patcher.c */
128
129/* Slice: added these keys */
130#define kPS2RestartFix"PS2RestartFix"/* acpi_patcher.c */
131#define kUseIntelHDMI"UseIntelHDMI"/* ati.c && nvidia.c && gma.c */
132
133/* Signal64: added this key */
134#define kLegacyOff"USBLegacyOff"/* usb.c */
135
136/* Lebidou: added this key */
137
138/* Meklort: added these keys */
139#define kMD0Image"md0"/* ramdisk.h */
140#define kEnableWifi"EnableWifi"/* networking.c */
141
142/* Andyvand: added these keys */
143//#define kSSDT"SSDT"/* acpi_patcher.c */
144#define kHPET"HPET"/* acpi_patcher.c */
145#define kSBST"SBST"/* acpi_patcher.c */
146#define kECDT"ECDT"/* acpi_patcher.c */
147#define kASFT"ASFT"/* acpi_patcher.c */
148#define kDMAR"DMAR"/* acpi_patcher.c */
149#define kFADT"FADT"/* acpi_patcher.c */
150#define kAPIC"APIC"/* acpi_patcher.c */
151#define kMCFG"MCFG"/* acpi_patcher.c */
152#define kDropHPET"DropHPET"/* acpi_patcher.c */
153#define kDropSLIC"DropSLIC"/* acpi_patcher.c */
154#define kDropSBST"DropSBST"/* acpi_patcher.c */
155#define kDropECDT"DropECDT"/* acpi_patcher.c */
156#define kDropASFT"DropASFT"/* acpi_patcher.c */
157#define kDropDMAR"DropDMAR"/* acpi_patcher.c */
158
159/* Mojodojo: added these keys */
160#define kGeneratePStates"GeneratePStates"/* acpi_patcher.c */
161#define kGenerateCStates"GenerateCStates"/* acpi_patcher.c */
162#define kCSTUsingSystemIO"CSTUsingSystemIO"/* acpi_patcher.c */
163#define kEnableC2State"EnableC2State"/* acpi_patcher.c */
164#define kEnableC3State"EnableC3State"/* acpi_patcher.c */
165#define kEnableC4State"EnableC4State"/* acpi_patcher.c */
166#define kEnableC6State"EnableC6State"/* acpi_patcher.c */
167#define kEnableC7State"EnableC7State"/* acpi_patcher.c */
168
169/* valv: added these keys */
170#define kbusratio"busratio"/* cpu.c */
171#define kDcfg0"display_0"/* nvidia.c */
172#define kDcfg1"display_1"/* nvidia.c */
173
174/* Marchrius: added this key */
175#define kEnableBacklight"EnableBacklight"/* nvidia.c */
176
177/* Kabyl: added these keys */
178#define kAtiConfig"AtiConfig"/* ati.c */
179#define kAtiPorts"AtiPorts"/* ati.c */
180#define kATYbinimage"ATYbinimage"/* ati.c */
181
182/* cosmo1: added these keys */
183#define kEnableHDMIAudio"EnableHDMIAudio"/* ati.c && nvidia.c */
184
185/* cparm: added these keys */
186
187/* ErmaC: added these keys */
188#define kEnableDualLink"EnableDualLink"/* ati.c && nvidia.c && gma.c*/
189#define kNvidiaGeneric"NvidiaGeneric"/* nvidia.c */
190#define kSkipIntelGfx"SkipIntelGfx"/* pci_setup.c */
191#define kSkipNvidiaGfx"SkipNvidiaGfx"/* pci_setup.c */
192#define kSkipAtiGfx"SkipAtiGfx"/* pci_setup.c */
193#define kIntelCapriFB"IntelCapriFB"/* gma.c was HD4K-ig */
194#define kIntelAzulFB"IntelAzulFB"/* gma.c was HD5K-ig */
195#define kIntelBdwFB"IntelBDWFB"/* gma.c */
196#define kAAPLCustomIG"InjectIntel-ig"/* gma.c */
197#define kHDAEnabler"HDAEnabler"/* pci_setup.c */
198#define kHDEFLayoutID"HDEFLayoutID"/* hda.c */
199#define kHDAULayoutID"HDAULayoutID"/* hda.c */
200#define kBGRT"BGRT"/* acpi_patcher.c */
201#define kDropBGRT"DropBGRT"/* acpi_patcher.c */
202#define kDropMCFG"DropMCFG"/* acpi_patcher.c */
203#define kDropAPIC"DropAPIC"/* acpi_patcher.c */
204
205/* Karas: added this key */
206#define kMemFullInfo"ForceFullMemInfo"/* smbios.c */
207
208/* Bungo: added this key */
209#define kPrivateData"PrivateData"/* smbios_decode.c */
210
211
212/*
213 * Flags to the booter or kernel
214 */
215#define kVerboseModeFlag"-v"
216#define kSafeModeFlag"-x"
217#define kIgnoreCachesFlag"-f"
218#define kIgnoreBootFileFlag"-F"
219#define kSingleUserModeFlag"-s"
220
221/*
222 * Booter behavior control
223 */
224#define kBootTimeout-1
225#define kCDBootTimeout8
226
227/*
228 * A global set by boot() to record the device that the booter was loaded from.
229 */
230#define ROOT_DEVICE_SIZE 512
231extern int gBIOSDev;
232extern long gBootMode;
233extern bool sysConfigValid;
234extern char bootBanner[];
235extern char bootPrompt[];
236extern bool gOverrideKernel;
237extern char *gPlatformName;
238extern char gMKextName[];
239extern char gRootDevice[];
240extern bool gEnableCDROMRescan;
241extern bool gScanSingleDrive;
242extern bool useGUI;
243
244/*
245 * Boot Modes
246 */
247enum {
248kBootModeNormal = 0,
249kBootModeSafe = 1,
250kBootModeSecure = 2,
251kBootModeQuiet = 4
252};
253
254extern void initialize_runtime();
255extern void common_boot(int biosdev);
256extern bool checkOSVersion(const char * version);
257extern uint32_t getMacOSVerCurrent();
258
259/*
260 * usb.c
261 */
262extern int usb_loop();
263
264/*
265 * graphics.c
266 */
267extern void printVBEModeInfo();
268extern void setVideoMode(int mode, int drawgraphics);
269extern int getVideoMode();
270extern void spinActivityIndicator();
271extern void clearActivityIndicator();
272extern void drawColorRectangle(
273 unsigned short x,
274 unsigned short y,
275 unsigned short width,
276 unsigned short height,
277 unsigned char colorIndex
278 );
279extern void drawDataRectangle(
280 unsigned short x,
281 unsigned short y,
282 unsigned short width,
283 unsigned short height,
284 unsigned char *data
285 );
286extern int
287convertImage( unsigned short width,
288 unsigned short height,
289 const unsigned char *imageData,
290 unsigned char **newImageData );
291extern char * decodeRLE( const void * rleData, int rleBlocks, int outBytes );
292extern void drawBootGraphics(void);
293extern void drawPreview(void *src, uint8_t *saveunder);
294extern int getVideoMode(void);
295extern void loadImageScale (void *input, int iw, int ih, int ip, void *output, int ow, int oh, int op, int or);
296
297/*
298 * drivers.c
299 */
300extern long LoadExtraDrivers(char * dirSpec);
301extern long LoadDrivers(char * dirSpec);
302extern long DecodeKernel(void *binary, entry_t *rentry, char **raddr, int *rsize);
303typedef long (*FileLoadDrivers_t)(char *dirSpec, long plugin);
304// Bungo:
305extern char gDarwinBuildVerStr[256];
306
307/*!
308 Hookable function pointer called during the driver loading phase that
309 allows other code to cause additional drivers to be loaded.
310 */
311extern long (*LoadExtraDrivers_p)(FileLoadDrivers_t FileLoadDrivers_p);
312
313/*
314 * options.c
315 */
316extern char gBootUUIDString[];
317extern int getBootOptions(bool firstRun);
318extern int processBootOptions();
319extern int selectAlternateBootDevice(int bootdevice);
320extern bool promptForRescanOption(void);
321
322void showHelp();
323void showTextFile();
324char *getMemoryInfoString();
325
326typedef struct {
327char name[80];
328void * param;
329} MenuItem;
330
331/*
332 * lzss.c
333 */
334extern int decompress_lzss(u_int8_t *dst, u_int32_t dstlen, u_int8_t *src, u_int32_t srclen);
335extern u_int8_t *compress_lzss(u_int8_t *dst, u_int32_t dstlen, u_int8_t *src, u_int32_t srcLen);
336
337/*
338 * lzvn.c
339 */
340extern size_t lzvn_decode(void*dst,
341 size_tdst_size,
342 const void*src,
343 size_tsrc_size);
344/*
345extern size_t lzvn_encode(void*dst,
346 size_tdst_size,
347 const void*src,
348 size_tsrc_size,
349 void*work);
350*/
351
352struct compressed_kernel_header {
353u_int32_t signature;
354u_int32_t compress_type;
355u_int32_t adler32;
356u_int32_t uncompressed_size;
357u_int32_t compressed_size;
358u_int32_t reserved[11];
359char platform_name[64];
360char root_path[256];
361u_int8_t data[0];
362};
363typedef struct compressed_kernel_header compressed_kernel_header;
364
365/* resume.c */
366void HibernateBoot(char *boot_device);
367void HibernateBootSnow(char *boot_device);
368
369/* bmdecompress.c */
370void *DecompressData(void *srcbase, int *dw, int *dh, int *bytesPerPixel);
371
372#endif /* !__BOOT2_BOOT_H */
373

Archive Download this file

Revision: 2708