summaryrefslogtreecommitdiff
path: root/kjarna/protocol.c
diff options
context:
space:
mode:
authorAda Christine <adachristine18@gmail.com>2024-02-11 23:48:04 +0000
committerAda Christine <adachristine18@gmail.com>2024-02-11 23:48:04 +0000
commit3f9278b48ff4bc0d2cf1604034b3bba548572f04 (patch)
treedbdabed3ff580079d2e21045d2cbc5b274c2e418 /kjarna/protocol.c
parent9fbfc6e951e565ef98c49c1dcfc4b6a39514f17d (diff)
kjarna initial impl
Diffstat (limited to 'kjarna/protocol.c')
-rw-r--r--kjarna/protocol.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/kjarna/protocol.c b/kjarna/protocol.c
new file mode 100644
index 0000000..e4be9cd
--- /dev/null
+++ b/kjarna/protocol.c
@@ -0,0 +1,24 @@
+#include <efi/error.h>
+
+#include "kjarna_efi.h"
+
+void *efi_get_protocol(EFI_HANDLE handle, EFI_GUID *guid)
+{
+ void *protocol;
+
+ efi_errno = gBS->OpenProtocol(
+ handle,
+ guid,
+ &protocol,
+ efi_context->handle,
+ nullptr,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL);
+
+ if (EFI_ERROR(efi_errno))
+ {
+ return nullptr;
+ }
+
+ return protocol;
+}
+