xref: /illumos-gate/usr/src/uts/common/sys/multiboot.h (revision 6915124b)
1ae115bc7Smrj /*
2ae115bc7Smrj  * CDDL HEADER START
3ae115bc7Smrj  *
4ae115bc7Smrj  * The contents of this file are subject to the terms of the
5ae115bc7Smrj  * Common Development and Distribution License (the "License").
6ae115bc7Smrj  * You may not use this file except in compliance with the License.
7ae115bc7Smrj  *
8ae115bc7Smrj  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9ae115bc7Smrj  * or http://www.opensolaris.org/os/licensing.
10ae115bc7Smrj  * See the License for the specific language governing permissions
11ae115bc7Smrj  * and limitations under the License.
12ae115bc7Smrj  *
13ae115bc7Smrj  * When distributing Covered Code, include this CDDL HEADER in each
14ae115bc7Smrj  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15ae115bc7Smrj  * If applicable, add the following below this CDDL HEADER, with the
16ae115bc7Smrj  * fields enclosed by brackets "[]" replaced with your own identifying
17ae115bc7Smrj  * information: Portions Copyright [yyyy] [name of copyright owner]
18ae115bc7Smrj  *
19ae115bc7Smrj  * CDDL HEADER END
20ae115bc7Smrj  */
21ae115bc7Smrj 
22ae115bc7Smrj /*
23a561078eSMark Johnson  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24ae115bc7Smrj  * Use is subject to license terms.
25ae115bc7Smrj  */
26ae115bc7Smrj 
27ae115bc7Smrj #ifndef	_MULTIBOOT_H
28ae115bc7Smrj #define	_MULTIBOOT_H
29ae115bc7Smrj 
30ae115bc7Smrj #ifdef	__cplusplus
31ae115bc7Smrj extern "C" {
32ae115bc7Smrj #endif
33ae115bc7Smrj 
34ae115bc7Smrj /*
35ae115bc7Smrj  * Definitions of structures/data for using a multiboot compliant OS loader.
36ae115bc7Smrj  */
37ae115bc7Smrj #define	MB_HEADER_MAGIC		 0x1BADB002	/* magic */
385420b805SSeth Goldberg 
395420b805SSeth Goldberg /* The 32-bit kernel does not require the use of the AOUT kludge */
405420b805SSeth Goldberg #define	MB_HEADER_FLAGS_32	 0x00000003	/* flags we use */
415420b805SSeth Goldberg #define	MB_HEADER_CHECKSUM_32	-0x1BADB005	/* -(magic + flag) */
425420b805SSeth Goldberg 
435420b805SSeth Goldberg #define	MB_HEADER_FLAGS_64	 0x00010003	/* flags we use */
445420b805SSeth Goldberg #define	MB_HEADER_CHECKSUM_64	-0x1BAEB005	/* -(magic + flag) */
45ae115bc7Smrj 
46ae115bc7Smrj /*
47ae115bc7Smrj  * passed by boot loader to kernel
48ae115bc7Smrj  */
49ae115bc7Smrj #define	MB_BOOTLOADER_MAGIC	0x2BADB002
50ae115bc7Smrj 
51ae115bc7Smrj #ifndef _ASM		/* excluded from assembly routines */
52ae115bc7Smrj 
53ae115bc7Smrj #include <sys/types.h>
54ae115bc7Smrj #include <sys/types32.h>
55ae115bc7Smrj 
56ae115bc7Smrj /*
57ae115bc7Smrj  * The Multiboot header must be somewhere in the 1st 8K of the image that
58ae115bc7Smrj  * the loader loads into memory.
59ae115bc7Smrj  */
60ae115bc7Smrj typedef struct multiboot_header {
61ae115bc7Smrj 	uint32_t	magic;
62ae115bc7Smrj 	uint32_t	flags;
63ae115bc7Smrj 	uint32_t	checksum;
64ae115bc7Smrj 	caddr32_t	header_addr;	/* use as (mutliboot_header_t *) */
65ae115bc7Smrj 	caddr32_t	load_addr;
66ae115bc7Smrj 	caddr32_t	load_end_addr;
67ae115bc7Smrj 	caddr32_t	bss_end_addr;
68ae115bc7Smrj 	caddr32_t	entry_addr;
69ae115bc7Smrj } multiboot_header_t;
70ae115bc7Smrj 
71ae115bc7Smrj /* The section header table for ELF. */
72ae115bc7Smrj typedef struct mb_elf_shtable {
73ae115bc7Smrj 	uint32_t num;
74ae115bc7Smrj 	uint32_t size;
75ae115bc7Smrj 	uint32_t addr;
76ae115bc7Smrj 	uint32_t shndx;
77ae115bc7Smrj } mb_elf_shtable_t;
78ae115bc7Smrj 
79ae115bc7Smrj /* The module structure. */
80ae115bc7Smrj typedef struct mb_module {
81ae115bc7Smrj 	caddr32_t	mod_start;
82ae115bc7Smrj 	caddr32_t	mod_end;
83ae115bc7Smrj 	caddr32_t	mod_name;	/* use as (char *) */
84ae115bc7Smrj 	uint32_t	reserved;
85ae115bc7Smrj } mb_module_t;
86ae115bc7Smrj 
87ae115bc7Smrj /*
88ae115bc7Smrj  * Memory map data structure. Walked in a bizarre way - see mutltiboot
89ae115bc7Smrj  * documentation for example.
90ae115bc7Smrj  */
91ae115bc7Smrj typedef struct mb_memory_map {
92ae115bc7Smrj 	uint32_t	size;
93ae115bc7Smrj 	uint32_t	base_addr_low;
94ae115bc7Smrj 	uint32_t	base_addr_high;
95ae115bc7Smrj 	uint32_t	length_low;
96ae115bc7Smrj 	uint32_t	length_high;
97ae115bc7Smrj 	uint32_t	type;		/* only value of 1 is RAM */
98ae115bc7Smrj } mb_memory_map_t;
99ae115bc7Smrj 
100ae115bc7Smrj 
101*6915124bSKonstantin Ananyev /* Drive Info structure.  */
102*6915124bSKonstantin Ananyev typedef struct mb_drive_info {
103*6915124bSKonstantin Ananyev 	uint32_t	size;		/* The size of this structure */
104*6915124bSKonstantin Ananyev 	uint8_t		drive_number;	/* The BIOS drive number */
105*6915124bSKonstantin Ananyev 	uint8_t		drive_mode;	/* The access mode (see below) */
106*6915124bSKonstantin Ananyev 	uint16_t	drive_cylinders;	/* The BIOS geometry */
107*6915124bSKonstantin Ananyev 	uint8_t		drive_heads;
108*6915124bSKonstantin Ananyev 	uint8_t		drive_sectors;
109*6915124bSKonstantin Ananyev 	/* The array of I/O ports used for the drive.  */
110*6915124bSKonstantin Ananyev 	uint16_t	drive_ports[1];
111*6915124bSKonstantin Ananyev } mb_drive_info_t;
112*6915124bSKonstantin Ananyev 
113*6915124bSKonstantin Ananyev /* Drive Mode.  */
114*6915124bSKonstantin Ananyev #define	MB_DI_CHS_MODE		0
115*6915124bSKonstantin Ananyev #define	MB_DI_LBA_MODE		1
116*6915124bSKonstantin Ananyev 
117*6915124bSKonstantin Ananyev 
118ae115bc7Smrj /*
119ae115bc7Smrj  * The Multiboot information. This is supplied by the multiboot loader
120ae115bc7Smrj  * for the OS.
121ae115bc7Smrj  *
122ae115bc7Smrj  * The flag bit fields defined what multiboot info the boot
123ae115bc7Smrj  * loader (see struct multiboot_info below) supplied:
124*6915124bSKonstantin Ananyev  */
125*6915124bSKonstantin Ananyev /* flag[0]	mem_upper, mem_loader */
126*6915124bSKonstantin Ananyev #define	MB_INFO_MEMORY			0x00000001
127*6915124bSKonstantin Ananyev /* flag[1]	boot_device */
128*6915124bSKonstantin Ananyev #define	MB_INFO_BOOTDEV			0x00000002
129*6915124bSKonstantin Ananyev /* flag[2]	cmdline (for launching kernel) */
130*6915124bSKonstantin Ananyev #define	MB_INFO_CMDLINE			0x00000004
131*6915124bSKonstantin Ananyev /* flag[3]	mods_count, mods_addr */
132*6915124bSKonstantin Ananyev #define	MB_INFO_MODS			0x00000008
133*6915124bSKonstantin Ananyev /* flag[4]	symbol table for a.out */
134*6915124bSKonstantin Ananyev #define	MB_INFO_AOUT_SYMS		0x00000010
135*6915124bSKonstantin Ananyev /* flag[5]	symbol table for elf */
136*6915124bSKonstantin Ananyev #define	MB_INFO_ELF_SHDR		0x00000020
137*6915124bSKonstantin Ananyev /* flag[6]	mmap_length, mmap_addr */
138*6915124bSKonstantin Ananyev #define	MB_INFO_MEM_MAP			0x00000040
139*6915124bSKonstantin Ananyev /* flag[7]	drives_length, drivers_addr */
140*6915124bSKonstantin Ananyev #define	MB_INFO_DRIVE_INFO		0x00000080
141*6915124bSKonstantin Ananyev /* flag[8]	config_table */
142*6915124bSKonstantin Ananyev #define	MB_INFO_CONFIG_TABLE		0x00000100
143*6915124bSKonstantin Ananyev /* flag[9]	boot_loader_name */
144*6915124bSKonstantin Ananyev #define	MB_INFO_BOOT_LOADER_NAME	0x00000200
145*6915124bSKonstantin Ananyev /* flag[10]	apm_table */
146*6915124bSKonstantin Ananyev #define	MB_INFO_APM_TABLE		0x00000400
147*6915124bSKonstantin Ananyev /*
148ae115bc7Smrj  * flag[11]	vbe_control_info
149ae115bc7Smrj  *		vbe_mode_info
150ae115bc7Smrj  *		vbe_mode
151ae115bc7Smrj  *		vbe_interface_seg
152ae115bc7Smrj  *		vbe_interface_off
153ae115bc7Smrj  *		vbe_interface_len
154ae115bc7Smrj  */
155*6915124bSKonstantin Ananyev #define	MB_INFO_VIDEO_INFO		0x00000800
156*6915124bSKonstantin Ananyev 
157ae115bc7Smrj typedef struct multiboot_info {
158ae115bc7Smrj 	uint32_t	flags;
159ae115bc7Smrj 	uint32_t	mem_lower;	/* # of pages below 1Meg */
160ae115bc7Smrj 	uint32_t	mem_upper;	/* # of pages above 1Meg */
161ae115bc7Smrj 	uint32_t	boot_device;
162ae115bc7Smrj 	caddr32_t	cmdline;	/* use as (char *) */
163ae115bc7Smrj 	uint32_t	mods_count;
164ae115bc7Smrj 	caddr32_t	mods_addr;	/* use as (mb_module_t *) */
165ae115bc7Smrj 	mb_elf_shtable_t elf_sec;
166ae115bc7Smrj 	uint32_t	mmap_length;
167ae115bc7Smrj 	caddr32_t	mmap_addr;	/* use as (mb_memory_map_t *) */
168ae115bc7Smrj 	uint32_t	drives_length;
169ae115bc7Smrj 	caddr32_t	drives_addr;
170ae115bc7Smrj 	caddr32_t	config_table;
171ae115bc7Smrj 	caddr32_t	boot_loader_name;
172ae115bc7Smrj 	caddr32_t	apm_table;
173ae115bc7Smrj 	uint32_t	vbe_control_info;
174ae115bc7Smrj 	uint32_t	vbe_mode_info;
175ae115bc7Smrj 	uint16_t	vbe_mode;
176ae115bc7Smrj 	uint16_t	vbe_interface_seg;
177ae115bc7Smrj 	uint16_t	vbe_interface_off;
178ae115bc7Smrj 	uint16_t	vbe_interface_len;
179ae115bc7Smrj } multiboot_info_t;
180ae115bc7Smrj 
181ae115bc7Smrj /*
182ae115bc7Smrj  * netinfo for Solaris diskless booting
183ae115bc7Smrj  * XXX - not part of multiboot spec
184ae115bc7Smrj  */
185ae115bc7Smrj struct sol_netinfo {
186ae115bc7Smrj 	uint8_t sn_infotype;
187ae115bc7Smrj 	uint8_t sn_mactype;
188ae115bc7Smrj 	uint8_t sn_maclen;
189ae115bc7Smrj 	uint8_t sn_padding;
190a561078eSMark Johnson 	uint32_t sn_ciaddr;
191a561078eSMark Johnson 	uint32_t sn_siaddr;
192a561078eSMark Johnson 	uint32_t sn_giaddr;
193a561078eSMark Johnson 	uint32_t sn_netmask;
194ae115bc7Smrj 	uint8_t sn_macaddr[1];
195ae115bc7Smrj };
196ae115bc7Smrj 
197ae115bc7Smrj /* identify bootp/dhcp reply or rarp/ifconfig */
198ae115bc7Smrj #define	SN_TYPE_BOOTP   2
199ae115bc7Smrj #define	SN_TYPE_RARP    0xf0
200ae115bc7Smrj 
201ae115bc7Smrj 
202ae115bc7Smrj #endif /* _ASM */
203ae115bc7Smrj 
204ae115bc7Smrj 
205ae115bc7Smrj #ifdef	__cplusplus
206ae115bc7Smrj }
207ae115bc7Smrj #endif
208ae115bc7Smrj 
209ae115bc7Smrj #endif	/* _MULTIBOOT_H */
210