summaryrefslogtreecommitdiff
path: root/kernel/mboot/efi.c
blob: 75b869a53f6a5e58fa50de8a11924debad634e53 (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <comus/mboot.h>

#include "mboot.h"

#define MULTIBOOT_TAG_TYPE_EFI64 12
#define MULTIBOOT_TAG_TYPE_EFI64_IH 20

struct multiboot_tag_efi64 {
	uint32_t type;
	uint32_t size;
	uint64_t pointer;
};

struct multiboot_tag_efi64_ih {
	uint32_t type;
	uint32_t size;
	uint64_t pointer;
};

EFI_SYSTEM_TABLE *mboot_get_efi_st(void)
{
	void *tag = locate_mboot_table(MULTIBOOT_TAG_TYPE_EFI64);
	if (tag == NULL)
		return NULL;

	struct multiboot_tag_efi64 *efi = (struct multiboot_tag_efi64 *)tag;
	return (void *)efi->pointer;
}

EFI_HANDLE mboot_get_efi_hdl(void)
{
	void *tag = locate_mboot_table(MULTIBOOT_TAG_TYPE_EFI64_IH);
	if (tag == NULL)
		return NULL;

	struct multiboot_tag_efi64_ih *ih = (struct multiboot_tag_efi64_ih *)tag;
	return (void *)ih->pointer;
}