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