xref: /illumos-gate/usr/src/uts/common/sys/multiboot.h (revision 050c4bfe)
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 #define	MB_HEADER_FLAGS		 0x00010003	/* flags we use */
39 #define	MB_HEADER_CHECKSUM	-0x1BAEB005	/* -(magic + flag) */
40 
41 /*
42  * passed by boot loader to kernel
43  */
44 #define	MB_BOOTLOADER_MAGIC	0x2BADB002
45 
46 #ifndef _ASM		/* excluded from assembly routines */
47 
48 #include <sys/types.h>
49 #include <sys/types32.h>
50 
51 /*
52  * The Multiboot header must be somewhere in the 1st 8K of the image that
53  * the loader loads into memory.
54  */
55 typedef struct multiboot_header {
56 	uint32_t	magic;
57 	uint32_t	flags;
58 	uint32_t	checksum;
59 	caddr32_t	header_addr;	/* use as (mutliboot_header_t *) */
60 	caddr32_t	load_addr;
61 	caddr32_t	load_end_addr;
62 	caddr32_t	bss_end_addr;
63 	caddr32_t	entry_addr;
64 } multiboot_header_t;
65 
66 /* The section header table for ELF. */
67 typedef struct mb_elf_shtable {
68 	uint32_t num;
69 	uint32_t size;
70 	uint32_t addr;
71 	uint32_t shndx;
72 } mb_elf_shtable_t;
73 
74 /* The module structure. */
75 typedef struct mb_module {
76 	caddr32_t	mod_start;
77 	caddr32_t	mod_end;
78 	caddr32_t	mod_name;	/* use as (char *) */
79 	uint32_t	reserved;
80 } mb_module_t;
81 
82 /*
83  * Memory map data structure. Walked in a bizarre way - see mutltiboot
84  * documentation for example.
85  */
86 typedef struct mb_memory_map {
87 	uint32_t	size;
88 	uint32_t	base_addr_low;
89 	uint32_t	base_addr_high;
90 	uint32_t	length_low;
91 	uint32_t	length_high;
92 	uint32_t	type;		/* only value of 1 is RAM */
93 } mb_memory_map_t;
94 
95 
96 /*
97  * The Multiboot information. This is supplied by the multiboot loader
98  * for the OS.
99  *
100  * The flag bit fields defined what multiboot info the boot
101  * loader (see struct multiboot_info below) supplied:
102  *	flag[0]		mem_upper, mem_loader
103  *	flag[1]		boot_device
104  *	flag[2]		cmdline (for launching kernel)
105  *	flag[3]		mods_count, mods_addr
106  *	flag[4]		symbol table for a.out
107  *	flag[5]		symbol table for elf
108  *	flag[6]		mmap_length, mmap_addr
109  *	flag[7]		drives_length, drivers_addr
110  *	flag[8]		config_table
111  *	flag[9]		boot_loader_name
112  *	flag[10]	apm_table
113  *	flag[11]	vbe_control_info
114  *			vbe_mode_info
115  *			vbe_mode
116  *			vbe_interface_seg
117  *			vbe_interface_off
118  *			vbe_interface_len
119  */
120 typedef struct multiboot_info {
121 	uint32_t	flags;
122 	uint32_t	mem_lower;	/* # of pages below 1Meg */
123 	uint32_t	mem_upper;	/* # of pages above 1Meg */
124 	uint32_t	boot_device;
125 	caddr32_t	cmdline;	/* use as (char *) */
126 	uint32_t	mods_count;
127 	caddr32_t	mods_addr;	/* use as (mb_module_t *) */
128 	mb_elf_shtable_t elf_sec;
129 	uint32_t	mmap_length;
130 	caddr32_t	mmap_addr;	/* use as (mb_memory_map_t *) */
131 	uint32_t	drives_length;
132 	caddr32_t	drives_addr;
133 	caddr32_t	config_table;
134 	caddr32_t	boot_loader_name;
135 	caddr32_t	apm_table;
136 	uint32_t	vbe_control_info;
137 	uint32_t	vbe_mode_info;
138 	uint16_t	vbe_mode;
139 	uint16_t	vbe_interface_seg;
140 	uint16_t	vbe_interface_off;
141 	uint16_t	vbe_interface_len;
142 } multiboot_info_t;
143 
144 /*
145  * netinfo for Solaris diskless booting
146  * XXX - not part of multiboot spec
147  */
148 struct sol_netinfo {
149 	uint8_t sn_infotype;
150 	uint8_t sn_mactype;
151 	uint8_t sn_maclen;
152 	uint8_t sn_padding;
153 	uint32_t sn_ciaddr;
154 	uint32_t sn_siaddr;
155 	uint32_t sn_giaddr;
156 	uint32_t sn_netmask;
157 	uint8_t sn_macaddr[1];
158 };
159 
160 /* identify bootp/dhcp reply or rarp/ifconfig */
161 #define	SN_TYPE_BOOTP   2
162 #define	SN_TYPE_RARP    0xf0
163 
164 
165 #endif /* _ASM */
166 
167 
168 #ifdef	__cplusplus
169 }
170 #endif
171 
172 #endif	/* _MULTIBOOT_H */
173