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