bootinfo.h revision 1.1 1 1.1 fvdl /* $NetBSD: bootinfo.h,v 1.1 2003/02/26 21:26:10 fvdl Exp $ */
2 1.1 fvdl
3 1.1 fvdl /*
4 1.1 fvdl * Copyright (c) 1997
5 1.1 fvdl * Matthias Drochner. All rights reserved.
6 1.1 fvdl *
7 1.1 fvdl * Redistribution and use in source and binary forms, with or without
8 1.1 fvdl * modification, are permitted provided that the following conditions
9 1.1 fvdl * are met:
10 1.1 fvdl * 1. Redistributions of source code must retain the above copyright
11 1.1 fvdl * notice, this list of conditions and the following disclaimer.
12 1.1 fvdl * 2. Redistributions in binary form must reproduce the above copyright
13 1.1 fvdl * notice, this list of conditions and the following disclaimer in the
14 1.1 fvdl * documentation and/or other materials provided with the distribution.
15 1.1 fvdl * 3. All advertising materials mentioning features or use of this software
16 1.1 fvdl * must display the following acknowledgement:
17 1.1 fvdl * This product includes software developed for the NetBSD Project
18 1.1 fvdl * by Matthias Drochner.
19 1.1 fvdl * 4. The name of the author may not be used to endorse or promote products
20 1.1 fvdl * derived from this software without specific prior written permission.
21 1.1 fvdl *
22 1.1 fvdl * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23 1.1 fvdl * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 1.1 fvdl * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 1.1 fvdl * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26 1.1 fvdl * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27 1.1 fvdl * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 1.1 fvdl * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 1.1 fvdl * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 1.1 fvdl * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31 1.1 fvdl * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 1.1 fvdl *
33 1.1 fvdl */
34 1.1 fvdl
35 1.1 fvdl #ifndef _LOCORE
36 1.1 fvdl
37 1.1 fvdl struct btinfo_common {
38 1.1 fvdl int len;
39 1.1 fvdl int type;
40 1.1 fvdl };
41 1.1 fvdl
42 1.1 fvdl #define BTINFO_BOOTPATH 0
43 1.1 fvdl #define BTINFO_BOOTDISK 3
44 1.1 fvdl #define BTINFO_NETIF 4
45 1.1 fvdl #define BTINFO_CONSOLE 6
46 1.1 fvdl #define BTINFO_BIOSGEOM 7
47 1.1 fvdl #define BTINFO_SYMTAB 8
48 1.1 fvdl #define BTINFO_MEMMAP 9
49 1.1 fvdl
50 1.1 fvdl struct btinfo_bootpath {
51 1.1 fvdl struct btinfo_common common;
52 1.1 fvdl char bootpath[80];
53 1.1 fvdl };
54 1.1 fvdl
55 1.1 fvdl struct btinfo_bootdisk {
56 1.1 fvdl struct btinfo_common common;
57 1.1 fvdl int labelsector; /* label valid if != -1 */
58 1.1 fvdl struct {
59 1.1 fvdl u_int16_t type, checksum;
60 1.1 fvdl char packname[16];
61 1.1 fvdl } label;
62 1.1 fvdl int biosdev;
63 1.1 fvdl int partition;
64 1.1 fvdl };
65 1.1 fvdl
66 1.1 fvdl struct btinfo_netif {
67 1.1 fvdl struct btinfo_common common;
68 1.1 fvdl char ifname[16];
69 1.1 fvdl int bus;
70 1.1 fvdl #define BI_BUS_ISA 0
71 1.1 fvdl #define BI_BUS_PCI 1
72 1.1 fvdl union {
73 1.1 fvdl unsigned int iobase; /* ISA */
74 1.1 fvdl unsigned int tag; /* PCI, BIOS format */
75 1.1 fvdl } addr;
76 1.1 fvdl };
77 1.1 fvdl
78 1.1 fvdl struct btinfo_console {
79 1.1 fvdl struct btinfo_common common;
80 1.1 fvdl char devname[16];
81 1.1 fvdl int addr;
82 1.1 fvdl int speed;
83 1.1 fvdl };
84 1.1 fvdl
85 1.1 fvdl struct btinfo_symtab {
86 1.1 fvdl struct btinfo_common common;
87 1.1 fvdl int nsym;
88 1.1 fvdl int ssym;
89 1.1 fvdl int esym;
90 1.1 fvdl };
91 1.1 fvdl
92 1.1 fvdl struct bi_memmap_entry {
93 1.1 fvdl u_int64_t addr; /* beginning of block */ /* 8 */
94 1.1 fvdl u_int64_t size; /* size of block */ /* 8 */
95 1.1 fvdl u_int32_t type; /* type of block */ /* 4 */
96 1.1 fvdl } __attribute__((packed)); /* == 20 */
97 1.1 fvdl
98 1.1 fvdl #define BIM_Memory 1 /* available RAM usable by OS */
99 1.1 fvdl #define BIM_Reserved 2 /* in use or reserved by the system */
100 1.1 fvdl #define BIM_ACPI 3 /* ACPI Reclaim memory */
101 1.1 fvdl #define BIM_NVS 4 /* ACPI NVS memory */
102 1.1 fvdl
103 1.1 fvdl struct btinfo_memmap {
104 1.1 fvdl struct btinfo_common common;
105 1.1 fvdl int num;
106 1.1 fvdl struct bi_memmap_entry entry[1]; /* var len */
107 1.1 fvdl };
108 1.1 fvdl
109 1.1 fvdl #include <sys/disklabel_mbr.h>
110 1.1 fvdl
111 1.1 fvdl /*
112 1.1 fvdl * Structure describing disk info as seen by the BIOS.
113 1.1 fvdl */
114 1.1 fvdl struct bi_biosgeom_entry {
115 1.1 fvdl int sec, head, cyl; /* geometry */
116 1.1 fvdl u_int64_t totsec; /* LBA sectors from ext int13 */
117 1.1 fvdl int flags, dev; /* flags, BIOS device # */
118 1.1 fvdl #define BI_GEOM_INVALID 0x01
119 1.1 fvdl #define BI_GEOM_EXTINT13 0x02
120 1.1 fvdl unsigned int cksum; /* MBR checksum */
121 1.1 fvdl int res0, res1, res2, res3; /* future expansion; 0 now */
122 1.1 fvdl struct mbr_partition dosparts[NMBRPART]; /* MBR itself */
123 1.1 fvdl } __attribute__((packed));
124 1.1 fvdl
125 1.1 fvdl struct btinfo_biosgeom {
126 1.1 fvdl struct btinfo_common common;
127 1.1 fvdl int num;
128 1.1 fvdl struct bi_biosgeom_entry disk[1]; /* var len */
129 1.1 fvdl };
130 1.1 fvdl
131 1.1 fvdl #ifdef _KERNEL
132 1.1 fvdl void *lookup_bootinfo __P((int));
133 1.1 fvdl #endif
134 1.1 fvdl #endif /* _LOCORE */
135 1.1 fvdl
136 1.1 fvdl #ifdef _KERNEL
137 1.1 fvdl #define BOOTINFO_MAXSIZE 4096
138 1.1 fvdl #endif
139