xref: /freebsd/sys/i386/include/bootinfo.h (revision 197e5e73ef2943d90f1afc5317ade21513ea1bf3)
176b993fbSRodney W. Grimes /*-
276b993fbSRodney W. Grimes  * Copyright (C) 1994 by Rodney W. Grimes, Milwaukie, Oregon  97222
376b993fbSRodney W. Grimes  * All rights reserved.
476b993fbSRodney W. Grimes  *
576b993fbSRodney W. Grimes  * Redistribution and use in source and binary forms, with or without
676b993fbSRodney W. Grimes  * modification, are permitted provided that the following conditions
776b993fbSRodney W. Grimes  * are met:
876b993fbSRodney W. Grimes  * 1. Redistributions of source code must retain the above copyright
976b993fbSRodney W. Grimes  *    notice, this list of conditions and the following disclaimer as
1076b993fbSRodney W. Grimes  *    the first lines of this file unmodified.
1176b993fbSRodney W. Grimes  * 2. Redistributions in binary form must reproduce the above copyright
1276b993fbSRodney W. Grimes  *    notice, this list of conditions and the following disclaimer in the
1376b993fbSRodney W. Grimes  *    documentation and/or other materials provided with the distribution.
1476b993fbSRodney W. Grimes  * 3. All advertising materials mentioning features or use of this software
1576b993fbSRodney W. Grimes  *    must display the following acknowledgement:
1676b993fbSRodney W. Grimes  *	This product includes software developed by Rodney W. Grimes.
1776b993fbSRodney W. Grimes  * 4. The name of the author may not be used to endorse or promote products
1876b993fbSRodney W. Grimes  *    derived from this software without specific prior written permission.
1976b993fbSRodney W. Grimes  *
2076b993fbSRodney W. Grimes  * THIS SOFTWARE IS PROVIDED BY RODNEY W. GRIMES ``AS IS'' AND
2176b993fbSRodney W. Grimes  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2276b993fbSRodney W. Grimes  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2376b993fbSRodney W. Grimes  * ARE DISCLAIMED.  IN NO EVENT SHALL RODNEY W. GRIMES BE LIABLE
2476b993fbSRodney W. Grimes  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2576b993fbSRodney W. Grimes  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2676b993fbSRodney W. Grimes  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2776b993fbSRodney W. Grimes  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2876b993fbSRodney W. Grimes  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2976b993fbSRodney W. Grimes  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3076b993fbSRodney W. Grimes  * SUCH DAMAGE.
3176b993fbSRodney W. Grimes  *
32c3aac50fSPeter Wemm  * $FreeBSD$
3376b993fbSRodney W. Grimes  */
3476b993fbSRodney W. Grimes 
3576b993fbSRodney W. Grimes #ifndef	_MACHINE_BOOTINFO_H_
3676b993fbSRodney W. Grimes #define	_MACHINE_BOOTINFO_H_
3776b993fbSRodney W. Grimes 
38b5d89ca8SBruce Evans /* Only change the version number if you break compatibility. */
39b5d89ca8SBruce Evans #define	BOOTINFO_VERSION	1
40b5d89ca8SBruce Evans 
41fbc5b307SPoul-Henning Kamp #define	N_BIOS_GEOM		8
42b5d89ca8SBruce Evans 
43b5d89ca8SBruce Evans /*
44b5d89ca8SBruce Evans  * A zero bootinfo field often means that there is no info available.
45b5d89ca8SBruce Evans  * Flags are used to indicate the validity of fields where zero is a
46b5d89ca8SBruce Evans  * normal value.
47b5d89ca8SBruce Evans  */
48b5d89ca8SBruce Evans struct bootinfo {
499d508ad2SBruce Evans 	u_int32_t	bi_version;
509d508ad2SBruce Evans 	u_int32_t	bi_kernelname;		/* represents a char * */
519d508ad2SBruce Evans 	u_int32_t	bi_nfs_diskless;	/* struct nfs_diskless * */
52b5d89ca8SBruce Evans 				/* End of fields that are always present. */
53b5d89ca8SBruce Evans #define	bi_endcommon	bi_n_bios_used
549d508ad2SBruce Evans 	u_int32_t	bi_n_bios_used;
559d508ad2SBruce Evans 	u_int32_t	bi_bios_geom[N_BIOS_GEOM];
569d508ad2SBruce Evans 	u_int32_t	bi_size;
579d508ad2SBruce Evans 	u_int8_t	bi_memsizes_valid;
58c2316d3eSMike Smith 	u_int8_t	bi_bios_dev;		/* bootdev BIOS unit number */
59882ffc4bSMike Smith 	u_int8_t	bi_pad[2];
609d508ad2SBruce Evans 	u_int32_t	bi_basemem;
619d508ad2SBruce Evans 	u_int32_t	bi_extmem;
629d508ad2SBruce Evans 	u_int32_t	bi_symtab;		/* struct symtab * */
639d508ad2SBruce Evans 	u_int32_t	bi_esymtab;		/* struct symtab * */
647877a80aSMike Smith 				/* Items below only from advanced bootloader */
657877a80aSMike Smith 	u_int32_t	bi_kernend;		/* end of kernel space */
667877a80aSMike Smith 	u_int32_t	bi_envp;		/* environment */
677877a80aSMike Smith 	u_int32_t	bi_modulep;		/* preloaded modules */
6876b993fbSRodney W. Grimes };
6976b993fbSRodney W. Grimes 
70664a31e4SPeter Wemm #ifdef _KERNEL
71b5d89ca8SBruce Evans extern struct bootinfo	bootinfo;
72e0abbebfSPoul-Henning Kamp #endif
73b5d89ca8SBruce Evans 
74197e5e73SPoul-Henning Kamp /*
75197e5e73SPoul-Henning Kamp  * Constants for converting boot-style device number to type,
76197e5e73SPoul-Henning Kamp  * adaptor (uba, mba, etc), unit number and partition number.
77197e5e73SPoul-Henning Kamp  * Type (== major device number) is in the low byte
78197e5e73SPoul-Henning Kamp  * for backward compatibility.  Except for that of the "magic
79197e5e73SPoul-Henning Kamp  * number", each mask applies to the shifted value.
80197e5e73SPoul-Henning Kamp  * Format:
81197e5e73SPoul-Henning Kamp  *	 (4) (4) (4) (4)  (8)     (8)
82197e5e73SPoul-Henning Kamp  *	--------------------------------
83197e5e73SPoul-Henning Kamp  *	|MA | AD| CT| UN| PART  | TYPE |
84197e5e73SPoul-Henning Kamp  *	--------------------------------
85197e5e73SPoul-Henning Kamp  */
86197e5e73SPoul-Henning Kamp #define	B_ADAPTORSHIFT		24
87197e5e73SPoul-Henning Kamp #define	B_ADAPTORMASK		0x0f
88197e5e73SPoul-Henning Kamp #define	B_ADAPTOR(val)		(((val) >> B_ADAPTORSHIFT) & B_ADAPTORMASK)
89197e5e73SPoul-Henning Kamp #define B_CONTROLLERSHIFT	20
90197e5e73SPoul-Henning Kamp #define B_CONTROLLERMASK	0xf
91197e5e73SPoul-Henning Kamp #define	B_CONTROLLER(val)	(((val)>>B_CONTROLLERSHIFT) & B_CONTROLLERMASK)
92197e5e73SPoul-Henning Kamp #define B_SLICESHIFT		20
93197e5e73SPoul-Henning Kamp #define B_SLICEMASK		0xff
94197e5e73SPoul-Henning Kamp #define B_SLICE(val)		(((val)>>B_SLICESHIFT) & B_SLICEMASK)
95197e5e73SPoul-Henning Kamp #define B_UNITSHIFT		16
96197e5e73SPoul-Henning Kamp #define B_UNITMASK		0xf
97197e5e73SPoul-Henning Kamp #define	B_UNIT(val)		(((val) >> B_UNITSHIFT) & B_UNITMASK)
98197e5e73SPoul-Henning Kamp #define B_PARTITIONSHIFT	8
99197e5e73SPoul-Henning Kamp #define B_PARTITIONMASK		0xff
100197e5e73SPoul-Henning Kamp #define	B_PARTITION(val)	(((val) >> B_PARTITIONSHIFT) & B_PARTITIONMASK)
101197e5e73SPoul-Henning Kamp #define	B_TYPESHIFT		0
102197e5e73SPoul-Henning Kamp #define	B_TYPEMASK		0xff
103197e5e73SPoul-Henning Kamp #define	B_TYPE(val)		(((val) >> B_TYPESHIFT) & B_TYPEMASK)
104197e5e73SPoul-Henning Kamp 
105197e5e73SPoul-Henning Kamp #define	B_MAGICMASK	0xf0000000
106197e5e73SPoul-Henning Kamp #define	B_DEVMAGIC	0xa0000000
107197e5e73SPoul-Henning Kamp 
108197e5e73SPoul-Henning Kamp #define MAKEBOOTDEV(type, adaptor, controller, unit, partition) \
109197e5e73SPoul-Henning Kamp 	(((type) << B_TYPESHIFT) | ((adaptor) << B_ADAPTORSHIFT) | \
110197e5e73SPoul-Henning Kamp 	((controller) << B_CONTROLLERSHIFT) | ((unit) << B_UNITSHIFT) | \
111197e5e73SPoul-Henning Kamp 	((partition) << B_PARTITIONSHIFT) | B_DEVMAGIC)
112197e5e73SPoul-Henning Kamp 
113197e5e73SPoul-Henning Kamp #define	BASE_SLICE		2
114197e5e73SPoul-Henning Kamp #define	COMPATIBILITY_SLICE	0
115197e5e73SPoul-Henning Kamp #define	MAX_SLICES		32
116197e5e73SPoul-Henning Kamp #define	WHOLE_DISK_SLICE	1
117197e5e73SPoul-Henning Kamp 
118b5d89ca8SBruce Evans #endif	/* !_MACHINE_BOOTINFO_H_ */
119