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