L4Re - L4 Runtime Environment
mb_info.h
Go to the documentation of this file.
1 
5 /*
6  * (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
7  * Frank Mehnert <fm3@os.inf.tu-dresden.de>
8  * economic rights: Technische Universit├Ąt Dresden (Germany)
9  * This file is part of TUD:OS and distributed under the terms of the
10  * GNU Lesser General Public License 2.1.
11  * Please see the COPYING-LGPL-2.1 file for details.
12  */
13 
14 #ifndef L4UTIL_MB_INFO_H
15 #define L4UTIL_MB_INFO_H
16 
17 /******************************************************************************
18  * Multiboot (v1)
19  *****************************************************************************/
20 
21 #ifndef __ASSEMBLY__
22 
23 #include <l4/sys/l4int.h>
24 
31 typedef struct
32 {
38 
39 
47 typedef struct __attribute__((packed))
48 {
53  /* unspecified optional padding... */
55 
56 #define l4util_mb_for_each_mmap_entry(i, mbi) \
57  for (i = (l4util_mb_addr_range_t *)(unsigned long)mbi->mmap_addr; \
58  (unsigned long)i < (unsigned long)mbi->mmap_addr + mbi->mmap_length; \
59  i = (l4util_mb_addr_range_t *)((unsigned long)i + mmap->struct_size + sizeof (mmap->struct_size)))
60 
62 #define MB_ARD_MEMORY 1
63 
68 #define MB_ART_MEMORY 1
69 #define MB_ART_RESERVED 2
70 #define MB_ART_ACPI 3
72 #define MB_ART_NVS 4
73 #define MB_ART_UNUSABLE 5
77 typedef struct
78 {
79  l4_uint32_t size;
80  l4_uint8_t drive_number;
81  l4_uint8_t drive_mode;
82  l4_uint16_t drive_cylinders;
83  l4_uint8_t drive_heads;
84  l4_uint8_t drive_sectors;
85  l4_uint16_t drive_ports[0];
87 
88 /* Drive Mode. */
89 #define MB_DI_CHS_MODE 0
90 #define MB_DI_LBA_MODE 1
91 
92 
94 typedef struct
95 {
96  l4_uint16_t version;
97  l4_uint16_t cseg;
98  l4_uint32_t offset;
99  l4_uint16_t cseg_16;
100  l4_uint16_t dseg_16;
101  l4_uint16_t cseg_len;
102  l4_uint16_t cseg_16_len;
103  l4_uint16_t dseg_16_len;
105 
106 
108 typedef struct
109 {
110  l4_uint8_t signature[4];
111  l4_uint16_t version;
112  l4_uint32_t oem_string;
113  l4_uint32_t capabilities;
114  l4_uint32_t video_mode;
115  l4_uint16_t total_memory;
116  l4_uint16_t oem_software_rev;
117  l4_uint32_t oem_vendor_name;
118  l4_uint32_t oem_product_name;
119  l4_uint32_t oem_product_rev;
120  l4_uint8_t reserved[222];
121  l4_uint8_t oem_data[256];
122 } __attribute__((packed)) l4util_mb_vbe_ctrl_t;
123 
124 
126 typedef struct
127 {
130  l4_uint16_t mode_attributes;
131  l4_uint8_t win_a_attributes;
132  l4_uint8_t win_b_attributes;
133  l4_uint16_t win_granularity;
134  l4_uint16_t win_size;
135  l4_uint16_t win_a_segment;
136  l4_uint16_t win_b_segment;
137  l4_uint32_t win_func;
138  l4_uint16_t bytes_per_scanline;
143  l4_uint16_t x_resolution;
144  l4_uint16_t y_resolution;
145  l4_uint8_t x_char_size;
146  l4_uint8_t y_char_size;
147  l4_uint8_t number_of_planes;
148  l4_uint8_t bits_per_pixel;
149  l4_uint8_t number_of_banks;
150  l4_uint8_t memory_model;
151  l4_uint8_t bank_size;
152  l4_uint8_t number_of_image_pages;
153  l4_uint8_t reserved0;
158  l4_uint8_t red_mask_size;
159  l4_uint8_t red_field_position;
160  l4_uint8_t green_mask_size;
161  l4_uint8_t green_field_position;
162  l4_uint8_t blue_mask_size;
163  l4_uint8_t blue_field_position;
164  l4_uint8_t reserved_mask_size;
165  l4_uint8_t reserved_field_position;
166  l4_uint8_t direct_color_mode_info;
171  l4_uint32_t phys_base;
172  l4_uint32_t reserved1;
173  l4_uint16_t reversed2;
178  l4_uint16_t linear_bytes_per_scanline;
179  l4_uint8_t banked_number_of_image_pages;
180  l4_uint8_t linear_number_of_image_pages;
181  l4_uint8_t linear_red_mask_size;
182  l4_uint8_t linear_red_field_position;
183  l4_uint8_t linear_green_mask_size;
184  l4_uint8_t linear_green_field_position;
185  l4_uint8_t linear_blue_mask_size;
186  l4_uint8_t linear_blue_field_position;
187  l4_uint8_t linear_reserved_mask_size;
188  l4_uint8_t linear_reserved_field_position;
189  l4_uint32_t max_pixel_clock;
190 
191  /* The VBE spec says this structure should have a size of 256 bytes but
192  * the described structure layout is only 255 bytes... */
193  l4_uint8_t reserved3[189 + 1];
195 } __attribute__ ((packed)) l4util_mb_vbe_mode_t;
196 
197 
206 typedef struct
207 {
208  l4_uint32_t flags;
209  l4_uint32_t mem_lower;
210  l4_uint32_t mem_upper;
211  l4_uint32_t boot_device;
212  l4_uint32_t cmdline;
213  l4_uint32_t mods_count;
214  l4_uint32_t mods_addr;
216  union
217  {
218  struct
219  {
221  l4_uint32_t tabsize;
222  l4_uint32_t strsize;
223  l4_uint32_t addr;
224  l4_uint32_t pad;
225  }
226  a;
227 
228  struct
229  {
231  l4_uint32_t num;
233  l4_uint32_t addr;
234  l4_uint32_t shndx;
235  }
236  e;
237  }
238  syms;
239 
240  l4_uint32_t mmap_length;
241  l4_uint32_t mmap_addr;
242  l4_uint32_t drives_length;
243  l4_uint32_t drives_addr;
244  l4_uint32_t config_table;
245  l4_uint32_t boot_loader_name;
246  l4_uint32_t apm_table;
247  l4_uint32_t vbe_ctrl_info;
248  l4_uint32_t vbe_mode_info;
249  l4_uint16_t vbe_mode;
250  l4_uint16_t vbe_interface_seg;
251  l4_uint16_t vbe_interface_off;
252  l4_uint16_t vbe_interface_len;
254 
255 #endif /* ! __ASSEMBLY__ */
256 
262 #define L4UTIL_MB_MEMORY 0x00000001
265 #define L4UTIL_MB_BOOTDEV 0x00000002
268 #define L4UTIL_MB_CMDLINE 0x00000004
271 #define L4UTIL_MB_MODS 0x00000008
273 /* These next two are mutually exclusive */
275 #define L4UTIL_MB_AOUT_SYMS 0x00000010
278 #define L4UTIL_MB_ELF_SHDR 0x00000020
281 #define L4UTIL_MB_MEM_MAP 0x00000040
284 #define L4UTIL_MB_DRIVE_INFO 0x00000080
287 #define L4UTIL_MB_CONFIG_TABLE 0x00000100
290 #define L4UTIL_MB_BOOT_LOADER_NAME 0x00000200
293 #define L4UTIL_MB_APM_TABLE 0x00000400
296 #define L4UTIL_MB_VIDEO_INFO 0x00000800
298 
300 #define L4UTIL_MB_VALID 0x2BADB002UL
301 #define L4UTIL_MB_VALID_ASM 0x2BADB002
302 
303 
304 /******************************************************************************
305  * Multiboot2
306  *****************************************************************************/
307 
308 #ifndef __ASSEMBLY__
309 
310 typedef struct
311 {
312  l4_uint32_t total_size;
313  l4_uint32_t reserved;
314 } __attribute__((packed)) l4util_mb2_info_t;
315 
316 typedef struct
317 {
318  char string[0];
319 } __attribute__((packed)) l4util_mb2_cmdline_tag_t;
320 
321 typedef struct
322 {
323  l4_uint32_t mod_start;
324  l4_uint32_t mod_end;
325  char string[];
326 } __attribute__((packed)) l4util_mb2_module_tag_t;
327 
328 typedef struct
329 {
330  l4_uint64_t base_addr;
331  l4_uint64_t length;
332  l4_uint32_t type;
333  l4_uint32_t reserved;
334 } __attribute__((packed)) l4util_mb2_memmap_entry_t;
335 
336 typedef struct
337 {
338  l4_uint32_t entry_size;
339  l4_uint32_t entry_version;
340  l4util_mb2_memmap_entry_t entries[];
341 } __attribute__((packed)) l4util_mb2_memmap_tag_t;
342 
343 typedef struct
344 {
345  char data[0];
346 } __attribute__((packed)) l4util_mb2_rsdp_tag_t;
347 
348 typedef struct
349 {
350  l4_uint32_t type;
351  l4_uint32_t size;
352 
353  union
354  {
355  l4util_mb2_cmdline_tag_t cmdline;
356  l4util_mb2_module_tag_t module;
357  l4util_mb2_memmap_tag_t memmap;
358  l4util_mb2_rsdp_tag_t rsdp;
359  };
360 } __attribute__((packed)) l4util_mb2_tag_t;
361 
362 #endif /* ! __ASSEMBLY__ */
363 
364 
365 #define L4UTIL_MB2_MAGIC 0xE85250D6
366 #define L4UTIL_MB2_ARCH_I386 0x0
367 
368 #define L4UTIL_MB2_TERMINATOR_HEADER_TAG 0
369 #define L4UTIL_MB2_INFO_REQUEST_HEADER_TAG 1
370 #define L4UTIL_MB2_ENTRY_ADDRESS_HEADER_TAG 3
371 
372 #define L4UTIL_MB2_TAG_FLAG_REQUIRED 0
373 
374 #define L4UTIL_MB2_TAG_ALIGN_SHIFT 3
375 #define L4UTIL_MB2_TAG_ALIGN 8
376 
377 #define L4UTIL_MB2_TERMINATOR_INFO_TAG 0
378 #define L4UTIL_MB2_BOOT_CMDLINE_INFO_TAG 1
379 #define L4UTIL_MB2_MODULE_INFO_TAG 3
380 #define L4UTIL_MB2_MEMORY_MAP_INFO_TAG 6
381 #define L4UTIL_MB2_RSDP_OLD_INFO_TAG 14
382 #define L4UTIL_MB2_RSDP_NEW_INFO_TAG 15
383 
384 #endif
Drive Info structure.
Definition: mb_info.h:78
l4_uint32_t pad
padding to take it to 16 bytes
Definition: mb_info.h:36
unsigned short int l4_uint16_t
Unsigned 16bit value.
Definition: l4int.h:38
l4_uint32_t type
type of memory range
Definition: mb_info.h:52
l4_uint32_t cmdline
Module command line.
Definition: mb_info.h:35
l4_uint64_t addr
Start address.
Definition: mb_info.h:50
l4_uint32_t mod_end
End address of module in memory.
Definition: mb_info.h:34
l4_uint32_t struct_size
Size of structure.
Definition: mb_info.h:49
VBE controller information.
Definition: mb_info.h:109
VBE mode information.
Definition: mb_info.h:127
APM BIOS info.
Definition: mb_info.h:95
unsigned char l4_uint8_t
Unsigned 8bit value.
Definition: l4int.h:36
INT-15, AX=E820 style "AddressRangeDescriptor" ...with a "size" parameter on the front which is the s...
Definition: mb_info.h:47
unsigned long long l4_uint64_t
Unsigned 64bit value.
Definition: l4int.h:42
l4_uint32_t mod_start
Starting address of module in memory.
Definition: mb_info.h:33
l4_uint64_t size
Size of memory range.
Definition: mb_info.h:51
unsigned int l4_uint32_t
Unsigned 32bit value.
Definition: l4int.h:40