xref: /onnv-gate/usr/src/uts/common/sys/multiboot.h (revision 10525:c8fd4dff34d8)
13446Smrj /*
23446Smrj  * CDDL HEADER START
33446Smrj  *
43446Smrj  * The contents of this file are subject to the terms of the
53446Smrj  * Common Development and Distribution License (the "License").
63446Smrj  * You may not use this file except in compliance with the License.
73446Smrj  *
83446Smrj  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
93446Smrj  * or http://www.opensolaris.org/os/licensing.
103446Smrj  * See the License for the specific language governing permissions
113446Smrj  * and limitations under the License.
123446Smrj  *
133446Smrj  * When distributing Covered Code, include this CDDL HEADER in each
143446Smrj  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
153446Smrj  * If applicable, add the following below this CDDL HEADER, with the
163446Smrj  * fields enclosed by brackets "[]" replaced with your own identifying
173446Smrj  * information: Portions Copyright [yyyy] [name of copyright owner]
183446Smrj  *
193446Smrj  * CDDL HEADER END
203446Smrj  */
213446Smrj 
223446Smrj /*
239937SMark.Johnson@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
243446Smrj  * Use is subject to license terms.
253446Smrj  */
263446Smrj 
273446Smrj #ifndef	_MULTIBOOT_H
283446Smrj #define	_MULTIBOOT_H
293446Smrj 
303446Smrj #ifdef	__cplusplus
313446Smrj extern "C" {
323446Smrj #endif
333446Smrj 
343446Smrj /*
353446Smrj  * Definitions of structures/data for using a multiboot compliant OS loader.
363446Smrj  */
373446Smrj #define	MB_HEADER_MAGIC		 0x1BADB002	/* magic */
3810304SSeth.Goldberg@Sun.COM 
3910304SSeth.Goldberg@Sun.COM /* The 32-bit kernel does not require the use of the AOUT kludge */
4010304SSeth.Goldberg@Sun.COM #define	MB_HEADER_FLAGS_32	 0x00000003	/* flags we use */
4110304SSeth.Goldberg@Sun.COM #define	MB_HEADER_CHECKSUM_32	-0x1BADB005	/* -(magic + flag) */
4210304SSeth.Goldberg@Sun.COM 
4310304SSeth.Goldberg@Sun.COM #define	MB_HEADER_FLAGS_64	 0x00010003	/* flags we use */
4410304SSeth.Goldberg@Sun.COM #define	MB_HEADER_CHECKSUM_64	-0x1BAEB005	/* -(magic + flag) */
453446Smrj 
463446Smrj /*
473446Smrj  * passed by boot loader to kernel
483446Smrj  */
493446Smrj #define	MB_BOOTLOADER_MAGIC	0x2BADB002
503446Smrj 
513446Smrj #ifndef _ASM		/* excluded from assembly routines */
523446Smrj 
533446Smrj #include <sys/types.h>
543446Smrj #include <sys/types32.h>
553446Smrj 
563446Smrj /*
573446Smrj  * The Multiboot header must be somewhere in the 1st 8K of the image that
583446Smrj  * the loader loads into memory.
593446Smrj  */
603446Smrj typedef struct multiboot_header {
613446Smrj 	uint32_t	magic;
623446Smrj 	uint32_t	flags;
633446Smrj 	uint32_t	checksum;
643446Smrj 	caddr32_t	header_addr;	/* use as (mutliboot_header_t *) */
653446Smrj 	caddr32_t	load_addr;
663446Smrj 	caddr32_t	load_end_addr;
673446Smrj 	caddr32_t	bss_end_addr;
683446Smrj 	caddr32_t	entry_addr;
693446Smrj } multiboot_header_t;
703446Smrj 
713446Smrj /* The section header table for ELF. */
723446Smrj typedef struct mb_elf_shtable {
733446Smrj 	uint32_t num;
743446Smrj 	uint32_t size;
753446Smrj 	uint32_t addr;
763446Smrj 	uint32_t shndx;
773446Smrj } mb_elf_shtable_t;
783446Smrj 
793446Smrj /* The module structure. */
803446Smrj typedef struct mb_module {
813446Smrj 	caddr32_t	mod_start;
823446Smrj 	caddr32_t	mod_end;
833446Smrj 	caddr32_t	mod_name;	/* use as (char *) */
843446Smrj 	uint32_t	reserved;
853446Smrj } mb_module_t;
863446Smrj 
873446Smrj /*
883446Smrj  * Memory map data structure. Walked in a bizarre way - see mutltiboot
893446Smrj  * documentation for example.
903446Smrj  */
913446Smrj typedef struct mb_memory_map {
923446Smrj 	uint32_t	size;
933446Smrj 	uint32_t	base_addr_low;
943446Smrj 	uint32_t	base_addr_high;
953446Smrj 	uint32_t	length_low;
963446Smrj 	uint32_t	length_high;
973446Smrj 	uint32_t	type;		/* only value of 1 is RAM */
983446Smrj } mb_memory_map_t;
993446Smrj 
1003446Smrj 
101*10525SKonstantin.Ananyev@Sun.COM /* Drive Info structure.  */
102*10525SKonstantin.Ananyev@Sun.COM typedef struct mb_drive_info {
103*10525SKonstantin.Ananyev@Sun.COM 	uint32_t	size;		/* The size of this structure */
104*10525SKonstantin.Ananyev@Sun.COM 	uint8_t		drive_number;	/* The BIOS drive number */
105*10525SKonstantin.Ananyev@Sun.COM 	uint8_t		drive_mode;	/* The access mode (see below) */
106*10525SKonstantin.Ananyev@Sun.COM 	uint16_t	drive_cylinders;	/* The BIOS geometry */
107*10525SKonstantin.Ananyev@Sun.COM 	uint8_t		drive_heads;
108*10525SKonstantin.Ananyev@Sun.COM 	uint8_t		drive_sectors;
109*10525SKonstantin.Ananyev@Sun.COM 	/* The array of I/O ports used for the drive.  */
110*10525SKonstantin.Ananyev@Sun.COM 	uint16_t	drive_ports[1];
111*10525SKonstantin.Ananyev@Sun.COM } mb_drive_info_t;
112*10525SKonstantin.Ananyev@Sun.COM 
113*10525SKonstantin.Ananyev@Sun.COM /* Drive Mode.  */
114*10525SKonstantin.Ananyev@Sun.COM #define	MB_DI_CHS_MODE		0
115*10525SKonstantin.Ananyev@Sun.COM #define	MB_DI_LBA_MODE		1
116*10525SKonstantin.Ananyev@Sun.COM 
117*10525SKonstantin.Ananyev@Sun.COM 
1183446Smrj /*
1193446Smrj  * The Multiboot information. This is supplied by the multiboot loader
1203446Smrj  * for the OS.
1213446Smrj  *
1223446Smrj  * The flag bit fields defined what multiboot info the boot
1233446Smrj  * loader (see struct multiboot_info below) supplied:
1243446Smrj  */
125*10525SKonstantin.Ananyev@Sun.COM /* flag[0]	mem_upper, mem_loader */
126*10525SKonstantin.Ananyev@Sun.COM #define	MB_INFO_MEMORY			0x00000001
127*10525SKonstantin.Ananyev@Sun.COM /* flag[1]	boot_device */
128*10525SKonstantin.Ananyev@Sun.COM #define	MB_INFO_BOOTDEV			0x00000002
129*10525SKonstantin.Ananyev@Sun.COM /* flag[2]	cmdline (for launching kernel) */
130*10525SKonstantin.Ananyev@Sun.COM #define	MB_INFO_CMDLINE			0x00000004
131*10525SKonstantin.Ananyev@Sun.COM /* flag[3]	mods_count, mods_addr */
132*10525SKonstantin.Ananyev@Sun.COM #define	MB_INFO_MODS			0x00000008
133*10525SKonstantin.Ananyev@Sun.COM /* flag[4]	symbol table for a.out */
134*10525SKonstantin.Ananyev@Sun.COM #define	MB_INFO_AOUT_SYMS		0x00000010
135*10525SKonstantin.Ananyev@Sun.COM /* flag[5]	symbol table for elf */
136*10525SKonstantin.Ananyev@Sun.COM #define	MB_INFO_ELF_SHDR		0x00000020
137*10525SKonstantin.Ananyev@Sun.COM /* flag[6]	mmap_length, mmap_addr */
138*10525SKonstantin.Ananyev@Sun.COM #define	MB_INFO_MEM_MAP			0x00000040
139*10525SKonstantin.Ananyev@Sun.COM /* flag[7]	drives_length, drivers_addr */
140*10525SKonstantin.Ananyev@Sun.COM #define	MB_INFO_DRIVE_INFO		0x00000080
141*10525SKonstantin.Ananyev@Sun.COM /* flag[8]	config_table */
142*10525SKonstantin.Ananyev@Sun.COM #define	MB_INFO_CONFIG_TABLE		0x00000100
143*10525SKonstantin.Ananyev@Sun.COM /* flag[9]	boot_loader_name */
144*10525SKonstantin.Ananyev@Sun.COM #define	MB_INFO_BOOT_LOADER_NAME	0x00000200
145*10525SKonstantin.Ananyev@Sun.COM /* flag[10]	apm_table */
146*10525SKonstantin.Ananyev@Sun.COM #define	MB_INFO_APM_TABLE		0x00000400
147*10525SKonstantin.Ananyev@Sun.COM /*
148*10525SKonstantin.Ananyev@Sun.COM  * flag[11]	vbe_control_info
149*10525SKonstantin.Ananyev@Sun.COM  *		vbe_mode_info
150*10525SKonstantin.Ananyev@Sun.COM  *		vbe_mode
151*10525SKonstantin.Ananyev@Sun.COM  *		vbe_interface_seg
152*10525SKonstantin.Ananyev@Sun.COM  *		vbe_interface_off
153*10525SKonstantin.Ananyev@Sun.COM  *		vbe_interface_len
154*10525SKonstantin.Ananyev@Sun.COM  */
155*10525SKonstantin.Ananyev@Sun.COM #define	MB_INFO_VIDEO_INFO		0x00000800
156*10525SKonstantin.Ananyev@Sun.COM 
1573446Smrj typedef struct multiboot_info {
1583446Smrj 	uint32_t	flags;
1593446Smrj 	uint32_t	mem_lower;	/* # of pages below 1Meg */
1603446Smrj 	uint32_t	mem_upper;	/* # of pages above 1Meg */
1613446Smrj 	uint32_t	boot_device;
1623446Smrj 	caddr32_t	cmdline;	/* use as (char *) */
1633446Smrj 	uint32_t	mods_count;
1643446Smrj 	caddr32_t	mods_addr;	/* use as (mb_module_t *) */
1653446Smrj 	mb_elf_shtable_t elf_sec;
1663446Smrj 	uint32_t	mmap_length;
1673446Smrj 	caddr32_t	mmap_addr;	/* use as (mb_memory_map_t *) */
1683446Smrj 	uint32_t	drives_length;
1693446Smrj 	caddr32_t	drives_addr;
1703446Smrj 	caddr32_t	config_table;
1713446Smrj 	caddr32_t	boot_loader_name;
1723446Smrj 	caddr32_t	apm_table;
1733446Smrj 	uint32_t	vbe_control_info;
1743446Smrj 	uint32_t	vbe_mode_info;
1753446Smrj 	uint16_t	vbe_mode;
1763446Smrj 	uint16_t	vbe_interface_seg;
1773446Smrj 	uint16_t	vbe_interface_off;
1783446Smrj 	uint16_t	vbe_interface_len;
1793446Smrj } multiboot_info_t;
1803446Smrj 
1813446Smrj /*
1823446Smrj  * netinfo for Solaris diskless booting
1833446Smrj  * XXX - not part of multiboot spec
1843446Smrj  */
1853446Smrj struct sol_netinfo {
1863446Smrj 	uint8_t sn_infotype;
1873446Smrj 	uint8_t sn_mactype;
1883446Smrj 	uint8_t sn_maclen;
1893446Smrj 	uint8_t sn_padding;
1909937SMark.Johnson@Sun.COM 	uint32_t sn_ciaddr;
1919937SMark.Johnson@Sun.COM 	uint32_t sn_siaddr;
1929937SMark.Johnson@Sun.COM 	uint32_t sn_giaddr;
1939937SMark.Johnson@Sun.COM 	uint32_t sn_netmask;
1943446Smrj 	uint8_t sn_macaddr[1];
1953446Smrj };
1963446Smrj 
1973446Smrj /* identify bootp/dhcp reply or rarp/ifconfig */
1983446Smrj #define	SN_TYPE_BOOTP   2
1993446Smrj #define	SN_TYPE_RARP    0xf0
2003446Smrj 
2013446Smrj 
2023446Smrj #endif /* _ASM */
2033446Smrj 
2043446Smrj 
2053446Smrj #ifdef	__cplusplus
2063446Smrj }
2073446Smrj #endif
2083446Smrj 
2093446Smrj #endif	/* _MULTIBOOT_H */
210