]> git.saurik.com Git - apple/boot.git/blob - i386/libsa/kernBootStruct.h
550db5d2a3e2f24e8b2da3a74df897deb59049f6
[apple/boot.git] / i386 / libsa / kernBootStruct.h
1 /*
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * Portions Copyright (c) 1999 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 1.1 (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 * kernBootStruct.h
26 * What the booter leaves behind for the kernel.
27 */
28
29 #ifndef __BOOT_KERNBOOTSTRUCT_H
30 #define __BOOT_KERNBOOTSTRUCT_H
31
32 /*
33 * Maximum number of boot drivers that can be loaded.
34 */
35 #define NDRIVERS 500
36
37 /*
38 * Types of boot driver that may be loaded by the booter.
39 */
40 enum {
41 kBootDriverTypeInvalid = 0,
42 kBootDriverTypeKEXT = 1,
43 kBootDriverTypeMKEXT = 2
44 };
45
46 typedef struct {
47 unsigned long address; // address where driver was loaded
48 unsigned long size; // number of bytes
49 unsigned long type; // driver type
50 } driver_config_t;
51
52 /*
53 * APM BIOS information.
54 */
55 typedef struct {
56 unsigned short major_vers; // == 0 if not present
57 unsigned short minor_vers;
58 unsigned long cs32_base;
59 unsigned long cs16_base;
60 unsigned long ds_base;
61 unsigned long cs_length;
62 unsigned long ds_length;
63 unsigned long entry_offset;
64 union {
65 struct {
66 unsigned long mode_16 :1;
67 unsigned long mode_32 :1;
68 unsigned long idle_slows_cpu :1;
69 unsigned long reserved :29;
70 } f;
71 unsigned long data;
72 } flags;
73 unsigned long connected;
74 } APM_config_t;
75
76 /*
77 * PCI bus information.
78 */
79 typedef struct _PCI_bus_info_t {
80 union {
81 struct {
82 unsigned char configMethod1 :1;
83 unsigned char configMethod2 :1;
84 unsigned char :2;
85 unsigned char specialCycle1 :1;
86 unsigned char specialCycle2 :1;
87 } s;
88 unsigned char d;
89 } u_bus;
90 unsigned char maxBusNum;
91 unsigned char majorVersion;
92 unsigned char minorVersion;
93 unsigned char BIOSPresent;
94 } PCI_bus_info_t;
95
96 /*
97 * Video information.
98 */
99 struct boot_video {
100 unsigned long v_baseAddr; // Base address of video memory
101 unsigned long v_display; // Display Code (if Applicable
102 unsigned long v_rowBytes; // Number of bytes per pixel row
103 unsigned long v_width; // Width
104 unsigned long v_height; // Height
105 unsigned long v_depth; // Pixel Depth
106 };
107
108 typedef struct boot_video boot_video;
109
110 #define GRAPHICS_MODE 1
111 #define TEXT_MODE 0
112
113 #define BOOT_STRING_LEN 160
114 #define CONFIG_SIZE (12 * 4096)
115
116 typedef struct {
117 short version;
118 char bootString[BOOT_STRING_LEN]; // boot arguments
119 int magicCookie; // KERNBOOTMAGIC
120 int numIDEs; // number of IDE drives
121 int rootdev; // root device
122 int convmem; // conventional memory
123 int extmem; // extended memory
124 char bootFile[128]; // kernel file name
125 int firstAddr0; // first address for kern convmem
126 int diskInfo[4]; // info for bios dev 80-83
127 int graphicsMode; // booted in graphics mode?
128 int kernDev; // device kernel was fetched from
129 int numBootDrivers; // number of drivers loaded
130 char * configEnd; // pointer to end of config files
131 int kaddr; // kernel load address
132 int ksize; // size of kernel
133 driver_config_t driverConfig[NDRIVERS];
134 char _reserved[2052];
135 boot_video video;
136 PCI_bus_info_t pciInfo;
137 APM_config_t apmConfig;
138 char config[CONFIG_SIZE];
139 } KERNBOOTSTRUCT;
140
141 #define KERNSTRUCT_ADDR ((KERNBOOTSTRUCT *) 0x11000)
142 #define KERNBOOTMAGIC 0xa7a7a7a7
143
144 #ifndef KERNEL
145 extern KERNBOOTSTRUCT * kernBootStruct;
146 #endif
147
148 #endif /* !__BOOT_KERNBOOTSTRUCT_H */