home *** CD-ROM | disk | FTP | other *** search
/ H4CK3R 4 / hacker04 / 04_HACK04.ISO / darwin / darwinx86.iso / usr / include / pexpert / i386 / boot.h next >
Encoding:
C/C++ Source or Header  |  2001-09-30  |  6.1 KB  |  195 lines

  1. /*
  2.  * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
  3.  *
  4.  * @APPLE_LICENSE_HEADER_START@
  5.  * 
  6.  * The contents of this file constitute Original Code as defined in and
  7.  * are subject to the Apple Public Source License Version 1.1 (the
  8.  * "License").  You may not use this file except in compliance with the
  9.  * License.  Please obtain a copy of the License at
  10.  * http://www.apple.com/publicsource and read it before using this file.
  11.  * 
  12.  * This Original Code and all software distributed under the License are
  13.  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  14.  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
  15.  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
  16.  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
  17.  * License for the specific language governing rights and limitations
  18.  * under the License.
  19.  * 
  20.  * @APPLE_LICENSE_HEADER_END@
  21.  */
  22. #ifndef _PEXPERT_I386_BOOT_H
  23. #define _PEXPERT_I386_BOOT_H
  24.  
  25. /*
  26.  * What the booter leaves behind for the kernel.
  27.  */
  28.  
  29. /*
  30.  * Maximum number of boot drivers that can be loaded.
  31.  */
  32. #define NDRIVERS  500
  33.  
  34. /*
  35.  * Types of boot driver that may be loaded by the booter.
  36.  */
  37. enum {
  38.     kBootDriverTypeInvalid = 0,
  39.     kBootDriverTypeKEXT    = 1,
  40.     kBootDriverTypeMKEXT   = 2
  41. };
  42.  
  43. typedef struct {
  44.     unsigned long address;  // address where driver was loaded
  45.     unsigned long size;     // number of bytes
  46.     unsigned long type;     // driver type
  47. } driver_config_t;
  48.  
  49. /*
  50.  * APM BIOS information.
  51.  */
  52. typedef struct {
  53.     unsigned short major_vers;    // == 0 if not present
  54.     unsigned short minor_vers;
  55.     unsigned long  cs32_base;
  56.     unsigned long  cs16_base;
  57.     unsigned long  ds_base;
  58.     unsigned long  cs_length;
  59.     unsigned long  ds_length;
  60.     unsigned long  entry_offset;
  61.     union {
  62.         struct {
  63.             unsigned long mode_16        :1;
  64.             unsigned long mode_32        :1;
  65.             unsigned long idle_slows_cpu :1;
  66.             unsigned long reserved       :29;
  67.         } f;
  68.         unsigned long data;
  69.     } flags;
  70.     unsigned long connected;
  71. } APM_config_t;
  72.  
  73. /*
  74.  * PCI bus information.
  75.  */
  76. typedef struct _PCI_bus_info_t {
  77.     union {
  78.         struct {
  79.             unsigned char configMethod1 :1;
  80.             unsigned char configMethod2 :1;
  81.             unsigned char               :2;
  82.             unsigned char specialCycle1 :1;
  83.             unsigned char specialCycle2 :1;
  84.         } s;
  85.         unsigned char d;
  86.     } u_bus;
  87.     unsigned char maxBusNum;
  88.     unsigned char majorVersion;
  89.     unsigned char minorVersion;
  90.     unsigned char BIOSPresent;
  91. } PCI_bus_info_t;
  92.  
  93. /*
  94.  * Video information.
  95.  */
  96. struct boot_video {
  97.     unsigned long v_baseAddr;    // Base address of video memory
  98.     unsigned long v_display;    // Display Code (if Applicable
  99.     unsigned long v_rowBytes;   // Number of bytes per pixel row
  100.     unsigned long v_width;      // Width
  101.     unsigned long v_height;     // Height
  102.     unsigned long v_depth;      // Pixel Depth
  103. };
  104.  
  105. typedef struct boot_video  boot_video;
  106.  
  107. #define GRAPHICS_MODE     1
  108. #define TEXT_MODE         0
  109.  
  110. #define BOOT_STRING_LEN   160
  111. #define CONFIG_SIZE       (12 * 4096)
  112.  
  113. typedef struct {
  114.     short            version;
  115.     char             bootString[BOOT_STRING_LEN];  // boot arguments
  116.     int              magicCookie;                  // KERNBOOTMAGIC
  117.     int              numIDEs;                      // number of IDE drives
  118.     int              rootdev;                      // root device
  119.     int              convmem;                      // conventional memory
  120.     int              extmem;                       // extended memory
  121.     char             bootFile[128];                // kernel file name
  122.     int              firstAddr0;                   // first address for kern convmem
  123.     int              diskInfo[4];                  // info for bios dev 80-83
  124.     int              graphicsMode;                 // booted in graphics mode?
  125.     int              kernDev;                      // device kernel was fetched from
  126.     int              numBootDrivers;               // number of drivers loaded
  127.     char *           configEnd;                    // pointer to end of config files
  128.     int              kaddr;                        // kernel load address
  129.     int              ksize;                        // size of kernel
  130.     driver_config_t  driverConfig[NDRIVERS];
  131.     char             _reserved[2052];
  132.     boot_video       video;
  133.     PCI_bus_info_t   pciInfo;
  134.     APM_config_t     apmConfig;
  135.     char             config[CONFIG_SIZE];
  136. } KERNBOOTSTRUCT;
  137.  
  138. #define KERNSTRUCT_ADDR   ((KERNBOOTSTRUCT *) 0x11000)
  139. #define KERNBOOTMAGIC     0xa7a7a7a7
  140.  
  141. #ifndef KERNEL
  142. extern KERNBOOTSTRUCT *   kernBootStruct;
  143. #endif
  144.  
  145. #define BOOT_LINE_LENGTH        256
  146.  
  147. /*
  148.  * Video information.. 
  149.  */
  150.  
  151. struct Boot_Video {
  152.     unsigned long    v_baseAddr;    /* Base address of video memory */
  153.     unsigned long    v_display;    /* Display Code (if Applicable */
  154.     unsigned long    v_rowBytes;    /* Number of bytes per pixel row */
  155.     unsigned long    v_width;    /* Width */
  156.     unsigned long    v_height;    /* Height */
  157.     unsigned long    v_depth;    /* Pixel Depth */
  158. };
  159.  
  160. typedef struct Boot_Video    Boot_Video;
  161.  
  162. /* DRAM Bank definitions - describes physical memory layout.
  163.  */
  164. #define    kMaxDRAMBanks    26        /* maximum number of DRAM banks */
  165.  
  166. struct DRAMBank
  167. {
  168.     unsigned long    base;        /* physical base of DRAM bank */
  169.     unsigned long    size;        /* size of bank */
  170. };
  171. typedef struct DRAMBank DRAMBank;
  172.  
  173.  
  174. /* Boot argument structure - passed into Mach kernel at boot time.
  175.  */
  176. #define kBootArgsVersion        1
  177. #define kBootArgsRevision        1
  178.  
  179. typedef struct boot_args {
  180.   unsigned short    Revision;    /* Revision of boot_args structure */
  181.   unsigned short    Version;    /* Version of boot_args structure */
  182.   char        CommandLine[BOOT_LINE_LENGTH];    /* Passed in command line */
  183.   DRAMBank    PhysicalDRAM[kMaxDRAMBanks];    /* base and range pairs for the 26 DRAM banks */
  184.   Boot_Video    Video;        /* Video Information */
  185.     unsigned long    machineType;    /* Machine Type (gestalt) */
  186.     void        *deviceTreeP;    /* Base of flattened device tree */
  187.     unsigned long    deviceTreeLength;/* Length of flattened tree */
  188.     unsigned long    topOfKernelData;/* Highest address used in kernel data area */
  189. } boot_args;
  190.  
  191. extern boot_args passed_args;
  192.  
  193. #endif /* _PEXPERT_I386_BOOT_H */
  194.  
  195.