]> git.proxmox.com Git - grub2.git/blob - include/multiboot2.h
merged with mainline
[grub2.git] / include / multiboot2.h
1 /* multiboot2.h - Multiboot 2 header file. */
2 /* Copyright (C) 1999,2003,2007,2008,2009,2010 Free Software Foundation, Inc.
3 *
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:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
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.
20 */
21
22 #ifndef MULTIBOOT_HEADER
23 #define MULTIBOOT_HEADER 1
24
25 /* How many bytes from the start of the file we search for the header. */
26 #define MULTIBOOT_SEARCH 32768
27 #define MULTIBOOT_HEADER_ALIGN 8
28
29 /* The magic field should contain this. */
30 #define MULTIBOOT2_HEADER_MAGIC 0xe85250d6
31
32 /* This should be in %eax. */
33 #define MULTIBOOT2_BOOTLOADER_MAGIC 0x36d76289
34
35 /* Alignment of multiboot modules. */
36 #define MULTIBOOT_MOD_ALIGN 0x00001000
37
38 /* Alignment of the multiboot info structure. */
39 #define MULTIBOOT_INFO_ALIGN 0x00000008
40
41 /* Flags set in the 'flags' member of the multiboot header. */
42
43 #define MULTIBOOT_TAG_ALIGN 8
44 #define MULTIBOOT_TAG_TYPE_END 0
45 #define MULTIBOOT_TAG_TYPE_CMDLINE 1
46 #define MULTIBOOT_TAG_TYPE_BOOT_LOADER_NAME 2
47 #define MULTIBOOT_TAG_TYPE_MODULE 3
48 #define MULTIBOOT_TAG_TYPE_BASIC_MEMINFO 4
49 #define MULTIBOOT_TAG_TYPE_BOOTDEV 5
50 #define MULTIBOOT_TAG_TYPE_MMAP 6
51 #define MULTIBOOT_TAG_TYPE_VBE 7
52 #define MULTIBOOT_TAG_TYPE_FRAMEBUFFER 8
53 #define MULTIBOOT_TAG_TYPE_ELF_SECTIONS 9
54 #define MULTIBOOT_TAG_TYPE_APM 10
55
56 #define MULTIBOOT_HEADER_TAG_END 0
57 #define MULTIBOOT_HEADER_TAG_INFORMATION_REQUEST 1
58 #define MULTIBOOT_HEADER_TAG_ADDRESS 2
59 #define MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS 3
60 #define MULTIBOOT_HEADER_TAG_CONSOLE_FLAGS 4
61 #define MULTIBOOT_HEADER_TAG_FRAMEBUFFER 5
62 #define MULTIBOOT_HEADER_TAG_MODULE_ALIGN 6
63
64 #define MULTIBOOT_ARCHITECTURE_I386 0
65 #define MULTIBOOT_ARCHITECTURE_MIPS32 4
66 #define MULTIBOOT_HEADER_TAG_OPTIONAL 1
67
68 #define MULTIBOOT_CONSOLE_FLAGS_CONSOLE_REQUIRED 1
69 #define MULTIBOOT_CONSOLE_FLAGS_EGA_TEXT_SUPPORTED 2
70
71 #ifndef ASM_FILE
72
73 typedef unsigned char multiboot_uint8_t;
74 typedef unsigned short multiboot_uint16_t;
75 typedef unsigned int multiboot_uint32_t;
76 typedef unsigned long long multiboot_uint64_t;
77
78 struct multiboot_header
79 {
80 /* Must be MULTIBOOT_MAGIC - see above. */
81 multiboot_uint32_t magic;
82
83 /* ISA */
84 multiboot_uint32_t architecture;
85
86 /* Total header length. */
87 multiboot_uint32_t header_length;
88
89 /* The above fields plus this one must equal 0 mod 2^32. */
90 multiboot_uint32_t checksum;
91 };
92
93 struct multiboot_header_tag
94 {
95 multiboot_uint16_t type;
96 multiboot_uint16_t flags;
97 multiboot_uint32_t size;
98 };
99
100 struct multiboot_header_tag_information_request
101 {
102 multiboot_uint16_t type;
103 multiboot_uint16_t flags;
104 multiboot_uint32_t size;
105 multiboot_uint32_t requests[0];
106 };
107
108 struct multiboot_header_tag_address
109 {
110 multiboot_uint16_t type;
111 multiboot_uint16_t flags;
112 multiboot_uint32_t size;
113 multiboot_uint32_t header_addr;
114 multiboot_uint32_t load_addr;
115 multiboot_uint32_t load_end_addr;
116 multiboot_uint32_t bss_end_addr;
117 };
118
119 struct multiboot_header_tag_entry_address
120 {
121 multiboot_uint16_t type;
122 multiboot_uint16_t flags;
123 multiboot_uint32_t size;
124 multiboot_uint32_t entry_addr;
125 };
126
127 struct multiboot_header_tag_console_flags
128 {
129 multiboot_uint16_t type;
130 multiboot_uint16_t flags;
131 multiboot_uint32_t size;
132 multiboot_uint32_t console_flags;
133 };
134
135 struct multiboot_header_tag_framebuffer
136 {
137 multiboot_uint16_t type;
138 multiboot_uint16_t flags;
139 multiboot_uint32_t size;
140 multiboot_uint32_t width;
141 multiboot_uint32_t height;
142 multiboot_uint32_t depth;
143 };
144
145 struct multiboot_header_tag_module_align
146 {
147 multiboot_uint16_t type;
148 multiboot_uint16_t flags;
149 multiboot_uint32_t size;
150 multiboot_uint32_t width;
151 multiboot_uint32_t height;
152 multiboot_uint32_t depth;
153 };
154
155 struct multiboot_color
156 {
157 multiboot_uint8_t red;
158 multiboot_uint8_t green;
159 multiboot_uint8_t blue;
160 };
161
162 struct multiboot_mmap_entry
163 {
164 multiboot_uint64_t addr;
165 multiboot_uint64_t len;
166 #define MULTIBOOT_MEMORY_AVAILABLE 1
167 #define MULTIBOOT_MEMORY_RESERVED 2
168 #define MULTIBOOT_MEMORY_ACPI_RECLAIMABLE 3
169 #define MULTIBOOT_MEMORY_NVS 4
170 multiboot_uint32_t type;
171 multiboot_uint32_t zero;
172 } __attribute__((packed));
173 typedef struct multiboot_mmap_entry multiboot_memory_map_t;
174
175 struct multiboot_tag
176 {
177 multiboot_uint32_t type;
178 multiboot_uint32_t size;
179 };
180
181 struct multiboot_tag_string
182 {
183 multiboot_uint32_t type;
184 multiboot_uint32_t size;
185 char string[0];
186 };
187
188 struct multiboot_tag_module
189 {
190 multiboot_uint32_t type;
191 multiboot_uint32_t size;
192 multiboot_uint32_t mod_start;
193 multiboot_uint32_t mod_end;
194 char cmdline[0];
195 };
196
197 struct multiboot_tag_basic_meminfo
198 {
199 multiboot_uint32_t type;
200 multiboot_uint32_t size;
201 multiboot_uint32_t mem_lower;
202 multiboot_uint32_t mem_upper;
203 };
204
205 struct multiboot_tag_bootdev
206 {
207 multiboot_uint32_t type;
208 multiboot_uint32_t size;
209 multiboot_uint32_t biosdev;
210 multiboot_uint32_t slice;
211 multiboot_uint32_t part;
212 };
213
214 struct multiboot_tag_mmap
215 {
216 multiboot_uint32_t type;
217 multiboot_uint32_t size;
218 multiboot_uint32_t entry_size;
219 multiboot_uint32_t entry_version;
220 struct multiboot_mmap_entry entries[0];
221 };
222
223 struct multiboot_vbe_info_block
224 {
225 multiboot_uint8_t external_specification[512];
226 };
227
228 struct multiboot_vbe_mode_info_block
229 {
230 multiboot_uint8_t external_specification[256];
231 };
232
233 struct multiboot_tag_vbe
234 {
235 multiboot_uint32_t type;
236 multiboot_uint32_t size;
237
238 multiboot_uint16_t vbe_mode;
239 multiboot_uint16_t vbe_interface_seg;
240 multiboot_uint16_t vbe_interface_off;
241 multiboot_uint16_t vbe_interface_len;
242
243 struct multiboot_vbe_info_block vbe_control_info;
244 struct multiboot_vbe_mode_info_block vbe_mode_info;
245 };
246
247 struct multiboot_tag_framebuffer_common
248 {
249 multiboot_uint32_t type;
250 multiboot_uint32_t size;
251
252 multiboot_uint64_t framebuffer_addr;
253 multiboot_uint32_t framebuffer_pitch;
254 multiboot_uint32_t framebuffer_width;
255 multiboot_uint32_t framebuffer_height;
256 multiboot_uint8_t framebuffer_bpp;
257 #define MULTIBOOT_FRAMEBUFFER_TYPE_INDEXED 0
258 #define MULTIBOOT_FRAMEBUFFER_TYPE_RGB 1
259 #define MULTIBOOT_FRAMEBUFFER_TYPE_EGA_TEXT 2
260 multiboot_uint8_t framebuffer_type;
261 multiboot_uint16_t reserved;
262 };
263
264 struct multiboot_tag_framebuffer
265 {
266 struct multiboot_tag_framebuffer_common common;
267
268 union
269 {
270 struct
271 {
272 multiboot_uint16_t framebuffer_palette_num_colors;
273 struct multiboot_color framebuffer_palette[0];
274 };
275 struct
276 {
277 multiboot_uint8_t framebuffer_red_field_position;
278 multiboot_uint8_t framebuffer_red_mask_size;
279 multiboot_uint8_t framebuffer_green_field_position;
280 multiboot_uint8_t framebuffer_green_mask_size;
281 multiboot_uint8_t framebuffer_blue_field_position;
282 multiboot_uint8_t framebuffer_blue_mask_size;
283 };
284 };
285 };
286
287 struct multiboot_tag_elf_sections
288 {
289 multiboot_uint32_t type;
290 multiboot_uint32_t size;
291 multiboot_uint32_t num;
292 multiboot_uint32_t entsize;
293 multiboot_uint32_t shndx;
294 char sections[0];
295 };
296
297 struct multiboot_tag_apm
298 {
299 multiboot_uint32_t type;
300 multiboot_uint32_t size;
301 multiboot_uint16_t version;
302 multiboot_uint16_t cseg;
303 multiboot_uint32_t offset;
304 multiboot_uint16_t cseg_16;
305 multiboot_uint16_t dseg;
306 multiboot_uint16_t flags;
307 multiboot_uint16_t cseg_len;
308 multiboot_uint16_t cseg_16_len;
309 multiboot_uint16_t dseg_len;
310 };
311
312 #endif /* ! ASM_FILE */
313
314 #endif /* ! MULTIBOOT_HEADER */