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 * Define a GUID that we can use to to pass environment variables. 16 * 17 * For example, to set the variable var to the value val via the EFI shell: 18 * # setvar env -guid 97ef3e03-7329-4a6a-b9ba-6c1fdcc5f823 -rt =L"val" 19 */ 20 #define EFI_VAR_GUID EFI_GUID(0x97ef3e03, 0x7329, 0x4a6a, 0xb9, 0xba, 0x6c, 0x1f, 0xdc, 0xc5, 0xf8, 0x23); 21 22 /* Names of environment variables we can handle */ 23 #define ENV_VARNAME_DTBFILE L"fdtfile" 24 25 /* 26 * efi_bootinfo_t: stores EFI-related machine info retrieved before exiting EFI 27 * boot services, and is then used by setup_efi(). setup_efi() cannot retrieve 28 * this info as it is called after ExitBootServices and thus some EFI resources 29 * and functions are not available. 30 */ 31 typedef struct { 32 struct efi_boot_memmap mem_map; 33 const void *fdt; 34 } efi_bootinfo_t; 35 36 efi_status_t _relocate(long ldbase, Elf64_Dyn *dyn, efi_handle_t handle, 37 efi_system_table_t *sys_tab); 38 efi_status_t efi_get_memory_map(struct efi_boot_memmap *map); 39 efi_status_t efi_exit_boot_services(void *handle, struct efi_boot_memmap *map); 40 efi_status_t efi_get_system_config_table(efi_guid_t table_guid, void **table); 41 efi_status_t efi_main(efi_handle_t handle, efi_system_table_t *sys_tab); 42 43 #endif /* _EFI_H_ */ 44