xref: /titanic_50/usr/src/uts/common/sys/multiboot.h (revision ae115bc77f6fcde83175c75b4206dc2e50747966)
1*ae115bc7Smrj /*
2*ae115bc7Smrj  * CDDL HEADER START
3*ae115bc7Smrj  *
4*ae115bc7Smrj  * The contents of this file are subject to the terms of the
5*ae115bc7Smrj  * Common Development and Distribution License (the "License").
6*ae115bc7Smrj  * You may not use this file except in compliance with the License.
7*ae115bc7Smrj  *
8*ae115bc7Smrj  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*ae115bc7Smrj  * or http://www.opensolaris.org/os/licensing.
10*ae115bc7Smrj  * See the License for the specific language governing permissions
11*ae115bc7Smrj  * and limitations under the License.
12*ae115bc7Smrj  *
13*ae115bc7Smrj  * When distributing Covered Code, include this CDDL HEADER in each
14*ae115bc7Smrj  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*ae115bc7Smrj  * If applicable, add the following below this CDDL HEADER, with the
16*ae115bc7Smrj  * fields enclosed by brackets "[]" replaced with your own identifying
17*ae115bc7Smrj  * information: Portions Copyright [yyyy] [name of copyright owner]
18*ae115bc7Smrj  *
19*ae115bc7Smrj  * CDDL HEADER END
20*ae115bc7Smrj  */
21*ae115bc7Smrj 
22*ae115bc7Smrj /*
23*ae115bc7Smrj  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
24*ae115bc7Smrj  * Use is subject to license terms.
25*ae115bc7Smrj  */
26*ae115bc7Smrj 
27*ae115bc7Smrj #ifndef	_MULTIBOOT_H
28*ae115bc7Smrj #define	_MULTIBOOT_H
29*ae115bc7Smrj 
30*ae115bc7Smrj #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*ae115bc7Smrj 
32*ae115bc7Smrj #ifdef	__cplusplus
33*ae115bc7Smrj extern "C" {
34*ae115bc7Smrj #endif
35*ae115bc7Smrj 
36*ae115bc7Smrj /*
37*ae115bc7Smrj  * Definitions of structures/data for using a multiboot compliant OS loader.
38*ae115bc7Smrj  */
39*ae115bc7Smrj #define	MB_HEADER_MAGIC		 0x1BADB002	/* magic */
40*ae115bc7Smrj #define	MB_HEADER_FLAGS		 0x00010003	/* flags we use */
41*ae115bc7Smrj #define	MB_HEADER_CHECKSUM	-0x1BAEB005	/* -(magic + flag) */
42*ae115bc7Smrj 
43*ae115bc7Smrj /*
44*ae115bc7Smrj  * passed by boot loader to kernel
45*ae115bc7Smrj  */
46*ae115bc7Smrj #define	MB_BOOTLOADER_MAGIC	0x2BADB002
47*ae115bc7Smrj 
48*ae115bc7Smrj #ifndef _ASM		/* excluded from assembly routines */
49*ae115bc7Smrj 
50*ae115bc7Smrj #include <sys/types.h>
51*ae115bc7Smrj #include <sys/types32.h>
52*ae115bc7Smrj 
53*ae115bc7Smrj /*
54*ae115bc7Smrj  * The Multiboot header must be somewhere in the 1st 8K of the image that
55*ae115bc7Smrj  * the loader loads into memory.
56*ae115bc7Smrj  */
57*ae115bc7Smrj typedef struct multiboot_header {
58*ae115bc7Smrj 	uint32_t	magic;
59*ae115bc7Smrj 	uint32_t	flags;
60*ae115bc7Smrj 	uint32_t	checksum;
61*ae115bc7Smrj 	caddr32_t	header_addr;	/* use as (mutliboot_header_t *) */
62*ae115bc7Smrj 	caddr32_t	load_addr;
63*ae115bc7Smrj 	caddr32_t	load_end_addr;
64*ae115bc7Smrj 	caddr32_t	bss_end_addr;
65*ae115bc7Smrj 	caddr32_t	entry_addr;
66*ae115bc7Smrj } multiboot_header_t;
67*ae115bc7Smrj 
68*ae115bc7Smrj /* The section header table for ELF. */
69*ae115bc7Smrj typedef struct mb_elf_shtable {
70*ae115bc7Smrj 	uint32_t num;
71*ae115bc7Smrj 	uint32_t size;
72*ae115bc7Smrj 	uint32_t addr;
73*ae115bc7Smrj 	uint32_t shndx;
74*ae115bc7Smrj } mb_elf_shtable_t;
75*ae115bc7Smrj 
76*ae115bc7Smrj /* The module structure. */
77*ae115bc7Smrj typedef struct mb_module {
78*ae115bc7Smrj 	caddr32_t	mod_start;
79*ae115bc7Smrj 	caddr32_t	mod_end;
80*ae115bc7Smrj 	caddr32_t	mod_name;	/* use as (char *) */
81*ae115bc7Smrj 	uint32_t	reserved;
82*ae115bc7Smrj } mb_module_t;
83*ae115bc7Smrj 
84*ae115bc7Smrj /*
85*ae115bc7Smrj  * Memory map data structure. Walked in a bizarre way - see mutltiboot
86*ae115bc7Smrj  * documentation for example.
87*ae115bc7Smrj  */
88*ae115bc7Smrj typedef struct mb_memory_map {
89*ae115bc7Smrj 	uint32_t	size;
90*ae115bc7Smrj 	uint32_t	base_addr_low;
91*ae115bc7Smrj 	uint32_t	base_addr_high;
92*ae115bc7Smrj 	uint32_t	length_low;
93*ae115bc7Smrj 	uint32_t	length_high;
94*ae115bc7Smrj 	uint32_t	type;		/* only value of 1 is RAM */
95*ae115bc7Smrj } mb_memory_map_t;
96*ae115bc7Smrj 
97*ae115bc7Smrj 
98*ae115bc7Smrj /*
99*ae115bc7Smrj  * The Multiboot information. This is supplied by the multiboot loader
100*ae115bc7Smrj  * for the OS.
101*ae115bc7Smrj  *
102*ae115bc7Smrj  * The flag bit fields defined what multiboot info the boot
103*ae115bc7Smrj  * loader (see struct multiboot_info below) supplied:
104*ae115bc7Smrj  *	flag[0]		mem_upper, mem_loader
105*ae115bc7Smrj  *	flag[1]		boot_device
106*ae115bc7Smrj  *	flag[2]		cmdline (for launching kernel)
107*ae115bc7Smrj  *	flag[3]		mods_count, mods_addr
108*ae115bc7Smrj  *	flag[4]		symbol table for a.out
109*ae115bc7Smrj  *	flag[5]		symbol table for elf
110*ae115bc7Smrj  *	flag[6]		mmap_length, mmap_addr
111*ae115bc7Smrj  *	flag[7]		drives_length, drivers_addr
112*ae115bc7Smrj  *	flag[8]		config_table
113*ae115bc7Smrj  *	flag[9]		boot_loader_name
114*ae115bc7Smrj  *	flag[10]	apm_table
115*ae115bc7Smrj  *	flag[11]	vbe_control_info
116*ae115bc7Smrj  *			vbe_mode_info
117*ae115bc7Smrj  *			vbe_mode
118*ae115bc7Smrj  *			vbe_interface_seg
119*ae115bc7Smrj  *			vbe_interface_off
120*ae115bc7Smrj  *			vbe_interface_len
121*ae115bc7Smrj  */
122*ae115bc7Smrj typedef struct multiboot_info {
123*ae115bc7Smrj 	uint32_t	flags;
124*ae115bc7Smrj 	uint32_t	mem_lower;	/* # of pages below 1Meg */
125*ae115bc7Smrj 	uint32_t	mem_upper;	/* # of pages above 1Meg */
126*ae115bc7Smrj 	uint32_t	boot_device;
127*ae115bc7Smrj 	caddr32_t	cmdline;	/* use as (char *) */
128*ae115bc7Smrj 	uint32_t	mods_count;
129*ae115bc7Smrj 	caddr32_t	mods_addr;	/* use as (mb_module_t *) */
130*ae115bc7Smrj 	mb_elf_shtable_t elf_sec;
131*ae115bc7Smrj 	uint32_t	mmap_length;
132*ae115bc7Smrj 	caddr32_t	mmap_addr;	/* use as (mb_memory_map_t *) */
133*ae115bc7Smrj 	uint32_t	drives_length;
134*ae115bc7Smrj 	caddr32_t	drives_addr;
135*ae115bc7Smrj 	caddr32_t	config_table;
136*ae115bc7Smrj 	caddr32_t	boot_loader_name;
137*ae115bc7Smrj 	caddr32_t	apm_table;
138*ae115bc7Smrj 	uint32_t	vbe_control_info;
139*ae115bc7Smrj 	uint32_t	vbe_mode_info;
140*ae115bc7Smrj 	uint16_t	vbe_mode;
141*ae115bc7Smrj 	uint16_t	vbe_interface_seg;
142*ae115bc7Smrj 	uint16_t	vbe_interface_off;
143*ae115bc7Smrj 	uint16_t	vbe_interface_len;
144*ae115bc7Smrj } multiboot_info_t;
145*ae115bc7Smrj 
146*ae115bc7Smrj /*
147*ae115bc7Smrj  * netinfo for Solaris diskless booting
148*ae115bc7Smrj  * XXX - not part of multiboot spec
149*ae115bc7Smrj  */
150*ae115bc7Smrj struct sol_netinfo {
151*ae115bc7Smrj 	uint8_t sn_infotype;
152*ae115bc7Smrj 	uint8_t sn_mactype;
153*ae115bc7Smrj 	uint8_t sn_maclen;
154*ae115bc7Smrj 	uint8_t sn_padding;
155*ae115bc7Smrj 	ulong_t sn_ciaddr;
156*ae115bc7Smrj 	ulong_t sn_siaddr;
157*ae115bc7Smrj 	ulong_t sn_giaddr;
158*ae115bc7Smrj 	ulong_t sn_netmask;
159*ae115bc7Smrj 	uint8_t sn_macaddr[1];
160*ae115bc7Smrj };
161*ae115bc7Smrj 
162*ae115bc7Smrj /* identify bootp/dhcp reply or rarp/ifconfig */
163*ae115bc7Smrj #define	SN_TYPE_BOOTP   2
164*ae115bc7Smrj #define	SN_TYPE_RARP    0xf0
165*ae115bc7Smrj 
166*ae115bc7Smrj 
167*ae115bc7Smrj #endif /* _ASM */
168*ae115bc7Smrj 
169*ae115bc7Smrj 
170*ae115bc7Smrj #ifdef	__cplusplus
171*ae115bc7Smrj }
172*ae115bc7Smrj #endif
173*ae115bc7Smrj 
174*ae115bc7Smrj #endif	/* _MULTIBOOT_H */
175