2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
23 #ifndef _PEXPERT_I386_BOOT_H
24 #define _PEXPERT_I386_BOOT_H
27 * What the booter leaves behind for the kernel.
31 * Maximum number of boot drivers that can be loaded.
36 * Types of boot driver that may be loaded by the booter.
39 kBootDriverTypeInvalid
= 0,
40 kBootDriverTypeKEXT
= 1,
41 kBootDriverTypeMKEXT
= 2
45 unsigned long address
; // address where driver was loaded
46 unsigned long size
; // number of bytes
47 unsigned long type
; // driver type
51 * APM BIOS information.
54 unsigned short major_vers
; // == 0 if not present
55 unsigned short minor_vers
;
56 unsigned long cs32_base
;
57 unsigned long cs16_base
;
58 unsigned long ds_base
;
59 unsigned long cs_length
;
60 unsigned long ds_length
;
61 unsigned long entry_offset
;
64 unsigned long mode_16
:1;
65 unsigned long mode_32
:1;
66 unsigned long idle_slows_cpu
:1;
67 unsigned long reserved
:29;
71 unsigned long connected
;
75 * PCI bus information.
77 typedef struct _PCI_bus_info_t
{
80 unsigned char configMethod1
:1;
81 unsigned char configMethod2
:1;
83 unsigned char specialCycle1
:1;
84 unsigned char specialCycle2
:1;
88 unsigned char maxBusNum
;
89 unsigned char majorVersion
;
90 unsigned char minorVersion
;
91 unsigned char BIOSPresent
;
98 unsigned long v_baseAddr
; // Base address of video memory
99 unsigned long v_display
; // Display Code (if Applicable
100 unsigned long v_rowBytes
; // Number of bytes per pixel row
101 unsigned long v_width
; // Width
102 unsigned long v_height
; // Height
103 unsigned long v_depth
; // Pixel Depth
106 typedef struct boot_video boot_video
;
108 #define GRAPHICS_MODE 1
113 * INT15, E820h - Query System Address Map.
115 * Documented in ACPI Specification Rev 2.0,
116 * Chapter 15 (System Address Map Interfaces).
120 * ACPI defined memory range types.
123 kMemoryRangeUsable
= 1, // RAM usable by the OS.
124 kMemoryRangeReserved
= 2, // Reserved. (Do not use)
125 kMemoryRangeACPI
= 3, // ACPI tables. Can be reclaimed.
126 kMemoryRangeNVS
= 4, // ACPI NVS memory. (Do not use)
128 /* Undefined types should be treated as kMemoryRangeReserved */
132 * Memory range descriptor.
134 typedef struct MemoryRange
{
135 unsigned long long base
; // 64-bit base address
136 unsigned long long length
; // 64-bit length in bytes
137 unsigned long type
; // type of memory range
138 unsigned long reserved
;
141 #define kMemoryMapCountMax 40
144 * BIOS drive information.
146 struct boot_drive_info
{
147 struct drive_params
{
148 unsigned short buf_size
;
149 unsigned short info_flags
;
150 unsigned long phys_cyls
;
151 unsigned long phys_heads
;
152 unsigned long phys_spt
;
153 unsigned long long phys_sectors
;
154 unsigned short phys_nbps
;
155 unsigned short dpte_offset
;
156 unsigned short dpte_segment
;
158 unsigned char path_len
;
159 unsigned char reserved1
;
160 unsigned short reserved2
;
161 unsigned char bus_type
[4];
162 unsigned char interface_type
[8];
163 unsigned char interface_path
[8];
164 unsigned char dev_path
[8];
165 unsigned char reserved3
;
166 unsigned char checksum
;
167 } params
__attribute__((packed
));
169 unsigned short io_port_base
;
170 unsigned short control_port_base
;
171 unsigned char head_flags
;
172 unsigned char vendor_info
;
173 unsigned char irq
: 4;
174 unsigned char irq_unused
: 4;
175 unsigned char block_count
;
176 unsigned char dma_channel
: 4;
177 unsigned char dma_type
: 4;
178 unsigned char pio_type
: 4;
179 unsigned char pio_unused
: 4;
180 unsigned short option_flags
;
181 unsigned short reserved
;
182 unsigned char revision
;
183 unsigned char checksum
;
184 } dpte
__attribute__((packed
));
185 } __attribute__((packed
));
186 typedef struct boot_drive_info boot_drive_info_t
;
188 #define MAX_BIOS_DEVICES 8
190 #define OLD_BOOT_STRING_LEN 160
191 #define BOOT_STRING_LEN 1024
192 #define CONFIG_SIZE (12 * 4096)
194 /* Old structure for compatibility */
198 char bootString
[OLD_BOOT_STRING_LEN
]; // boot arguments
199 int magicCookie
; // KERNBOOTMAGIC
200 int numIDEs
; // number of IDE drives
201 int rootdev
; // root device
202 int convmem
; // conventional memory
203 int extmem
; // extended memory
204 char bootFile
[128]; // kernel file name
205 int firstAddr0
; // first address for kern convmem
206 int diskInfo
[4]; // info for bios dev 80-83
207 int graphicsMode
; // booted in graphics mode?
208 int kernDev
; // device kernel was fetched from
209 int numBootDrivers
; // number of drivers loaded
210 char * configEnd
; // pointer to end of config files
211 int kaddr
; // kernel load address
212 int ksize
; // size of kernel
213 driver_config_t driverConfig
[NDRIVERS
];
214 char _reserved
[2052];
216 PCI_bus_info_t pciInfo
;
217 APM_config_t apmConfig
;
218 char config
[CONFIG_SIZE
];
221 #define KERNSTRUCT_ADDR ((KERNBOOTSTRUCT *) 0x11000)
222 #define KERNBOOTMAGIC 0xa7a7a7a7
224 #define BOOT_LINE_LENGTH 256
227 * Video information..
231 unsigned long v_baseAddr
; /* Base address of video memory */
232 unsigned long v_display
; /* Display Code (if Applicable */
233 unsigned long v_rowBytes
; /* Number of bytes per pixel row */
234 unsigned long v_width
; /* Width */
235 unsigned long v_height
; /* Height */
236 unsigned long v_depth
; /* Pixel Depth */
239 typedef struct Boot_Video Boot_Video
;
241 /* DRAM Bank definitions - describes physical memory layout.
243 #define kMaxDRAMBanks 26 /* maximum number of DRAM banks */
247 unsigned long base
; /* physical base of DRAM bank */
248 unsigned long size
; /* size of bank */
250 typedef struct DRAMBank DRAMBank
;
253 /* Boot argument structure - passed into Mach kernel at boot time.
255 #define kBootArgsVersion 1
256 #define kBootArgsRevision 1
258 typedef struct boot_args
{
259 unsigned short Revision
; /* Revision of boot_args structure */
260 unsigned short Version
; /* Version of boot_args structure */
261 char CommandLine
[BOOT_LINE_LENGTH
]; /* Passed in command line */
262 DRAMBank PhysicalDRAM
[kMaxDRAMBanks
]; /* base and range pairs for the 26 DRAM banks */
263 Boot_Video Video
; /* Video Information */
264 unsigned long machineType
; /* Machine Type (gestalt) */
265 void *deviceTreeP
; /* Base of flattened device tree */
266 unsigned long deviceTreeLength
;/* Length of flattened tree */
267 unsigned long topOfKernelData
;/* Highest address used in kernel data area */
270 extern boot_args passed_args
;
275 #define KERNEL_BOOT_MAGIC 0xa5b6d7e8
277 typedef struct KernelBootArgs
{
278 unsigned int magicCookie
; // KERNEL_BOOT_MAGIC
279 unsigned short version
;
280 unsigned short revision
;
281 unsigned int size
; // size of KernelBootArgs structure
282 int numDrives
; // number of BIOS drives
283 int rootdev
; // root device
284 int convmem
; // conventional memory
285 int extmem
; // extended memory
286 unsigned int firstAddr0
; // first address for kern convmem
287 int graphicsMode
; // booted in graphics mode?
288 int kernDev
; // device kernel was fetched from
289 int numBootDrivers
; // number of drivers loaded
290 char * configEnd
; // pointer to end of config files
291 unsigned int kaddr
; // kernel load address
292 unsigned int ksize
; // size of kernel
293 char bootFile
[128]; // kernel file name
294 char bootString
[BOOT_STRING_LEN
]; // boot arguments
295 driver_config_t driverConfig
[NDRIVERS
];
296 unsigned long memoryMapCount
;
297 MemoryRange memoryMap
[kMemoryMapCountMax
];
298 boot_drive_info_t driveInfo
[MAX_BIOS_DEVICES
];
300 PCI_bus_info_t pciInfo
;
301 APM_config_t apmConfig
;
302 char config
[CONFIG_SIZE
];
306 #endif /* _PEXPERT_I386_BOOT_H */