multiboot2.h 11 KB

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