root / lab4 / .minix-src / include / x86 / bootinfo.h @ 14
History | View | Annotate | Download (6.11 KB)
1 |
/* $NetBSD: bootinfo.h,v 1.23 2013/08/30 16:42:17 jmcneill 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 |
#define BTINFO_BOOTPATH 0 |
30 |
#define BTINFO_ROOTDEVICE 1 |
31 |
#define BTINFO_BOOTDISK 3 |
32 |
#define BTINFO_NETIF 4 |
33 |
#define BTINFO_CONSOLE 6 |
34 |
#define BTINFO_BIOSGEOM 7 |
35 |
#define BTINFO_SYMTAB 8 |
36 |
#define BTINFO_MEMMAP 9 |
37 |
#define BTINFO_BOOTWEDGE 10 |
38 |
#define BTINFO_MODULELIST 11 |
39 |
#define BTINFO_FRAMEBUFFER 12 |
40 |
#define BTINFO_USERCONFCOMMANDS 13 |
41 |
|
42 |
#ifndef _LOCORE
|
43 |
|
44 |
struct btinfo_common {
|
45 |
int len;
|
46 |
int type;
|
47 |
}; |
48 |
|
49 |
struct btinfo_bootpath {
|
50 |
struct btinfo_common common;
|
51 |
char bootpath[80]; |
52 |
}; |
53 |
|
54 |
struct btinfo_rootdevice {
|
55 |
struct btinfo_common common;
|
56 |
char devname[16]; |
57 |
}; |
58 |
|
59 |
struct btinfo_bootdisk {
|
60 |
struct btinfo_common common;
|
61 |
int labelsector; /* label valid if != -1 */ |
62 |
struct {
|
63 |
uint16_t type, checksum; |
64 |
char packname[16]; |
65 |
} label; |
66 |
int biosdev;
|
67 |
int partition;
|
68 |
}; |
69 |
|
70 |
struct btinfo_bootwedge {
|
71 |
struct btinfo_common common;
|
72 |
int biosdev;
|
73 |
daddr_t startblk; |
74 |
uint64_t nblks; |
75 |
daddr_t matchblk; |
76 |
uint64_t matchnblks; |
77 |
uint8_t matchhash[16]; /* MD5 hash */ |
78 |
} __packed; |
79 |
|
80 |
struct btinfo_netif {
|
81 |
struct btinfo_common common;
|
82 |
char ifname[16]; |
83 |
int bus;
|
84 |
#define BI_BUS_ISA 0 |
85 |
#define BI_BUS_PCI 1 |
86 |
union {
|
87 |
unsigned int iobase; /* ISA */ |
88 |
unsigned int tag; /* PCI, BIOS format */ |
89 |
} addr; |
90 |
}; |
91 |
|
92 |
struct btinfo_console {
|
93 |
struct btinfo_common common;
|
94 |
char devname[16]; |
95 |
int addr;
|
96 |
int speed;
|
97 |
}; |
98 |
|
99 |
struct btinfo_symtab {
|
100 |
struct btinfo_common common;
|
101 |
int nsym;
|
102 |
int ssym;
|
103 |
int esym;
|
104 |
}; |
105 |
|
106 |
struct bi_memmap_entry {
|
107 |
uint64_t addr; /* beginning of block */ /* 8 */ |
108 |
uint64_t size; /* size of block */ /* 8 */ |
109 |
uint32_t type; /* type of block */ /* 4 */ |
110 |
} __packed; /* == 20 */
|
111 |
|
112 |
#define BIM_Memory 1 /* available RAM usable by OS */ |
113 |
#define BIM_Reserved 2 /* in use or reserved by the system */ |
114 |
#define BIM_ACPI 3 /* ACPI Reclaim memory */ |
115 |
#define BIM_NVS 4 /* ACPI NVS memory */ |
116 |
|
117 |
struct btinfo_memmap {
|
118 |
struct btinfo_common common;
|
119 |
int num;
|
120 |
struct bi_memmap_entry entry[1]; /* var len */ |
121 |
}; |
122 |
|
123 |
#if HAVE_NBTOOL_CONFIG_H
|
124 |
#include <nbinclude/sys/bootblock.h> |
125 |
#else
|
126 |
#include <sys/bootblock.h> |
127 |
#endif /* HAVE_NBTOOL_CONFIG_H */ |
128 |
|
129 |
/*
|
130 |
* Structure describing disk info as seen by the BIOS.
|
131 |
*/
|
132 |
struct bi_biosgeom_entry {
|
133 |
int sec, head, cyl; /* geometry */ |
134 |
uint64_t totsec; /* LBA sectors from ext int13 */
|
135 |
int flags, dev; /* flags, BIOS device # */ |
136 |
#define BI_GEOM_INVALID 0x000001 |
137 |
#define BI_GEOM_EXTINT13 0x000002 |
138 |
#ifdef BIOSDISK_EXTINFO_V3
|
139 |
#define BI_GEOM_BADCKSUM 0x000004 /* v3.x checksum invalid */ |
140 |
#define BI_GEOM_BUS_MASK 0x00ff00 /* connecting bus type */ |
141 |
#define BI_GEOM_BUS_ISA 0x000100 |
142 |
#define BI_GEOM_BUS_PCI 0x000200 |
143 |
#define BI_GEOM_BUS_OTHER 0x00ff00 |
144 |
#define BI_GEOM_IFACE_MASK 0xff0000 /* interface type */ |
145 |
#define BI_GEOM_IFACE_ATA 0x010000 |
146 |
#define BI_GEOM_IFACE_ATAPI 0x020000 |
147 |
#define BI_GEOM_IFACE_SCSI 0x030000 |
148 |
#define BI_GEOM_IFACE_USB 0x040000 |
149 |
#define BI_GEOM_IFACE_1394 0x050000 /* Firewire */ |
150 |
#define BI_GEOM_IFACE_FIBRE 0x060000 /* Fibre channel */ |
151 |
#define BI_GEOM_IFACE_OTHER 0xff0000 |
152 |
unsigned int cksum; /* MBR checksum */ |
153 |
unsigned int interface_path; /* ISA iobase PCI bus/dev/fun */ |
154 |
uint64_t device_path; |
155 |
int res0; /* future expansion; 0 now */ |
156 |
#else
|
157 |
unsigned int cksum; /* MBR checksum */ |
158 |
int res0, res1, res2, res3; /* future expansion; 0 now */ |
159 |
#endif
|
160 |
struct mbr_partition mbrparts[MBR_PART_COUNT]; /* MBR itself */ |
161 |
} __packed; |
162 |
|
163 |
struct btinfo_biosgeom {
|
164 |
struct btinfo_common common;
|
165 |
int num;
|
166 |
struct bi_biosgeom_entry disk[1]; /* var len */ |
167 |
}; |
168 |
|
169 |
struct bi_modulelist_entry {
|
170 |
char path[80]; |
171 |
int type;
|
172 |
int len;
|
173 |
uint32_t base; |
174 |
}; |
175 |
#define BI_MODULE_NONE 0x00 |
176 |
#define BI_MODULE_ELF 0x01 |
177 |
#define BI_MODULE_IMAGE 0x02 |
178 |
#define BI_MODULE_RND 0x03 |
179 |
#define BI_MODULE_FS 0x04 |
180 |
|
181 |
struct btinfo_modulelist {
|
182 |
struct btinfo_common common;
|
183 |
int num;
|
184 |
uint32_t endpa; |
185 |
/* bi_modulelist_entry list follows */
|
186 |
}; |
187 |
|
188 |
struct btinfo_framebuffer {
|
189 |
struct btinfo_common common;
|
190 |
uint64_t physaddr; |
191 |
uint32_t flags; |
192 |
uint32_t width; |
193 |
uint32_t height; |
194 |
uint16_t stride; |
195 |
uint8_t depth; |
196 |
uint8_t rnum; |
197 |
uint8_t gnum; |
198 |
uint8_t bnum; |
199 |
uint8_t rpos; |
200 |
uint8_t gpos; |
201 |
uint8_t bpos; |
202 |
uint16_t vbemode; |
203 |
uint8_t reserved[14];
|
204 |
}; |
205 |
|
206 |
struct bi_userconfcommand {
|
207 |
char text[80]; |
208 |
}; |
209 |
|
210 |
struct btinfo_userconfcommands {
|
211 |
struct btinfo_common common;
|
212 |
int num;
|
213 |
/* bi_userconfcommand list follows */
|
214 |
}; |
215 |
|
216 |
#endif /* _LOCORE */ |
217 |
|
218 |
#ifdef _KERNEL
|
219 |
|
220 |
#define BOOTINFO_MAXSIZE 4096 |
221 |
|
222 |
#ifndef _LOCORE
|
223 |
/*
|
224 |
* Structure that holds the information passed by the boot loader.
|
225 |
*/
|
226 |
struct bootinfo {
|
227 |
/* Number of bootinfo_* entries in bi_data. */
|
228 |
uint32_t bi_nentries; |
229 |
|
230 |
/* Raw data of bootinfo entries. The first one (if any) is
|
231 |
* found at bi_data[0] and can be casted to (bootinfo_common *).
|
232 |
* Once this is done, the following entry is found at 'len'
|
233 |
* offset as specified by the previous entry. */
|
234 |
uint8_t bi_data[BOOTINFO_MAXSIZE - sizeof(uint32_t)];
|
235 |
}; |
236 |
|
237 |
extern struct bootinfo bootinfo; |
238 |
|
239 |
void *lookup_bootinfo(int); |
240 |
#endif /* _LOCORE */ |
241 |
|
242 |
#endif /* _KERNEL */ |