]> git.proxmox.com Git - grub2.git/blob - include/grub/i386/bsd.h
2009-05-02 Vladimir Serbinenko <phcoder@gmail.com>
[grub2.git] / include / grub / i386 / bsd.h
1 /*
2 * GRUB -- GRand Unified Bootloader
3 * Copyright (C) 2008 Free Software Foundation, Inc.
4 *
5 * GRUB is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * GRUB is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 #ifndef GRUB_BSD_CPU_HEADER
20 #define GRUB_BSD_CPU_HEADER 1
21
22 #include <grub/types.h>
23
24 #define KERNEL_TYPE_NONE 0
25 #define KERNEL_TYPE_FREEBSD 1
26 #define KERNEL_TYPE_OPENBSD 2
27 #define KERNEL_TYPE_NETBSD 3
28
29 #define GRUB_BSD_TEMP_BUFFER 0x68000
30
31 #define FREEBSD_RB_ASKNAME (1 << 0) /* ask for file name to reboot from */
32 #define FREEBSD_RB_SINGLE (1 << 1) /* reboot to single user only */
33 #define FREEBSD_RB_NOSYNC (1 << 2) /* dont sync before reboot */
34 #define FREEBSD_RB_HALT (1 << 3) /* don't reboot, just halt */
35 #define FREEBSD_RB_INITNAME (1 << 4) /* name given for /etc/init (unused) */
36 #define FREEBSD_RB_DFLTROOT (1 << 5) /* use compiled-in rootdev */
37 #define FREEBSD_RB_KDB (1 << 6) /* give control to kernel debugger */
38 #define FREEBSD_RB_RDONLY (1 << 7) /* mount root fs read-only */
39 #define FREEBSD_RB_DUMP (1 << 8) /* dump kernel memory before reboot */
40 #define FREEBSD_RB_MINIROOT (1 << 9) /* mini-root present in memory at boot time */
41 #define FREEBSD_RB_CONFIG (1 << 10) /* invoke user configuration routing */
42 #define FREEBSD_RB_VERBOSE (1 << 11) /* print all potentially useful info */
43 #define FREEBSD_RB_SERIAL (1 << 12) /* user serial port as console */
44 #define FREEBSD_RB_CDROM (1 << 13) /* use cdrom as root */
45 #define FREEBSD_RB_GDB (1 << 15) /* use GDB remote debugger instead of DDB */
46 #define FREEBSD_RB_MUTE (1 << 16) /* Come up with the console muted */
47 #define FREEBSD_RB_PAUSE (1 << 20)
48 #define FREEBSD_RB_QUIET (1 << 21)
49 #define FREEBSD_RB_NOINTR (1 << 28)
50 #define FREENSD_RB_MULTIPLE (1 << 29) /* Use multiple consoles */
51 #define FREEBSD_RB_DUAL FREENSD_RB_MULTIPLE
52 #define FREEBSD_RB_BOOTINFO (1 << 31) /* have `struct bootinfo *' arg */
53
54 #define FREEBSD_B_DEVMAGIC 0xa0000000
55 #define FREEBSD_B_SLICESHIFT 20
56 #define FREEBSD_B_UNITSHIFT 16
57 #define FREEBSD_B_PARTSHIFT 8
58 #define FREEBSD_B_TYPESHIFT 0
59
60 #define FREEBSD_BOOTINFO_VERSION 1
61 #define FREEBSD_N_BIOS_GEOM 8
62
63 #define FREEBSD_MODINFO_END 0x0000 /* End of list */
64 #define FREEBSD_MODINFO_NAME 0x0001 /* Name of module (string) */
65 #define FREEBSD_MODINFO_TYPE 0x0002 /* Type of module (string) */
66 #define FREEBSD_MODINFO_ADDR 0x0003 /* Loaded address */
67 #define FREEBSD_MODINFO_SIZE 0x0004 /* Size of module */
68 #define FREEBSD_MODINFO_EMPTY 0x0005 /* Has been deleted */
69 #define FREEBSD_MODINFO_ARGS 0x0006 /* Parameters string */
70 #define FREEBSD_MODINFO_METADATA 0x8000 /* Module-specfic */
71
72 #define FREEBSD_MODINFOMD_AOUTEXEC 0x0001 /* a.out exec header */
73 #define FREEBSD_MODINFOMD_ELFHDR 0x0002 /* ELF header */
74 #define FREEBSD_MODINFOMD_SSYM 0x0003 /* start of symbols */
75 #define FREEBSD_MODINFOMD_ESYM 0x0004 /* end of symbols */
76 #define FREEBSD_MODINFOMD_DYNAMIC 0x0005 /* _DYNAMIC pointer */
77 #define FREEBSD_MODINFOMD_ENVP 0x0006 /* envp[] */
78 #define FREEBSD_MODINFOMD_HOWTO 0x0007 /* boothowto */
79 #define FREEBSD_MODINFOMD_KERNEND 0x0008 /* kernend */
80 #define FREEBSD_MODINFOMD_SHDR 0x0009 /* section header table */
81 #define FREEBSD_MODINFOMD_NOCOPY 0x8000 /* don't copy this metadata to the kernel */
82
83 #define FREEBSD_MODINFOMD_DEPLIST (0x4001 | FREEBSD_MODINFOMD_NOCOPY) /* depends on */
84
85 #define FREEBSD_MODTYPE_KERNEL "elf kernel"
86 #define FREEBSD_MODTYPE_MODULE "elf module"
87 #define FREEBSD_MODTYPE_RAW "raw"
88
89 struct grub_freebsd_bootinfo
90 {
91 grub_uint32_t bi_version;
92 grub_uint8_t *bi_kernelname;
93 struct nfs_diskless *bi_nfs_diskless;
94 grub_uint32_t bi_n_bios_used;
95 grub_uint32_t bi_bios_geom[FREEBSD_N_BIOS_GEOM];
96 grub_uint32_t bi_size;
97 grub_uint8_t bi_memsizes_valid;
98 grub_uint8_t bi_bios_dev;
99 grub_uint8_t bi_pad[2];
100 grub_uint32_t bi_basemem;
101 grub_uint32_t bi_extmem;
102 grub_uint32_t bi_symtab;
103 grub_uint32_t bi_esymtab;
104 grub_uint32_t bi_kernend;
105 grub_uint32_t bi_envp;
106 grub_uint32_t bi_modulep;
107 } __attribute__ ((packed));
108
109 #define OPENBSD_RB_ASKNAME (1 << 0) /* ask for file name to reboot from */
110 #define OPENBSD_RB_SINGLE (1 << 1) /* reboot to single user only */
111 #define OPENBSD_RB_NOSYNC (1 << 2) /* dont sync before reboot */
112 #define OPENBSD_RB_HALT (1 << 3) /* don't reboot, just halt */
113 #define OPENBSD_RB_INITNAME (1 << 4) /* name given for /etc/init (unused) */
114 #define OPENBSD_RB_DFLTROOT (1 << 5) /* use compiled-in rootdev */
115 #define OPENBSD_RB_KDB (1 << 6) /* give control to kernel debugger */
116 #define OPENBSD_RB_RDONLY (1 << 7) /* mount root fs read-only */
117 #define OPENBSD_RB_DUMP (1 << 8) /* dump kernel memory before reboot */
118 #define OPENBSD_RB_MINIROOT (1 << 9) /* mini-root present in memory at boot time */
119 #define OPENBSD_RB_CONFIG (1 << 10) /* change configured devices */
120 #define OPENBSD_RB_TIMEBAD (1 << 11) /* don't call resettodr() in boot() */
121 #define OPENBSD_RB_POWERDOWN (1 << 12) /* attempt to power down machine */
122 #define OPENBSD_RB_SERCONS (1 << 13) /* use serial console if available */
123 #define OPENBSD_RB_USERREQ (1 << 14) /* boot() called at user request (e.g. ddb) */
124
125 #define OPENBSD_B_DEVMAGIC 0xa0000000
126 #define OPENBSD_B_ADAPTORSHIFT 24
127 #define OPENBSD_B_CTRLSHIFT 20
128 #define OPENBSD_B_UNITSHIFT 16
129 #define OPENBSD_B_PARTSHIFT 8
130 #define OPENBSD_B_TYPESHIFT 0
131
132 #define OPENBSD_BOOTARG_APIVER (OPENBSD_BAPIV_VECTOR | \
133 OPENBSD_BAPIV_ENV | \
134 OPENBSD_BAPIV_BMEMMAP)
135
136 #define OPENBSD_BAPIV_ANCIENT 0x0 /* MD old i386 bootblocks */
137 #define OPENBSD_BAPIV_VARS 0x1 /* MD structure w/ add info passed */
138 #define OPENBSD_BAPIV_VECTOR 0x2 /* MI vector of MD structures passed */
139 #define OPENBSD_BAPIV_ENV 0x4 /* MI environment vars vector */
140 #define OPENBSD_BAPIV_BMEMMAP 0x8 /* MI memory map passed is in bytes */
141
142 #define OPENBSD_BOOTARG_ENV 0x1000
143 #define OPENBSD_BOOTARG_END -1
144
145 #define OPENBSD_BOOTARG_MMAP 0
146
147 struct grub_openbsd_bios_mmap
148 {
149 grub_uint64_t addr;
150 grub_uint64_t len;
151 #define OPENBSD_MMAP_AVAILABLE 1
152 #define OPENBSD_MMAP_RESERVED 2
153 grub_uint32_t type;
154 };
155
156 struct grub_openbsd_bootargs
157 {
158 int ba_type;
159 int ba_size;
160 struct grub_openbsd_bootargs *ba_next;
161 } __attribute__ ((packed));
162
163 #define NETBSD_RB_AUTOBOOT 0 /* flags for system auto-booting itself */
164
165 #define NETBSD_RB_ASKNAME (1 << 0) /* ask for file name to reboot from */
166 #define NETBSD_RB_SINGLE (1 << 1) /* reboot to single user only */
167 #define NETBSD_RB_NOSYNC (1 << 2) /* dont sync before reboot */
168 #define NETBSD_RB_HALT (1 << 3) /* don't reboot, just halt */
169 #define NETBSD_RB_INITNAME (1 << 4) /* name given for /etc/init (unused) */
170 #define NETBSD_RB_UNUSED1 (1 << 5) /* was RB_DFLTROOT, obsolete */
171 #define NETBSD_RB_KDB (1 << 6) /* give control to kernel debugger */
172 #define NETBSD_RB_RDONLY (1 << 7) /* mount root fs read-only */
173 #define NETBSD_RB_DUMP (1 << 8) /* dump kernel memory before reboot */
174 #define NETBSD_RB_MINIROOT (1 << 9) /* mini-root present in memory at boot time */
175 #define NETBSD_RB_STRING (1 << 10) /* use provided bootstr */
176 #define NETBSD_RB_POWERDOWN ((1 << 11) | RB_HALT) /* turn power off (or at least halt) */
177 #define NETBSD_RB_USERCONFIG (1 << 12) /* change configured devices */
178
179 #define NETBSD_AB_NORMAL 0 /* boot normally (default) */
180
181 #define NETBSD_AB_QUIET (1 << 16) /* boot quietly */
182 #define NETBSD_AB_VERBOSE (1 << 17) /* boot verbosely */
183 #define NETBSD_AB_SILENT (1 << 18) /* boot silently */
184 #define NETBSD_AB_DEBUG (1 << 19) /* boot with debug messages */
185
186 struct grub_netbsd_bootinfo
187 {
188 grub_uint32_t bi_count;
189 void *bi_data[1];
190 };
191
192 #define NETBSD_BTINFO_BOOTPATH 0
193 #define NETBSD_BTINFO_ROOTDEVICE 1
194 #define NETBSD_BTINFO_BOOTDISK 3
195
196 struct grub_netbsd_btinfo_common
197 {
198 int len;
199 int type;
200 };
201
202 struct grub_netbsd_btinfo_bootpath
203 {
204 struct grub_netbsd_btinfo_common common;
205 char bootpath[80];
206 };
207
208 struct grub_netbsd_btinfo_rootdevice
209 {
210 struct grub_netbsd_btinfo_common common;
211 char devname[16];
212 };
213
214 struct grub_netbsd_btinfo_bootdisk
215 {
216 struct grub_netbsd_btinfo_common common;
217 int labelsector; /* label valid if != -1 */
218 struct
219 {
220 grub_uint16_t type, checksum;
221 char packname[16];
222 } label;
223 int biosdev;
224 int partition;
225 };
226
227 #endif /* ! GRUB_BSD_CPU_HEADER */