1*199767f8SToomas Soome /*-
2*199767f8SToomas Soome  * Copyright (C) 1994 by Rodney W. Grimes, Milwaukie, Oregon  97222
3*199767f8SToomas Soome  * All rights reserved.
4*199767f8SToomas Soome  *
5*199767f8SToomas Soome  * Redistribution and use in source and binary forms, with or without
6*199767f8SToomas Soome  * modification, are permitted provided that the following conditions
7*199767f8SToomas Soome  * are met:
8*199767f8SToomas Soome  * 1. Redistributions of source code must retain the above copyright
9*199767f8SToomas Soome  *    notice, this list of conditions and the following disclaimer as
10*199767f8SToomas Soome  *    the first lines of this file unmodified.
11*199767f8SToomas Soome  * 2. Redistributions in binary form must reproduce the above copyright
12*199767f8SToomas Soome  *    notice, this list of conditions and the following disclaimer in the
13*199767f8SToomas Soome  *    documentation and/or other materials provided with the distribution.
14*199767f8SToomas Soome  * 3. All advertising materials mentioning features or use of this software
15*199767f8SToomas Soome  *    must display the following acknowledgement:
16*199767f8SToomas Soome  *	This product includes software developed by Rodney W. Grimes.
17*199767f8SToomas Soome  * 4. The name of the author may not be used to endorse or promote products
18*199767f8SToomas Soome  *    derived from this software without specific prior written permission.
19*199767f8SToomas Soome  *
20*199767f8SToomas Soome  * THIS SOFTWARE IS PROVIDED BY RODNEY W. GRIMES ``AS IS'' AND
21*199767f8SToomas Soome  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22*199767f8SToomas Soome  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23*199767f8SToomas Soome  * ARE DISCLAIMED.  IN NO EVENT SHALL RODNEY W. GRIMES BE LIABLE
24*199767f8SToomas Soome  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25*199767f8SToomas Soome  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26*199767f8SToomas Soome  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27*199767f8SToomas Soome  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28*199767f8SToomas Soome  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29*199767f8SToomas Soome  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30*199767f8SToomas Soome  * SUCH DAMAGE.
31*199767f8SToomas Soome  *
32*199767f8SToomas Soome  * $FreeBSD$
33*199767f8SToomas Soome  */
34*199767f8SToomas Soome 
35*199767f8SToomas Soome #ifndef	_MACHINE_BOOTINFO_H_
36*199767f8SToomas Soome #define	_MACHINE_BOOTINFO_H_
37*199767f8SToomas Soome 
38*199767f8SToomas Soome /* Only change the version number if you break compatibility. */
39*199767f8SToomas Soome #define	BOOTINFO_VERSION	1
40*199767f8SToomas Soome 
41*199767f8SToomas Soome #define	N_BIOS_GEOM		8
42*199767f8SToomas Soome 
43*199767f8SToomas Soome /*
44*199767f8SToomas Soome  * A zero bootinfo field often means that there is no info available.
45*199767f8SToomas Soome  * Flags are used to indicate the validity of fields where zero is a
46*199767f8SToomas Soome  * normal value.
47*199767f8SToomas Soome  */
48*199767f8SToomas Soome struct bootinfo {
49*199767f8SToomas Soome 	u_int32_t	bi_version;
50*199767f8SToomas Soome 	u_int32_t	bi_kernelname;		/* represents a char * */
51*199767f8SToomas Soome 	u_int32_t	bi_nfs_diskless;	/* struct nfs_diskless * */
52*199767f8SToomas Soome 				/* End of fields that are always present. */
53*199767f8SToomas Soome #define	bi_endcommon	bi_n_bios_used
54*199767f8SToomas Soome 	u_int32_t	bi_n_bios_used;
55*199767f8SToomas Soome 	u_int32_t	bi_bios_geom[N_BIOS_GEOM];
56*199767f8SToomas Soome 	u_int32_t	bi_size;
57*199767f8SToomas Soome 	u_int8_t	bi_memsizes_valid;
58*199767f8SToomas Soome 	u_int8_t	bi_bios_dev;		/* bootdev BIOS unit number */
59*199767f8SToomas Soome 	u_int8_t	bi_pad[2];
60*199767f8SToomas Soome 	u_int32_t	bi_basemem;
61*199767f8SToomas Soome 	u_int32_t	bi_extmem;
62*199767f8SToomas Soome 	u_int32_t	bi_symtab;		/* struct symtab * */
63*199767f8SToomas Soome 	u_int32_t	bi_esymtab;		/* struct symtab * */
64*199767f8SToomas Soome 				/* Items below only from advanced bootloader */
65*199767f8SToomas Soome 	u_int32_t	bi_kernend;		/* end of kernel space */
66*199767f8SToomas Soome 	u_int32_t	bi_envp;		/* environment */
67*199767f8SToomas Soome 	u_int32_t	bi_modulep;		/* preloaded modules */
68*199767f8SToomas Soome 	uint32_t	bi_memdesc_version;	/* EFI memory desc version */
69*199767f8SToomas Soome 	uint64_t	bi_memdesc_size;	/* sizeof EFI memory desc */
70*199767f8SToomas Soome 	uint64_t	bi_memmap;		/* pa of EFI memory map */
71*199767f8SToomas Soome 	uint64_t	bi_memmap_size;		/* size of EFI memory map */
72*199767f8SToomas Soome 	uint64_t	bi_hcdp;		/* DIG64 HCDP table */
73*199767f8SToomas Soome 	uint64_t	bi_fpswa;		/* FPSWA interface */
74*199767f8SToomas Soome 	uint64_t	bi_systab;		/* pa of EFI system table */
75*199767f8SToomas Soome };
76*199767f8SToomas Soome 
77*199767f8SToomas Soome #ifdef _KERNEL
78*199767f8SToomas Soome extern struct bootinfo	bootinfo;
79*199767f8SToomas Soome #endif
80*199767f8SToomas Soome 
81*199767f8SToomas Soome /*
82*199767f8SToomas Soome  * Constants for converting boot-style device number to type,
83*199767f8SToomas Soome  * adaptor (uba, mba, etc), unit number and partition number.
84*199767f8SToomas Soome  * Type (== major device number) is in the low byte
85*199767f8SToomas Soome  * for backward compatibility.  Except for that of the "magic
86*199767f8SToomas Soome  * number", each mask applies to the shifted value.
87*199767f8SToomas Soome  * Format:
88*199767f8SToomas Soome  *	 (4)   (8)   (4)  (8)     (8)
89*199767f8SToomas Soome  *	--------------------------------
90*199767f8SToomas Soome  *	|MA | SLICE | UN| PART  | TYPE |
91*199767f8SToomas Soome  *	--------------------------------
92*199767f8SToomas Soome  */
93*199767f8SToomas Soome #define B_SLICESHIFT		20
94*199767f8SToomas Soome #define B_SLICEMASK		0xff
95*199767f8SToomas Soome #define B_SLICE(val)		(((val)>>B_SLICESHIFT) & B_SLICEMASK)
96*199767f8SToomas Soome #define B_UNITSHIFT		16
97*199767f8SToomas Soome #define B_UNITMASK		0xf
98*199767f8SToomas Soome #define	B_UNIT(val)		(((val) >> B_UNITSHIFT) & B_UNITMASK)
99*199767f8SToomas Soome #define B_PARTITIONSHIFT	8
100*199767f8SToomas Soome #define B_PARTITIONMASK		0xff
101*199767f8SToomas Soome #define	B_PARTITION(val)	(((val) >> B_PARTITIONSHIFT) & B_PARTITIONMASK)
102*199767f8SToomas Soome #define	B_TYPESHIFT		0
103*199767f8SToomas Soome #define	B_TYPEMASK		0xff
104*199767f8SToomas Soome #define	B_TYPE(val)		(((val) >> B_TYPESHIFT) & B_TYPEMASK)
105*199767f8SToomas Soome 
106*199767f8SToomas Soome #define	B_MAGICMASK	0xf0000000
107*199767f8SToomas Soome #define	B_DEVMAGIC	0xa0000000
108*199767f8SToomas Soome 
109*199767f8SToomas Soome #define	MAKEBOOTDEV(type, slice, unit, partition) \
110*199767f8SToomas Soome 	(((type) << B_TYPESHIFT) | ((slice) << B_SLICESHIFT) | \
111*199767f8SToomas Soome 	((unit) << B_UNITSHIFT) | ((partition) << B_PARTITIONSHIFT) | \
112*199767f8SToomas Soome 	B_DEVMAGIC)
113*199767f8SToomas Soome 
114*199767f8SToomas Soome #define	BASE_SLICE		2
115*199767f8SToomas Soome #define	COMPATIBILITY_SLICE	0
116*199767f8SToomas Soome #define	MAX_SLICES		32
117*199767f8SToomas Soome #define	WHOLE_DISK_SLICE	1
118*199767f8SToomas Soome 
119*199767f8SToomas Soome #endif	/* !_MACHINE_BOOTINFO_H_ */
120