summaryrefslogtreecommitdiff
path: root/kjarna/efi/protocol.c
blob: e4be9cd0513796484300e0bef45db294039e3084 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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;
}