1 /* 2 * GRUB -- GRand Unified Bootloader 3 * Copyright (C) 2000 Free Software Foundation, Inc. 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 */ 19 20 /* 21 * The structure type "mod_list" is used by the "multiboot_info" structure. 22 */ 23 24 #ifndef MBOOT_MB_INFO_H 25 #define MBOOT_MB_INFO_H 26 27 #include <inttypes.h> 28 29 struct mod_list { 30 /* the memory used goes from bytes 'mod_start' to 'mod_end-1' inclusive */ 31 uint32_t mod_start; 32 uint32_t mod_end; 33 34 /* Module command line */ 35 uint32_t cmdline; 36 37 /* padding to take it to 16 bytes (must be zero) */ 38 uint32_t pad; 39 }; 40 41 /* 42 * INT-15, AX=E820 style "AddressRangeDescriptor" 43 * ...with a "size" parameter on the front which is the structure size - 4, 44 * pointing to the next one, up until the full buffer length of the memory 45 * map has been reached. 46 */ 47 48 struct AddrRangeDesc { 49 uint32_t size; 50 uint64_t BaseAddr; 51 uint64_t Length; 52 uint32_t Type; 53 /* unspecified optional padding... */ 54 } __attribute__ ((packed)); 55 56 /* usable memory "Type", all others are reserved. */ 57 #define MB_ARD_MEMORY 1 58 59 /* Drive Info structure. */ 60 struct drive_info { 61 /* The size of this structure. */ 62 uint32_t size; 63 64 /* The BIOS drive number. */ 65 uint8_t drive_number; 66 67 /* The access mode (see below). */ 68 uint8_t drive_mode; 69 70 /* The BIOS geometry. */ 71 uint16_t drive_cylinders; 72 uint8_t drive_heads; 73 uint8_t drive_sectors; 74 75 /* The array of I/O ports used for the drive. */ 76 uint16_t drive_ports[0]; 77 }; 78 79 /* Drive Mode. */ 80 #define MB_DI_CHS_MODE 0 81 #define MB_DI_LBA_MODE 1 82 83 /* APM BIOS info. */ 84 struct apm_info { 85 uint16_t version; 86 uint16_t cseg; 87 uint32_t offset; 88 uint16_t cseg_16; 89 uint16_t dseg_16; 90 uint16_t cseg_len; 91 uint16_t cseg_16_len; 92 uint16_t dseg_16_len; 93 }; 94 95 /* 96 * MultiBoot Info description 97 * 98 * This is the struct passed to the boot image. This is done by placing 99 * its address in the EAX register. 100 */ 101 102 struct multiboot_info { 103 /* MultiBoot info version number */ 104 uint32_t flags; 105 106 /* Available memory from BIOS */ 107 uint32_t mem_lower; 108 uint32_t mem_upper; 109 110 /* "root" partition */ 111 uint32_t boot_device; 112 113 /* Kernel command line */ 114 uint32_t cmdline; 115 116 /* Boot-Module list */ 117 uint32_t mods_count; 118 uint32_t mods_addr; 119 120 union { 121 struct { 122 /* (a.out) Kernel symbol table info */ 123 uint32_t tabsize; 124 uint32_t strsize; 125 uint32_t addr; 126 uint32_t pad; 127 } a; 128 struct { 129 /* (ELF) Kernel section header table */ 130 uint32_t num; 131 uint32_t size; 132 uint32_t addr; 133 uint32_t shndx; 134 } e; 135 } syms; 136 137 /* Memory Mapping buffer */ 138 uint32_t mmap_length; 139 uint32_t mmap_addr; 140 141 /* Drive Info buffer */ 142 uint32_t drives_length; 143 uint32_t drives_addr; 144 145 /* ROM configuration table */ 146 uint32_t config_table; 147 148 /* Boot Loader Name */ 149 uint32_t boot_loader_name; 150 151 /* APM table */ 152 uint32_t apm_table; 153 154 /* Video */ 155 uint32_t vbe_control_info; 156 uint32_t vbe_mode_info; 157 uint16_t vbe_mode; 158 uint16_t vbe_interface_seg; 159 uint16_t vbe_interface_off; 160 uint16_t vbe_interface_len; 161 }; 162 163 /* 164 * Flags to be set in the 'flags' parameter above 165 */ 166 167 /* is there basic lower/upper memory information? */ 168 #define MB_INFO_MEMORY 0x00000001 169 /* is there a boot device set? */ 170 #define MB_INFO_BOOTDEV 0x00000002 171 /* is the command-line defined? */ 172 #define MB_INFO_CMDLINE 0x00000004 173 /* are there modules to do something with? */ 174 #define MB_INFO_MODS 0x00000008 175 176 /* These next two are mutually exclusive */ 177 178 /* is there a symbol table loaded? */ 179 #define MB_INFO_AOUT_SYMS 0x00000010 180 /* is there an ELF section header table? */ 181 #define MB_INFO_ELF_SHDR 0x00000020 182 183 /* is there a full memory map? */ 184 #define MB_INFO_MEM_MAP 0x00000040 185 186 /* Is there drive info? */ 187 #define MB_INFO_DRIVE_INFO 0x00000080 188 189 /* Is there a config table? */ 190 #define MB_INFO_CONFIG_TABLE 0x00000100 191 192 /* Is there a boot loader name? */ 193 #define MB_INFO_BOOT_LOADER_NAME 0x00000200 194 195 /* Is there a APM table? */ 196 #define MB_INFO_APM_TABLE 0x00000400 197 198 /* Is there video information? */ 199 #define MB_INFO_VIDEO_INFO 0x00000800 200 201 /* 202 * The following value must be present in the EAX register. 203 */ 204 205 #define MULTIBOOT_VALID 0x2BADB002 206 207 #endif /* MBOOT_MB_INFO_H */ 208