Chameleon

Chameleon Svn Source Tree

Root/branches/azimutz/Chazi/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:
33// Todo: don't include headers like boot.h on other headers, unless...!
34// move keys to the headers of the files they're in, if they have it!?
35// check header wrappers...
36
37//#include "saio_internal.h" // the only one needed by boot.h it self.
38#include "bootstruct.h"
39
40/*
41 * Default names - these end with "Name" (easier to sort them).
42 */
43#define kDefaultKernelName"mach_kernel"
44#define kDefaultThemeName"Default" // revert?
45/*
46#define kDefaultBootPlistName"com.apple.Boot.plist"
47#define kDefaultDSDTName"dsdt.aml"
48#define kDefaultSMBIOSName"smbios.plist"
49#define kDefaultRamdiskName"Preboot.dmg"
50???*/
51
52/*
53 * Default paths?????
54 */
55
56/*
57 * Undeclared (or undeclared here)
58 */
59/*
60"-checkers" gui.c, getValFK;
61"biosdev" mboot.c, getValFBK
62"timeout" mboot.c, getValFBK
63"partno" mboot.c, getValFBK
64"DumpSPD" spd.c, getBollFK
65*/
66
67/*
68 * Keys used in system Boot.plist - these end with "Key".
69 */
70//identifier string locationtypecomment
71#define kTextModeKey "Text Mode" // graphics.cgetNumberArraiFP- default 80x25 - kFlag - does it work??
72//#define kProductVersionKey "ProductVersion" // options.cgetValFK- (boot.c on trunk) - reverted
73
74#define kDefaultPartitionKey "Default Partition" // sys.cgetStringFK
75#define kHidePartitionKey "Hide Partition" // disk.cgetValFK
76#define kRenamePartitionKey "Rename Partition" // disk.cgetStringFK
77
78#define kInstantMenuKey "Instant Menu" // boot.cgetBoolFK
79#define kQuietBootKey "Quiet Boot" // boot.cgetBoolFK- kFlag
80#define kTimeoutKey "Timeout" // options.cgetIntFK
81#define kThemeNameKey "Theme" // gui.cgetValFK
82#define kGUIKey "GUI" // boot.cgetBoolFK
83#define kBootBannerKey "Boot Banner" // options.cgetBoolFK
84#define kLegacyLogoKey "Legacy Logo" // gui.cgetBoolFK- revert?
85#define kDebugInfoKey "DebugInfo" // gui.c, graphics.cgetBoolFK
86#define kRescanPromptKey "Rescan Prompt" // boot.cgetBoolFK- cdrom only - firstrun
87#define kRescanKey "Rescan" // boot.cgetBoolFK- cdrom only?? - firstrun
88#define kCDROMPromptKey "CD-ROM Prompt" // options.cgetValFK- internal??
89#define kCDROMOptionKey "CD-ROM Option Key" // options.cgetIntFK- internal?? (F8)
90#define kScanSingleDriveKey "Scan Single Drive" // boot.cgetBoolFK
91#define kDevicePropertiesKey "device-properties" // device_inject.cgetValFK
92#define kWaitForKeypressKey "Wait" // boot.cgetBoolFK
93#define kAltConfigKey "config" // stringTable.cgetValFK- kFlag - hum.. handle like kFlag??
94#define kCanOverrideKey "CanOverride" // stringTable.cgetBoolFK- remember -F ***
95#define kRootDeviceKey "rd" // options.cprocessBootArg- kFlag
96#define kBootDeviceKey "Boot Device" // options.cgetValFK- kFlag/option??????
97#define kBootUUIDKey "boot-uuid" // options.cprocessBootArg- kFlag
98#define kHelperRootUUIDKey "Root UUID" // options.cgetValFK- kFlag
99#define kArchKey "arch" // boot.cgetValFK- kFlag - after all,
100// it's to be passed via "kernel Flags" ?? - "man com.apple.Boot.plist"
101#define kKernelNameKey "Kernel" // options.cgetValFK- kFlag*** bFlag ?
102#define kKernelCacheKey "Kernel Cache" // boot.cgetValFK- kFlag
103#define kKernelFlagsKey "Kernel Flags" // options.cgetValFK- kFlags***
104#define kIgnoreKCKey "ignoreKC" // boot.cgetBoolFK- testing***
105
106#define kKPatcherKey "PatchKernel" // kernel_patcher.cgetBoolFK
107#define kAltExtensionsKey "kext" // drivers.cgetValFK
108#define kMKextCacheKey "MKext Cache" // options.cgetValFK- kFlag
109#define kMD0ImageKey "md0" // ramdisk.cgetValFK
110#define kWakeKey "Wake" // boot.cgetBoolFK
111#define kForceWakeKey "ForceWake" // boot.cgetBoolFK
112#define kWakeKeyImageKey "WakeImage" // boot.cgetValFK- location???
113
114//#define kUseAtiROMKey "UseAtiROM" // ati.cgetBoolFK ?? modules
115//#define kAtiConfigKey "AtiConfig" // ati.cgetStringFK
116//#define kATYbinimageKey "ATYbinimage" // ati.cgetBoolFK
117
118//#define kUseNvidiaROMKey "UseNvidiaROM" // nvidia.cgetBoolFK
119//#define kVBIOSKey "VBIOS" // nvidia.cgetBoolFK
120#define kGraphicsModeKey "Graphics Mode" // graphics.cgetNumberArraiFP- kFlag
121#define kAutoResolutionKey "AutoResolution" // boot.cgetBoolFK
122//#define kGraphicsEnablerKey "GraphicsEnabler" // GraphicsEnabler.cgetBoolFK
123#define kDSDTKey "DSDT" // acpi_patcher.cgetValFK
124#define kDropSSDTKey "DropSSDT" // acpi_patcher.cgetBoolFK
125#define kRestartFixKey "RestartFix" // acpi_patcher.cgetBoolFK- revert to true?
126#define kGeneratePStatesKey "GeneratePStates" // acpi_patcher.cgetBoolFK
127#define kGenerateCStatesKey "GenerateCStates" // acpi_patcher.cgetBoolFK
128#define kEnableC2StatesKey "EnableC2State" // acpi_patcher.cgetBoolFK
129#define kEnableC3StatesKey "EnableC3State" // acpi_patcher.cgetBoolFK
130#define kEnableC4StatesKey "EnableC4State" // acpi_patcher.cgetBoolFK
131//#define kUseMemDetectKey "UseMemDetect" // platform.cgetBoolFK
132#define kSMBIOSdefaultsKey "SMBIOSdefaults" // smbios_patcher.cgetBoolFK
133#define kSMBIOSKey "SMBIOS" // fake_efi.cgetValFK
134//Azi: should this be changed to "SystemID"? BootHelp.txt matches SystemId
135// cleaned obsolete comments on fake_efi.c, lines 500/508 & 608.
136// fixed CHANGES file, lines 39/40.
137#define kSystemIDKey "SystemId" // fake_efi.cgetStringFK
138#define kSystemTypeKey "SystemType" // fake_efi.cgetStringFK
139#define kPCIRootUIDKey "PciRoot" // pci_root.cgetValFK
140#define kEthernetBuiltInKey "EthernetBuiltIn" // pci_setup.cgetBoolFK
141#define kForceHPETKey "ForceHPET" // pci_setup.cgetBoolFK
142#define kUSBBusFixKey "USBBusFix" // usb.cgetBoolFK- trouble! - USBLegacyOff + the other = hang
143#define kEHCIacquireKey "EHCIacquire" // usb.cgetBoolFK
144#define kEHCIhardKey "EHCIhard" // usb.cgetBoolFK- ??
145#define kUHCIresetKey "UHCIreset" // usb.cgetBoolFK
146#define kLegacyOffKey "USBLegacyOff" // usb.cgetBoolFK
147#define kBusRatioKey "busratio" // cpu.cgetValFK
148
149/*
150 * Flags to the booter and/or kernel - these end with "Flag".
151 */
152//identifier string locationtypecomment
153#define kVerboseModeFlag "-v" // options.cgetValFK- kFlag
154#define kSafeModeFlag "-x" // options.cgetValFBootK & getValFK - ?? - kFlag
155#define kIgnoreCachesFlag "-f" // options.cgetValFK- kFlag
156#define kIgnoreBootFileFlag "-F" // options.cgetValFBootK- kFlag
157#define kSingleUserModeFlag "-s" // options.cgetValFK- kFlag
158
159/*
160 * Booter behavior control
161 */
162#define kBootTimeout -1
163#define kCDBootTimeout 8
164
165//Azi: place ?? Well, somehow this change of place seemd a good idea
166// to me at the time; if i just remembered why ??? - check in what files are these used!***
167enum {
168kBackspaceKey = 0x08,
169kTabKey = 0x09,
170kReturnKey = 0x0d,
171kEscapeKey = 0x1b,
172kUpArrowkey = 0x4800,
173kDownArrowkey = 0x5000,
174kASCIIKeyMask = 0x7f,
175kF2Key = 0x3c00, //Azi:autoresolution
176kF5Key = 0x3f00,
177kF10Key = 0x4400
178};
179
180/*
181 * A global set by boot() to record the device that the booter
182 * was loaded from.
183 */
184extern int gBIOSDev;
185extern long gBootMode;
186extern bool sysConfigValid;
187extern char bootBanner[];
188extern char bootLogBanner[];
189extern char bootPrompt[];
190extern bool gOverrideKernel;
191extern char *gPlatformName; // disabled ??
192extern char gMKextName[];
193extern char gRootDevice[];
194extern bool gEnableCDROMRescan;
195extern bool gScanSingleDrive;
196extern bool useGUI;
197
198/*
199 * Boot Modes
200 */
201enum {
202 kBootModeNormal = 0,
203 kBootModeSafe = 1,
204 kBootModeSecure = 2,
205 kBootModeQuiet = 4
206};
207
208extern void initialize_runtime();
209extern void common_boot(int biosdev);
210
211/*
212 * usb.c
213 */
214extern int usb_loop();
215
216/*
217 * graphics.c
218 */
219extern void printVBEModeInfo();
220extern void setVideoMode(int mode, int drawgraphics);
221extern int getVideoMode();
222extern void spinActivityIndicator();
223extern void clearActivityIndicator();
224extern void drawColorRectangle( unsigned short x,
225 unsigned short y,
226 unsigned short width,
227 unsigned short height,
228 unsigned char colorIndex );
229extern void drawDataRectangle( unsigned short x,
230 unsigned short y,
231 unsigned short width,
232 unsigned short height,
233 unsigned char * data );
234extern int
235convertImage( unsigned short width,
236 unsigned short height,
237 const unsigned char *imageData,
238 unsigned char **newImageData );
239extern char * decodeRLE( const void * rleData, int rleBlocks, int outBytes );
240extern void drawBootGraphics(void);
241extern void drawPreview(void *src, uint8_t * saveunder);
242extern int getVideoMode(void);
243extern void loadImageScale (void *input, int iw, int ih, int ip, void *output, int ow, int oh, int op, int or);
244
245/*
246 * drivers.c
247 */
248extern long LoadDrivers(char * dirSpec);
249extern long DecodeKernel(void *binary, entry_t *rentry, char **raddr, int *rsize);
250
251typedef long (*FileLoadDrivers_t)(char *dirSpec, long plugin);
252/*!
253 Hookable function pointer called during the driver loading phase that
254 allows other code to cause additional drivers to be loaded.
255 */
256extern long (*LoadExtraDrivers_p)(FileLoadDrivers_t FileLoadDrivers_p);
257
258/*
259 * options.c
260 */
261extern int getBootOptions(bool firstRun);
262extern int processBootOptions();
263extern int selectAlternateBootDevice(int bootdevice);
264extern bool promptForRescanOption(void);
265
266void showHelp();
267void showTextFile();
268char *getMemoryInfoString();
269
270typedef struct {
271 char name[80];
272 void * param;
273} MenuItem;
274
275/*
276 * lzss.c
277 */
278extern int decompress_lzss(u_int8_t *dst, u_int8_t *src, u_int32_t srclen);
279
280struct compressed_kernel_header {
281 u_int32_t signature;
282 u_int32_t compress_type;
283 u_int32_t adler32;
284 u_int32_t uncompressed_size;
285 u_int32_t compressed_size;
286 u_int32_t reserved[11];
287 char platform_name[64];
288 char root_path[256];
289 u_int8_t data[0];
290};
291typedef struct compressed_kernel_header compressed_kernel_header;
292
293/* resume.c */
294void HibernateBoot(char *boot_device);
295
296/* bmdecompress.c */
297void * DecompressData(void *srcbase, int *dw, int *dh, int *bytesPerPixel);
298
299#endif /* !__BOOT2_BOOT_H */
300

Archive Download this file

Revision: 1023