Chameleon

Chameleon Svn Source Tree

Root/branches/azimutz/Chazileon/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/*
25 * Copyright 1994 NeXT Computer, Inc.
26 * All rights reserved.
27 */
28
29#ifndef __BOOT2_BOOT_H
30#define __BOOT2_BOOT_H
31
32//Azi:include - keep boot.h free of includes as possible, for now.
33#include "saio_internal.h"
34//#include "libsaio.h"
35//#include "autoresolution.h" // not needed; it's included were it's needed.
36
37#if DEBUG
38#ifndef AUTORES_DEBUG
39#define AUTORES_DEBUG
40#endif
41#endif
42
43/*
44 * temporary "keys related" stuff
45 *
46- deactivated:
47#define kPlatformKey"platform"// options.c, processBootArgumentremoved, says on comment
48#define kACPIKey"acpi"//not in use, afaics
49#define kPCIRootUIDKey"PCIRootUID"// pci_root.c, getValFKremoved by me
50#define k32BitModeFlag"-x32" // boot.c, getValFKremoved by me
51"-pci0"// pci_root.c, getValFKremoved by me
52"-pci1"// pci_root.c, getValFKremoved by me
53
54- lost & found:
55"-checkers" gui.c, getValFK; booter flag
56"biosdev" mboot.c, getValFBK
57"timeout" mboot.c, getValFBK
58"partno" mboot.c, getValFBK
59"DumpSPD" spd.c, getBollFK
60
61- ramdisk specific:
62"Info" // ramdisk.c, getValFK
63"BTAlias" // ramdisk.c, getBollFK
64
65kNVCAPnvidia.c, getValFK
66This introduces a new way (to me) to implement key/value;
67key is declared as a "variable", char kNVCAP[12]; on nvidia.c, setup_nvidia_devprop().
68Check: http://efixusers.com/showthread.php?t=644, Update Version 1.1.9 (Asere's booter).
69
70- Keep just most "useful at boot prompt" stuff on BootHelp; make it a real "boot help", not a user guide.
71- Check who is set to "Yes" by default and if it's really needed! (wake)
72- move keys to the headers of the files they're in, if they have it!?
73*/
74
75/*
76 * Default names - these end with "Name" (easier to sort them).
77 */
78
79#define kDefaultKernelName"mach_kernel"
80#define kDefaultThemeName"Default"
81/*#define kDefaultBootPlistName"com.apple.Boot.plist"
82#define kDefaultDSDTName"dsdt.aml"
83#define kDefaultSMBIOSName"smbios.plist"
84#define kDefaultRamdiskName"Preboot.dmg" ???*/
85
86/*
87 * Keys used in system Boot.plist - these end with "Key".
88 *
89 * Keys marked with * on the "location" area, are present on BootHelp file.
90 * New or temporary keys, since RC4, are marked with # on the "location" area.
91 */
92//definitionnamelocation/functiondescription/comment
93
94// leave for later...
95#define kTextModeKey"Text Mode"// graphics.c, getNumberArrayFromPropertytextmode resolution??
96#define kProductVersion"ProductVersion"// boot.c, getValFK, internalkey on SystemVersion.plist
97
98// First run: keys that make no sense on "override" Boot.plist or typed at boot prompt.
99#define kDefaultPartitionKey"Default Partition"// sys.c, getValFK
100#define kHidePartitionKey"Hide Partition"// disk.c, getValFK
101#define kRenamePartitionKey"Rename Partition"// disk.c, getStringFK
102#define kTimeoutKey"Timeout"// * options.c, getIntFK
103#define kInstantMenuKey"Instant Menu"// * boot.c, getBollFK
104#define kQuietBootKey"Quiet Boot"// * boot.c, getBollFK
105#define kThemeNameKey"Theme"// gui.c, getValFKoverride default name
106#define kGUIKey"GUI"// * boot.c, getBollFK
107#define kBootBannerKey"Boot Banner"// * options.c, getBollFK
108#define kDisplayInfoKey"DisplayInfo"// #gui.c, graphics.c, getBollFK
109#define kGraphicsModeKey"Graphics Mode"// * graphics.c, getNumberArrayFromProperty
110#define kCDROMPromptKey"CD-ROM Prompt"// options.c, getValFK
111#define kCDROMOptionKey"CD-ROM Option Key"// options.c, getIntFK & getValFK
112#define kRescanPromptKey"Rescan Prompt"// boot.c, getBollFKtest this
113#define kRescanKey"Rescan"// * boot.c, getBollFK
114#define kScanSingleDriveKey"Scan Single Drive"// * boot.c, getBollFK
115#define kDevicePropertiesKey"device-properties"// device_inject.c, getValFK
116
117// Common: firstrun or secondrun
118#define kWaitForKeypressKey"Wait"// * boot.c, getBollFKturn this into flag?
119#define kTestConfigKey"config"// # stringTable.c, getValFK
120#define kKernelNameKey"Kernel"// * options.c, getValFK,override default name; at boot prompt typing the name is enough.
121#define kKernelCacheKey"Kernel Cache"// boot.c, getValFKtest this
122#define kKernelFlagsKey"Kernel Flags"// * options.c, getValFK
123#define kPatchKernelKey"PatchKernel"// # stringTable.c, getBollFKMeklort
124
125#define kRootDeviceKey"rd"// * options.c, processBootArgumenttest this,
126#define kBootDeviceKey"Boot Device"// options.c, getValFKand this??
127
128#define kBootUUIDKey"boot-uuid"// options.c, processBootArgumenttest this
129#define kHelperRootUUIDKey"Root UUID"// options.c, getValFKcan't test this
130
131#define kExtensionsKey"kext"// # drivers.c, getValFK
132#define kMKextCacheKey"MKext Cache"// options.c, getValFKtest this
133#define kDSDTKey"DSDT"// * acpi_patcher.c, getValFKoverride default path/name!?
134#define kDropSSDTKey"DropSSDT"// * acpi_patcher.c, getBollFK
135#define kSMBIOSKey"SMBIOS"// * fake_efi.c; getValFK
136#define kSMBIOSdefaultsKey"SMBIOSdefaults"// * smbios_patcher.c, getBollFK
137#define kWakeKey"Wake"// * boot.c, getBollFKfirstrun?
138#define kForceWakeKey"ForceWake"// * boot.c, getBollFKfirstrun?
139#define kWakeImageKey"WakeImage"// * boot.c, getValFKfirstrun?
140#define kPCIRootUIDKey"PciRoot"// * pci_root.c, getValFK,
141#define kUseAtiROMKey"UseAtiROM"// # ati.c, getBollFKfirstrun?
142#define kUseNvidiaROMKey"UseNvidiaROM"// # nvidia.c, getBollFKfirstrun?
143#define kVBIOSKey"VBIOS"// nvidia.c, getBollFKfirstrun?
144#define kSystemIDKey"SystemId"// * fake_efi.c, getStringFK
145#define kSystemTypeKey"SystemType"// * acpi_patcher.c, getStringFK
146#define kEthernetBuiltInKey"EthernetBuiltIn"// * pci_setup.c, getBollFK
147#define kGraphicsEnablerKey"GraphicsEnabler"// * pci_setup.c, getBollFK
148#define kLegacyLogoKey"Legacy Logo"// * gui.c, getBollFK
149#define kEHCIhardKey"EHCIhard"// usb.c, getBollFK, - rc4Azi: wtf is this?? internal?
150#define kUSBBusFixKey"USBBusFix"// * pci_setup.c, getBollFK
151#define kEHCIacquireKey"EHCIacquire"// * pci_setup.c, getBollFK
152#define kUHCIresetKey"UHCIreset"// * pci_setup.c, getBollFK
153#define kForceHPETKey"ForceHPET"// * pci_setup.c, getBollFK
154#define kLegacyOffKey"USBLegacyOff"// # usb.c, getBoolFKMeklort
155#define kMD0ImageKey"md0"// # ramdisk.c, getValFK||
156#define kRestartFixKey"RestartFix"// # acpi_patcher.c, getBollFK
157#define kUseMemDetectKey"UseMemDetect"// # platform.c, getBollFK
158#define kAutoResolutionKey"AutoResolution"// # boot.c, getBollFKdon't forget F2 key, to change resolution!
159#define kCanOverrideKey"CanOverride"// # stringTable.c, getBollFKAzi: most probably will be gone
160#define kGeneratePStatesKey"GeneratePStates"// # acpi_patcher.c, getBoolFKMozodojo
161#define kGenerateCStatesKey"GenerateCStates"// # acpi_patcher.c, getBoolFK||
162#define kEnableC4States"EnableC4State"// # acpi_patcher.c,||
163
164/*
165 * Flags to the booter and/or kernel - these end with "Flag".
166 */
167// A summary on next 3 flags:
168// These have no use on machines with cpu "without" 64 bit intructions.
169// Those machines boot i386 arch by "default", Legacy mode!
170// Reworked "arch" key; kind of a fusion between "arch" & "k32BitModeFlag";
171// If this (or something similar) doesn't stick, i vote for arch=i386, it's more educational!
172// 2 keys doing the same thing, just adds confusion!!
173#define kArchI386Flag"32"// # boot.c, getValFKforce i386 ("64 bit Mode" available)
174// Used by the booter to pass i386 arch; used by the kernel to disable "64 bit Mode".
175#define kLegacyModeFlag"-legacy"// # boot.c, fake_efi.c, getValFK;force i386 + disable "64 bit Mode"
176// Just to override i386/-legacy if flagged on Boot.plist.
177#define kArchX86_64Flag"64"// # boot.c, getValFK
178//----------
179#define kVerboseModeFlag"-v"// * options.c, getValFK
180#define kOldSafeModeFlag"-f"// kIgnoreCacheModeFlag***, options.c, getValFK
181#define kSafeModeFlag"-x"// * options.c, getValueFBK (5) & getValFK
182#define kSingleUserModeFlag"-s"// * options.c, getValFK
183#define kIgnoreBootFileFlag"-F"// * options.c, getValFBK
184// Can't remember if i ever tried -F; had an idea.. make this point to kTestConfigFileKey,
185// kind of a -config key.. like if "if you have a messed up config file" use -F to ignore it
186// and use a "safe default one".. investigate
187
188/*
189 * Booter behavior control
190 */
191#define kBootTimeout-1
192#define kCDBootTimeout8
193
194/*
195 * A global set by boot() to record the device that the booter
196 * was loaded from.
197 */
198extern int gBIOSDev;
199extern long gBootMode;
200extern bool sysConfigValid;
201extern char bootBanner[];
202extern char bootPrompt[];
203extern bool gOverrideKernel;
204//extern char *gPlatformName; //Azi: not in use
205extern char gMKextName[];
206extern char gRootDevice[];
207extern bool gEnableCDROMRescan;
208extern bool gScanSingleDrive;
209extern bool useGUI;
210
211/*
212 * Boot Modes
213 */
214enum {
215 kBootModeNormal = 0,
216 kBootModeSafe = 1,
217 kBootModeSecure = 2,
218 kBootModeQuiet = 4
219};
220
221extern void initialize_runtime();
222extern void common_boot(int biosdev);
223
224/*
225 * usb.c
226 */
227extern int usb_loop();
228
229/*
230 * graphics.c
231 */
232extern void printVBEModeInfo();
233extern void setVideoMode(int mode, int drawgraphics);
234extern int getVideoMode();
235extern void spinActivityIndicator();
236extern void clearActivityIndicator();
237extern void drawColorRectangle( unsigned short x,
238 unsigned short y,
239 unsigned short width,
240 unsigned short height,
241 unsigned char colorIndex );
242extern void drawDataRectangle( unsigned short x,
243 unsigned short y,
244 unsigned short width,
245 unsigned short height,
246 unsigned char * data );
247extern int
248convertImage( unsigned short width,
249 unsigned short height,
250 const unsigned char *imageData,
251 unsigned char **newImageData );
252extern char * decodeRLE( const void * rleData, int rleBlocks, int outBytes );
253extern void drawBootGraphics(void);
254extern void drawPreview(void *src, uint8_t * saveunder);
255extern int getVideoMode(void);
256extern void loadImageScale (void *input, int iw, int ih, int ip, void *output, int ow, int oh, int op, int or);
257
258/*
259 * drivers.c
260 */
261extern long LoadDrivers(char * dirSpec);
262extern long DecodeKernel(void *binary, entry_t *rentry, char **raddr, int *rsize);
263
264typedef long (*FileLoadDrivers_t)(char *dirSpec, long plugin);
265/*!
266 Hookable function pointer called during the driver loading phase that
267 allows other code to cause additional drivers to be loaded.
268 */
269extern long (*LoadExtraDrivers_p)(FileLoadDrivers_t FileLoadDrivers_p);
270
271/*
272 * options.c
273 */
274extern int getBootOptions(bool firstRun);
275extern int processBootOptions();
276extern int selectAlternateBootDevice(int bootdevice);
277extern bool promptForRescanOption(void);
278
279void showHelp();
280void showTextFile();
281char *getMemoryInfoString();
282
283typedef struct {
284 char name[80];
285 void * param;
286} MenuItem;
287
288/*
289 * lzss.c
290 */
291extern int decompress_lzss(u_int8_t *dst, u_int8_t *src, u_int32_t srclen);
292
293struct compressed_kernel_header {
294 u_int32_t signature;
295 u_int32_t compress_type;
296 u_int32_t adler32;
297 u_int32_t uncompressed_size;
298 u_int32_t compressed_size;
299 u_int32_t reserved[11];
300 char platform_name[64];
301 char root_path[256];
302 u_int8_t data[0];
303};
304typedef struct compressed_kernel_header compressed_kernel_header;
305
306/* resume.c */
307void HibernateBoot(char *boot_device);
308
309/* bmdecompress.c */
310void * DecompressData(void *srcbase, int *dw, int *dh, int *bytesPerPixel);
311
312#endif /* !__BOOT2_BOOT_H */
313

Archive Download this file

Revision: 353