1 /*
2  * Copyright 2014, General Dynamics C4 Systems
3  *
4  * SPDX-License-Identifier: GPL-2.0-only
5  */
6 
7 #pragma once
8 /* Adapted from the MultiBoot Specification:  */
9 /* www.gnu.org/software/grub/manual/multiboot */
10 
11 #define MULTIBOOT_MAGIC 0x2BADB002
12 
13 #include <types.h>
14 #include <sel4/arch/bootinfo_types.h>
15 
16 typedef struct multiboot_module {
17     uint32_t  start;
18     uint32_t  end;
19     uint32_t  name;
20     uint32_t reserved;
21 } PACKED multiboot_module_t;
22 
23 typedef struct multiboot_mmap {
24     uint32_t size;
25     uint64_t base_addr;
26     uint64_t length;
27     uint32_t type;
28 } PACKED multiboot_mmap_t;
29 
30 typedef struct multiboot_info {
31     /* struct split into multiple parts due to details of how C parser works */
32     struct multiboot_part1 {
33         uint32_t flags;
34         uint32_t mem_lower;
35         uint32_t mem_upper;
36         uint32_t boot_device;
37         uint32_t cmdline;
38         uint32_t mod_count;
39         uint32_t mod_list;
40     } part1;
41     /* The symbol table information in the multiboot header is comprised of a union
42      * as we neither a. support unions in the kernel or b. need the symbol information
43      * we will just skip the 4 words of this */
44     struct multiboot_part2 {
45         uint32_t syms[4];
46         uint32_t mmap_length;
47         uint32_t mmap_addr;
48         uint32_t drives_length;
49         uint32_t drives_addr;
50         uint32_t config_table;
51         uint32_t boot_loader_name;
52         uint32_t apm_table;
53         uint32_t vbe_control_info;
54         uint32_t vbe_mode_info;
55         uint16_t vbe_mode;
56         uint16_t vbe_interface_seg;
57         uint16_t vbe_interface_off;
58         uint16_t vbe_interface_len;
59     } part2;
60 } PACKED multiboot_info_t;
61 
62 #define MULTIBOOT_INFO_MEM_FLAG     BIT(0)
63 #define MULTIBOOT_INFO_CMDLINE_FLAG BIT(2)
64 #define MULTIBOOT_INFO_MODS_FLAG    BIT(3)
65 #define MULTIBOOT_INFO_MMAP_FLAG    BIT(6)
66 #define MULTIBOOT_INFO_GRAPHICS_FLAG BIT(11)
67 #define MULTIBOOT_MMAP_USEABLE_TYPE     1
68 #define MULTIBOOT_MMAP_RESERVED_TYPE    2
69 #define MULTIBOOT_MMAP_ACPI_TYPE        3
70 #define MULTIBOOT_MMAP_ACPI_NVS_TYPE    4
71 #define MULTIBOOT_MMAP_BAD_TYPE         5
72 
73