summaryrefslogtreecommitdiff
path: root/kernel/efi/efi.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/efi/efi.c')
-rw-r--r--kernel/efi/efi.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/kernel/efi/efi.c b/kernel/efi/efi.c
new file mode 100644
index 0000000..4f253a7
--- /dev/null
+++ b/kernel/efi/efi.c
@@ -0,0 +1,28 @@
+#include "lib/klib.h"
+#include <lib.h>
+#include <comus/efi.h>
+#include <comus/mboot.h>
+#include <comus/memory.h>
+#include <efi.h>
+
+#include "efi.h"
+
+void efi_init(EFI_HANDLE IH, EFI_SYSTEM_TABLE *ST)
+{
+ EFI_STATUS status;
+
+ if (IH == NULL || ST == NULL)
+ return;
+
+ status = efi_load_mmap(ST);
+ if (EFI_ERROR(status))
+ panic("Failed to load efi memory map, EFI_STATUS = %lu\n", status);
+
+ status = efi_load_gop(ST);
+ if (EFI_ERROR(status))
+ panic(
+ "Failed to locate graphics output protocol (GOP), EFI_STATUS = %lu\n",
+ status);
+
+ ST->BootServices->ExitBootServices(IH, 0);
+}