summaryrefslogtreecommitdiff
path: root/kernel/mboot/efi.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/mboot/efi.c')
-rw-r--r--kernel/mboot/efi.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/kernel/mboot/efi.c b/kernel/mboot/efi.c
new file mode 100644
index 0000000..75b869a
--- /dev/null
+++ b/kernel/mboot/efi.c
@@ -0,0 +1,38 @@
+#include <comus/mboot.h>
+
+#include "mboot.h"
+
+#define MULTIBOOT_TAG_TYPE_EFI64 12
+#define MULTIBOOT_TAG_TYPE_EFI64_IH 20
+
+struct multiboot_tag_efi64 {
+ uint32_t type;
+ uint32_t size;
+ uint64_t pointer;
+};
+
+struct multiboot_tag_efi64_ih {
+ uint32_t type;
+ uint32_t size;
+ uint64_t pointer;
+};
+
+EFI_SYSTEM_TABLE *mboot_get_efi_st(void)
+{
+ void *tag = locate_mboot_table(MULTIBOOT_TAG_TYPE_EFI64);
+ if (tag == NULL)
+ return NULL;
+
+ struct multiboot_tag_efi64 *efi = (struct multiboot_tag_efi64 *)tag;
+ return (void *)efi->pointer;
+}
+
+EFI_HANDLE mboot_get_efi_hdl(void)
+{
+ void *tag = locate_mboot_table(MULTIBOOT_TAG_TYPE_EFI64_IH);
+ if (tag == NULL)
+ return NULL;
+
+ struct multiboot_tag_efi64_ih *ih = (struct multiboot_tag_efi64_ih *)tag;
+ return (void *)ih->pointer;
+}