xref: /netbsd-src/sys/arch/x86/include/bootinfo.h (revision de1dfb1250df962f1ff3a011772cf58e605aed11)
1 /*	$NetBSD: bootinfo.h,v 1.5 2004/03/24 17:06:58 drochner Exp $	*/
2 
3 /*
4  * Copyright (c) 1997
5  *	Matthias Drochner.  All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  *
27  */
28 
29 #ifndef _LOCORE
30 
31 struct btinfo_common {
32 	int len;
33 	int type;
34 };
35 
36 #define BTINFO_BOOTPATH 0
37 #define BTINFO_BOOTDISK 3
38 #define BTINFO_NETIF 4
39 #define BTINFO_CONSOLE 6
40 #define BTINFO_BIOSGEOM 7
41 #define BTINFO_SYMTAB 8
42 #define BTINFO_MEMMAP 9
43 
44 struct btinfo_bootpath {
45 	struct btinfo_common common;
46 	char bootpath[80];
47 };
48 
49 struct btinfo_bootdisk {
50 	struct btinfo_common common;
51 	int labelsector; /* label valid if != -1 */
52 	struct {
53 		u_int16_t type, checksum;
54 		char packname[16];
55 	} label;
56 	int biosdev;
57 	int partition;
58 };
59 
60 struct btinfo_netif {
61 	struct btinfo_common common;
62 	char ifname[16];
63 	int bus;
64 #define BI_BUS_ISA 0
65 #define BI_BUS_PCI 1
66 	union {
67 		unsigned int iobase; /* ISA */
68 		unsigned int tag; /* PCI, BIOS format */
69 	} addr;
70 };
71 
72 struct btinfo_console {
73 	struct btinfo_common common;
74 	char devname[16];
75 	int addr;
76 	int speed;
77 };
78 
79 struct btinfo_symtab {
80 	struct btinfo_common common;
81 	int nsym;
82 	int ssym;
83 	int esym;
84 };
85 
86 struct bi_memmap_entry {
87 	u_int64_t addr;		/* beginning of block */	/* 8 */
88 	u_int64_t size;		/* size of block */		/* 8 */
89 	u_int32_t type;		/* type of block */		/* 4 */
90 } __attribute__((packed));				/*	== 20 */
91 
92 #define	BIM_Memory	1	/* available RAM usable by OS */
93 #define	BIM_Reserved	2	/* in use or reserved by the system */
94 #define	BIM_ACPI	3	/* ACPI Reclaim memory */
95 #define	BIM_NVS		4	/* ACPI NVS memory */
96 
97 struct btinfo_memmap {
98 	struct btinfo_common common;
99 	int num;
100 	struct bi_memmap_entry entry[1]; /* var len */
101 };
102 
103 #include <sys/bootblock.h>
104 
105 /*
106  * Structure describing disk info as seen by the BIOS.
107  */
108 struct bi_biosgeom_entry {
109 	int		sec, head, cyl;		/* geometry */
110 	u_int64_t	totsec;			/* LBA sectors from ext int13 */
111 	int		flags, dev;		/* flags, BIOS device # */
112 #define BI_GEOM_INVALID		0x000001
113 #define BI_GEOM_EXTINT13	0x000002
114 #ifdef BIOSDISK_EXT13INFO_V3
115 #define BI_GEOM_BADCKSUM	0x000004	/* v3.x checksum invalid */
116 #define BI_GEOM_BUS_MASK	0x00ff00	/* connecting bus type */
117 #define BI_GEOM_BUS_ISA		0x000100
118 #define BI_GEOM_BUS_PCI		0x000200
119 #define BI_GEOM_BUS_OTHER	0x00ff00
120 #define BI_GEOM_IFACE_MASK	0xff0000	/* interface type */
121 #define BI_GEOM_IFACE_ATA	0x010000
122 #define BI_GEOM_IFACE_ATAPI	0x020000
123 #define BI_GEOM_IFACE_SCSI	0x030000
124 #define BI_GEOM_IFACE_USB	0x040000
125 #define BI_GEOM_IFACE_1394	0x050000	/* Firewire */
126 #define BI_GEOM_IFACE_FIBRE	0x060000	/* Fibre channel */
127 #define BI_GEOM_IFACE_OTHER	0xff0000
128 	unsigned int	cksum;			/* MBR checksum */
129 	u_int		interface_path;		/* ISA iobase PCI bus/dev/fun */
130 	u_int64_t	device_path;
131 	int		res0;			/* future expansion; 0 now */
132 #else
133 	unsigned int	cksum;			/* MBR checksum */
134 	int		res0, res1, res2, res3;	/* future expansion; 0 now */
135 #endif
136 	struct mbr_partition dosparts[MBR_PART_COUNT]; /* MBR itself */
137 } __attribute__((packed));
138 
139 struct btinfo_biosgeom {
140 	struct btinfo_common common;
141 	int num;
142 	struct bi_biosgeom_entry disk[1]; /* var len */
143 };
144 
145 #ifdef _KERNEL
146 void *lookup_bootinfo(int);
147 #endif
148 #endif /* _LOCORE */
149 
150 #ifdef _KERNEL
151 #define BOOTINFO_MAXSIZE 4096
152 #endif
153