xref: /titanic_51/usr/src/uts/common/sys/multiboot.h (revision 791a814c934fcd4deb13b26c1f116ff283272a0d)
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 /*
102  * The Multiboot information. This is supplied by the multiboot loader
103  * for the OS.
104  *
105  * The flag bit fields defined what multiboot info the boot
106  * loader (see struct multiboot_info below) supplied:
107  *	flag[0]		mem_upper, mem_loader
108  *	flag[1]		boot_device
109  *	flag[2]		cmdline (for launching kernel)
110  *	flag[3]		mods_count, mods_addr
111  *	flag[4]		symbol table for a.out
112  *	flag[5]		symbol table for elf
113  *	flag[6]		mmap_length, mmap_addr
114  *	flag[7]		drives_length, drivers_addr
115  *	flag[8]		config_table
116  *	flag[9]		boot_loader_name
117  *	flag[10]	apm_table
118  *	flag[11]	vbe_control_info
119  *			vbe_mode_info
120  *			vbe_mode
121  *			vbe_interface_seg
122  *			vbe_interface_off
123  *			vbe_interface_len
124  */
125 typedef struct multiboot_info {
126 	uint32_t	flags;
127 	uint32_t	mem_lower;	/* # of pages below 1Meg */
128 	uint32_t	mem_upper;	/* # of pages above 1Meg */
129 	uint32_t	boot_device;
130 	caddr32_t	cmdline;	/* use as (char *) */
131 	uint32_t	mods_count;
132 	caddr32_t	mods_addr;	/* use as (mb_module_t *) */
133 	mb_elf_shtable_t elf_sec;
134 	uint32_t	mmap_length;
135 	caddr32_t	mmap_addr;	/* use as (mb_memory_map_t *) */
136 	uint32_t	drives_length;
137 	caddr32_t	drives_addr;
138 	caddr32_t	config_table;
139 	caddr32_t	boot_loader_name;
140 	caddr32_t	apm_table;
141 	uint32_t	vbe_control_info;
142 	uint32_t	vbe_mode_info;
143 	uint16_t	vbe_mode;
144 	uint16_t	vbe_interface_seg;
145 	uint16_t	vbe_interface_off;
146 	uint16_t	vbe_interface_len;
147 } multiboot_info_t;
148 
149 /*
150  * netinfo for Solaris diskless booting
151  * XXX - not part of multiboot spec
152  */
153 struct sol_netinfo {
154 	uint8_t sn_infotype;
155 	uint8_t sn_mactype;
156 	uint8_t sn_maclen;
157 	uint8_t sn_padding;
158 	uint32_t sn_ciaddr;
159 	uint32_t sn_siaddr;
160 	uint32_t sn_giaddr;
161 	uint32_t sn_netmask;
162 	uint8_t sn_macaddr[1];
163 };
164 
165 /* identify bootp/dhcp reply or rarp/ifconfig */
166 #define	SN_TYPE_BOOTP   2
167 #define	SN_TYPE_RARP    0xf0
168 
169 
170 #endif /* _ASM */
171 
172 
173 #ifdef	__cplusplus
174 }
175 #endif
176 
177 #endif	/* _MULTIBOOT_H */
178