2 * Copyright (C) 1999,2003,2007,2008,2009,2010 Free Software Foundation, Inc.
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to
6 * deal in the Software without restriction, including without limitation the
7 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 * sell copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ANY
17 * DEVELOPER OR DISTRIBUTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
18 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
19 * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 * Copyright 2016 Toomas Soome <tsoome@me.com>
27 * This header contains definitions for Multiboot 2 boot protocol, based on
28 * the reference implementation by grub 2.
30 * At the time this was written (Jan 2017), the Multiboot 2 documentation is in
31 * process of being rewritten and the information in the specification is not
32 * entirely correct. Instead, you must rely on grub 2 source code.
34 * This header provides essential support for the Multiboot 2 specification
35 * for illumos and makes it possible to pass the needed structures from the
36 * boot loader to the kernel.
39 #ifndef _SYS_MULTIBOOT2_H
40 #define _SYS_MULTIBOOT2_H
46 /* How many bytes from the start of the file we search for the header. */
47 #define MULTIBOOT_SEARCH 32768
48 #define MULTIBOOT_HEADER_ALIGN 8
50 /* The magic field should contain this. */
51 #define MULTIBOOT2_HEADER_MAGIC 0xe85250d6
53 /* This should be in %eax. */
54 #define MULTIBOOT2_BOOTLOADER_MAGIC 0x36d76289
56 /* Alignment of multiboot modules. */
57 #if defined(__i386) || defined(__amd64)
58 #define MULTIBOOT_MOD_ALIGN 0x00001000
60 #error No architecture defined
63 /* Alignment of the multiboot info structure. */
64 #define MULTIBOOT_INFO_ALIGN 0x00000008
66 /* Flags set in the 'flags' member of the multiboot header. */
68 #define MULTIBOOT_TAG_ALIGN 8
69 #define MULTIBOOT_TAG_TYPE_END 0
70 #define MULTIBOOT_TAG_TYPE_CMDLINE 1
71 #define MULTIBOOT_TAG_TYPE_BOOT_LOADER_NAME 2
72 #define MULTIBOOT_TAG_TYPE_MODULE 3
73 #define MULTIBOOT_TAG_TYPE_BASIC_MEMINFO 4
74 #define MULTIBOOT_TAG_TYPE_BOOTDEV 5
75 #define MULTIBOOT_TAG_TYPE_MMAP 6
76 #define MULTIBOOT_TAG_TYPE_VBE 7
77 #define MULTIBOOT_TAG_TYPE_FRAMEBUFFER 8
78 #define MULTIBOOT_TAG_TYPE_ELF_SECTIONS 9
79 #define MULTIBOOT_TAG_TYPE_APM 10
80 #define MULTIBOOT_TAG_TYPE_EFI32 11
81 #define MULTIBOOT_TAG_TYPE_EFI64 12
82 #define MULTIBOOT_TAG_TYPE_SMBIOS 13
83 #define MULTIBOOT_TAG_TYPE_ACPI_OLD 14
84 #define MULTIBOOT_TAG_TYPE_ACPI_NEW 15
85 #define MULTIBOOT_TAG_TYPE_NETWORK 16
86 #define MULTIBOOT_TAG_TYPE_EFI_MMAP 17
87 #define MULTIBOOT_TAG_TYPE_EFI_BS 18
88 #define MULTIBOOT_TAG_TYPE_EFI32_IH 19
89 #define MULTIBOOT_TAG_TYPE_EFI64_IH 20
90 #define MULTIBOOT_TAG_TYPE_LOAD_BASE_ADDR 21
92 #define MULTIBOOT_HEADER_TAG_END 0
93 #define MULTIBOOT_HEADER_TAG_INFORMATION_REQUEST 1
94 #define MULTIBOOT_HEADER_TAG_ADDRESS 2
95 #define MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS 3
96 #define MULTIBOOT_HEADER_TAG_CONSOLE_FLAGS 4
97 #define MULTIBOOT_HEADER_TAG_FRAMEBUFFER 5
98 #define MULTIBOOT_HEADER_TAG_MODULE_ALIGN 6
99 #define MULTIBOOT_HEADER_TAG_EFI_BS 7
100 #define MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS_EFI32 8
101 #define MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS_EFI64 9
102 #define MULTIBOOT_HEADER_TAG_RELOCATABLE 10
104 #define MULTIBOOT_ARCHITECTURE_I386 0
105 #define MULTIBOOT_ARCHITECTURE_MIPS32 4
106 #define MULTIBOOT_HEADER_TAG_OPTIONAL 1
108 /* Hints for relocatable kernel load preference */
109 #define MULTIBOOT_LOAD_PREFERENCE_NONE 0
110 #define MULTIBOOT_LOAD_PREFERENCE_LOW 1
111 #define MULTIBOOT_LOAD_PREFERENCE_HIGH 2
113 /* Values for console_flags field in tag multiboot_header_tag_console_flags. */
114 #define MULTIBOOT_CONSOLE_FLAGS_CONSOLE_REQUIRED 1
115 #define MULTIBOOT_CONSOLE_FLAGS_EGA_TEXT_SUPPORTED 2
119 #include <sys/stdint.h>
123 typedef struct multiboot_header_tag
{
127 } multiboot_header_tag_t
;
129 typedef struct multiboot2_header
{
130 /* Must be MULTIBOOT2_MAGIC - see above. */
134 uint32_t mb2_architecture
;
136 /* Total header length. */
137 uint32_t mb2_header_length
;
139 /* The above fields plus this one must equal 0 mod 2^32. */
140 uint32_t mb2_checksum
;
141 multiboot_header_tag_t mb2_tags
[];
142 } multiboot2_header_t
;
144 typedef struct multiboot_header_tag_information_request
{
148 uint32_t mbh_requests
[];
149 } multiboot_header_tag_information_request_t
;
151 typedef struct multiboot_header_tag_address
{
155 uint32_t mbh_header_addr
;
156 uint32_t mbh_load_addr
;
157 uint32_t mbh_load_end_addr
;
158 uint32_t mbh_bss_end_addr
;
159 } multiboot_header_tag_address_t
;
161 typedef struct multiboot_header_tag_entry_address
{
165 uint32_t mbh_entry_addr
;
166 } multiboot_header_tag_entry_address_t
;
168 typedef struct multiboot_header_tag_console_flags
{
172 uint32_t mbh_console_flags
;
173 } multiboot_header_tag_console_flags_t
;
175 typedef struct multiboot_header_tag_framebuffer
{
182 } multiboot_header_tag_framebuffer_t
;
184 typedef struct multiboot_header_tag_module_align
{
188 } multiboot_header_tag_module_align_t
;
190 typedef struct multiboot_header_tag_relocatable
{
194 uint32_t mbh_min_addr
;
195 uint32_t mbh_max_addr
;
197 uint32_t mbh_preference
;
198 } multiboot_header_tag_relocatable_t
;
200 typedef struct multiboot_color
{
206 typedef struct multiboot_mmap_entry
{
209 #define MULTIBOOT_MEMORY_AVAILABLE 1
210 #define MULTIBOOT_MEMORY_RESERVED 2
211 #define MULTIBOOT_MEMORY_ACPI_RECLAIMABLE 3
212 #define MULTIBOOT_MEMORY_NVS 4
213 #define MULTIBOOT_MEMORY_BADRAM 5
215 uint32_t mmap_reserved
;
216 } multiboot_mmap_entry_t
;
218 typedef struct multiboot_tag
{
223 typedef struct multiboot2_info_header
{
224 uint32_t mbi_total_size
;
225 uint32_t mbi_reserved
;
226 multiboot_tag_t mbi_tags
[];
227 } multiboot2_info_header_t
;
229 typedef struct multiboot_tag_string
{
233 } multiboot_tag_string_t
;
235 typedef struct multiboot_tag_module
{
238 uint32_t mb_mod_start
;
241 } multiboot_tag_module_t
;
243 typedef struct multiboot_tag_basic_meminfo
{
246 uint32_t mb_mem_lower
;
247 uint32_t mb_mem_upper
;
248 } multiboot_tag_basic_meminfo_t
;
250 typedef struct multiboot_tag_bootdev
{
256 } multiboot_tag_bootdev_t
;
258 typedef struct multiboot_tag_mmap
{
261 uint32_t mb_entry_size
;
262 uint32_t mb_entry_version
;
263 uint8_t mb_entries
[];
264 } multiboot_tag_mmap_t
;
266 struct multiboot_vbe_info_block
{
267 uint8_t vbe_external_specification
[512];
270 struct multiboot_vbe_mode_info_block
{
271 uint8_t vbe_external_specification
[256];
274 typedef struct multiboot_tag_vbe
{
279 uint16_t vbe_interface_seg
;
280 uint16_t vbe_interface_off
;
281 uint16_t vbe_interface_len
;
283 struct multiboot_vbe_info_block vbe_control_info
;
284 struct multiboot_vbe_mode_info_block vbe_mode_info
;
285 } multiboot_tag_vbe_t
;
287 struct multiboot_tag_framebuffer_common
{
291 uint64_t framebuffer_addr
;
292 uint32_t framebuffer_pitch
;
293 uint32_t framebuffer_width
;
294 uint32_t framebuffer_height
;
295 uint8_t framebuffer_bpp
;
296 #define MULTIBOOT_FRAMEBUFFER_TYPE_INDEXED 0
297 #define MULTIBOOT_FRAMEBUFFER_TYPE_RGB 1
298 #define MULTIBOOT_FRAMEBUFFER_TYPE_EGA_TEXT 2
299 uint8_t framebuffer_type
;
300 uint16_t mb_reserved
;
303 typedef struct multiboot_tag_framebuffer
{
304 struct multiboot_tag_framebuffer_common framebuffer_common
;
308 uint16_t framebuffer_palette_num_colors
;
309 multiboot_color_t framebuffer_palette
[];
312 uint8_t framebuffer_red_field_position
;
313 uint8_t framebuffer_red_mask_size
;
314 uint8_t framebuffer_green_field_position
;
315 uint8_t framebuffer_green_mask_size
;
316 uint8_t framebuffer_blue_field_position
;
317 uint8_t framebuffer_blue_mask_size
;
320 } multiboot_tag_framebuffer_t
;
322 typedef struct multiboot_tag_elf_sections
{
329 } multiboot_tag_elf_sections_t
;
331 typedef struct multiboot_tag_apm
{
340 uint16_t mb_cseg_len
;
341 uint16_t mb_cseg_16_len
;
342 uint16_t mb_dseg_len
;
343 } multiboot_tag_apm_t
;
345 typedef struct multiboot_tag_efi32
{
349 } multiboot_tag_efi32_t
;
351 typedef struct multiboot_tag_efi64
{
355 } multiboot_tag_efi64_t
;
357 typedef struct multiboot_tag_smbios
{
362 uint8_t mb_reserved
[6];
364 } multiboot_tag_smbios_t
;
366 typedef struct multiboot_tag_old_acpi
{
370 } multiboot_tag_old_acpi_t
;
372 typedef struct multiboot_tag_new_acpi
{
376 } multiboot_tag_new_acpi_t
;
378 typedef struct multiboot_tag_network
{
381 uint8_t mb_dhcpack
[];
382 } multiboot_tag_network_t
;
384 typedef struct multiboot_tag_efi_mmap
{
387 uint32_t mb_descr_size
;
388 uint32_t mb_descr_vers
;
389 uint8_t mb_efi_mmap
[];
390 } multiboot_tag_efi_mmap_t
;
392 typedef struct multiboot_tag_efi32_ih
{
396 } multiboot_tag_efi32_ih_t
;
398 typedef struct multiboot_tag_efi64_ih
{
402 } multiboot_tag_efi64_ih_t
;
404 typedef struct multiboot_tag_load_base_addr
{
407 uint32_t mb_load_base_addr
;
408 } multiboot_tag_load_base_addr_t
;
418 #endif /* !_SYS_MULTIBOOT2_H */