limine.h (19636B)
1 /* BSD Zero Clause License */ 2 3 /* Copyright (C) 2022-2025 Mintsuki and contributors. 4 * 5 * Permission to use, copy, modify, and/or distribute this software for any 6 * purpose with or without fee is hereby granted. 7 * 8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION 13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 */ 16 17 #ifndef LIMINE_H 18 #define LIMINE_H 1 19 20 #ifdef __cplusplus 21 extern "C" { 22 #endif 23 24 #include <stdint.h> 25 26 /* Misc */ 27 28 #ifdef LIMINE_NO_POINTERS 29 # define LIMINE_PTR(TYPE) uint64_t 30 #else 31 # define LIMINE_PTR(TYPE) TYPE 32 #endif 33 34 #ifndef LIMINE_API_REVISION 35 # define LIMINE_API_REVISION 0 36 #endif 37 38 #if LIMINE_API_REVISION > 3 39 # error "limine.h API revision unsupported" 40 #endif 41 42 #ifdef __GNUC__ 43 # define LIMINE_DEPRECATED __attribute__((__deprecated__)) 44 # define LIMINE_DEPRECATED_IGNORE_START \ 45 _Pragma("GCC diagnostic push") \ 46 _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") 47 # define LIMINE_DEPRECATED_IGNORE_END \ 48 _Pragma("GCC diagnostic pop") 49 #else 50 # define LIMINE_DEPRECATED 51 # define LIMINE_DEPRECATED_IGNORE_START 52 # define LIMINE_DEPRECATED_IGNORE_END 53 #endif 54 55 #define LIMINE_REQUESTS_START_MARKER \ 56 uint64_t limine_requests_start_marker[4] = { 0xf6b8f4b39de7d1ae, 0xfab91a6940fcb9cf, \ 57 0x785c6ed015d3e316, 0x181e920a7852b9d9 }; 58 #define LIMINE_REQUESTS_END_MARKER \ 59 uint64_t limine_requests_end_marker[2] = { 0xadc0e0531bb10d03, 0x9572709f31764c62 }; 60 61 #define LIMINE_REQUESTS_DELIMITER LIMINE_REQUESTS_END_MARKER 62 63 #define LIMINE_BASE_REVISION(N) \ 64 uint64_t limine_base_revision[3] = { 0xf9562b2d5c95a6c8, 0x6a7b384944536bdc, (N) }; 65 66 #define LIMINE_BASE_REVISION_SUPPORTED (limine_base_revision[2] == 0) 67 68 #define LIMINE_LOADED_BASE_REV_VALID (limine_base_revision[1] != 0x6a7b384944536bdc) 69 #define LIMINE_LOADED_BASE_REVISION (limine_base_revision[1]) 70 71 #define LIMINE_COMMON_MAGIC 0xc7b1dd30df4c8b88, 0x0a82e883a194f07b 72 73 struct limine_uuid { 74 uint32_t a; 75 uint16_t b; 76 uint16_t c; 77 uint8_t d[8]; 78 }; 79 80 #define LIMINE_MEDIA_TYPE_GENERIC 0 81 #define LIMINE_MEDIA_TYPE_OPTICAL 1 82 #define LIMINE_MEDIA_TYPE_TFTP 2 83 84 struct limine_file { 85 uint64_t revision; 86 LIMINE_PTR(void *) address; 87 uint64_t size; 88 LIMINE_PTR(char *) path; 89 #if LIMINE_API_REVISION >= 3 90 LIMINE_PTR(char *) string; 91 #else 92 LIMINE_PTR(char *) cmdline; 93 #endif 94 uint32_t media_type; 95 uint32_t unused; 96 uint32_t tftp_ip; 97 uint32_t tftp_port; 98 uint32_t partition_index; 99 uint32_t mbr_disk_id; 100 struct limine_uuid gpt_disk_uuid; 101 struct limine_uuid gpt_part_uuid; 102 struct limine_uuid part_uuid; 103 }; 104 105 /* Boot info */ 106 107 #define LIMINE_BOOTLOADER_INFO_REQUEST { LIMINE_COMMON_MAGIC, 0xf55038d8e2a1202f, 0x279426fcf5f59740 } 108 109 struct limine_bootloader_info_response { 110 uint64_t revision; 111 LIMINE_PTR(char *) name; 112 LIMINE_PTR(char *) version; 113 }; 114 115 struct limine_bootloader_info_request { 116 uint64_t id[4]; 117 uint64_t revision; 118 LIMINE_PTR(struct limine_bootloader_info_response *) response; 119 }; 120 121 /* Executable command line */ 122 123 #define LIMINE_EXECUTABLE_CMDLINE_REQUEST { LIMINE_COMMON_MAGIC, 0x4b161536e598651e, 0xb390ad4a2f1f303a } 124 125 struct limine_executable_cmdline_response { 126 uint64_t revision; 127 LIMINE_PTR(char *) cmdline; 128 }; 129 130 struct limine_executable_cmdline_request { 131 uint64_t id[4]; 132 uint64_t revision; 133 LIMINE_PTR(struct limine_executable_cmdline_response *) response; 134 }; 135 136 /* Firmware type */ 137 138 #define LIMINE_FIRMWARE_TYPE_REQUEST { LIMINE_COMMON_MAGIC, 0x8c2f75d90bef28a8, 0x7045a4688eac00c3 } 139 140 #define LIMINE_FIRMWARE_TYPE_X86BIOS 0 141 #define LIMINE_FIRMWARE_TYPE_UEFI32 1 142 #define LIMINE_FIRMWARE_TYPE_UEFI64 2 143 #define LIMINE_FIRMWARE_TYPE_SBI 3 144 145 struct limine_firmware_type_response { 146 uint64_t revision; 147 uint64_t firmware_type; 148 }; 149 150 struct limine_firmware_type_request { 151 uint64_t id[4]; 152 uint64_t revision; 153 LIMINE_PTR(struct limine_firmware_type_response *) response; 154 }; 155 156 /* Stack size */ 157 158 #define LIMINE_STACK_SIZE_REQUEST { LIMINE_COMMON_MAGIC, 0x224ef0460a8e8926, 0xe1cb0fc25f46ea3d } 159 160 struct limine_stack_size_response { 161 uint64_t revision; 162 }; 163 164 struct limine_stack_size_request { 165 uint64_t id[4]; 166 uint64_t revision; 167 LIMINE_PTR(struct limine_stack_size_response *) response; 168 uint64_t stack_size; 169 }; 170 171 /* HHDM */ 172 173 #define LIMINE_HHDM_REQUEST { LIMINE_COMMON_MAGIC, 0x48dcf1cb8ad2b852, 0x63984e959a98244b } 174 175 struct limine_hhdm_response { 176 uint64_t revision; 177 uint64_t offset; 178 }; 179 180 struct limine_hhdm_request { 181 uint64_t id[4]; 182 uint64_t revision; 183 LIMINE_PTR(struct limine_hhdm_response *) response; 184 }; 185 186 /* Framebuffer */ 187 188 #define LIMINE_FRAMEBUFFER_REQUEST { LIMINE_COMMON_MAGIC, 0x9d5827dcd881dd75, 0xa3148604f6fab11b } 189 190 #define LIMINE_FRAMEBUFFER_RGB 1 191 192 struct limine_video_mode { 193 uint64_t pitch; 194 uint64_t width; 195 uint64_t height; 196 uint16_t bpp; 197 uint8_t memory_model; 198 uint8_t red_mask_size; 199 uint8_t red_mask_shift; 200 uint8_t green_mask_size; 201 uint8_t green_mask_shift; 202 uint8_t blue_mask_size; 203 uint8_t blue_mask_shift; 204 }; 205 206 struct limine_framebuffer { 207 LIMINE_PTR(void *) address; 208 uint64_t width; 209 uint64_t height; 210 uint64_t pitch; 211 uint16_t bpp; 212 uint8_t memory_model; 213 uint8_t red_mask_size; 214 uint8_t red_mask_shift; 215 uint8_t green_mask_size; 216 uint8_t green_mask_shift; 217 uint8_t blue_mask_size; 218 uint8_t blue_mask_shift; 219 uint8_t unused[7]; 220 uint64_t edid_size; 221 LIMINE_PTR(void *) edid; 222 /* Response revision 1 */ 223 uint64_t mode_count; 224 LIMINE_PTR(struct limine_video_mode **) modes; 225 }; 226 227 struct limine_framebuffer_response { 228 uint64_t revision; 229 uint64_t framebuffer_count; 230 LIMINE_PTR(struct limine_framebuffer **) framebuffers; 231 }; 232 233 struct limine_framebuffer_request { 234 uint64_t id[4]; 235 uint64_t revision; 236 LIMINE_PTR(struct limine_framebuffer_response *) response; 237 }; 238 239 /* Terminal */ 240 241 #define LIMINE_TERMINAL_REQUEST { LIMINE_COMMON_MAGIC, 0xc8ac59310c2b0844, 0xa68d0c7265d38878 } 242 243 #define LIMINE_TERMINAL_CB_DEC 10 244 #define LIMINE_TERMINAL_CB_BELL 20 245 #define LIMINE_TERMINAL_CB_PRIVATE_ID 30 246 #define LIMINE_TERMINAL_CB_STATUS_REPORT 40 247 #define LIMINE_TERMINAL_CB_POS_REPORT 50 248 #define LIMINE_TERMINAL_CB_KBD_LEDS 60 249 #define LIMINE_TERMINAL_CB_MODE 70 250 #define LIMINE_TERMINAL_CB_LINUX 80 251 252 #define LIMINE_TERMINAL_CTX_SIZE ((uint64_t)(-1)) 253 #define LIMINE_TERMINAL_CTX_SAVE ((uint64_t)(-2)) 254 #define LIMINE_TERMINAL_CTX_RESTORE ((uint64_t)(-3)) 255 #define LIMINE_TERMINAL_FULL_REFRESH ((uint64_t)(-4)) 256 257 /* Response revision 1 */ 258 #define LIMINE_TERMINAL_OOB_OUTPUT_GET ((uint64_t)(-10)) 259 #define LIMINE_TERMINAL_OOB_OUTPUT_SET ((uint64_t)(-11)) 260 261 #define LIMINE_TERMINAL_OOB_OUTPUT_OCRNL (1 << 0) 262 #define LIMINE_TERMINAL_OOB_OUTPUT_OFDEL (1 << 1) 263 #define LIMINE_TERMINAL_OOB_OUTPUT_OFILL (1 << 2) 264 #define LIMINE_TERMINAL_OOB_OUTPUT_OLCUC (1 << 3) 265 #define LIMINE_TERMINAL_OOB_OUTPUT_ONLCR (1 << 4) 266 #define LIMINE_TERMINAL_OOB_OUTPUT_ONLRET (1 << 5) 267 #define LIMINE_TERMINAL_OOB_OUTPUT_ONOCR (1 << 6) 268 #define LIMINE_TERMINAL_OOB_OUTPUT_OPOST (1 << 7) 269 270 LIMINE_DEPRECATED_IGNORE_START 271 272 struct LIMINE_DEPRECATED limine_terminal; 273 274 typedef void (*limine_terminal_write)(struct limine_terminal *, const char *, uint64_t); 275 typedef void (*limine_terminal_callback)(struct limine_terminal *, uint64_t, uint64_t, uint64_t, uint64_t); 276 277 struct LIMINE_DEPRECATED limine_terminal { 278 uint64_t columns; 279 uint64_t rows; 280 LIMINE_PTR(struct limine_framebuffer *) framebuffer; 281 }; 282 283 struct LIMINE_DEPRECATED limine_terminal_response { 284 uint64_t revision; 285 uint64_t terminal_count; 286 LIMINE_PTR(struct limine_terminal **) terminals; 287 LIMINE_PTR(limine_terminal_write) write; 288 }; 289 290 struct LIMINE_DEPRECATED limine_terminal_request { 291 uint64_t id[4]; 292 uint64_t revision; 293 LIMINE_PTR(struct limine_terminal_response *) response; 294 LIMINE_PTR(limine_terminal_callback) callback; 295 }; 296 297 LIMINE_DEPRECATED_IGNORE_END 298 299 /* Paging mode */ 300 301 #define LIMINE_PAGING_MODE_REQUEST { LIMINE_COMMON_MAGIC, 0x95c1a0edab0944cb, 0xa4e5cb3842f7488a } 302 303 #if defined (__x86_64__) || defined (__i386__) 304 #define LIMINE_PAGING_MODE_X86_64_4LVL 0 305 #define LIMINE_PAGING_MODE_X86_64_5LVL 1 306 #define LIMINE_PAGING_MODE_MIN LIMINE_PAGING_MODE_X86_64_4LVL 307 #define LIMINE_PAGING_MODE_DEFAULT LIMINE_PAGING_MODE_X86_64_4LVL 308 #elif defined (__aarch64__) 309 #define LIMINE_PAGING_MODE_AARCH64_4LVL 0 310 #define LIMINE_PAGING_MODE_AARCH64_5LVL 1 311 #define LIMINE_PAGING_MODE_MIN LIMINE_PAGING_MODE_AARCH64_4LVL 312 #define LIMINE_PAGING_MODE_DEFAULT LIMINE_PAGING_MODE_AARCH64_4LVL 313 #elif defined (__riscv) && (__riscv_xlen == 64) 314 #define LIMINE_PAGING_MODE_RISCV_SV39 0 315 #define LIMINE_PAGING_MODE_RISCV_SV48 1 316 #define LIMINE_PAGING_MODE_RISCV_SV57 2 317 #define LIMINE_PAGING_MODE_MIN LIMINE_PAGING_MODE_RISCV_SV39 318 #define LIMINE_PAGING_MODE_DEFAULT LIMINE_PAGING_MODE_RISCV_SV48 319 #elif defined (__loongarch__) && (__loongarch_grlen == 64) 320 #define LIMINE_PAGING_MODE_LOONGARCH64_4LVL 0 321 #define LIMINE_PAGING_MODE_MIN LIMINE_PAGING_MODE_LOONGARCH64_4LVL 322 #define LIMINE_PAGING_MODE_DEFAULT LIMINE_PAGING_MODE_LOONGARCH64_4LVL 323 #else 324 #error Unknown architecture 325 #endif 326 327 struct limine_paging_mode_response { 328 uint64_t revision; 329 uint64_t mode; 330 }; 331 332 struct limine_paging_mode_request { 333 uint64_t id[4]; 334 uint64_t revision; 335 LIMINE_PTR(struct limine_paging_mode_response *) response; 336 uint64_t mode; 337 uint64_t max_mode; 338 uint64_t min_mode; 339 }; 340 341 /* 5-level paging */ 342 343 #define LIMINE_5_LEVEL_PAGING_REQUEST { LIMINE_COMMON_MAGIC, 0x94469551da9b3192, 0xebe5e86db7382888 } 344 345 LIMINE_DEPRECATED_IGNORE_START 346 347 struct LIMINE_DEPRECATED limine_5_level_paging_response { 348 uint64_t revision; 349 }; 350 351 struct LIMINE_DEPRECATED limine_5_level_paging_request { 352 uint64_t id[4]; 353 uint64_t revision; 354 LIMINE_PTR(struct limine_5_level_paging_response *) response; 355 }; 356 357 LIMINE_DEPRECATED_IGNORE_END 358 359 /* MP */ 360 361 #if LIMINE_API_REVISION >= 1 362 # define LIMINE_MP_REQUEST { LIMINE_COMMON_MAGIC, 0x95a67b819a1b857e, 0xa0b61b723b6a73e0 } 363 # define LIMINE_MP(TEXT) limine_mp_##TEXT 364 #else 365 # define LIMINE_SMP_REQUEST { LIMINE_COMMON_MAGIC, 0x95a67b819a1b857e, 0xa0b61b723b6a73e0 } 366 # define LIMINE_MP(TEXT) limine_smp_##TEXT 367 #endif 368 369 struct LIMINE_MP(info); 370 371 typedef void (*limine_goto_address)(struct LIMINE_MP(info) *); 372 373 #if defined (__x86_64__) || defined (__i386__) 374 375 #if LIMINE_API_REVISION >= 1 376 # define LIMINE_MP_X2APIC (1 << 0) 377 #else 378 # define LIMINE_SMP_X2APIC (1 << 0) 379 #endif 380 381 struct LIMINE_MP(info) { 382 uint32_t processor_id; 383 uint32_t lapic_id; 384 uint64_t reserved; 385 LIMINE_PTR(limine_goto_address) goto_address; 386 uint64_t extra_argument; 387 }; 388 389 struct LIMINE_MP(response) { 390 uint64_t revision; 391 uint32_t flags; 392 uint32_t bsp_lapic_id; 393 uint64_t cpu_count; 394 LIMINE_PTR(struct LIMINE_MP(info) **) cpus; 395 }; 396 397 #elif defined (__aarch64__) 398 399 struct LIMINE_MP(info) { 400 uint32_t processor_id; 401 uint32_t reserved1; 402 uint64_t mpidr; 403 uint64_t reserved; 404 LIMINE_PTR(limine_goto_address) goto_address; 405 uint64_t extra_argument; 406 }; 407 408 struct LIMINE_MP(response) { 409 uint64_t revision; 410 uint64_t flags; 411 uint64_t bsp_mpidr; 412 uint64_t cpu_count; 413 LIMINE_PTR(struct LIMINE_MP(info) **) cpus; 414 }; 415 416 #elif defined (__riscv) && (__riscv_xlen == 64) 417 418 struct LIMINE_MP(info) { 419 uint64_t processor_id; 420 uint64_t hartid; 421 uint64_t reserved; 422 LIMINE_PTR(limine_goto_address) goto_address; 423 uint64_t extra_argument; 424 }; 425 426 struct LIMINE_MP(response) { 427 uint64_t revision; 428 uint64_t flags; 429 uint64_t bsp_hartid; 430 uint64_t cpu_count; 431 LIMINE_PTR(struct LIMINE_MP(info) **) cpus; 432 }; 433 434 #elif defined (__loongarch__) && (__loongarch_grlen == 64) 435 436 struct LIMINE_MP(info) { 437 uint64_t reserved; 438 }; 439 440 struct LIMINE_MP(response) { 441 uint64_t cpu_count; 442 LIMINE_PTR(struct LIMINE_MP(info) **) cpus; 443 }; 444 445 #else 446 #error Unknown architecture 447 #endif 448 449 struct LIMINE_MP(request) { 450 uint64_t id[4]; 451 uint64_t revision; 452 LIMINE_PTR(struct LIMINE_MP(response) *) response; 453 uint64_t flags; 454 }; 455 456 /* Memory map */ 457 458 #define LIMINE_MEMMAP_REQUEST { LIMINE_COMMON_MAGIC, 0x67cf3d9d378a806f, 0xe304acdfc50c3c62 } 459 460 #define LIMINE_MEMMAP_USABLE 0 461 #define LIMINE_MEMMAP_RESERVED 1 462 #define LIMINE_MEMMAP_ACPI_RECLAIMABLE 2 463 #define LIMINE_MEMMAP_ACPI_NVS 3 464 #define LIMINE_MEMMAP_BAD_MEMORY 4 465 #define LIMINE_MEMMAP_BOOTLOADER_RECLAIMABLE 5 466 #if LIMINE_API_REVISION >= 2 467 # define LIMINE_MEMMAP_EXECUTABLE_AND_MODULES 6 468 #else 469 # define LIMINE_MEMMAP_KERNEL_AND_MODULES 6 470 #endif 471 #define LIMINE_MEMMAP_FRAMEBUFFER 7 472 473 struct limine_memmap_entry { 474 uint64_t base; 475 uint64_t length; 476 uint64_t type; 477 }; 478 479 struct limine_memmap_response { 480 uint64_t revision; 481 uint64_t entry_count; 482 LIMINE_PTR(struct limine_memmap_entry **) entries; 483 }; 484 485 struct limine_memmap_request { 486 uint64_t id[4]; 487 uint64_t revision; 488 LIMINE_PTR(struct limine_memmap_response *) response; 489 }; 490 491 /* Entry point */ 492 493 #define LIMINE_ENTRY_POINT_REQUEST { LIMINE_COMMON_MAGIC, 0x13d86c035a1cd3e1, 0x2b0caa89d8f3026a } 494 495 typedef void (*limine_entry_point)(void); 496 497 struct limine_entry_point_response { 498 uint64_t revision; 499 }; 500 501 struct limine_entry_point_request { 502 uint64_t id[4]; 503 uint64_t revision; 504 LIMINE_PTR(struct limine_entry_point_response *) response; 505 LIMINE_PTR(limine_entry_point) entry; 506 }; 507 508 /* Executable File */ 509 510 #if LIMINE_API_REVISION >= 2 511 # define LIMINE_EXECUTABLE_FILE_REQUEST { LIMINE_COMMON_MAGIC, 0xad97e90e83f1ed67, 0x31eb5d1c5ff23b69 } 512 #else 513 # define LIMINE_KERNEL_FILE_REQUEST { LIMINE_COMMON_MAGIC, 0xad97e90e83f1ed67, 0x31eb5d1c5ff23b69 } 514 #endif 515 516 #if LIMINE_API_REVISION >= 2 517 struct limine_executable_file_response { 518 #else 519 struct limine_kernel_file_response { 520 #endif 521 uint64_t revision; 522 #if LIMINE_API_REVISION >= 2 523 LIMINE_PTR(struct limine_file *) executable_file; 524 #else 525 LIMINE_PTR(struct limine_file *) kernel_file; 526 #endif 527 }; 528 529 #if LIMINE_API_REVISION >= 2 530 struct limine_executable_file_request { 531 #else 532 struct limine_kernel_file_request { 533 #endif 534 uint64_t id[4]; 535 uint64_t revision; 536 #if LIMINE_API_REVISION >= 2 537 LIMINE_PTR(struct limine_executable_file_response *) response; 538 #else 539 LIMINE_PTR(struct limine_kernel_file_response *) response; 540 #endif 541 }; 542 543 /* Module */ 544 545 #define LIMINE_MODULE_REQUEST { LIMINE_COMMON_MAGIC, 0x3e7e279702be32af, 0xca1c4f3bd1280cee } 546 547 #define LIMINE_INTERNAL_MODULE_REQUIRED (1 << 0) 548 #define LIMINE_INTERNAL_MODULE_COMPRESSED (1 << 1) 549 550 struct limine_internal_module { 551 LIMINE_PTR(const char *) path; 552 #if LIMINE_API_REVISION >= 3 553 LIMINE_PTR(const char *) string; 554 #else 555 LIMINE_PTR(const char *) cmdline; 556 #endif 557 uint64_t flags; 558 }; 559 560 struct limine_module_response { 561 uint64_t revision; 562 uint64_t module_count; 563 LIMINE_PTR(struct limine_file **) modules; 564 }; 565 566 struct limine_module_request { 567 uint64_t id[4]; 568 uint64_t revision; 569 LIMINE_PTR(struct limine_module_response *) response; 570 571 /* Request revision 1 */ 572 uint64_t internal_module_count; 573 LIMINE_PTR(struct limine_internal_module **) internal_modules; 574 }; 575 576 /* RSDP */ 577 578 #define LIMINE_RSDP_REQUEST { LIMINE_COMMON_MAGIC, 0xc5e77b6b397e7b43, 0x27637845accdcf3c } 579 580 struct limine_rsdp_response { 581 uint64_t revision; 582 #if LIMINE_API_REVISION >= 1 583 uint64_t address; 584 #else 585 LIMINE_PTR(void *) address; 586 #endif 587 }; 588 589 struct limine_rsdp_request { 590 uint64_t id[4]; 591 uint64_t revision; 592 LIMINE_PTR(struct limine_rsdp_response *) response; 593 }; 594 595 /* SMBIOS */ 596 597 #define LIMINE_SMBIOS_REQUEST { LIMINE_COMMON_MAGIC, 0x9e9046f11e095391, 0xaa4a520fefbde5ee } 598 599 struct limine_smbios_response { 600 uint64_t revision; 601 #if LIMINE_API_REVISION >= 1 602 uint64_t entry_32; 603 uint64_t entry_64; 604 #else 605 LIMINE_PTR(void *) entry_32; 606 LIMINE_PTR(void *) entry_64; 607 #endif 608 }; 609 610 struct limine_smbios_request { 611 uint64_t id[4]; 612 uint64_t revision; 613 LIMINE_PTR(struct limine_smbios_response *) response; 614 }; 615 616 /* EFI system table */ 617 618 #define LIMINE_EFI_SYSTEM_TABLE_REQUEST { LIMINE_COMMON_MAGIC, 0x5ceba5163eaaf6d6, 0x0a6981610cf65fcc } 619 620 struct limine_efi_system_table_response { 621 uint64_t revision; 622 #if LIMINE_API_REVISION >= 1 623 uint64_t address; 624 #else 625 LIMINE_PTR(void *) address; 626 #endif 627 }; 628 629 struct limine_efi_system_table_request { 630 uint64_t id[4]; 631 uint64_t revision; 632 LIMINE_PTR(struct limine_efi_system_table_response *) response; 633 }; 634 635 /* EFI memory map */ 636 637 #define LIMINE_EFI_MEMMAP_REQUEST { LIMINE_COMMON_MAGIC, 0x7df62a431d6872d5, 0xa4fcdfb3e57306c8 } 638 639 struct limine_efi_memmap_response { 640 uint64_t revision; 641 LIMINE_PTR(void *) memmap; 642 uint64_t memmap_size; 643 uint64_t desc_size; 644 uint64_t desc_version; 645 }; 646 647 struct limine_efi_memmap_request { 648 uint64_t id[4]; 649 uint64_t revision; 650 LIMINE_PTR(struct limine_efi_memmap_response *) response; 651 }; 652 653 /* Date at boot */ 654 655 #if LIMINE_API_REVISION >= 3 656 # define LIMINE_DATE_AT_BOOT_REQUEST { LIMINE_COMMON_MAGIC, 0x502746e184c088aa, 0xfbc5ec83e6327893 } 657 #else 658 # define LIMINE_BOOT_TIME_REQUEST { LIMINE_COMMON_MAGIC, 0x502746e184c088aa, 0xfbc5ec83e6327893 } 659 #endif 660 661 #if LIMINE_API_REVISION >= 3 662 struct limine_date_at_boot_response { 663 #else 664 struct limine_boot_time_response { 665 #endif 666 uint64_t revision; 667 #if LIMINE_API_REVISION >= 3 668 int64_t timestamp; 669 #else 670 int64_t boot_time; 671 #endif 672 }; 673 674 #if LIMINE_API_REVISION >= 3 675 struct limine_date_at_boot_request { 676 #else 677 struct limine_boot_time_request { 678 #endif 679 uint64_t id[4]; 680 uint64_t revision; 681 #if LIMINE_API_REVISION >= 3 682 LIMINE_PTR(struct limine_date_at_boot_response *) response; 683 #else 684 LIMINE_PTR(struct limine_boot_time_response *) response; 685 #endif 686 }; 687 688 /* Executable address */ 689 690 #if LIMINE_API_REVISION >= 2 691 # define LIMINE_EXECUTABLE_ADDRESS_REQUEST { LIMINE_COMMON_MAGIC, 0x71ba76863cc55f63, 0xb2644a48c516a487 } 692 #else 693 # define LIMINE_KERNEL_ADDRESS_REQUEST { LIMINE_COMMON_MAGIC, 0x71ba76863cc55f63, 0xb2644a48c516a487 } 694 #endif 695 696 #if LIMINE_API_REVISION >= 2 697 struct limine_executable_address_response { 698 #else 699 struct limine_kernel_address_response { 700 #endif 701 uint64_t revision; 702 uint64_t physical_base; 703 uint64_t virtual_base; 704 }; 705 706 #if LIMINE_API_REVISION >= 2 707 struct limine_executable_address_request { 708 #else 709 struct limine_kernel_address_request { 710 #endif 711 uint64_t id[4]; 712 uint64_t revision; 713 #if LIMINE_API_REVISION >= 2 714 LIMINE_PTR(struct limine_executable_address_response *) response; 715 #else 716 LIMINE_PTR(struct limine_kernel_address_response *) response; 717 #endif 718 }; 719 720 /* Device Tree Blob */ 721 722 #define LIMINE_DTB_REQUEST { LIMINE_COMMON_MAGIC, 0xb40ddb48fb54bac7, 0x545081493f81ffb7 } 723 724 struct limine_dtb_response { 725 uint64_t revision; 726 LIMINE_PTR(void *) dtb_ptr; 727 }; 728 729 struct limine_dtb_request { 730 uint64_t id[4]; 731 uint64_t revision; 732 LIMINE_PTR(struct limine_dtb_response *) response; 733 }; 734 735 /* RISC-V Boot Hart ID */ 736 737 #define LIMINE_RISCV_BSP_HARTID_REQUEST { LIMINE_COMMON_MAGIC, 0x1369359f025525f9, 0x2ff2a56178391bb6 } 738 739 struct limine_riscv_bsp_hartid_response { 740 uint64_t revision; 741 uint64_t bsp_hartid; 742 }; 743 744 struct limine_riscv_bsp_hartid_request { 745 uint64_t id[4]; 746 uint64_t revision; 747 LIMINE_PTR(struct limine_riscv_bsp_hartid_response *) response; 748 }; 749 750 #ifdef __cplusplus 751 } 752 #endif 753 754 #endif