From f61da8be06fdfebc598cba783e78117319231140 Mon Sep 17 00:00:00 2001 From: Ada Christine Date: Sun, 3 Mar 2024 08:44:42 +0000 Subject: build changes --- boot/efi/protocol.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 boot/efi/protocol.c (limited to 'boot/efi/protocol.c') diff --git a/boot/efi/protocol.c b/boot/efi/protocol.c new file mode 100644 index 0000000..6bf8123 --- /dev/null +++ b/boot/efi/protocol.c @@ -0,0 +1,33 @@ +#include + +#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; +} + +void efi_close_protocol(EFI_HANDLE handle, EFI_GUID *guid) +{ + efi_errno = gBS->CloseProtocol( + handle, + guid, + efi_context->handle, + nullptr); +} + -- cgit v1.3.1-1-g115d