multiboot2.h revision 1.1 1 1.1 manu /* multiboot2.h - Multiboot 2 header file. */
2 1.1 manu /* Copyright (C) 1999,2003,2007,2008,2009,2010 Free Software Foundation, Inc.
3 1.1 manu *
4 1.1 manu * Permission is hereby granted, free of charge, to any person obtaining a copy
5 1.1 manu * of this software and associated documentation files (the "Software"), to
6 1.1 manu * deal in the Software without restriction, including without limitation the
7 1.1 manu * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 1.1 manu * sell copies of the Software, and to permit persons to whom the Software is
9 1.1 manu * furnished to do so, subject to the following conditions:
10 1.1 manu *
11 1.1 manu * The above copyright notice and this permission notice shall be included in
12 1.1 manu * all copies or substantial portions of the Software.
13 1.1 manu *
14 1.1 manu * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 1.1 manu * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 1.1 manu * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ANY
17 1.1 manu * DEVELOPER OR DISTRIBUTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
18 1.1 manu * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
19 1.1 manu * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 1.1 manu */
21 1.1 manu
22 1.1 manu #ifndef MULTIBOOT_HEADER
23 1.1 manu #define MULTIBOOT_HEADER 1
24 1.1 manu
25 1.1 manu /* How many bytes from the start of the file we search for the header. */
26 1.1 manu #define MULTIBOOT_SEARCH 32768
27 1.1 manu #define MULTIBOOT_HEADER_ALIGN 8
28 1.1 manu
29 1.1 manu /* The magic field should contain this. */
30 1.1 manu #define MULTIBOOT2_HEADER_MAGIC 0xe85250d6
31 1.1 manu
32 1.1 manu /* This should be in %eax. */
33 1.1 manu #define MULTIBOOT2_BOOTLOADER_MAGIC 0x36d76289
34 1.1 manu
35 1.1 manu /* Alignment of multiboot modules. */
36 1.1 manu #define MULTIBOOT_MOD_ALIGN 0x00001000
37 1.1 manu
38 1.1 manu /* Alignment of the multiboot info structure. */
39 1.1 manu #define MULTIBOOT_INFO_ALIGN 0x00000008
40 1.1 manu
41 1.1 manu /* Flags set in the 'flags' member of the multiboot header. */
42 1.1 manu
43 1.1 manu #define MULTIBOOT_TAG_ALIGN 8
44 1.1 manu #define MULTIBOOT_TAG_TYPE_END 0
45 1.1 manu #define MULTIBOOT_TAG_TYPE_CMDLINE 1
46 1.1 manu #define MULTIBOOT_TAG_TYPE_BOOT_LOADER_NAME 2
47 1.1 manu #define MULTIBOOT_TAG_TYPE_MODULE 3
48 1.1 manu #define MULTIBOOT_TAG_TYPE_BASIC_MEMINFO 4
49 1.1 manu #define MULTIBOOT_TAG_TYPE_BOOTDEV 5
50 1.1 manu #define MULTIBOOT_TAG_TYPE_MMAP 6
51 1.1 manu #define MULTIBOOT_TAG_TYPE_VBE 7
52 1.1 manu #define MULTIBOOT_TAG_TYPE_FRAMEBUFFER 8
53 1.1 manu #define MULTIBOOT_TAG_TYPE_ELF_SECTIONS 9
54 1.1 manu #define MULTIBOOT_TAG_TYPE_APM 10
55 1.1 manu #define MULTIBOOT_TAG_TYPE_EFI32 11
56 1.1 manu #define MULTIBOOT_TAG_TYPE_EFI64 12
57 1.1 manu #define MULTIBOOT_TAG_TYPE_SMBIOS 13
58 1.1 manu #define MULTIBOOT_TAG_TYPE_ACPI_OLD 14
59 1.1 manu #define MULTIBOOT_TAG_TYPE_ACPI_NEW 15
60 1.1 manu #define MULTIBOOT_TAG_TYPE_NETWORK 16
61 1.1 manu #define MULTIBOOT_TAG_TYPE_EFI_MMAP 17
62 1.1 manu #define MULTIBOOT_TAG_TYPE_EFI_BS 18
63 1.1 manu #define MULTIBOOT_TAG_TYPE_EFI32_IH 19
64 1.1 manu #define MULTIBOOT_TAG_TYPE_EFI64_IH 20
65 1.1 manu #define MULTIBOOT_TAG_TYPE_LOAD_BASE_ADDR 21
66 1.1 manu
67 1.1 manu #define MULTIBOOT_HEADER_TAG_END 0
68 1.1 manu #define MULTIBOOT_HEADER_TAG_INFORMATION_REQUEST 1
69 1.1 manu #define MULTIBOOT_HEADER_TAG_ADDRESS 2
70 1.1 manu #define MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS 3
71 1.1 manu #define MULTIBOOT_HEADER_TAG_CONSOLE_FLAGS 4
72 1.1 manu #define MULTIBOOT_HEADER_TAG_FRAMEBUFFER 5
73 1.1 manu #define MULTIBOOT_HEADER_TAG_MODULE_ALIGN 6
74 1.1 manu #define MULTIBOOT_HEADER_TAG_EFI_BS 7
75 1.1 manu #define MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS_EFI32 8
76 1.1 manu #define MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS_EFI64 9
77 1.1 manu #define MULTIBOOT_HEADER_TAG_RELOCATABLE 10
78 1.1 manu
79 1.1 manu #define MULTIBOOT_ARCHITECTURE_I386 0
80 1.1 manu #define MULTIBOOT_ARCHITECTURE_MIPS32 4
81 1.1 manu #define MULTIBOOT_HEADER_TAG_OPTIONAL 1
82 1.1 manu
83 1.1 manu #define MULTIBOOT_LOAD_PREFERENCE_NONE 0
84 1.1 manu #define MULTIBOOT_LOAD_PREFERENCE_LOW 1
85 1.1 manu #define MULTIBOOT_LOAD_PREFERENCE_HIGH 2
86 1.1 manu
87 1.1 manu #define MULTIBOOT_CONSOLE_FLAGS_CONSOLE_REQUIRED 1
88 1.1 manu #define MULTIBOOT_CONSOLE_FLAGS_EGA_TEXT_SUPPORTED 2
89 1.1 manu
90 1.1 manu #ifndef ASM_FILE
91 1.1 manu
92 1.1 manu typedef unsigned char multiboot_uint8_t;
93 1.1 manu typedef unsigned short multiboot_uint16_t;
94 1.1 manu typedef unsigned int multiboot_uint32_t;
95 1.1 manu typedef unsigned long long multiboot_uint64_t;
96 1.1 manu
97 1.1 manu struct multiboot_header
98 1.1 manu {
99 1.1 manu /* Must be MULTIBOOT_MAGIC - see above. */
100 1.1 manu multiboot_uint32_t magic;
101 1.1 manu
102 1.1 manu /* ISA */
103 1.1 manu multiboot_uint32_t architecture;
104 1.1 manu
105 1.1 manu /* Total header length. */
106 1.1 manu multiboot_uint32_t header_length;
107 1.1 manu
108 1.1 manu /* The above fields plus this one must equal 0 mod 2^32. */
109 1.1 manu multiboot_uint32_t checksum;
110 1.1 manu };
111 1.1 manu
112 1.1 manu struct multiboot_header_tag
113 1.1 manu {
114 1.1 manu multiboot_uint16_t type;
115 1.1 manu multiboot_uint16_t flags;
116 1.1 manu multiboot_uint32_t size;
117 1.1 manu };
118 1.1 manu
119 1.1 manu struct multiboot_header_tag_information_request
120 1.1 manu {
121 1.1 manu multiboot_uint16_t type;
122 1.1 manu multiboot_uint16_t flags;
123 1.1 manu multiboot_uint32_t size;
124 1.1 manu multiboot_uint32_t requests[0];
125 1.1 manu };
126 1.1 manu
127 1.1 manu struct multiboot_header_tag_address
128 1.1 manu {
129 1.1 manu multiboot_uint16_t type;
130 1.1 manu multiboot_uint16_t flags;
131 1.1 manu multiboot_uint32_t size;
132 1.1 manu multiboot_uint32_t header_addr;
133 1.1 manu multiboot_uint32_t load_addr;
134 1.1 manu multiboot_uint32_t load_end_addr;
135 1.1 manu multiboot_uint32_t bss_end_addr;
136 1.1 manu };
137 1.1 manu
138 1.1 manu struct multiboot_header_tag_entry_address
139 1.1 manu {
140 1.1 manu multiboot_uint16_t type;
141 1.1 manu multiboot_uint16_t flags;
142 1.1 manu multiboot_uint32_t size;
143 1.1 manu multiboot_uint32_t entry_addr;
144 1.1 manu };
145 1.1 manu
146 1.1 manu struct multiboot_header_tag_console_flags
147 1.1 manu {
148 1.1 manu multiboot_uint16_t type;
149 1.1 manu multiboot_uint16_t flags;
150 1.1 manu multiboot_uint32_t size;
151 1.1 manu multiboot_uint32_t console_flags;
152 1.1 manu };
153 1.1 manu
154 1.1 manu struct multiboot_header_tag_framebuffer
155 1.1 manu {
156 1.1 manu multiboot_uint16_t type;
157 1.1 manu multiboot_uint16_t flags;
158 1.1 manu multiboot_uint32_t size;
159 1.1 manu multiboot_uint32_t width;
160 1.1 manu multiboot_uint32_t height;
161 1.1 manu multiboot_uint32_t depth;
162 1.1 manu };
163 1.1 manu
164 1.1 manu struct multiboot_header_tag_module_align
165 1.1 manu {
166 1.1 manu multiboot_uint16_t type;
167 1.1 manu multiboot_uint16_t flags;
168 1.1 manu multiboot_uint32_t size;
169 1.1 manu };
170 1.1 manu
171 1.1 manu struct multiboot_header_tag_relocatable
172 1.1 manu {
173 1.1 manu multiboot_uint16_t type;
174 1.1 manu multiboot_uint16_t flags;
175 1.1 manu multiboot_uint32_t size;
176 1.1 manu multiboot_uint32_t min_addr;
177 1.1 manu multiboot_uint32_t max_addr;
178 1.1 manu multiboot_uint32_t align;
179 1.1 manu multiboot_uint32_t preference;
180 1.1 manu };
181 1.1 manu
182 1.1 manu struct multiboot_color
183 1.1 manu {
184 1.1 manu multiboot_uint8_t red;
185 1.1 manu multiboot_uint8_t green;
186 1.1 manu multiboot_uint8_t blue;
187 1.1 manu };
188 1.1 manu
189 1.1 manu struct multiboot_mmap_entry
190 1.1 manu {
191 1.1 manu multiboot_uint64_t addr;
192 1.1 manu multiboot_uint64_t len;
193 1.1 manu #define MULTIBOOT_MEMORY_AVAILABLE 1
194 1.1 manu #define MULTIBOOT_MEMORY_RESERVED 2
195 1.1 manu #define MULTIBOOT_MEMORY_ACPI_RECLAIMABLE 3
196 1.1 manu #define MULTIBOOT_MEMORY_NVS 4
197 1.1 manu #define MULTIBOOT_MEMORY_BADRAM 5
198 1.1 manu multiboot_uint32_t type;
199 1.1 manu multiboot_uint32_t zero;
200 1.1 manu };
201 1.1 manu typedef struct multiboot_mmap_entry multiboot_memory_map_t;
202 1.1 manu
203 1.1 manu struct multiboot_tag
204 1.1 manu {
205 1.1 manu multiboot_uint32_t type;
206 1.1 manu multiboot_uint32_t size;
207 1.1 manu };
208 1.1 manu
209 1.1 manu struct multiboot_tag_string
210 1.1 manu {
211 1.1 manu multiboot_uint32_t type;
212 1.1 manu multiboot_uint32_t size;
213 1.1 manu char string[0];
214 1.1 manu };
215 1.1 manu
216 1.1 manu struct multiboot_tag_module
217 1.1 manu {
218 1.1 manu multiboot_uint32_t type;
219 1.1 manu multiboot_uint32_t size;
220 1.1 manu multiboot_uint32_t mod_start;
221 1.1 manu multiboot_uint32_t mod_end;
222 1.1 manu char cmdline[0];
223 1.1 manu };
224 1.1 manu
225 1.1 manu struct multiboot_tag_basic_meminfo
226 1.1 manu {
227 1.1 manu multiboot_uint32_t type;
228 1.1 manu multiboot_uint32_t size;
229 1.1 manu multiboot_uint32_t mem_lower;
230 1.1 manu multiboot_uint32_t mem_upper;
231 1.1 manu };
232 1.1 manu
233 1.1 manu struct multiboot_tag_bootdev
234 1.1 manu {
235 1.1 manu multiboot_uint32_t type;
236 1.1 manu multiboot_uint32_t size;
237 1.1 manu multiboot_uint32_t biosdev;
238 1.1 manu multiboot_uint32_t slice;
239 1.1 manu multiboot_uint32_t part;
240 1.1 manu };
241 1.1 manu
242 1.1 manu struct multiboot_tag_mmap
243 1.1 manu {
244 1.1 manu multiboot_uint32_t type;
245 1.1 manu multiboot_uint32_t size;
246 1.1 manu multiboot_uint32_t entry_size;
247 1.1 manu multiboot_uint32_t entry_version;
248 1.1 manu struct multiboot_mmap_entry entries[0];
249 1.1 manu };
250 1.1 manu
251 1.1 manu struct multiboot_vbe_info_block
252 1.1 manu {
253 1.1 manu multiboot_uint8_t external_specification[512];
254 1.1 manu };
255 1.1 manu
256 1.1 manu struct multiboot_vbe_mode_info_block
257 1.1 manu {
258 1.1 manu multiboot_uint8_t external_specification[256];
259 1.1 manu };
260 1.1 manu
261 1.1 manu struct multiboot_tag_vbe
262 1.1 manu {
263 1.1 manu multiboot_uint32_t type;
264 1.1 manu multiboot_uint32_t size;
265 1.1 manu
266 1.1 manu multiboot_uint16_t vbe_mode;
267 1.1 manu multiboot_uint16_t vbe_interface_seg;
268 1.1 manu multiboot_uint16_t vbe_interface_off;
269 1.1 manu multiboot_uint16_t vbe_interface_len;
270 1.1 manu
271 1.1 manu struct multiboot_vbe_info_block vbe_control_info;
272 1.1 manu struct multiboot_vbe_mode_info_block vbe_mode_info;
273 1.1 manu };
274 1.1 manu
275 1.1 manu struct multiboot_tag_framebuffer_common
276 1.1 manu {
277 1.1 manu multiboot_uint32_t type;
278 1.1 manu multiboot_uint32_t size;
279 1.1 manu
280 1.1 manu multiboot_uint64_t framebuffer_addr;
281 1.1 manu multiboot_uint32_t framebuffer_pitch;
282 1.1 manu multiboot_uint32_t framebuffer_width;
283 1.1 manu multiboot_uint32_t framebuffer_height;
284 1.1 manu multiboot_uint8_t framebuffer_bpp;
285 1.1 manu #define MULTIBOOT_FRAMEBUFFER_TYPE_INDEXED 0
286 1.1 manu #define MULTIBOOT_FRAMEBUFFER_TYPE_RGB 1
287 1.1 manu #define MULTIBOOT_FRAMEBUFFER_TYPE_EGA_TEXT 2
288 1.1 manu multiboot_uint8_t framebuffer_type;
289 1.1 manu multiboot_uint16_t reserved;
290 1.1 manu };
291 1.1 manu
292 1.1 manu struct multiboot_tag_framebuffer
293 1.1 manu {
294 1.1 manu struct multiboot_tag_framebuffer_common common;
295 1.1 manu
296 1.1 manu union
297 1.1 manu {
298 1.1 manu struct
299 1.1 manu {
300 1.1 manu multiboot_uint16_t framebuffer_palette_num_colors;
301 1.1 manu struct multiboot_color framebuffer_palette[0];
302 1.1 manu };
303 1.1 manu struct
304 1.1 manu {
305 1.1 manu multiboot_uint8_t framebuffer_red_field_position;
306 1.1 manu multiboot_uint8_t framebuffer_red_mask_size;
307 1.1 manu multiboot_uint8_t framebuffer_green_field_position;
308 1.1 manu multiboot_uint8_t framebuffer_green_mask_size;
309 1.1 manu multiboot_uint8_t framebuffer_blue_field_position;
310 1.1 manu multiboot_uint8_t framebuffer_blue_mask_size;
311 1.1 manu };
312 1.1 manu };
313 1.1 manu };
314 1.1 manu
315 1.1 manu struct multiboot_tag_elf_sections
316 1.1 manu {
317 1.1 manu multiboot_uint32_t type;
318 1.1 manu multiboot_uint32_t size;
319 1.1 manu multiboot_uint32_t num;
320 1.1 manu multiboot_uint32_t entsize;
321 1.1 manu multiboot_uint32_t shndx;
322 1.1 manu char sections[0];
323 1.1 manu };
324 1.1 manu
325 1.1 manu struct multiboot_tag_apm
326 1.1 manu {
327 1.1 manu multiboot_uint32_t type;
328 1.1 manu multiboot_uint32_t size;
329 1.1 manu multiboot_uint16_t version;
330 1.1 manu multiboot_uint16_t cseg;
331 1.1 manu multiboot_uint32_t offset;
332 1.1 manu multiboot_uint16_t cseg_16;
333 1.1 manu multiboot_uint16_t dseg;
334 1.1 manu multiboot_uint16_t flags;
335 1.1 manu multiboot_uint16_t cseg_len;
336 1.1 manu multiboot_uint16_t cseg_16_len;
337 1.1 manu multiboot_uint16_t dseg_len;
338 1.1 manu };
339 1.1 manu
340 1.1 manu struct multiboot_tag_efi32
341 1.1 manu {
342 1.1 manu multiboot_uint32_t type;
343 1.1 manu multiboot_uint32_t size;
344 1.1 manu multiboot_uint32_t pointer;
345 1.1 manu };
346 1.1 manu
347 1.1 manu struct multiboot_tag_efi64
348 1.1 manu {
349 1.1 manu multiboot_uint32_t type;
350 1.1 manu multiboot_uint32_t size;
351 1.1 manu multiboot_uint64_t pointer;
352 1.1 manu };
353 1.1 manu
354 1.1 manu struct multiboot_tag_smbios
355 1.1 manu {
356 1.1 manu multiboot_uint32_t type;
357 1.1 manu multiboot_uint32_t size;
358 1.1 manu multiboot_uint8_t major;
359 1.1 manu multiboot_uint8_t minor;
360 1.1 manu multiboot_uint8_t reserved[6];
361 1.1 manu multiboot_uint8_t tables[0];
362 1.1 manu };
363 1.1 manu
364 1.1 manu struct multiboot_tag_old_acpi
365 1.1 manu {
366 1.1 manu multiboot_uint32_t type;
367 1.1 manu multiboot_uint32_t size;
368 1.1 manu multiboot_uint8_t rsdp[0];
369 1.1 manu };
370 1.1 manu
371 1.1 manu struct multiboot_tag_new_acpi
372 1.1 manu {
373 1.1 manu multiboot_uint32_t type;
374 1.1 manu multiboot_uint32_t size;
375 1.1 manu multiboot_uint8_t rsdp[0];
376 1.1 manu };
377 1.1 manu
378 1.1 manu struct multiboot_tag_network
379 1.1 manu {
380 1.1 manu multiboot_uint32_t type;
381 1.1 manu multiboot_uint32_t size;
382 1.1 manu multiboot_uint8_t dhcpack[0];
383 1.1 manu };
384 1.1 manu
385 1.1 manu struct multiboot_tag_efi_mmap
386 1.1 manu {
387 1.1 manu multiboot_uint32_t type;
388 1.1 manu multiboot_uint32_t size;
389 1.1 manu multiboot_uint32_t descr_size;
390 1.1 manu multiboot_uint32_t descr_vers;
391 1.1 manu multiboot_uint8_t efi_mmap[0];
392 1.1 manu };
393 1.1 manu
394 1.1 manu struct multiboot_tag_efi32_ih
395 1.1 manu {
396 1.1 manu multiboot_uint32_t type;
397 1.1 manu multiboot_uint32_t size;
398 1.1 manu multiboot_uint32_t pointer;
399 1.1 manu };
400 1.1 manu
401 1.1 manu struct multiboot_tag_efi64_ih
402 1.1 manu {
403 1.1 manu multiboot_uint32_t type;
404 1.1 manu multiboot_uint32_t size;
405 1.1 manu multiboot_uint64_t pointer;
406 1.1 manu };
407 1.1 manu
408 1.1 manu struct multiboot_tag_load_base_addr
409 1.1 manu {
410 1.1 manu multiboot_uint32_t type;
411 1.1 manu multiboot_uint32_t size;
412 1.1 manu multiboot_uint32_t load_base_addr;
413 1.1 manu };
414 1.1 manu
415 1.1 manu #endif /* ! ASM_FILE */
416 1.1 manu
417 1.1 manu #endif /* ! MULTIBOOT_HEADER */
418