]> git.saurik.com Git - apple/xnu.git/blame - pexpert/pexpert/i386/boot.h
xnu-344.23.tar.gz
[apple/xnu.git] / pexpert / pexpert / i386 / boot.h
CommitLineData
1c79356b
A
1/*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
de355530
A
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.
1c79356b 11 *
de355530
A
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
1c79356b
A
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
de355530
A
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.
1c79356b
A
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
0b4e3aa0
A
29/*
30 * Maximum number of boot drivers that can be loaded.
1c79356b 31 */
0b4e3aa0 32#define NDRIVERS 500
1c79356b 33
0b4e3aa0
A
34/*
35 * Types of boot driver that may be loaded by the booter.
1c79356b 36 */
0b4e3aa0
A
37enum {
38 kBootDriverTypeInvalid = 0,
39 kBootDriverTypeKEXT = 1,
40 kBootDriverTypeMKEXT = 2
41};
1c79356b
A
42
43typedef struct {
0b4e3aa0
A
44 unsigned long address; // address where driver was loaded
45 unsigned long size; // number of bytes
46 unsigned long type; // driver type
1c79356b
A
47} driver_config_t;
48
0b4e3aa0
A
49/*
50 * APM BIOS information.
51 */
1c79356b 52typedef struct {
0b4e3aa0
A
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;
1c79356b 61 union {
0b4e3aa0
A
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;
1c79356b 69 } flags;
0b4e3aa0 70 unsigned long connected;
1c79356b
A
71} APM_config_t;
72
0b4e3aa0
A
73/*
74 * PCI bus information.
75 */
1c79356b
A
76typedef struct _PCI_bus_info_t {
77 union {
0b4e3aa0
A
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;
1c79356b
A
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/*
0b4e3aa0 94 * Video information.
1c79356b 95 */
1c79356b 96struct boot_video {
0b4e3aa0
A
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
1c79356b
A
103};
104
0b4e3aa0
A
105typedef struct boot_video boot_video;
106
107#define GRAPHICS_MODE 1
108#define TEXT_MODE 0
1c79356b 109
0b4e3aa0
A
110#define BOOT_STRING_LEN 160
111#define CONFIG_SIZE (12 * 4096)
1c79356b
A
112
113typedef struct {
0b4e3aa0
A
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];
1c79356b
A
136} KERNBOOTSTRUCT;
137
0b4e3aa0
A
138#define KERNSTRUCT_ADDR ((KERNBOOTSTRUCT *) 0x11000)
139#define KERNBOOTMAGIC 0xa7a7a7a7
1c79356b
A
140
141#ifndef KERNEL
0b4e3aa0 142extern KERNBOOTSTRUCT * kernBootStruct;
1c79356b
A
143#endif
144
145#define BOOT_LINE_LENGTH 256
146
147/*
148 * Video information..
149 */
150
151struct 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
160typedef 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
166struct DRAMBank
167{
168 unsigned long base; /* physical base of DRAM bank */
169 unsigned long size; /* size of bank */
170};
171typedef 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
179typedef 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
191extern boot_args passed_args;
192
193#endif /* _PEXPERT_I386_BOOT_H */
194