diff options
| author | Ada Christine <adachristine18@gmail.com> | 2024-03-03 08:44:42 +0000 |
|---|---|---|
| committer | Ada Christine <adachristine18@gmail.com> | 2024-03-03 08:44:42 +0000 |
| commit | f61da8be06fdfebc598cba783e78117319231140 (patch) | |
| tree | 0ef21f89e98a985ab5d985aaac1e032c868e8b81 /boot/efi/protocol.c | |
| parent | 9681d6a6cbde12b00beab62683b8db98f680ba2b (diff) | |
build changes
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); +} + |
