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