diff options
Diffstat (limited to 'boot/efi/protocol.c')
| -rw-r--r-- | boot/efi/protocol.c | 33 |
1 files changed, 33 insertions, 0 deletions
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 <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; +} + +void efi_close_protocol(EFI_HANDLE handle, EFI_GUID *guid) +{ + efi_errno = gBS->CloseProtocol( + handle, + guid, + efi_context->handle, + nullptr); +} + |
