1829Samenkov/* multiboot2.h - Multiboot 2 header file. */ 29330Slana/* Copyright (C) 1999,2003,2007,2008,2009,2010 Free Software Foundation, Inc. 3829Samenkov * 4829Samenkov * Permission is hereby granted, free of charge, to any person obtaining a copy 5829Samenkov * of this software and associated documentation files (the "Software"), to 6829Samenkov * deal in the Software without restriction, including without limitation the 78729Sserb * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 8829Samenkov * sell copies of the Software, and to permit persons to whom the Software is 9829Samenkov * furnished to do so, subject to the following conditions: 10829Samenkov * 11829Samenkov * The above copyright notice and this permission notice shall be included in 12829Samenkov * all copies or substantial portions of the Software. 13829Samenkov * 14829Samenkov * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15829Samenkov * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16829Samenkov * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ANY 17829Samenkov * DEVELOPER OR DISTRIBUTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 18829Samenkov * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 192362Sohair * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 202362Sohair */ 212362Sohair 22829Samenkov#ifndef MULTIBOOT_HEADER 23829Samenkov#define MULTIBOOT_HEADER 1 24829Samenkov 25829Samenkov/* How many bytes from the start of the file we search for the header. */ 26829Samenkov#define MULTIBOOT_SEARCH 32768 27829Samenkov#define MULTIBOOT_HEADER_ALIGN 8 28829Samenkov 29829Samenkov/* The magic field should contain this. */ 30829Samenkov#define MULTIBOOT2_HEADER_MAGIC 0xe85250d6 31829Samenkov 32829Samenkov/* This should be in %eax. */ 33829Samenkov#define MULTIBOOT2_BOOTLOADER_MAGIC 0x36d76289 34829Samenkov 35829Samenkov/* Alignment of multiboot modules. */ 36829Samenkov#define MULTIBOOT_MOD_ALIGN 0x00001000 37829Samenkov 38829Samenkov/* Alignment of the multiboot info structure. */ 39829Samenkov#define MULTIBOOT_INFO_ALIGN 0x00000008 40829Samenkov 41829Samenkov/* Flags set in the 'flags' member of the multiboot header. */ 42829Samenkov 43829Samenkov#define MULTIBOOT_TAG_ALIGN 8 44829Samenkov#define MULTIBOOT_TAG_TYPE_END 0 45829Samenkov#define MULTIBOOT_TAG_TYPE_CMDLINE 1 46829Samenkov#define MULTIBOOT_TAG_TYPE_BOOT_LOADER_NAME 2 47829Samenkov#define MULTIBOOT_TAG_TYPE_MODULE 3 48829Samenkov#define MULTIBOOT_TAG_TYPE_BASIC_MEMINFO 4 49829Samenkov#define MULTIBOOT_TAG_TYPE_BOOTDEV 5 50829Samenkov#define MULTIBOOT_TAG_TYPE_MMAP 6 51829Samenkov#define MULTIBOOT_TAG_TYPE_VBE 7 52829Samenkov#define MULTIBOOT_TAG_TYPE_FRAMEBUFFER 8 53829Samenkov#define MULTIBOOT_TAG_TYPE_ELF_SECTIONS 9 54829Samenkov#define MULTIBOOT_TAG_TYPE_APM 10 55829Samenkov#define MULTIBOOT_TAG_TYPE_EFI32 11 56829Samenkov#define MULTIBOOT_TAG_TYPE_EFI64 12 57829Samenkov#define MULTIBOOT_TAG_TYPE_SMBIOS 13 58829Samenkov#define MULTIBOOT_TAG_TYPE_ACPI_OLD 14 59829Samenkov#define MULTIBOOT_TAG_TYPE_ACPI_NEW 15 60829Samenkov#define MULTIBOOT_TAG_TYPE_NETWORK 16 61829Samenkov#define MULTIBOOT_TAG_TYPE_EFI_MMAP 17 62829Samenkov#define MULTIBOOT_TAG_TYPE_EFI_BS 18 63829Samenkov#define MULTIBOOT_TAG_TYPE_EFI32_IH 19 64829Samenkov#define MULTIBOOT_TAG_TYPE_EFI64_IH 20 65829Samenkov#define MULTIBOOT_TAG_TYPE_LOAD_BASE_ADDR 21 66829Samenkov 67829Samenkov#define MULTIBOOT_HEADER_TAG_END 0 68829Samenkov#define MULTIBOOT_HEADER_TAG_INFORMATION_REQUEST 1 69829Samenkov#define MULTIBOOT_HEADER_TAG_ADDRESS 2 70829Samenkov#define MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS 3 71829Samenkov#define MULTIBOOT_HEADER_TAG_CONSOLE_FLAGS 4 72829Samenkov#define MULTIBOOT_HEADER_TAG_FRAMEBUFFER 5 73829Samenkov#define MULTIBOOT_HEADER_TAG_MODULE_ALIGN 6 74829Samenkov#define MULTIBOOT_HEADER_TAG_EFI_BS 7 75829Samenkov#define MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS_EFI64 9 76829Samenkov#define MULTIBOOT_HEADER_TAG_RELOCATABLE 10 77829Samenkov 78829Samenkov#define MULTIBOOT2_ARCHITECTURE_I386 0 79829Samenkov#define MULTIBOOT2_ARCHITECTURE_MIPS32 4 80829Samenkov#define MULTIBOOT_HEADER_TAG_OPTIONAL 1 81829Samenkov 82829Samenkov#define MULTIBOOT_LOAD_PREFERENCE_NONE 0 83829Samenkov#define MULTIBOOT_LOAD_PREFERENCE_LOW 1 84829Samenkov#define MULTIBOOT_LOAD_PREFERENCE_HIGH 2 852867Samenkov 86829Samenkov#define MULTIBOOT_CONSOLE_FLAGS_CONSOLE_REQUIRED 1 87829Samenkov#define MULTIBOOT_CONSOLE_FLAGS_EGA_TEXT_SUPPORTED 2 882867Samenkov 89829Samenkov#ifndef ASM_FILE 90829Samenkov 912867Samenkovtypedef unsigned char multiboot_uint8_t; 92829Samenkovtypedef unsigned short multiboot_uint16_t; 93829Samenkovtypedef unsigned int multiboot_uint32_t; 942867Samenkovtypedef unsigned long long multiboot_uint64_t; 95829Samenkov 96829Samenkovstruct multiboot_header 97829Samenkov{ 98829Samenkov /* Must be MULTIBOOT_MAGIC - see above. */ 99829Samenkov multiboot_uint32_t magic; 100829Samenkov 101829Samenkov /* ISA */ 102829Samenkov multiboot_uint32_t architecture; 103829Samenkov 104829Samenkov /* Total header length. */ 105829Samenkov multiboot_uint32_t header_length; 106829Samenkov 107829Samenkov /* The above fields plus this one must equal 0 mod 2^32. */ 108829Samenkov multiboot_uint32_t checksum; 109829Samenkov}; 110829Samenkov 111829Samenkovstruct multiboot_header_tag 112829Samenkov{ 113829Samenkov multiboot_uint16_t type; 114829Samenkov multiboot_uint16_t flags; 115829Samenkov multiboot_uint32_t size; 116829Samenkov}; 117829Samenkov 118829Samenkovstruct multiboot_header_tag_information_request 119829Samenkov{ 120829Samenkov multiboot_uint16_t type; 121829Samenkov multiboot_uint16_t flags; 122829Samenkov multiboot_uint32_t size; 123829Samenkov multiboot_uint32_t requests[0]; 124829Samenkov}; 125829Samenkov 126829Samenkovstruct multiboot_header_tag_address 127829Samenkov{ 128829Samenkov multiboot_uint16_t type; 129829Samenkov multiboot_uint16_t flags; 130829Samenkov multiboot_uint32_t size; 131829Samenkov multiboot_uint32_t header_addr; 132829Samenkov multiboot_uint32_t load_addr; 133829Samenkov multiboot_uint32_t load_end_addr; 134829Samenkov multiboot_uint32_t bss_end_addr; 135829Samenkov}; 136829Samenkov 137829Samenkovstruct multiboot_header_tag_entry_address 138829Samenkov{ 139829Samenkov multiboot_uint16_t type; 140829Samenkov multiboot_uint16_t flags; 141829Samenkov multiboot_uint32_t size; 142829Samenkov multiboot_uint32_t entry_addr; 143829Samenkov}; 144829Samenkov 145829Samenkovstruct multiboot_header_tag_console_flags 146829Samenkov{ 147829Samenkov multiboot_uint16_t type; 148829Samenkov multiboot_uint16_t flags; 149829Samenkov multiboot_uint32_t size; 150829Samenkov multiboot_uint32_t console_flags; 151829Samenkov}; 152829Samenkov 153829Samenkovstruct multiboot_header_tag_framebuffer 154829Samenkov{ 155829Samenkov multiboot_uint16_t type; 156829Samenkov multiboot_uint16_t flags; 157829Samenkov multiboot_uint32_t size; 158829Samenkov multiboot_uint32_t width; 159829Samenkov multiboot_uint32_t height; 160829Samenkov multiboot_uint32_t depth; 161829Samenkov}; 162829Samenkov 163829Samenkovstruct multiboot_header_tag_module_align 164829Samenkov{ 165829Samenkov multiboot_uint16_t type; 166829Samenkov multiboot_uint16_t flags; 167829Samenkov multiboot_uint32_t size; 168829Samenkov}; 169829Samenkov 170829Samenkovstruct multiboot_header_tag_relocatable 171829Samenkov{ 172829Samenkov multiboot_uint16_t type; 173829Samenkov multiboot_uint16_t flags; 174829Samenkov multiboot_uint32_t size; 175829Samenkov multiboot_uint32_t min_addr; 176829Samenkov multiboot_uint32_t max_addr; 177829Samenkov multiboot_uint32_t align; 178829Samenkov multiboot_uint32_t preference; 179829Samenkov}; 180829Samenkov 181829Samenkovstruct multiboot_color 182829Samenkov{ 183829Samenkov multiboot_uint8_t red; 184829Samenkov multiboot_uint8_t green; 185829Samenkov multiboot_uint8_t blue; 186829Samenkov}; 187829Samenkov 188829Samenkovstruct multiboot_mmap_entry 189829Samenkov{ 190829Samenkov multiboot_uint64_t addr; 191829Samenkov multiboot_uint64_t len; 192829Samenkov#define MULTIBOOT_MEMORY_AVAILABLE 1 193829Samenkov#define MULTIBOOT_MEMORY_RESERVED 2 194829Samenkov#define MULTIBOOT_MEMORY_ACPI_RECLAIMABLE 3 195829Samenkov#define MULTIBOOT_MEMORY_NVS 4 196829Samenkov#define MULTIBOOT_MEMORY_BADRAM 5 197829Samenkov multiboot_uint32_t type; 198829Samenkov multiboot_uint32_t zero; 199829Samenkov}; 200829Samenkovtypedef struct multiboot_mmap_entry multiboot_memory_map_t; 201829Samenkov 202829Samenkovstruct multiboot_tag 203829Samenkov{ 204829Samenkov multiboot_uint32_t type; 205829Samenkov multiboot_uint32_t size; 206829Samenkov}; 207829Samenkov 208829Samenkovstruct multiboot_tag_string 209829Samenkov{ 210829Samenkov multiboot_uint32_t type; 211829Samenkov multiboot_uint32_t size; 212829Samenkov char string[0]; 213829Samenkov}; 214829Samenkov 215829Samenkovstruct multiboot_tag_module 216829Samenkov{ 217829Samenkov multiboot_uint32_t type; 218829Samenkov multiboot_uint32_t size; 219829Samenkov multiboot_uint32_t mod_start; 220829Samenkov multiboot_uint32_t mod_end; 221829Samenkov char cmdline[0]; 222829Samenkov}; 223829Samenkov 224829Samenkovstruct multiboot_tag_basic_meminfo 225829Samenkov{ 226829Samenkov multiboot_uint32_t type; 227829Samenkov multiboot_uint32_t size; 228829Samenkov multiboot_uint32_t mem_lower; 229829Samenkov multiboot_uint32_t mem_upper; 230829Samenkov}; 231 232struct multiboot_tag_bootdev 233{ 234 multiboot_uint32_t type; 235 multiboot_uint32_t size; 236 multiboot_uint32_t biosdev; 237 multiboot_uint32_t slice; 238 multiboot_uint32_t part; 239}; 240 241struct multiboot_tag_mmap 242{ 243 multiboot_uint32_t type; 244 multiboot_uint32_t size; 245 multiboot_uint32_t entry_size; 246 multiboot_uint32_t entry_version; 247 struct multiboot_mmap_entry entries[0]; 248}; 249 250struct multiboot_vbe_info_block 251{ 252 multiboot_uint8_t external_specification[512]; 253}; 254 255struct multiboot_vbe_mode_info_block 256{ 257 multiboot_uint8_t external_specification[256]; 258}; 259 260struct multiboot_tag_vbe 261{ 262 multiboot_uint32_t type; 263 multiboot_uint32_t size; 264 265 multiboot_uint16_t vbe_mode; 266 multiboot_uint16_t vbe_interface_seg; 267 multiboot_uint16_t vbe_interface_off; 268 multiboot_uint16_t vbe_interface_len; 269 270 struct multiboot_vbe_info_block vbe_control_info; 271 struct multiboot_vbe_mode_info_block vbe_mode_info; 272}; 273 274struct multiboot_tag_framebuffer_common 275{ 276 multiboot_uint32_t type; 277 multiboot_uint32_t size; 278 279 multiboot_uint64_t framebuffer_addr; 280 multiboot_uint32_t framebuffer_pitch; 281 multiboot_uint32_t framebuffer_width; 282 multiboot_uint32_t framebuffer_height; 283 multiboot_uint8_t framebuffer_bpp; 284#define MULTIBOOT_FRAMEBUFFER_TYPE_INDEXED 0 285#define MULTIBOOT_FRAMEBUFFER_TYPE_RGB 1 286#define MULTIBOOT_FRAMEBUFFER_TYPE_EGA_TEXT 2 287 multiboot_uint8_t framebuffer_type; 288 multiboot_uint16_t reserved; 289}; 290 291struct multiboot_tag_framebuffer 292{ 293 struct multiboot_tag_framebuffer_common common; 294 295 union 296 { 297 struct 298 { 299 multiboot_uint16_t framebuffer_palette_num_colors; 300 struct multiboot_color framebuffer_palette[0]; 301 }; 302 struct 303 { 304 multiboot_uint8_t framebuffer_red_field_position; 305 multiboot_uint8_t framebuffer_red_mask_size; 306 multiboot_uint8_t framebuffer_green_field_position; 307 multiboot_uint8_t framebuffer_green_mask_size; 308 multiboot_uint8_t framebuffer_blue_field_position; 309 multiboot_uint8_t framebuffer_blue_mask_size; 310 }; 311 }; 312}; 313 314struct multiboot_tag_elf_sections 315{ 316 multiboot_uint32_t type; 317 multiboot_uint32_t size; 318 multiboot_uint32_t num; 319 multiboot_uint32_t entsize; 320 multiboot_uint32_t shndx; 321 char sections[0]; 322}; 323 324struct multiboot_tag_apm 325{ 326 multiboot_uint32_t type; 327 multiboot_uint32_t size; 328 multiboot_uint16_t version; 329 multiboot_uint16_t cseg; 330 multiboot_uint32_t offset; 331 multiboot_uint16_t cseg_16; 332 multiboot_uint16_t dseg; 333 multiboot_uint16_t flags; 334 multiboot_uint16_t cseg_len; 335 multiboot_uint16_t cseg_16_len; 336 multiboot_uint16_t dseg_len; 337}; 338 339struct multiboot_tag_efi32 340{ 341 multiboot_uint32_t type; 342 multiboot_uint32_t size; 343 multiboot_uint32_t pointer; 344}; 345 346struct multiboot_tag_efi64 347{ 348 multiboot_uint32_t type; 349 multiboot_uint32_t size; 350 multiboot_uint64_t pointer; 351}; 352 353struct multiboot_tag_smbios 354{ 355 multiboot_uint32_t type; 356 multiboot_uint32_t size; 357 multiboot_uint8_t major; 358 multiboot_uint8_t minor; 359 multiboot_uint8_t reserved[6]; 360 multiboot_uint8_t tables[0]; 361}; 362 363struct multiboot_tag_old_acpi 364{ 365 multiboot_uint32_t type; 366 multiboot_uint32_t size; 367 multiboot_uint8_t rsdp[0]; 368}; 369 370struct multiboot_tag_new_acpi 371{ 372 multiboot_uint32_t type; 373 multiboot_uint32_t size; 374 multiboot_uint8_t rsdp[0]; 375}; 376 377struct multiboot_tag_network 378{ 379 multiboot_uint32_t type; 380 multiboot_uint32_t size; 381 multiboot_uint8_t dhcpack[0]; 382}; 383 384struct multiboot_tag_efi_mmap 385{ 386 multiboot_uint32_t type; 387 multiboot_uint32_t size; 388 multiboot_uint32_t descr_size; 389 multiboot_uint32_t descr_vers; 390 multiboot_uint8_t efi_mmap[0]; 391}; 392 393struct multiboot_tag_efi32_ih 394{ 395 multiboot_uint32_t type; 396 multiboot_uint32_t size; 397 multiboot_uint32_t pointer; 398}; 399 400struct multiboot_tag_efi64_ih 401{ 402 multiboot_uint32_t type; 403 multiboot_uint32_t size; 404 multiboot_uint64_t pointer; 405}; 406 407struct multiboot_tag_load_base_addr 408{ 409 multiboot_uint32_t type; 410 multiboot_uint32_t size; 411 multiboot_uint32_t load_base_addr; 412}; 413 414#endif /* ! ASM_FILE */ 415 416#endif /* ! MULTIBOOT_HEADER */ 417