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