xref: /kvm-unit-tests/lib/efi.h (revision b4e8c300aeef5bcdd329fc2b19c1a1b392280aca)
1 #ifndef _EFI_H_
2 #define _EFI_H_
3 
4 /*
5  * EFI-related functions.
6  *
7  * Copyright (c) 2021, Google Inc, Zixuan Wang <zixuanwang@google.com>
8  *
9  * SPDX-License-Identifier: LGPL-2.0-or-later
10  */
11 #include "linux/efi.h"
12 #include <elf.h>
13 
14 /*
15  * efi_bootinfo_t: stores EFI-related machine info retrieved before exiting EFI
16  * boot services, and is then used by setup_efi(). setup_efi() cannot retrieve
17  * this info as it is called after ExitBootServices and thus some EFI resources
18  * and functions are not available.
19  */
20 typedef struct {
21 	struct efi_boot_memmap mem_map;
22 } efi_bootinfo_t;
23 
24 efi_status_t _relocate(long ldbase, Elf64_Dyn *dyn, efi_handle_t handle,
25 		       efi_system_table_t *sys_tab);
26 efi_status_t efi_get_memory_map(struct efi_boot_memmap *map);
27 efi_status_t efi_exit_boot_services(void *handle, struct efi_boot_memmap *map);
28 efi_status_t efi_get_system_config_table(efi_guid_t table_guid, void **table);
29 efi_status_t efi_main(efi_handle_t handle, efi_system_table_t *sys_tab);
30 
31 #endif /* _EFI_H_ */
32