2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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.
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
20 * @APPLE_LICENSE_HEADER_END@
22 #ifndef _PEXPERT_I386_BOOT_H
23 #define _PEXPERT_I386_BOOT_H
26 * What the booter leaves behind for the kernel.
30 * Maximum number of boot drivers that can be loaded.
35 * Types of boot driver that may be loaded by the booter.
38 kBootDriverTypeInvalid
= 0,
39 kBootDriverTypeKEXT
= 1,
40 kBootDriverTypeMKEXT
= 2
44 unsigned long address
; // address where driver was loaded
45 unsigned long size
; // number of bytes
46 unsigned long type
; // driver type
50 * APM BIOS information.
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
;
63 unsigned long mode_16
:1;
64 unsigned long mode_32
:1;
65 unsigned long idle_slows_cpu
:1;
66 unsigned long reserved
:29;
70 unsigned long connected
;
74 * PCI bus information.
76 typedef struct _PCI_bus_info_t
{
79 unsigned char configMethod1
:1;
80 unsigned char configMethod2
:1;
82 unsigned char specialCycle1
:1;
83 unsigned char specialCycle2
:1;
87 unsigned char maxBusNum
;
88 unsigned char majorVersion
;
89 unsigned char minorVersion
;
90 unsigned char BIOSPresent
;
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
105 typedef struct boot_video boot_video
;
107 #define GRAPHICS_MODE 1
112 * INT15, E820h - Query System Address Map.
114 * Documented in ACPI Specification Rev 2.0,
115 * Chapter 15 (System Address Map Interfaces).
119 * ACPI defined memory range types.
122 kMemoryRangeUsable
= 1, // RAM usable by the OS.
123 kMemoryRangeReserved
= 2, // Reserved. (Do not use)
124 kMemoryRangeACPI
= 3, // ACPI tables. Can be reclaimed.
125 kMemoryRangeNVS
= 4, // ACPI NVS memory. (Do not use)
127 /* Undefined types should be treated as kMemoryRangeReserved */
131 * Memory range descriptor.
133 typedef struct MemoryRange
{
134 unsigned long long base
; // 64-bit base address
135 unsigned long long length
; // 64-bit length in bytes
136 unsigned long type
; // type of memory range
137 unsigned long reserved
;
140 #define kMemoryMapCountMax 40
143 * BIOS drive information.
145 struct boot_drive_info
{
146 struct drive_params
{
147 unsigned short buf_size
;
148 unsigned short info_flags
;
149 unsigned long phys_cyls
;
150 unsigned long phys_heads
;
151 unsigned long phys_spt
;
152 unsigned long long phys_sectors
;
153 unsigned short phys_nbps
;
154 unsigned short dpte_offset
;
155 unsigned short dpte_segment
;
157 unsigned char path_len
;
158 unsigned char reserved1
;
159 unsigned short reserved2
;
160 unsigned char bus_type
[4];
161 unsigned char interface_type
[8];
162 unsigned char interface_path
[8];
163 unsigned char dev_path
[8];
164 unsigned char reserved3
;
165 unsigned char checksum
;
166 } params
__attribute__((packed
));
168 unsigned short io_port_base
;
169 unsigned short control_port_base
;
170 unsigned char head_flags
;
171 unsigned char vendor_info
;
172 unsigned char irq
: 4;
173 unsigned char irq_unused
: 4;
174 unsigned char block_count
;
175 unsigned char dma_channel
: 4;
176 unsigned char dma_type
: 4;
177 unsigned char pio_type
: 4;
178 unsigned char pio_unused
: 4;
179 unsigned short option_flags
;
180 unsigned short reserved
;
181 unsigned char revision
;
182 unsigned char checksum
;
183 } dpte
__attribute__((packed
));
184 } __attribute__((packed
));
185 typedef struct boot_drive_info boot_drive_info_t
;
187 #define MAX_BIOS_DEVICES 8
189 #define OLD_BOOT_STRING_LEN 160
190 #define BOOT_STRING_LEN 1024
191 #define CONFIG_SIZE (12 * 4096)
193 /* Old structure for compatibility */
197 char bootString
[OLD_BOOT_STRING_LEN
]; // boot arguments
198 int magicCookie
; // KERNBOOTMAGIC
199 int numIDEs
; // number of IDE drives
200 int rootdev
; // root device
201 int convmem
; // conventional memory
202 int extmem
; // extended memory
203 char bootFile
[128]; // kernel file name
204 int firstAddr0
; // first address for kern convmem
205 int diskInfo
[4]; // info for bios dev 80-83
206 int graphicsMode
; // booted in graphics mode?
207 int kernDev
; // device kernel was fetched from
208 int numBootDrivers
; // number of drivers loaded
209 char * configEnd
; // pointer to end of config files
210 int kaddr
; // kernel load address
211 int ksize
; // size of kernel
212 driver_config_t driverConfig
[NDRIVERS
];
213 char _reserved
[2052];
215 PCI_bus_info_t pciInfo
;
216 APM_config_t apmConfig
;
217 char config
[CONFIG_SIZE
];
220 #define KERNSTRUCT_ADDR ((KERNBOOTSTRUCT *) 0x11000)
221 #define KERNBOOTMAGIC 0xa7a7a7a7
223 #define BOOT_LINE_LENGTH 256
226 * Video information..
230 unsigned long v_baseAddr
; /* Base address of video memory */
231 unsigned long v_display
; /* Display Code (if Applicable */
232 unsigned long v_rowBytes
; /* Number of bytes per pixel row */
233 unsigned long v_width
; /* Width */
234 unsigned long v_height
; /* Height */
235 unsigned long v_depth
; /* Pixel Depth */
238 typedef struct Boot_Video Boot_Video
;
240 /* DRAM Bank definitions - describes physical memory layout.
242 #define kMaxDRAMBanks 26 /* maximum number of DRAM banks */
246 unsigned long base
; /* physical base of DRAM bank */
247 unsigned long size
; /* size of bank */
249 typedef struct DRAMBank DRAMBank
;
252 /* Boot argument structure - passed into Mach kernel at boot time.
254 #define kBootArgsVersion 1
255 #define kBootArgsRevision 1
257 typedef struct boot_args
{
258 unsigned short Revision
; /* Revision of boot_args structure */
259 unsigned short Version
; /* Version of boot_args structure */
260 char CommandLine
[BOOT_LINE_LENGTH
]; /* Passed in command line */
261 DRAMBank PhysicalDRAM
[kMaxDRAMBanks
]; /* base and range pairs for the 26 DRAM banks */
262 Boot_Video Video
; /* Video Information */
263 unsigned long machineType
; /* Machine Type (gestalt) */
264 void *deviceTreeP
; /* Base of flattened device tree */
265 unsigned long deviceTreeLength
;/* Length of flattened tree */
266 unsigned long topOfKernelData
;/* Highest address used in kernel data area */
269 extern boot_args passed_args
;
274 #define KERNEL_BOOT_MAGIC 0xa5b6d7e8
276 typedef struct KernelBootArgs
{
277 unsigned int magicCookie
; // KERNEL_BOOT_MAGIC
278 unsigned short version
;
279 unsigned short revision
;
280 unsigned int size
; // size of KernelBootArgs structure
281 int numDrives
; // number of BIOS drives
282 int rootdev
; // root device
283 int convmem
; // conventional memory
284 int extmem
; // extended memory
285 unsigned int firstAddr0
; // first address for kern convmem
286 int graphicsMode
; // booted in graphics mode?
287 int kernDev
; // device kernel was fetched from
288 int numBootDrivers
; // number of drivers loaded
289 char * configEnd
; // pointer to end of config files
290 unsigned int kaddr
; // kernel load address
291 unsigned int ksize
; // size of kernel
292 char bootFile
[128]; // kernel file name
293 char bootString
[BOOT_STRING_LEN
]; // boot arguments
294 driver_config_t driverConfig
[NDRIVERS
];
295 unsigned long memoryMapCount
;
296 MemoryRange memoryMap
[kMemoryMapCountMax
];
297 boot_drive_info_t driveInfo
[MAX_BIOS_DEVICES
];
299 PCI_bus_info_t pciInfo
;
300 APM_config_t apmConfig
;
301 char config
[CONFIG_SIZE
];
305 #endif /* _PEXPERT_I386_BOOT_H */