| 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 | * Keys used in system Boot.plist␊ |
| 36 | */␊ |
| 37 | #define kGraphicsModeKey␉"Graphics Mode"␊ |
| 38 | #define kTextModeKey␉␉"Text Mode"␊ |
| 39 | #define kQuietBootKey␉␉"Quiet Boot"␊ |
| 40 | #define kKernelFlagsKey␉␉"Kernel Flags"␊ |
| 41 | #define kMKextCacheKey␉␉"MKext Cache"␊ |
| 42 | #define kKernelNameKey␉␉"Kernel"␊ |
| 43 | #define kKernelCacheKey␉␉"Kernel Cache"␊ |
| 44 | #define kBootDeviceKey␉␉"Boot Device"␊ |
| 45 | #define kTimeoutKey␉␉␉"Timeout"␊ |
| 46 | #define kRootDeviceKey␉␉"rd"␊ |
| 47 | #define kBootUUIDKey␉␉"boot-uuid"␊ |
| 48 | #define kHelperRootUUIDKey␉"Root UUID"␊ |
| 49 | #define kPlatformKey␉␉"platform"␊ |
| 50 | #define kACPIKey␉␉␉"acpi"␊ |
| 51 | #define kCDROMPromptKey␉␉"CD-ROM Prompt"␊ |
| 52 | #define kCDROMOptionKey␉␉"CD-ROM Option Key"␊ |
| 53 | #define kRescanPromptKey␉"Rescan Prompt"␊ |
| 54 | #define kRescanKey␉␉ "Rescan"␊ |
| 55 | #define kScanSingleDriveKey␉"Scan Single Drive"␊ |
| 56 | #define kInsantMenuKey␉␉"Instant Menu"␊ |
| 57 | #define kDefaultKernel␉␉"mach_kernel"␊ |
| 58 | #define kGUIKey␉␉␉␉"GUI"␊ |
| 59 | #define kBootBannerKey␉␉"Boot Banner"␊ |
| 60 | #define kWaitForKeypressKey␉"Wait"␊ |
| 61 | /* AsereBLN: added the other keys */␊ |
| 62 | #define kUseAtiROM␉␉␉"UseAtiROM"␉␉␉/* ati.c */␊ |
| 63 | #define kWake␉␉␉␉"Wake"␉␉␉␉/* boot.c */␊ |
| 64 | #define kForceWake␉␉␉"ForceWake"␉␉␉/* boot.c */␊ |
| 65 | #define kWakeImage␉␉␉"WakeImage"␉␉␉/* boot.c */␊ |
| 66 | #define kProductVersion␉␉"ProductVersion"␉/* boot.c */␊ |
| 67 | #define karch␉␉␉␉"arch"␉␉␉␉/* boot.c */␊ |
| 68 | #define kDSDT␉␉␉␉"DSDT"␉␉␉␉/* acpi_patcher.c */␊ |
| 69 | #define kDropSSDT␉␉␉"DropSSDT"␉␉␉/* acpi_patcher.c */␊ |
| 70 | #define kRestartFix␉␉␉"RestartFix"␉␉/* 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 kSMBIOS␉␉␉␉"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␉␉␉"PCIRootUID"␉␉/* 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 | ␊ |
| 96 | /*␊ |
| 97 | * Flags to the booter or kernel␊ |
| 98 | */␊ |
| 99 | #define kVerboseModeFlag␉"-v"␊ |
| 100 | #define kSafeModeFlag␉␉"-x"␊ |
| 101 | #define kOldSafeModeFlag␉"-f"␊ |
| 102 | #define kIgnoreBootFileFlag␉"-F"␊ |
| 103 | #define kSingleUserModeFlag␉"-s"␊ |
| 104 | #define k32BitModeFlag␉␉"-x32"␊ |
| 105 | ␊ |
| 106 | /*␊ |
| 107 | * Booter behavior control␊ |
| 108 | */␊ |
| 109 | #define kBootTimeout -1␊ |
| 110 | #define kCDBootTimeout 8␊ |
| 111 | ␊ |
| 112 | /*␊ |
| 113 | * A global set by boot() to record the device that the booter␊ |
| 114 | * was loaded from.␊ |
| 115 | */␊ |
| 116 | extern int gBIOSDev;␊ |
| 117 | extern long gBootMode;␊ |
| 118 | extern bool sysConfigValid;␊ |
| 119 | extern char bootBanner[];␊ |
| 120 | extern char bootPrompt[];␊ |
| 121 | extern bool gOverrideKernel;␊ |
| 122 | extern char *gPlatformName;␊ |
| 123 | extern char gMKextName[];␊ |
| 124 | extern char gRootDevice[];␊ |
| 125 | extern bool gEnableCDROMRescan;␊ |
| 126 | extern bool gScanSingleDrive;␊ |
| 127 | extern bool useGUI;␊ |
| 128 | ␊ |
| 129 | /*␊ |
| 130 | * Boot Modes␊ |
| 131 | */␊ |
| 132 | enum {␊ |
| 133 | kBootModeNormal = 0,␊ |
| 134 | kBootModeSafe = 1,␊ |
| 135 | kBootModeSecure = 2,␊ |
| 136 | kBootModeQuiet = 4␊ |
| 137 | };␊ |
| 138 | ␊ |
| 139 | extern void initialize_runtime();␊ |
| 140 | extern void common_boot(int biosdev);␊ |
| 141 | ␊ |
| 142 | /*␊ |
| 143 | * usb.c␊ |
| 144 | */␊ |
| 145 | extern int usb_loop();␊ |
| 146 | ␊ |
| 147 | /*␊ |
| 148 | * graphics.c␊ |
| 149 | */␊ |
| 150 | extern void printVBEModeInfo();␊ |
| 151 | extern void setVideoMode(int mode, int drawgraphics);␊ |
| 152 | extern int getVideoMode();␊ |
| 153 | extern void spinActivityIndicator();␊ |
| 154 | extern void clearActivityIndicator();␊ |
| 155 | extern void drawColorRectangle( unsigned short x,␊ |
| 156 | unsigned short y,␊ |
| 157 | unsigned short width,␊ |
| 158 | unsigned short height,␊ |
| 159 | unsigned char colorIndex );␊ |
| 160 | extern void drawDataRectangle( unsigned short x,␊ |
| 161 | unsigned short y,␊ |
| 162 | unsigned short width,␊ |
| 163 | unsigned short height,␊ |
| 164 | unsigned char * data );␊ |
| 165 | extern int␊ |
| 166 | convertImage( unsigned short width,␊ |
| 167 | unsigned short height,␊ |
| 168 | const unsigned char *imageData,␊ |
| 169 | unsigned char **newImageData );␊ |
| 170 | extern char * decodeRLE( const void * rleData, int rleBlocks, int outBytes );␊ |
| 171 | extern void drawBootGraphics(void);␊ |
| 172 | extern void drawPreview(void *src, uint8_t * saveunder);␊ |
| 173 | extern int getVideoMode(void);␊ |
| 174 | extern void loadImageScale (void *input, int iw, int ih, int ip, void *output, int ow, int oh, int op, int or);␊ |
| 175 | ␊ |
| 176 | /*␊ |
| 177 | * drivers.c␊ |
| 178 | */␊ |
| 179 | extern long LoadDrivers(char * dirSpec);␊ |
| 180 | extern long DecodeKernel(void *binary, entry_t *rentry, char **raddr, int *rsize);␊ |
| 181 | ␊ |
| 182 | typedef long (*FileLoadDrivers_t)(char *dirSpec, long plugin);␊ |
| 183 | /*!␊ |
| 184 | Hookable function pointer called during the driver loading phase that␊ |
| 185 | allows other code to cause additional drivers to be loaded.␊ |
| 186 | */␊ |
| 187 | extern long (*LoadExtraDrivers_p)(FileLoadDrivers_t FileLoadDrivers_p);␊ |
| 188 | ␊ |
| 189 | /*␊ |
| 190 | * options.c␊ |
| 191 | */␊ |
| 192 | extern int getBootOptions(bool firstRun);␊ |
| 193 | extern int processBootOptions();␊ |
| 194 | extern int selectAlternateBootDevice(int bootdevice);␊ |
| 195 | extern bool promptForRescanOption(void);␊ |
| 196 | ␊ |
| 197 | void showHelp();␊ |
| 198 | void showTextFile();␊ |
| 199 | char *getMemoryInfoString();␊ |
| 200 | ␊ |
| 201 | typedef struct {␊ |
| 202 | char name[80];␊ |
| 203 | void * param;␊ |
| 204 | } MenuItem;␊ |
| 205 | ␊ |
| 206 | /*␊ |
| 207 | * lzss.c␊ |
| 208 | */␊ |
| 209 | extern int decompress_lzss(u_int8_t *dst, u_int8_t *src, u_int32_t srclen);␊ |
| 210 | ␊ |
| 211 | struct compressed_kernel_header {␊ |
| 212 | u_int32_t signature;␊ |
| 213 | u_int32_t compress_type;␊ |
| 214 | u_int32_t adler32;␊ |
| 215 | u_int32_t uncompressed_size;␊ |
| 216 | u_int32_t compressed_size;␊ |
| 217 | u_int32_t reserved[11];␊ |
| 218 | char platform_name[64];␊ |
| 219 | char root_path[256];␊ |
| 220 | u_int8_t data[0];␊ |
| 221 | };␊ |
| 222 | typedef struct compressed_kernel_header compressed_kernel_header;␊ |
| 223 | ␊ |
| 224 | /* resume.c */␊ |
| 225 | void HibernateBoot(char *boot_device);␊ |
| 226 | ␊ |
| 227 | /* bmdecompress.c */␊ |
| 228 | void * DecompressData(void *srcbase, int *dw, int *dh, int *bytesPerPixel);␊ |
| 229 | ␊ |
| 230 | #endif /* !__BOOT2_BOOT_H */␊ |
| 231 | |