summaryrefslogtreecommitdiff
path: root/kjarna/efi/protocol.c
diff options
context:
space:
mode:
Diffstat (limited to 'kjarna/efi/protocol.c')
-rw-r--r--kjarna/efi/protocol.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/kjarna/efi/protocol.c b/kjarna/efi/protocol.c
new file mode 100644
index 0000000..e4be9cd
--- /dev/null
+++ b/kjarna/efi/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;
+}
+