#ifndef _LINUX_EFI_H
#define _LINUX_EFI_H
#include <linux/init.h>
#include <linux/string.h>
#include <linux/time.h>
#include <linux/types.h>
#include <linux/proc_fs.h>
#include <linux/rtc.h>
#include <linux/ioport.h>
#include <linux/pfn.h>
#include <linux/pstore.h>
#include <linux/range.h>
#include <linux/reboot.h>
#include <linux/uuid.h>
#include <asm/page.h>
struct screen_info;
#define EFI_SUCCESS …
#define EFI_LOAD_ERROR …
#define EFI_INVALID_PARAMETER …
#define EFI_UNSUPPORTED …
#define EFI_BAD_BUFFER_SIZE …
#define EFI_BUFFER_TOO_SMALL …
#define EFI_NOT_READY …
#define EFI_DEVICE_ERROR …
#define EFI_WRITE_PROTECTED …
#define EFI_OUT_OF_RESOURCES …
#define EFI_NOT_FOUND …
#define EFI_ACCESS_DENIED …
#define EFI_TIMEOUT …
#define EFI_ABORTED …
#define EFI_SECURITY_VIOLATION …
efi_status_t;
efi_bool_t;
efi_char16_t;
efi_physical_addr_t;
efi_handle_t;
#if defined(CONFIG_X86_64)
#define __efiapi …
#elif defined(CONFIG_X86_32)
#define __efiapi …
#else
#define __efiapi
#endif
efi_guid_t __aligned(…);
#define EFI_GUID(a, b, c, d...) …
efi_table_hdr_t;
#define EFI_RESERVED_TYPE …
#define EFI_LOADER_CODE …
#define EFI_LOADER_DATA …
#define EFI_BOOT_SERVICES_CODE …
#define EFI_BOOT_SERVICES_DATA …
#define EFI_RUNTIME_SERVICES_CODE …
#define EFI_RUNTIME_SERVICES_DATA …
#define EFI_CONVENTIONAL_MEMORY …
#define EFI_UNUSABLE_MEMORY …
#define EFI_ACPI_RECLAIM_MEMORY …
#define EFI_ACPI_MEMORY_NVS …
#define EFI_MEMORY_MAPPED_IO …
#define EFI_MEMORY_MAPPED_IO_PORT_SPACE …
#define EFI_PAL_CODE …
#define EFI_PERSISTENT_MEMORY …
#define EFI_UNACCEPTED_MEMORY …
#define EFI_MAX_MEMORY_TYPE …
#define EFI_MEMORY_UC …
#define EFI_MEMORY_WC …
#define EFI_MEMORY_WT …
#define EFI_MEMORY_WB …
#define EFI_MEMORY_UCE …
#define EFI_MEMORY_WP …
#define EFI_MEMORY_RP …
#define EFI_MEMORY_XP …
#define EFI_MEMORY_NV …
#define EFI_MEMORY_MORE_RELIABLE …
#define EFI_MEMORY_RO …
#define EFI_MEMORY_SP …
#define EFI_MEMORY_CPU_CRYPTO …
#define EFI_MEMORY_RUNTIME …
#define EFI_MEMORY_DESCRIPTOR_VERSION …
#define EFI_PAGE_SHIFT …
#define EFI_PAGE_SIZE …
#define EFI_PAGES_MAX …
efi_memory_desc_t;
efi_capsule_header_t;
struct efi_manage_capsule_header { … } __packed;
struct efi_manage_capsule_image_header { … } __packed;
struct win_cert { … };
struct win_cert_uefi_guid { … };
struct efi_image_auth { … };
#define EFI_CAPSULE_PERSIST_ACROSS_RESET …
#define EFI_CAPSULE_POPULATE_SYSTEM_TABLE …
#define EFI_CAPSULE_INITIATE_RESET …
struct capsule_info { … };
int efi_capsule_setup_info(struct capsule_info *cap_info, void *kbuff,
size_t hdr_bytes);
int __efi_capsule_setup_info(struct capsule_info *cap_info);
#define EFI_TIME_ADJUST_DAYLIGHT …
#define EFI_TIME_IN_DAYLIGHT …
#define EFI_UNSPECIFIED_TIMEZONE …
efi_time_t;
efi_time_cap_t;
efi_boot_services_t;
#define EFI_RESET_COLD …
#define EFI_RESET_WARM …
#define EFI_RESET_SHUTDOWN …
#define EFI_RUNTIME_SERVICES_SIGNATURE …
#define EFI_RUNTIME_SERVICES_REVISION …
efi_runtime_services_32_t;
efi_get_time_t;
efi_set_time_t;
efi_get_wakeup_time_t;
efi_set_wakeup_time_t;
efi_get_variable_t;
efi_get_next_variable_t;
efi_set_variable_t;
efi_get_next_high_mono_count_t;
efi_reset_system_t;
efi_set_virtual_address_map_t;
efi_query_variable_info_t;
efi_update_capsule_t;
efi_query_capsule_caps_t;
efi_query_variable_store_t;
efi_runtime_services_t;
void efi_native_runtime_setup(void);
#define NULL_GUID …
#define ACPI_TABLE_GUID …
#define ACPI_20_TABLE_GUID …
#define SMBIOS_TABLE_GUID …
#define SMBIOS3_TABLE_GUID …
#define UGA_IO_PROTOCOL_GUID …
#define EFI_GLOBAL_VARIABLE_GUID …
#define UV_SYSTEM_TABLE_GUID …
#define LINUX_EFI_CRASH_GUID …
#define LOADED_IMAGE_PROTOCOL_GUID …
#define LOADED_IMAGE_DEVICE_PATH_PROTOCOL_GUID …
#define EFI_DEVICE_PATH_PROTOCOL_GUID …
#define EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID …
#define EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL_GUID …
#define EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID …
#define EFI_UGA_PROTOCOL_GUID …
#define EFI_PCI_IO_PROTOCOL_GUID …
#define EFI_FILE_INFO_ID …
#define EFI_SYSTEM_RESOURCE_TABLE_GUID …
#define EFI_FILE_SYSTEM_GUID …
#define DEVICE_TREE_GUID …
#define EFI_PROPERTIES_TABLE_GUID …
#define EFI_RNG_PROTOCOL_GUID …
#define EFI_RNG_ALGORITHM_RAW …
#define EFI_MEMORY_ATTRIBUTES_TABLE_GUID …
#define EFI_CONSOLE_OUT_DEVICE_GUID …
#define APPLE_PROPERTIES_PROTOCOL_GUID …
#define APPLE_SET_OS_PROTOCOL_GUID …
#define EFI_TCG2_PROTOCOL_GUID …
#define EFI_TCG2_FINAL_EVENTS_TABLE_GUID …
#define EFI_LOAD_FILE_PROTOCOL_GUID …
#define EFI_LOAD_FILE2_PROTOCOL_GUID …
#define EFI_RT_PROPERTIES_TABLE_GUID …
#define EFI_DXE_SERVICES_TABLE_GUID …
#define EFI_SMBIOS_PROTOCOL_GUID …
#define EFI_MEMORY_ATTRIBUTE_PROTOCOL_GUID …
#define EFI_IMAGE_SECURITY_DATABASE_GUID …
#define EFI_SHIM_LOCK_GUID …
#define EFI_CERT_SHA256_GUID …
#define EFI_CERT_X509_GUID …
#define EFI_CERT_X509_SHA256_GUID …
#define EFI_CC_BLOB_GUID …
#define EFI_CC_MEASUREMENT_PROTOCOL_GUID …
#define EFI_CC_FINAL_EVENTS_TABLE_GUID …
#define LINUX_EFI_SCREEN_INFO_TABLE_GUID …
#define LINUX_EFI_ARM_CPU_STATE_TABLE_GUID …
#define LINUX_EFI_LOADER_ENTRY_GUID …
#define LINUX_EFI_RANDOM_SEED_TABLE_GUID …
#define LINUX_EFI_TPM_EVENT_LOG_GUID …
#define LINUX_EFI_MEMRESERVE_TABLE_GUID …
#define LINUX_EFI_INITRD_MEDIA_GUID …
#define LINUX_EFI_MOK_VARIABLE_TABLE_GUID …
#define LINUX_EFI_COCO_SECRET_AREA_GUID …
#define LINUX_EFI_BOOT_MEMMAP_GUID …
#define LINUX_EFI_UNACCEPTED_MEM_TABLE_GUID …
#define RISCV_EFI_BOOT_PROTOCOL_GUID …
#define LINUX_EFI_LOADED_IMAGE_FIXED_GUID …
#define DELLEMC_EFI_RCI2_TABLE_GUID …
#define AMD_SEV_MEM_ENCRYPT_GUID …
#define OVMF_SEV_MEMORY_ACCEPTANCE_PROTOCOL_GUID …
efi_config_table_64_t;
efi_config_table_32_t;
efi_config_table_t;
efi_config_table_type_t;
#define EFI_SYSTEM_TABLE_SIGNATURE …
#define EFI_DXE_SERVICES_TABLE_SIGNATURE …
#define EFI_2_30_SYSTEM_TABLE_REVISION …
#define EFI_2_20_SYSTEM_TABLE_REVISION …
#define EFI_2_10_SYSTEM_TABLE_REVISION …
#define EFI_2_00_SYSTEM_TABLE_REVISION …
#define EFI_1_10_SYSTEM_TABLE_REVISION …
#define EFI_1_02_SYSTEM_TABLE_REVISION …
efi_system_table_64_t;
efi_system_table_32_t;
efi_simple_text_input_protocol_t;
efi_simple_text_output_protocol_t;
efi_system_table_t;
struct efi_boot_memmap { … };
struct efi_unaccepted_memory { … };
struct efi_memory_map_data { … };
struct efi_memory_map { … };
struct efi_mem_range { … };
efi_properties_table_t;
#define EFI_PROPERTIES_TABLE_VERSION …
#define EFI_PROPERTIES_RUNTIME_MEMORY_PROTECTION_NON_EXECUTABLE_PE_DATA …
efi_rt_properties_table_t;
#define EFI_RT_PROPERTIES_TABLE_VERSION …
#define EFI_INVALID_TABLE_ADDR …
#define EFI_MEMORY_ATTRIBUTES_FLAGS_RT_FORWARD_CONTROL_FLOW_GUARD …
efi_memory_attributes_table_t;
efi_signature_data_t;
efi_signature_list_t;
efi_sha256_hash_t;
efi_cert_x509_sha256_t;
extern unsigned long __ro_after_init efi_rng_seed;
extern struct efi { … } efi;
#define EFI_RT_SUPPORTED_GET_TIME …
#define EFI_RT_SUPPORTED_SET_TIME …
#define EFI_RT_SUPPORTED_GET_WAKEUP_TIME …
#define EFI_RT_SUPPORTED_SET_WAKEUP_TIME …
#define EFI_RT_SUPPORTED_GET_VARIABLE …
#define EFI_RT_SUPPORTED_GET_NEXT_VARIABLE_NAME …
#define EFI_RT_SUPPORTED_SET_VARIABLE …
#define EFI_RT_SUPPORTED_SET_VIRTUAL_ADDRESS_MAP …
#define EFI_RT_SUPPORTED_CONVERT_POINTER …
#define EFI_RT_SUPPORTED_GET_NEXT_HIGH_MONOTONIC_COUNT …
#define EFI_RT_SUPPORTED_RESET_SYSTEM …
#define EFI_RT_SUPPORTED_UPDATE_CAPSULE …
#define EFI_RT_SUPPORTED_QUERY_CAPSULE_CAPABILITIES …
#define EFI_RT_SUPPORTED_QUERY_VARIABLE_INFO …
#define EFI_RT_SUPPORTED_ALL …
#define EFI_RT_SUPPORTED_TIME_SERVICES …
#define EFI_RT_SUPPORTED_WAKEUP_SERVICES …
#define EFI_RT_SUPPORTED_VARIABLE_SERVICES …
extern struct mm_struct efi_mm;
static inline bool mm_is_efi(struct mm_struct *mm)
{ … }
static inline int
efi_guidcmp (efi_guid_t left, efi_guid_t right)
{ … }
static inline char *
efi_guid_to_str(efi_guid_t *guid, char *out)
{ … }
extern void efi_init (void);
extern void efi_earlycon_reprobe(void);
#ifdef CONFIG_EFI
extern void efi_enter_virtual_mode (void);
#else
static inline void efi_enter_virtual_mode (void) {}
#endif
#ifdef CONFIG_X86
extern efi_status_t efi_query_variable_store(u32 attributes,
unsigned long size,
bool nonblocking);
#else
static inline efi_status_t efi_query_variable_store(u32 attributes,
unsigned long size,
bool nonblocking)
{
return EFI_SUCCESS;
}
#endif
extern int __init __efi_memmap_init(struct efi_memory_map_data *data);
extern int __init efi_memmap_init_early(struct efi_memory_map_data *data);
extern int __init efi_memmap_init_late(phys_addr_t addr, unsigned long size);
extern void __init efi_memmap_unmap(void);
#ifdef CONFIG_EFI_ESRT
extern void __init efi_esrt_init(void);
#else
static inline void efi_esrt_init(void) { }
#endif
extern int efi_config_parse_tables(const efi_config_table_t *config_tables,
int count,
const efi_config_table_type_t *arch_tables);
extern int efi_systab_check_header(const efi_table_hdr_t *systab_hdr);
extern void efi_systab_report_header(const efi_table_hdr_t *systab_hdr,
unsigned long fw_vendor);
extern u64 efi_get_iobase (void);
extern int efi_mem_type(unsigned long phys_addr);
extern u64 efi_mem_attributes (unsigned long phys_addr);
extern u64 efi_mem_attribute (unsigned long phys_addr, unsigned long size);
extern int __init efi_uart_console_only (void);
extern u64 efi_mem_desc_end(efi_memory_desc_t *md);
extern int efi_mem_desc_lookup(u64 phys_addr, efi_memory_desc_t *out_md);
extern int __efi_mem_desc_lookup(u64 phys_addr, efi_memory_desc_t *out_md);
extern void efi_mem_reserve(phys_addr_t addr, u64 size);
extern int efi_mem_reserve_persistent(phys_addr_t addr, u64 size);
extern void efi_initialize_iomem_resources(struct resource *code_resource,
struct resource *data_resource, struct resource *bss_resource);
extern u64 efi_get_fdt_params(struct efi_memory_map_data *data);
extern struct kobject *efi_kobj;
extern int efi_reboot_quirk_mode;
extern bool efi_poweroff_required(void);
extern unsigned long efi_mem_attr_table;
efi_memattr_perm_setter;
extern int efi_memattr_init(void);
extern int efi_memattr_apply_permissions(struct mm_struct *mm,
efi_memattr_perm_setter fn);
#define efi_memdesc_ptr(map, desc_size, n) …
#define for_each_efi_memory_desc_in_map(m, md) …
#define for_each_efi_memory_desc(md) …
char * __init efi_md_typeattr_format(char *buf, size_t size,
const efi_memory_desc_t *md);
efi_element_handler_t;
extern int __init parse_efi_signature_list(
const char *source,
const void *data, size_t size,
efi_element_handler_t (*get_handler_for_guid)(const efi_guid_t *));
static inline int efi_range_is_wc(unsigned long start, unsigned long len)
{ … }
#define EFI_BOOT …
#define EFI_CONFIG_TABLES …
#define EFI_RUNTIME_SERVICES …
#define EFI_MEMMAP …
#define EFI_64BIT …
#define EFI_PARAVIRT …
#define EFI_ARCH_1 …
#define EFI_DBG …
#define EFI_NX_PE_DATA …
#define EFI_MEM_ATTR …
#define EFI_MEM_NO_SOFT_RESERVE …
#define EFI_PRESERVE_BS_REGIONS …
#ifdef CONFIG_EFI
static inline bool efi_enabled(int feature)
{ … }
extern void efi_reboot(enum reboot_mode reboot_mode, const char *__unused);
bool __pure __efi_soft_reserve_enabled(void);
static inline bool __pure efi_soft_reserve_enabled(void)
{ … }
static inline bool efi_rt_services_supported(unsigned int mask)
{ … }
extern void efi_find_mirror(void);
#else
static inline bool efi_enabled(int feature)
{
return false;
}
static inline void
efi_reboot(enum reboot_mode reboot_mode, const char *__unused) {}
static inline bool efi_soft_reserve_enabled(void)
{
return false;
}
static inline bool efi_rt_services_supported(unsigned int mask)
{
return false;
}
static inline void efi_find_mirror(void) {}
#endif
extern int efi_status_to_err(efi_status_t status);
#define EFI_VARIABLE_NON_VOLATILE …
#define EFI_VARIABLE_BOOTSERVICE_ACCESS …
#define EFI_VARIABLE_RUNTIME_ACCESS …
#define EFI_VARIABLE_HARDWARE_ERROR_RECORD …
#define EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS …
#define EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS …
#define EFI_VARIABLE_APPEND_WRITE …
#define EFI_VARIABLE_MASK …
#define EFI_VARIABLE_GUID_LEN …
#define EFI_DEV_HW …
#define EFI_DEV_PCI …
#define EFI_DEV_PCCARD …
#define EFI_DEV_MEM_MAPPED …
#define EFI_DEV_VENDOR …
#define EFI_DEV_CONTROLLER …
#define EFI_DEV_ACPI …
#define EFI_DEV_BASIC_ACPI …
#define EFI_DEV_EXPANDED_ACPI …
#define EFI_DEV_MSG …
#define EFI_DEV_MSG_ATAPI …
#define EFI_DEV_MSG_SCSI …
#define EFI_DEV_MSG_FC …
#define EFI_DEV_MSG_1394 …
#define EFI_DEV_MSG_USB …
#define EFI_DEV_MSG_USB_CLASS …
#define EFI_DEV_MSG_I20 …
#define EFI_DEV_MSG_MAC …
#define EFI_DEV_MSG_IPV4 …
#define EFI_DEV_MSG_IPV6 …
#define EFI_DEV_MSG_INFINIBAND …
#define EFI_DEV_MSG_UART …
#define EFI_DEV_MSG_VENDOR …
#define EFI_DEV_MEDIA …
#define EFI_DEV_MEDIA_HARD_DRIVE …
#define EFI_DEV_MEDIA_CDROM …
#define EFI_DEV_MEDIA_VENDOR …
#define EFI_DEV_MEDIA_FILE …
#define EFI_DEV_MEDIA_PROTOCOL …
#define EFI_DEV_MEDIA_REL_OFFSET …
#define EFI_DEV_BIOS_BOOT …
#define EFI_DEV_END_PATH …
#define EFI_DEV_END_PATH2 …
#define EFI_DEV_END_INSTANCE …
#define EFI_DEV_END_ENTIRE …
struct efi_generic_dev_path { … } __packed;
struct efi_acpi_dev_path { … } __packed;
struct efi_pci_dev_path { … } __packed;
struct efi_vendor_dev_path { … } __packed;
struct efi_rel_offset_dev_path { … } __packed;
struct efi_mem_mapped_dev_path { … } __packed;
struct efi_file_path_dev_path { … } __packed;
struct efi_dev_path { … } __packed;
struct device *efi_get_device_by_path(const struct efi_dev_path **node,
size_t *len);
static inline void memrange_efi_to_native(u64 *addr, u64 *npages)
{ … }
struct efivar_operations { … };
struct efivars { … };
#ifdef CONFIG_X86
u64 __attribute_const__ efivar_reserved_space(void);
#else
static inline u64 efivar_reserved_space(void) { return 0; }
#endif
#define EFI_VAR_NAME_LEN …
int efivars_register(struct efivars *efivars,
const struct efivar_operations *ops);
int efivars_unregister(struct efivars *efivars);
#ifdef CONFIG_EFI
bool efivar_is_available(void);
#else
static inline bool efivar_is_available(void) { return false; }
#endif
bool efivar_supports_writes(void);
int efivar_lock(void);
int efivar_trylock(void);
void efivar_unlock(void);
efi_status_t efivar_get_variable(efi_char16_t *name, efi_guid_t *vendor,
u32 *attr, unsigned long *size, void *data);
efi_status_t efivar_get_next_variable(unsigned long *name_size,
efi_char16_t *name, efi_guid_t *vendor);
efi_status_t efivar_set_variable_locked(efi_char16_t *name, efi_guid_t *vendor,
u32 attr, unsigned long data_size,
void *data, bool nonblocking);
efi_status_t efivar_set_variable(efi_char16_t *name, efi_guid_t *vendor,
u32 attr, unsigned long data_size, void *data);
efi_status_t efivar_query_variable_info(u32 attr, u64 *storage_space,
u64 *remaining_space,
u64 *max_variable_size);
#if IS_ENABLED(CONFIG_EFI_CAPSULE_LOADER)
extern bool efi_capsule_pending(int *reset_type);
extern int efi_capsule_supported(efi_guid_t guid, u32 flags,
size_t size, int *reset);
extern int efi_capsule_update(efi_capsule_header_t *capsule,
phys_addr_t *pages);
#else
static inline bool efi_capsule_pending(int *reset_type) { return false; }
#endif
#ifdef CONFIG_EFI
extern bool efi_runtime_disabled(void);
#else
static inline bool efi_runtime_disabled(void) { return true; }
#endif
extern void efi_call_virt_check_flags(unsigned long flags, const void *caller);
extern unsigned long efi_call_virt_save_flags(void);
enum efi_secureboot_mode { … };
static inline
enum efi_secureboot_mode efi_get_secureboot_mode(efi_get_variable_t *get_var)
{ … }
#ifdef CONFIG_EFI_EMBEDDED_FIRMWARE
void efi_check_for_embedded_firmwares(void);
#else
static inline void efi_check_for_embedded_firmwares(void) { }
#endif
#define arch_efi_call_virt(p, f, args...) …
#define efi_call_virt_pointer(p, f, args...) …
#define EFI_RANDOM_SEED_SIZE …
struct linux_efi_random_seed { … };
struct linux_efi_tpm_eventlog { … };
extern int efi_tpm_eventlog_init(void);
struct efi_tcg2_final_events_table { … };
extern int efi_tpm_final_log_size;
extern unsigned long rci2_table_phys;
efi_status_t
efi_call_acpi_prm_handler(efi_status_t (__efiapi *handler_addr)(u64, void *),
u64 param_buffer_addr, void *context);
enum efi_rts_ids { … };
efi_rts_args;
struct efi_runtime_work { … };
extern struct efi_runtime_work efi_rts_work;
extern struct workqueue_struct *efi_rts_wq;
struct linux_efi_memreserve { … };
#define EFI_MEMRESERVE_COUNT(size) …
void __init efi_arch_mem_reserve(phys_addr_t addr, u64 size);
char *efi_systab_show_arch(char *str);
struct efi_mokvar_table_entry { … } __attribute((packed));
#ifdef CONFIG_LOAD_UEFI_KEYS
extern void __init efi_mokvar_table_init(void);
extern struct efi_mokvar_table_entry *efi_mokvar_entry_next(
struct efi_mokvar_table_entry **mokvar_entry);
extern struct efi_mokvar_table_entry *efi_mokvar_entry_find(const char *name);
#else
static inline void efi_mokvar_table_init(void) { }
static inline struct efi_mokvar_table_entry *efi_mokvar_entry_next(
struct efi_mokvar_table_entry **mokvar_entry)
{
return NULL;
}
static inline struct efi_mokvar_table_entry *efi_mokvar_entry_find(
const char *name)
{
return NULL;
}
#endif
extern void efifb_setup_from_dmi(struct screen_info *si, const char *opt);
struct linux_efi_coco_secret_area { … };
struct linux_efi_initrd { … };
#define EFI_SECRET_TABLE_HEADER_GUID …
bool xen_efi_config_table_is_usable(const efi_guid_t *guid, unsigned long table);
static inline
bool efi_config_table_is_usable(const efi_guid_t *guid, unsigned long table)
{ … }
umode_t efi_attr_is_visible(struct kobject *kobj, struct attribute *attr, int n);
#define EFIVAR_OPS_RDONLY …
#define EFIVAR_OPS_RDWR …
extern struct blocking_notifier_head efivar_ops_nh;
void efivars_generic_ops_register(void);
void efivars_generic_ops_unregister(void);
#endif