2 * This file is part of the coreboot project.
4 * Copyright (C) 2003 Free Software Foundation, Inc.
5 * Copyright (C) 2008 Robert Millan
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 * multiboot.h - multiboot header file.
31 /* How many bytes from the start of the file we search for the header. */
32 #define MB_SEARCH 8192
34 /* The magic field should contain this. */
35 #define MB_MAGIC 0x1BADB002
37 /* This should be in %eax. */
38 #define MB_MAGIC2 0x2BADB002
40 /* The bits in the required part of flags field we don't support. */
41 #define MB_UNSUPPORTED 0x0000fffc
43 /* Alignment of multiboot modules. */
44 #define MB_MOD_ALIGN 0x00001000
47 * Flags set in the 'flags' member of the multiboot header.
50 /* Align all boot modules on i386 page (4KB) boundaries. */
51 #define MB_PAGE_ALIGN 0x00000001
53 /* Must pass memory information to OS. */
54 #define MB_MEMORY_INFO 0x00000002
56 /* Must pass video information to OS. */
57 #define MB_VIDEO_MODE 0x00000004
59 /* This flag indicates the use of the address fields in the header. */
60 #define MB_AOUT_KLUDGE 0x00010000
63 * Flags to be set in the 'flags' member of the multiboot info structure.
66 /* is there basic lower/upper memory information? */
67 #define MB_INFO_MEMORY 0x00000001
68 /* is there a boot device set? */
69 #define MB_INFO_BOOTDEV 0x00000002
70 /* is the command-line defined? */
71 #define MB_INFO_CMDLINE 0x00000004
72 /* are there modules to do something with? */
73 #define MB_INFO_MODS 0x00000008
75 /* These next two are mutually exclusive */
77 /* is there a symbol table loaded? */
78 #define MB_INFO_AOUT_SYMS 0x00000010
79 /* is there an ELF section header table? */
80 #define MB_INFO_ELF_SHDR 0x00000020
82 /* is there a full memory map? */
83 #define MB_INFO_MEM_MAP 0x00000040
85 /* Is there drive info? */
86 #define MB_INFO_DRIVE_INFO 0x00000080
88 /* Is there a config table? */
89 #define MB_INFO_CONFIG_TABLE 0x00000100
91 /* Is there a boot loader name? */
92 #define MB_INFO_BOOT_LOADER_NAME 0x00000200
94 /* Is there a APM table? */
95 #define MB_INFO_APM_TABLE 0x00000400
97 /* Is there video information? */
98 #define MB_INFO_VIDEO_INFO 0x00000800
100 struct multiboot_header {
101 /* Must be MB_MAGIC - see above. */
107 /* The above fields plus this one must equal 0 mod 2^32. */
110 /* These are only valid if MB_AOUT_KLUDGE is set. */
111 uint32_t header_addr;
113 uint32_t load_end_addr;
114 uint32_t bss_end_addr;
117 /* These are only valid if MB_VIDEO_MODE is set. */
124 struct multiboot_info {
125 /* Multiboot info version number */
128 /* Available memory from BIOS */
132 /* "root" partition */
133 uint32_t boot_device;
135 /* Kernel command line */
138 /* Boot-Module list */
144 /* Memory Mapping buffer */
145 uint32_t mmap_length;
148 /* Drive Info buffer */
149 uint32_t drives_length;
150 uint32_t drives_addr;
152 /* ROM configuration table */
153 uint32_t config_table;
155 /* Boot Loader Name */
156 uint32_t boot_loader_name;
162 uint32_t vbe_control_info;
163 uint32_t vbe_mode_info;
165 uint16_t vbe_interface_seg;
166 uint16_t vbe_interface_off;
167 uint16_t vbe_interface_len;
170 #define MULTIBOOT_MEMORY_AVAILABLE 1
171 #define MULTIBOOT_MEMORY_RESERVED 2
173 struct multiboot_mmap_entry {
178 } __attribute__ ((packed));
180 extern struct multiboot_info *mbi;
182 unsigned long write_multiboot_info(unsigned long rom_table_end);