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