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