4 * \brief Multiboot info structure as defined by GRUB */
6 * (c) 2008-2009 Technische Universität Dresden
7 * This file is part of TUD:OS and distributed under the terms of the
8 * GNU Lesser General Public License 2.1.
9 * Please see the COPYING-LGPL-2.1 file for details.
12 #ifndef L4UTIL_MB_INFO_H
13 #define L4UTIL_MB_INFO_H
17 #include <l4/sys/l4int.h>
20 * \anchor struct_l4util_mod_list
21 * The structure type "mod_list" is used by the
22 * \ref struct_l4util_mb_info "multiboot_info" structure.
27 l4_uint32_t mod_start; /**< Starting address of module in memory. */
28 l4_uint32_t mod_end; /**< End address of module in memory. */
29 l4_uint32_t cmdline; /**< Module command line */
30 l4_uint32_t pad; /**< padding to take it to 16 bytes */
35 * INT-15, AX=E820 style "AddressRangeDescriptor"
36 * ...with a "size" parameter on the front which is the structure size - 4,
37 * pointing to the next one, up until the full buffer length of the memory
38 * map has been reached.
41 typedef struct __attribute__((packed))
43 l4_uint32_t struct_size; /** <Size of structure */
44 l4_uint64_t addr; /** <Start address */
45 l4_uint64_t size; /** <Size of memory range */
46 l4_uint32_t type; /** <type of memory range */
47 /* unspecified optional padding... */
48 } l4util_mb_addr_range_t;
50 #define l4util_mb_for_each_mmap_entry(i, mbi) \
51 for (i = (l4util_mb_addr_range_t *) mbi->mmap_addr; \
52 (unsigned long)i < mbi->mmap_addr + mbi->mmap_length; \
53 i = (l4util_mb_addr_range_t *)((unsigned long)i + mmap->struct_size + sizeof (mmap->struct_size)))
55 /** usable memory "Type", all others are reserved. */
56 #define MB_ARD_MEMORY 1
59 * Address Range Types (ART) from "Advanced Configuration and Power Interface
60 * Specification" Rev3.0a (p. 390). Other values are undefined.
62 #define MB_ART_MEMORY 1 /**< available, usable RAM */
63 #define MB_ART_RESERVED 2 /**< in use or reserved by system */
64 #define MB_ART_ACPI 3 /**< ACPI Reclaim Memory (RAM that contains
66 #define MB_ART_NVS 4 /**< ACPI NVS Memory (must not be used by the OS */
67 #define MB_ART_UNUSABLE 5 /**< memory in which errores have been detected */
70 /** Drive Info structure. */
73 l4_uint32_t size; /** <The size of this structure. */
74 l4_uint8_t drive_number; /** <The BIOS drive number. */
75 l4_uint8_t drive_mode; /** <The access mode (see below). */
76 l4_uint16_t drive_cylinders; /** <number of cylinders */
77 l4_uint8_t drive_heads; /** <number of heads */
78 l4_uint8_t drive_sectors; /** <number of sectors per track */
79 l4_uint16_t drive_ports[0]; /** <Array of I/O ports used for the drive. */
83 #define MB_DI_CHS_MODE 0
84 #define MB_DI_LBA_MODE 1
96 l4_uint16_t cseg_16_len;
97 l4_uint16_t dseg_16_len;
101 /** VBE controller information. */
104 l4_uint8_t signature[4];
106 l4_uint32_t oem_string;
107 l4_uint32_t capabilities;
108 l4_uint32_t video_mode;
109 l4_uint16_t total_memory;
110 l4_uint16_t oem_software_rev;
111 l4_uint32_t oem_vendor_name;
112 l4_uint32_t oem_product_name;
113 l4_uint32_t oem_product_rev;
114 l4_uint8_t reserved[222];
115 l4_uint8_t oem_data[256];
116 } __attribute__((packed)) l4util_mb_vbe_ctrl_t;
119 /** VBE mode information. */
122 /** @name all VESA versions
124 l4_uint16_t mode_attributes;
125 l4_uint8_t win_a_attributes;
126 l4_uint8_t win_b_attributes;
127 l4_uint16_t win_granularity;
128 l4_uint16_t win_size;
129 l4_uint16_t win_a_segment;
130 l4_uint16_t win_b_segment;
131 l4_uint32_t win_func;
132 l4_uint16_t bytes_per_scanline;
135 /** @name >= VESA version 1.2
137 l4_uint16_t x_resolution;
138 l4_uint16_t y_resolution;
139 l4_uint8_t x_char_size;
140 l4_uint8_t y_char_size;
141 l4_uint8_t number_of_planes;
142 l4_uint8_t bits_per_pixel;
143 l4_uint8_t number_of_banks;
144 l4_uint8_t memory_model;
145 l4_uint8_t bank_size;
146 l4_uint8_t number_of_image_pages;
147 l4_uint8_t reserved0;
150 /** @name direct color
152 l4_uint8_t red_mask_size;
153 l4_uint8_t red_field_position;
154 l4_uint8_t green_mask_size;
155 l4_uint8_t green_field_position;
156 l4_uint8_t blue_mask_size;
157 l4_uint8_t blue_field_position;
158 l4_uint8_t reserved_mask_size;
159 l4_uint8_t reserved_field_position;
160 l4_uint8_t direct_color_mode_info;
163 /** @name >= VESA version 2.0
165 l4_uint32_t phys_base;
166 l4_uint32_t reserved1;
167 l4_uint16_t reversed2;
170 /** @name >= VESA version 3.0
172 l4_uint16_t linear_bytes_per_scanline;
173 l4_uint8_t banked_number_of_image_pages;
174 l4_uint8_t linear_number_of_image_pages;
175 l4_uint8_t linear_red_mask_size;
176 l4_uint8_t linear_red_field_position;
177 l4_uint8_t linear_green_mask_size;
178 l4_uint8_t linear_green_field_position;
179 l4_uint8_t linear_blue_mask_size;
180 l4_uint8_t linear_blue_field_position;
181 l4_uint8_t linear_reserved_mask_size;
182 l4_uint8_t linear_reserved_field_position;
183 l4_uint32_t max_pixel_clock;
185 /* The VBE spec says this structure should have a size of 256 bytes but
186 * the described structure layout is only 255 bytes... */
187 l4_uint8_t reserved3[189 + 1];
189 } __attribute__ ((packed)) l4util_mb_vbe_mode_t;
193 * \anchor struct_l4util_mb_info
194 * MultiBoot Info description
196 * This is the struct passed to the boot image. This is done by placing
197 * its address in the EAX register.
202 l4_uint32_t flags; /**< MultiBoot info version number */
203 l4_uint32_t mem_lower; /**< available memory below 1MB */
204 l4_uint32_t mem_upper; /**< available memory starting from 1MB [kB] */
205 l4_uint32_t boot_device; /**< "root" partition */
206 l4_uint32_t cmdline; /**< Kernel command line */
207 l4_uint32_t mods_count; /**< number of modules */
208 l4_uint32_t mods_addr; /**< module list */
214 /** (a.out) Kernel symbol table info */
224 /** (ELF) Kernel section header table */
234 l4_uint32_t mmap_length; /**< size of memory mapping buffer */
235 l4_uint32_t mmap_addr; /**< address of memory mapping buffer */
236 l4_uint32_t drives_length; /**< size of drive info buffer */
237 l4_uint32_t drives_addr; /**< address of driver info buffer */
238 l4_uint32_t config_table; /**< ROM configuration table */
239 l4_uint32_t boot_loader_name; /**< Boot Loader Name */
240 l4_uint32_t apm_table; /**< APM table */
241 l4_uint32_t vbe_ctrl_info; /**< VESA video contoller info */
242 l4_uint32_t vbe_mode_info; /**< VESA video mode info */
243 l4_uint16_t vbe_mode; /**< VESA video mode number */
244 l4_uint16_t vbe_interface_seg; /**< VESA segment of prot BIOS interface */
245 l4_uint16_t vbe_interface_off; /**< VESA offset of prot BIOS interface */
246 l4_uint16_t vbe_interface_len; /**< VESA lenght of prot BIOS interface */
249 #endif /* ! __ASSEMBLY__ */
252 * Flags to be set in the 'flags' parameter above
255 /** is there basic lower/upper memory information? */
256 #define L4UTIL_MB_MEMORY 0x00000001
258 /** is there a boot device set? */
259 #define L4UTIL_MB_BOOTDEV 0x00000002
261 /** is the command-line defined? */
262 #define L4UTIL_MB_CMDLINE 0x00000004
264 /** are there modules to do something with? */
265 #define L4UTIL_MB_MODS 0x00000008
267 /* These next two are mutually exclusive */
268 /** is there a symbol table loaded? */
269 #define L4UTIL_MB_AOUT_SYMS 0x00000010
271 /** is there an ELF section header table? */
272 #define L4UTIL_MB_ELF_SHDR 0x00000020
274 /** is there a full memory map? */
275 #define L4UTIL_MB_MEM_MAP 0x00000040
277 /** Is there drive info? */
278 #define L4UTIL_MB_DRIVE_INFO 0x00000080
280 /** Is there a config table? */
281 #define L4UTIL_MB_CONFIG_TABLE 0x00000100
283 /** Is there a boot loader name? */
284 #define L4UTIL_MB_BOOT_LOADER_NAME 0x00000200
286 /** Is there a APM table? */
287 #define L4UTIL_MB_APM_TABLE 0x00000400
289 /** Is there video information? */
290 #define L4UTIL_MB_VIDEO_INFO 0x00000800
293 /** If we are multiboot-compliant, this value is present in the eax register */
294 #define L4UTIL_MB_VALID 0x2BADB002UL
295 #define L4UTIL_MB_VALID_ASM 0x2BADB002