multiboot2.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417
  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. #ifndef MULTIBOOT_HEADER
  22. #define MULTIBOOT_HEADER 1
  23. /* How many bytes from the start of the file we search for the header. */
  24. #define MULTIBOOT_SEARCH 32768
  25. #define MULTIBOOT_HEADER_ALIGN 8
  26. /* The magic field should contain this. */
  27. #define MULTIBOOT2_HEADER_MAGIC 0xe85250d6
  28. /* This should be in %eax. */
  29. #define MULTIBOOT2_BOOTLOADER_MAGIC 0x36d76289
  30. /* Alignment of multiboot modules. */
  31. #define MULTIBOOT_MOD_ALIGN 0x00001000
  32. /* Alignment of the multiboot info structure. */
  33. #define MULTIBOOT_INFO_ALIGN 0x00000008
  34. /* Flags set in the 'flags' member of the multiboot header. */
  35. #define MULTIBOOT_TAG_ALIGN 8
  36. #define MULTIBOOT_TAG_TYPE_END 0
  37. #define MULTIBOOT_TAG_TYPE_CMDLINE 1
  38. #define MULTIBOOT_TAG_TYPE_BOOT_LOADER_NAME 2
  39. #define MULTIBOOT_TAG_TYPE_MODULE 3
  40. #define MULTIBOOT_TAG_TYPE_BASIC_MEMINFO 4
  41. #define MULTIBOOT_TAG_TYPE_BOOTDEV 5
  42. #define MULTIBOOT_TAG_TYPE_MMAP 6
  43. #define MULTIBOOT_TAG_TYPE_VBE 7
  44. #define MULTIBOOT_TAG_TYPE_FRAMEBUFFER 8
  45. #define MULTIBOOT_TAG_TYPE_ELF_SECTIONS 9
  46. #define MULTIBOOT_TAG_TYPE_APM 10
  47. #define MULTIBOOT_TAG_TYPE_EFI32 11
  48. #define MULTIBOOT_TAG_TYPE_EFI64 12
  49. #define MULTIBOOT_TAG_TYPE_SMBIOS 13
  50. #define MULTIBOOT_TAG_TYPE_ACPI_OLD 14
  51. #define MULTIBOOT_TAG_TYPE_ACPI_NEW 15
  52. #define MULTIBOOT_TAG_TYPE_NETWORK 16
  53. #define MULTIBOOT_TAG_TYPE_EFI_MMAP 17
  54. #define MULTIBOOT_TAG_TYPE_EFI_BS 18
  55. #define MULTIBOOT_TAG_TYPE_EFI32_IH 19
  56. #define MULTIBOOT_TAG_TYPE_EFI64_IH 20
  57. #define MULTIBOOT_TAG_TYPE_LOAD_BASE_ADDR 21
  58. #define MULTIBOOT_HEADER_TAG_END 0
  59. #define MULTIBOOT_HEADER_TAG_INFORMATION_REQUEST 1
  60. #define MULTIBOOT_HEADER_TAG_ADDRESS 2
  61. #define MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS 3
  62. #define MULTIBOOT_HEADER_TAG_CONSOLE_FLAGS 4
  63. #define MULTIBOOT_HEADER_TAG_FRAMEBUFFER 5
  64. #define MULTIBOOT_HEADER_TAG_MODULE_ALIGN 6
  65. #define MULTIBOOT_HEADER_TAG_EFI_BS 7
  66. #define MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS_EFI64 9
  67. #define MULTIBOOT_HEADER_TAG_RELOCATABLE 10
  68. #define MULTIBOOT_ARCHITECTURE_I386 0
  69. #define MULTIBOOT_ARCHITECTURE_MIPS32 4
  70. #define MULTIBOOT_HEADER_TAG_OPTIONAL 1
  71. #define MULTIBOOT_LOAD_PREFERENCE_NONE 0
  72. #define MULTIBOOT_LOAD_PREFERENCE_LOW 1
  73. #define MULTIBOOT_LOAD_PREFERENCE_HIGH 2
  74. #define MULTIBOOT_CONSOLE_FLAGS_CONSOLE_REQUIRED 1
  75. #define MULTIBOOT_CONSOLE_FLAGS_EGA_TEXT_SUPPORTED 2
  76. #ifndef ASM_FILE
  77. typedef unsigned char multiboot_uint8_t;
  78. typedef unsigned short multiboot_uint16_t;
  79. typedef unsigned int multiboot_uint32_t;
  80. typedef unsigned long long multiboot_uint64_t;
  81. struct multiboot_header
  82. {
  83. /* Must be MULTIBOOT_MAGIC - see above. */
  84. multiboot_uint32_t magic;
  85. /* ISA */
  86. multiboot_uint32_t architecture;
  87. /* Total header length. */
  88. multiboot_uint32_t header_length;
  89. /* The above fields plus this one must equal 0 mod 2^32. */
  90. multiboot_uint32_t checksum;
  91. };
  92. struct multiboot_header_tag
  93. {
  94. multiboot_uint16_t type;
  95. multiboot_uint16_t flags;
  96. multiboot_uint32_t size;
  97. };
  98. struct multiboot_header_tag_information_request
  99. {
  100. multiboot_uint16_t type;
  101. multiboot_uint16_t flags;
  102. multiboot_uint32_t size;
  103. multiboot_uint32_t requests[0];
  104. };
  105. struct multiboot_header_tag_address
  106. {
  107. multiboot_uint16_t type;
  108. multiboot_uint16_t flags;
  109. multiboot_uint32_t size;
  110. multiboot_uint32_t header_addr;
  111. multiboot_uint32_t load_addr;
  112. multiboot_uint32_t load_end_addr;
  113. multiboot_uint32_t bss_end_addr;
  114. };
  115. struct multiboot_header_tag_entry_address
  116. {
  117. multiboot_uint16_t type;
  118. multiboot_uint16_t flags;
  119. multiboot_uint32_t size;
  120. multiboot_uint32_t entry_addr;
  121. };
  122. struct multiboot_header_tag_console_flags
  123. {
  124. multiboot_uint16_t type;
  125. multiboot_uint16_t flags;
  126. multiboot_uint32_t size;
  127. multiboot_uint32_t console_flags;
  128. };
  129. struct multiboot_header_tag_framebuffer
  130. {
  131. multiboot_uint16_t type;
  132. multiboot_uint16_t flags;
  133. multiboot_uint32_t size;
  134. multiboot_uint32_t width;
  135. multiboot_uint32_t height;
  136. multiboot_uint32_t depth;
  137. };
  138. struct multiboot_header_tag_module_align
  139. {
  140. multiboot_uint16_t type;
  141. multiboot_uint16_t flags;
  142. multiboot_uint32_t size;
  143. };
  144. struct multiboot_header_tag_relocatable
  145. {
  146. multiboot_uint16_t type;
  147. multiboot_uint16_t flags;
  148. multiboot_uint32_t size;
  149. multiboot_uint32_t min_addr;
  150. multiboot_uint32_t max_addr;
  151. multiboot_uint32_t align;
  152. multiboot_uint32_t preference;
  153. };
  154. struct multiboot_color
  155. {
  156. multiboot_uint8_t red;
  157. multiboot_uint8_t green;
  158. multiboot_uint8_t blue;
  159. };
  160. struct multiboot_mmap_entry
  161. {
  162. multiboot_uint64_t addr;
  163. multiboot_uint64_t len;
  164. #define MULTIBOOT_MEMORY_AVAILABLE 1
  165. #define MULTIBOOT_MEMORY_RESERVED 2
  166. #define MULTIBOOT_MEMORY_ACPI_RECLAIMABLE 3
  167. #define MULTIBOOT_MEMORY_NVS 4
  168. #define MULTIBOOT_MEMORY_BADRAM 5
  169. multiboot_uint32_t type;
  170. multiboot_uint32_t zero;
  171. };
  172. typedef struct multiboot_mmap_entry multiboot_memory_map_t;
  173. struct multiboot_tag
  174. {
  175. multiboot_uint32_t type;
  176. multiboot_uint32_t size;
  177. };
  178. struct multiboot_tag_string
  179. {
  180. multiboot_uint32_t type;
  181. multiboot_uint32_t size;
  182. char string[0];
  183. };
  184. struct multiboot_tag_module
  185. {
  186. multiboot_uint32_t type;
  187. multiboot_uint32_t size;
  188. multiboot_uint32_t mod_start;
  189. multiboot_uint32_t mod_end;
  190. char cmdline[0];
  191. };
  192. struct multiboot_tag_basic_meminfo
  193. {
  194. multiboot_uint32_t type;
  195. multiboot_uint32_t size;
  196. multiboot_uint32_t mem_lower;
  197. multiboot_uint32_t mem_upper;
  198. };
  199. struct multiboot_tag_bootdev
  200. {
  201. multiboot_uint32_t type;
  202. multiboot_uint32_t size;
  203. multiboot_uint32_t biosdev;
  204. multiboot_uint32_t slice;
  205. multiboot_uint32_t part;
  206. };
  207. struct multiboot_tag_mmap
  208. {
  209. multiboot_uint32_t type;
  210. multiboot_uint32_t size;
  211. multiboot_uint32_t entry_size;
  212. multiboot_uint32_t entry_version;
  213. struct multiboot_mmap_entry entries[0];
  214. };
  215. struct multiboot_vbe_info_block
  216. {
  217. multiboot_uint8_t external_specification[512];
  218. };
  219. struct multiboot_vbe_mode_info_block
  220. {
  221. multiboot_uint8_t external_specification[256];
  222. };
  223. struct multiboot_tag_vbe
  224. {
  225. multiboot_uint32_t type;
  226. multiboot_uint32_t size;
  227. multiboot_uint16_t vbe_mode;
  228. multiboot_uint16_t vbe_interface_seg;
  229. multiboot_uint16_t vbe_interface_off;
  230. multiboot_uint16_t vbe_interface_len;
  231. struct multiboot_vbe_info_block vbe_control_info;
  232. struct multiboot_vbe_mode_info_block vbe_mode_info;
  233. };
  234. struct multiboot_tag_framebuffer_common
  235. {
  236. multiboot_uint32_t type;
  237. multiboot_uint32_t size;
  238. multiboot_uint64_t framebuffer_addr;
  239. multiboot_uint32_t framebuffer_pitch;
  240. multiboot_uint32_t framebuffer_width;
  241. multiboot_uint32_t framebuffer_height;
  242. multiboot_uint8_t framebuffer_bpp;
  243. #define MULTIBOOT_FRAMEBUFFER_TYPE_INDEXED 0
  244. #define MULTIBOOT_FRAMEBUFFER_TYPE_RGB 1
  245. #define MULTIBOOT_FRAMEBUFFER_TYPE_EGA_TEXT 2
  246. multiboot_uint8_t framebuffer_type;
  247. multiboot_uint16_t reserved;
  248. };
  249. struct multiboot_tag_framebuffer
  250. {
  251. struct multiboot_tag_framebuffer_common common;
  252. union
  253. {
  254. struct
  255. {
  256. multiboot_uint16_t framebuffer_palette_num_colors;
  257. struct multiboot_color framebuffer_palette[0];
  258. };
  259. struct
  260. {
  261. multiboot_uint8_t framebuffer_red_field_position;
  262. multiboot_uint8_t framebuffer_red_mask_size;
  263. multiboot_uint8_t framebuffer_green_field_position;
  264. multiboot_uint8_t framebuffer_green_mask_size;
  265. multiboot_uint8_t framebuffer_blue_field_position;
  266. multiboot_uint8_t framebuffer_blue_mask_size;
  267. };
  268. };
  269. };
  270. struct multiboot_tag_elf_sections
  271. {
  272. multiboot_uint32_t type;
  273. multiboot_uint32_t size;
  274. multiboot_uint32_t num;
  275. multiboot_uint32_t entsize;
  276. multiboot_uint32_t shndx;
  277. char sections[0];
  278. };
  279. struct multiboot_tag_apm
  280. {
  281. multiboot_uint32_t type;
  282. multiboot_uint32_t size;
  283. multiboot_uint16_t version;
  284. multiboot_uint16_t cseg;
  285. multiboot_uint32_t offset;
  286. multiboot_uint16_t cseg_16;
  287. multiboot_uint16_t dseg;
  288. multiboot_uint16_t flags;
  289. multiboot_uint16_t cseg_len;
  290. multiboot_uint16_t cseg_16_len;
  291. multiboot_uint16_t dseg_len;
  292. };
  293. struct multiboot_tag_efi32
  294. {
  295. multiboot_uint32_t type;
  296. multiboot_uint32_t size;
  297. multiboot_uint32_t pointer;
  298. };
  299. struct multiboot_tag_efi64
  300. {
  301. multiboot_uint32_t type;
  302. multiboot_uint32_t size;
  303. multiboot_uint64_t pointer;
  304. };
  305. struct multiboot_tag_smbios
  306. {
  307. multiboot_uint32_t type;
  308. multiboot_uint32_t size;
  309. multiboot_uint8_t major;
  310. multiboot_uint8_t minor;
  311. multiboot_uint8_t reserved[6];
  312. multiboot_uint8_t tables[0];
  313. };
  314. struct multiboot_tag_old_acpi
  315. {
  316. multiboot_uint32_t type;
  317. multiboot_uint32_t size;
  318. multiboot_uint8_t rsdp[0];
  319. };
  320. struct multiboot_tag_new_acpi
  321. {
  322. multiboot_uint32_t type;
  323. multiboot_uint32_t size;
  324. multiboot_uint8_t rsdp[0];
  325. };
  326. struct multiboot_tag_network
  327. {
  328. multiboot_uint32_t type;
  329. multiboot_uint32_t size;
  330. multiboot_uint8_t dhcpack[0];
  331. };
  332. struct multiboot_tag_efi_mmap
  333. {
  334. multiboot_uint32_t type;
  335. multiboot_uint32_t size;
  336. multiboot_uint32_t descr_size;
  337. multiboot_uint32_t descr_vers;
  338. multiboot_uint8_t efi_mmap[0];
  339. };
  340. struct multiboot_tag_efi32_ih
  341. {
  342. multiboot_uint32_t type;
  343. multiboot_uint32_t size;
  344. multiboot_uint32_t pointer;
  345. };
  346. struct multiboot_tag_efi64_ih
  347. {
  348. multiboot_uint32_t type;
  349. multiboot_uint32_t size;
  350. multiboot_uint64_t pointer;
  351. };
  352. struct multiboot_tag_load_base_addr
  353. {
  354. multiboot_uint32_t type;
  355. multiboot_uint32_t size;
  356. multiboot_uint32_t load_base_addr;
  357. };
  358. #endif /* ! ASM_FILE */
  359. #endif /* ! MULTIBOOT_HEADER */