| 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 | #include "libsaio.h"␊ |
| 33 | ␊ |
| 34 | /*␊ |
| 35 | * Default names␊ |
| 36 | */␊ |
| 37 | #define kDefaultKernel␉␉"mach_kernel"␊ |
| 38 | ␊ |
| 39 | /*␊ |
| 40 | * Keys used in system Boot.plist␊ |
| 41 | */␊ |
| 42 | #define kGraphicsModeKey␉"Graphics Mode"␉␉// graphics.c␊ |
| 43 | #define kTextModeKey␉␉"Text Mode"␉␉␉// graphics.c␊ |
| 44 | #define kQuietBootKey␉␉"Quiet Boot"␉␉// boot.c␊ |
| 45 | #define kKernelFlagsKey␉␉"Kernel Flags"␉␉// options.c␊ |
| 46 | #define kMKextCacheKey␉␉"MKext Cache"␉␉// options.c␊ |
| 47 | #define kKernelNameKey␉␉"Kernel"␉␉␉// options.c␊ |
| 48 | #define kKernelCacheKey␉␉"Kernel Cache"␉␉// boot.c␊ |
| 49 | #define kBootDeviceKey␉␉"Boot Device"␉␉// options.c␊ |
| 50 | #define kTimeoutKey␉␉␉"Timeout"␉␉␉// options.c␊ |
| 51 | #define kRootDeviceKey␉␉"rd"␉␉␉␉// options.c␊ |
| 52 | #define kBootUUIDKey␉␉"boot-uuid"␉␉␉// options.c␊ |
| 53 | #define kHelperRootUUIDKey␉"Root UUID"␉␉␉// options.c␊ |
| 54 | #define kCDROMPromptKey␉␉"CD-ROM Prompt"␉␉// options.c␊ |
| 55 | #define kCDROMOptionKey␉␉"CD-ROM Option Key"␉// options.c␊ |
| 56 | #define kRescanPromptKey␉"Rescan Prompt"␉␉// boot.c␊ |
| 57 | #define kRescanKey␉␉ "Rescan"␉␉␉// boot.c␊ |
| 58 | #define kScanSingleDriveKey␉"Scan Single Drive"␉// boot.c␊ |
| 59 | #define kInstantMenuKey␉␉"Instant Menu"␉␉// boot.c␊ |
| 60 | #define kGUIKey␉␉␉␉"GUI"␉␉␉␉// boot.c␊ |
| 61 | #define kBootBannerKey␉␉"Boot Banner"␉␉// options.c␊ |
| 62 | #define kWaitForKeypressKey␉"Wait"␉␉␉␉// boot.c␊ |
| 63 | #define kExtensionsKey␉␉"kext"␉␉␉␉// drivers.c␊ |
| 64 | #define kUseAtiROM␉␉␉"UseAtiROM"␉␉␉// ati.c␊ |
| 65 | #define kWake␉␉␉␉"Wake"␉␉␉␉// boot.c␊ |
| 66 | #define kForceWake␉␉␉"ForceWake"␉␉␉// boot.c␊ |
| 67 | #define kWakeImage␉␉␉"WakeImage"␉␉␉// boot.c␊ |
| 68 | #define kProductVersion␉␉"ProductVersion"␉// boot.c␊ |
| 69 | #define kDSDTKey␉␉␉"DSDT"␉␉␉␉// acpi_patcher.c␊ |
| 70 | #define kDropSSDT␉␉␉"DropSSDT"␉␉␉// acpi_patcher.c␊ |
| 71 | #define kRestartFix␉␉␉"RestartFix" // acpi_patcher.c␊ |
| 72 | #define kGeneratePStates␉"GeneratePStates"␉// acpi_patcher.c␊ |
| 73 | #define kGenerateCStates␉"GenerateCStates"␉// acpi_patcher.c␊ |
| 74 | #define kEnableC4States␉␉"EnableC4State"␉␉// acpi_patcher.c␊ |
| 75 | #define kDeviceProperties␉"device-properties"␉// device_inject.c␊ |
| 76 | #define kHidePartition␉␉"Hide Partition"␉// disk.c␊ |
| 77 | #define kRenamePartition␉"Rename Partition"␉// disk.c␊ |
| 78 | #define kSMBIOSKey␉␉␉"SMBIOS"␉␉␉// fake_efi.c␊ |
| 79 | #define kSystemID␉␉␉"SystemId"␉␉␉// fake_efi.c␊ |
| 80 | #define kSystemType␉␉␉"SystemType"␉␉// fake_efi.c␊ |
| 81 | #define kUseNvidiaROM␉␉"UseNvidiaROM"␉␉// nvidia.c␊ |
| 82 | #define kVBIOS␉␉␉␉"VBIOS"␉␉␉␉// nvidia.c␊ |
| 83 | #define kPCIRootUID␉␉␉"PciRoot"␉␉␉// pci_root.c␊ |
| 84 | #define kEthernetBuiltIn␉"EthernetBuiltIn"␉// pci_setup.c␊ |
| 85 | #define kGraphicsEnabler␉"GraphicsEnabler"␉// pci_setup.c␊ |
| 86 | #define kForceHPET␉␉␉"ForceHPET"␉␉␉// pci_setup.c␊ |
| 87 | #define kUseMemDetect␉␉"UseMemDetect"␉ // platform.c␊ |
| 88 | #define kSMBIOSdefaults␉␉"SMBIOSdefaults"␉// smbios_patcher.c␊ |
| 89 | #define kUSBBusFix␉␉␉"USBBusFix"␉␉␉// usb.c␊ |
| 90 | #define kEHCIacquire␉␉"EHCIacquire"␉␉// usb.c␊ |
| 91 | #define kUHCIreset␉␉␉"UHCIreset"␉␉␉// usb.c␊ |
| 92 | #define kLegacyOff␉␉␉"USBLegacyOff"␉␉// usb.c␊ |
| 93 | #define kEHCIhard␉␉␉"EHCIhard"␉␉␉// usb.c␊ |
| 94 | #define kDefaultPartition␉"Default Partition"␉// sys.c␊ |
| 95 | #define kMD0Image␉␉␉"md0"␉␉␉␉// ramdisk.h␊ |
| 96 | #define kTestConfigKey␉␉"config"␉␉␉// stringTable.c␊ |
| 97 | #define kCanOverrideKey␉␉"CanOverride"␉␉// stringTable.c␊ |
| 98 | ␊ |
| 99 | /*␊ |
| 100 | * Flags to the booter and/or kernel - these end with "Flag".␊ |
| 101 | */␊ |
| 102 | #define kVerboseModeFlag␉"-v"␉␉␉␉// options.c␊ |
| 103 | #define kSafeModeFlag␉␉"-x"␉␉␉␉// options.c␊ |
| 104 | #define kOldSafeModeFlag␉"-f"␉␉␉␉// options.c␊ |
| 105 | #define kIgnoreBootFileFlag␉"-F"␉␉␉␉// options.c␊ |
| 106 | #define kSingleUserModeFlag␉"-s"␉␉␉␉// options.c␊ |
| 107 | #define kArchI386Flag␉␉"32"␉␉␉␉// boot.c␊ |
| 108 | #define kLegacyModeFlag␉␉"-legacy"␉␉␉// boot.c␊ |
| 109 | #define kArchX86_64Flag␉␉"64"␉␉␉␉// boot.c␊ |
| 110 | ␊ |
| 111 | /*␊ |
| 112 | * Booter behavior control␊ |
| 113 | */␊ |
| 114 | #define kBootTimeout -1␊ |
| 115 | #define kCDBootTimeout 8␊ |
| 116 | ␊ |
| 117 | /*␊ |
| 118 | * A global set by boot() to record the device that the booter␊ |
| 119 | * was loaded from.␊ |
| 120 | */␊ |
| 121 | extern int gBIOSDev;␊ |
| 122 | extern long gBootMode;␊ |
| 123 | extern bool sysConfigValid;␊ |
| 124 | extern char bootBanner[];␊ |
| 125 | extern char bootPrompt[];␊ |
| 126 | extern bool gOverrideKernel;␊ |
| 127 | //extern char *gPlatformName; disabled␊ |
| 128 | extern char gMKextName[];␊ |
| 129 | extern char gRootDevice[];␊ |
| 130 | extern bool gEnableCDROMRescan;␊ |
| 131 | extern bool gScanSingleDrive;␊ |
| 132 | extern bool useGUI;␊ |
| 133 | ␊ |
| 134 | /*␊ |
| 135 | * Boot Modes␊ |
| 136 | */␊ |
| 137 | enum {␊ |
| 138 | kBootModeNormal = 0,␊ |
| 139 | kBootModeSafe = 1,␊ |
| 140 | kBootModeSecure = 2,␊ |
| 141 | kBootModeQuiet = 4␊ |
| 142 | };␊ |
| 143 | ␊ |
| 144 | extern void initialize_runtime();␊ |
| 145 | extern void common_boot(int biosdev);␊ |
| 146 | ␊ |
| 147 | /*␊ |
| 148 | * usb.c␊ |
| 149 | */␊ |
| 150 | extern int usb_loop();␊ |
| 151 | ␊ |
| 152 | /*␊ |
| 153 | * graphics.c␊ |
| 154 | */␊ |
| 155 | extern void printVBEModeInfo();␊ |
| 156 | extern void setVideoMode(int mode, int drawgraphics);␊ |
| 157 | extern int getVideoMode();␊ |
| 158 | extern void spinActivityIndicator();␊ |
| 159 | extern void clearActivityIndicator();␊ |
| 160 | extern void drawColorRectangle( unsigned short x,␊ |
| 161 | unsigned short y,␊ |
| 162 | unsigned short width,␊ |
| 163 | unsigned short height,␊ |
| 164 | unsigned char colorIndex );␊ |
| 165 | extern void drawDataRectangle( unsigned short x,␊ |
| 166 | unsigned short y,␊ |
| 167 | unsigned short width,␊ |
| 168 | unsigned short height,␊ |
| 169 | unsigned char * data );␊ |
| 170 | extern int␊ |
| 171 | convertImage( unsigned short width,␊ |
| 172 | unsigned short height,␊ |
| 173 | const unsigned char *imageData,␊ |
| 174 | unsigned char **newImageData );␊ |
| 175 | extern char * decodeRLE( const void * rleData, int rleBlocks, int outBytes );␊ |
| 176 | extern void drawBootGraphics(void);␊ |
| 177 | extern void drawPreview(void *src, uint8_t * saveunder);␊ |
| 178 | extern int getVideoMode(void);␊ |
| 179 | extern void loadImageScale (void *input, int iw, int ih, int ip, void *output, int ow, int oh, int op, int or);␊ |
| 180 | ␊ |
| 181 | /*␊ |
| 182 | * drivers.c␊ |
| 183 | */␊ |
| 184 | extern long LoadDrivers(char * dirSpec);␊ |
| 185 | extern long DecodeKernel(void *binary, entry_t *rentry, char **raddr, int *rsize);␊ |
| 186 | ␊ |
| 187 | typedef long (*FileLoadDrivers_t)(char *dirSpec, long plugin);␊ |
| 188 | /*!␊ |
| 189 | Hookable function pointer called during the driver loading phase that␊ |
| 190 | allows other code to cause additional drivers to be loaded.␊ |
| 191 | */␊ |
| 192 | extern long (*LoadExtraDrivers_p)(FileLoadDrivers_t FileLoadDrivers_p);␊ |
| 193 | ␊ |
| 194 | /*␊ |
| 195 | * options.c␊ |
| 196 | */␊ |
| 197 | extern int getBootOptions(bool firstRun);␊ |
| 198 | extern int processBootOptions();␊ |
| 199 | extern int selectAlternateBootDevice(int bootdevice);␊ |
| 200 | extern bool promptForRescanOption(void);␊ |
| 201 | ␊ |
| 202 | void showHelp();␊ |
| 203 | void showTextFile();␊ |
| 204 | char *getMemoryInfoString();␊ |
| 205 | ␊ |
| 206 | typedef struct {␊ |
| 207 | char name[80];␊ |
| 208 | void * param;␊ |
| 209 | } MenuItem;␊ |
| 210 | ␊ |
| 211 | /*␊ |
| 212 | * lzss.c␊ |
| 213 | */␊ |
| 214 | extern int decompress_lzss(u_int8_t *dst, u_int8_t *src, u_int32_t srclen);␊ |
| 215 | ␊ |
| 216 | struct compressed_kernel_header {␊ |
| 217 | u_int32_t signature;␊ |
| 218 | u_int32_t compress_type;␊ |
| 219 | u_int32_t adler32;␊ |
| 220 | u_int32_t uncompressed_size;␊ |
| 221 | u_int32_t compressed_size;␊ |
| 222 | u_int32_t reserved[11];␊ |
| 223 | char platform_name[64];␊ |
| 224 | char root_path[256];␊ |
| 225 | u_int8_t data[0];␊ |
| 226 | };␊ |
| 227 | typedef struct compressed_kernel_header compressed_kernel_header;␊ |
| 228 | ␊ |
| 229 | /* resume.c */␊ |
| 230 | void HibernateBoot(char *boot_device);␊ |
| 231 | ␊ |
| 232 | /* bmdecompress.c */␊ |
| 233 | void * DecompressData(void *srcbase, int *dw, int *dh, int *bytesPerPixel);␊ |
| 234 | ␊ |
| 235 | #endif /* !__BOOT2_BOOT_H */␊ |
| 236 | |