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