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

Archive Download this file

Revision: 2831