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