#ifndef _DRIVERS_FIRMWARE_EFI_EFISTUB_H
#define _DRIVERS_FIRMWARE_EFI_EFISTUB_H
#include <linux/compiler.h>
#include <linux/efi.h>
#include <linux/kernel.h>
#include <linux/kern_levels.h>
#include <linux/types.h>
#include <asm/efi.h>
#undef __init
#ifndef EFI_ALLOC_ALIGN
#define EFI_ALLOC_ALIGN …
#endif
#ifndef EFI_ALLOC_LIMIT
#define EFI_ALLOC_LIMIT …
#endif
extern bool efi_no5lvl;
extern bool efi_nochunk;
extern bool efi_nokaslr;
extern int efi_loglevel;
extern int efi_mem_encrypt;
extern bool efi_novamap;
extern const efi_system_table_t *efi_system_table;
efi_dxe_services_table_t;
extern const efi_dxe_services_table_t *efi_dxe_table;
efi_status_t __efiapi efi_pe_entry(efi_handle_t handle,
efi_system_table_t *sys_table_arg);
#ifndef ARCH_HAS_EFISTUB_WRAPPERS
#define efi_is_native …
#define efi_table_attr …
#define efi_fn_call …
#endif
#define efi_call_proto(inst, func, ...) …
#define efi_bs_call(func, ...) …
#define efi_rt_call(func, ...) …
#define efi_dxe_call(func, ...) …
#define efi_info(fmt, ...) …
#define efi_warn(fmt, ...) …
#define efi_err(fmt, ...) …
#define efi_debug(fmt, ...) …
#define efi_printk_once(fmt, ...) …
#define efi_info_once(fmt, ...) …
#define efi_warn_once(fmt, ...) …
#define efi_err_once(fmt, ...) …
#define efi_debug_once(fmt, ...) …
#ifndef fdt_setprop_inplace_var
#define fdt_setprop_inplace_var(fdt, node_offset, name, var) …
#endif
#ifndef fdt_setprop_var
#define fdt_setprop_var(fdt, node_offset, name, var) …
#endif
#define get_efi_var(name, vendor, ...) …
#define set_efi_var(name, vendor, ...) …
#define efi_get_handle_at(array, idx) …
#define efi_get_handle_num(size) …
#define for_each_efi_handle(handle, array, size, i) …
static inline
void efi_set_u64_split(u64 data, u32 *lo, u32 *hi)
{ … }
#define EFI_ALLOCATE_ANY_PAGES …
#define EFI_ALLOCATE_MAX_ADDRESS …
#define EFI_ALLOCATE_ADDRESS …
#define EFI_MAX_ALLOCATE_TYPE …
#define EFI_LOCATE_ALL_HANDLES …
#define EFI_LOCATE_BY_REGISTER_NOTIFY …
#define EFI_LOCATE_BY_PROTOCOL …
#define EFI_USEC_PER_SEC …
#define EFI_100NSEC_PER_USEC …
#define EFI_MMAP_NR_SLACK_SLOTS …
efi_device_path_protocol_t;
efi_device_path_to_text_protocol;
efi_device_path_to_text_protocol_t;
efi_device_path_from_text_protocol;
efi_device_path_from_text_protocol_t;
efi_event_t;
efi_event_notify_t void …);
#define EFI_EVT_TIMER …
#define EFI_EVT_RUNTIME …
#define EFI_EVT_NOTIFY_WAIT …
#define EFI_EVT_NOTIFY_SIGNAL …
static inline
void efi_set_event_at(efi_event_t *events, size_t idx, efi_event_t event)
{ … }
#define EFI_TPL_APPLICATION …
#define EFI_TPL_CALLBACK …
#define EFI_TPL_NOTIFY …
#define EFI_TPL_HIGH_LEVEL …
EFI_TIMER_DELAY;
efi_boot_services;
efi_gcd_memory_type_t;
efi_gcd_memory_space_desc_t;
efi_dxe_services_table;
efi_memory_attribute_protocol_t;
efi_memory_attribute_protocol;
efi_uga_draw_protocol_t;
efi_uga_draw_protocol;
efi_input_key_t;
efi_simple_text_input_protocol;
efi_status_t efi_wait_for_key(unsigned long usec, efi_input_key_t *key);
efi_simple_text_output_protocol;
#define PIXEL_RGB_RESERVED_8BIT_PER_COLOR …
#define PIXEL_BGR_RESERVED_8BIT_PER_COLOR …
#define PIXEL_BIT_MASK …
#define PIXEL_BLT_ONLY …
#define PIXEL_FORMAT_MAX …
efi_pixel_bitmask_t;
efi_graphics_output_mode_info_t;
efi_graphics_output_protocol_mode_t;
efi_graphics_output_protocol_mode;
efi_graphics_output_protocol_t;
efi_graphics_output_protocol;
efi_loaded_image_t;
efi_file_info_t;
efi_file_protocol_t;
efi_file_protocol;
efi_simple_file_system_protocol_t;
efi_simple_file_system_protocol;
#define EFI_FILE_MODE_READ …
#define EFI_FILE_MODE_WRITE …
#define EFI_FILE_MODE_CREATE …
EFI_PCI_IO_PROTOCOL_WIDTH;
EFI_PCI_IO_PROTOCOL_ATTRIBUTE_OPERATION;
efi_pci_io_protocol_access_32_t;
efi_pci_io_protocol_t;
efi_pci_io_protocol_cfg_t
buffer);
efi_pci_io_protocol_access_t;
efi_pci_io_protocol_config_access_t;
efi_pci_io_protocol;
#define EFI_PCI_IO_ATTRIBUTE_ISA_MOTHERBOARD_IO …
#define EFI_PCI_IO_ATTRIBUTE_ISA_IO …
#define EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO …
#define EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY …
#define EFI_PCI_IO_ATTRIBUTE_VGA_IO …
#define EFI_PCI_IO_ATTRIBUTE_IDE_PRIMARY_IO …
#define EFI_PCI_IO_ATTRIBUTE_IDE_SECONDARY_IO …
#define EFI_PCI_IO_ATTRIBUTE_MEMORY_WRITE_COMBINE …
#define EFI_PCI_IO_ATTRIBUTE_IO …
#define EFI_PCI_IO_ATTRIBUTE_MEMORY …
#define EFI_PCI_IO_ATTRIBUTE_BUS_MASTER …
#define EFI_PCI_IO_ATTRIBUTE_MEMORY_CACHED …
#define EFI_PCI_IO_ATTRIBUTE_MEMORY_DISABLE …
#define EFI_PCI_IO_ATTRIBUTE_EMBEDDED_DEVICE …
#define EFI_PCI_IO_ATTRIBUTE_EMBEDDED_ROM …
#define EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE …
#define EFI_PCI_IO_ATTRIBUTE_ISA_IO_16 …
#define EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO_16 …
#define EFI_PCI_IO_ATTRIBUTE_VGA_IO_16 …
struct efi_dev_path;
apple_properties_protocol_t;
apple_properties_protocol;
efi_tcg2_event_log_format;
#define INITRD_EVENT_TAG_ID …
#define LOAD_OPTIONS_EVENT_TAG_ID …
#define EV_EVENT_TAG …
#define EFI_TCG2_EVENT_HEADER_VERSION …
struct efi_tcg2_event { … } __packed;
TCG_PCClientTaggedEvent;
efi_tcg2_event_t;
efi_tcg2_protocol_t;
efi_tcg2_protocol;
efi_cc_version_t;
efi_cc_type_t;
#define EFI_CC_TYPE_NONE …
#define EFI_CC_TYPE_AMD_SEV …
#define EFI_CC_TYPE_INTEL_TDX …
efi_cc_mr_index_t;
struct efi_cc_event { … } __packed;
efi_cc_event_t;
efi_cc_event_log_bitmap_t;
efi_cc_event_log_format_t;
efi_cc_event_algorithm_bitmap_t;
efi_cc_boot_service_cap_t;
#define EFI_CC_EVENT_HEADER_VERSION …
#define EFI_CC_BOOT_HASH_ALG_SHA384 …
#define EFI_CC_EVENT_LOG_FORMAT_TCG_2 …
efi_cc_protocol_t;
efi_cc_protocol;
struct riscv_efi_boot_protocol { … };
efi_load_file_protocol_t;
efi_load_file2_protocol_t;
efi_load_file_protocol;
efi_load_option_t;
#define EFI_LOAD_OPTION_ACTIVE …
#define EFI_LOAD_OPTION_FORCE_RECONNECT …
#define EFI_LOAD_OPTION_HIDDEN …
#define EFI_LOAD_OPTION_CATEGORY …
#define EFI_LOAD_OPTION_CATEGORY_BOOT …
#define EFI_LOAD_OPTION_CATEGORY_APP …
#define EFI_LOAD_OPTION_BOOT_MASK …
#define EFI_LOAD_OPTION_MASK …
efi_load_option_unpacked_t;
void efi_pci_disable_bridge_busmaster(void);
efi_exit_boot_map_processing;
efi_status_t efi_exit_boot_services(void *handle, void *priv,
efi_exit_boot_map_processing priv_func);
efi_status_t efi_boot_kernel(void *handle, efi_loaded_image_t *image,
unsigned long kernel_addr, char *cmdline_ptr);
void *get_fdt(unsigned long *fdt_size);
efi_status_t efi_alloc_virtmap(efi_memory_desc_t **virtmap,
unsigned long *desc_size, u32 *desc_ver);
void efi_get_virtmap(efi_memory_desc_t *memory_map, unsigned long map_size,
unsigned long desc_size, efi_memory_desc_t *runtime_map,
int *count);
efi_status_t efi_get_random_bytes(unsigned long size, u8 *out);
efi_status_t efi_random_alloc(unsigned long size, unsigned long align,
unsigned long *addr, unsigned long random_seed,
int memory_type, unsigned long alloc_min,
unsigned long alloc_max);
efi_status_t efi_random_get_seed(void);
efi_status_t check_platform_features(void);
void *get_efi_config_table(efi_guid_t guid);
void efi_char16_puts(efi_char16_t *);
void efi_puts(const char *str);
__printf(1, 2) int efi_printk(char const *fmt, ...);
void efi_free(unsigned long size, unsigned long addr);
void efi_apply_loadoptions_quirk(const void **load_options, u32 *load_options_size);
char *efi_convert_cmdline(efi_loaded_image_t *image, int *cmd_line_len);
efi_status_t efi_get_memory_map(struct efi_boot_memmap **map,
bool install_cfg_tbl);
efi_status_t efi_allocate_pages(unsigned long size, unsigned long *addr,
unsigned long max);
efi_status_t efi_allocate_pages_aligned(unsigned long size, unsigned long *addr,
unsigned long max, unsigned long align,
int memory_type);
efi_status_t efi_low_alloc_above(unsigned long size, unsigned long align,
unsigned long *addr, unsigned long min);
efi_status_t efi_relocate_kernel(unsigned long *image_addr,
unsigned long image_size,
unsigned long alloc_size,
unsigned long preferred_addr,
unsigned long alignment,
unsigned long min_addr);
efi_status_t efi_parse_options(char const *cmdline);
void efi_parse_option_graphics(char *option);
efi_status_t efi_setup_gop(struct screen_info *si, efi_guid_t *proto,
unsigned long size);
efi_status_t handle_cmdline_files(efi_loaded_image_t *image,
const efi_char16_t *optstr,
int optstr_size,
unsigned long soft_limit,
unsigned long hard_limit,
unsigned long *load_addr,
unsigned long *load_size);
static inline efi_status_t efi_load_dtb(efi_loaded_image_t *image,
unsigned long *load_addr,
unsigned long *load_size)
{ … }
efi_status_t efi_load_initrd(efi_loaded_image_t *image,
unsigned long soft_limit,
unsigned long hard_limit,
const struct linux_efi_initrd **out);
efi_status_t handle_kernel_image(unsigned long *image_addr,
unsigned long *image_size,
unsigned long *reserve_addr,
unsigned long *reserve_size,
efi_loaded_image_t *image,
efi_handle_t image_handle);
efi_status_t efi_stub_common(efi_handle_t handle,
efi_loaded_image_t *image,
unsigned long image_addr,
char *cmdline_ptr);
efi_status_t efi_handle_cmdline(efi_loaded_image_t *image, char **cmdline_ptr);
asmlinkage void __noreturn efi_enter_kernel(unsigned long entrypoint,
unsigned long fdt_addr,
unsigned long fdt_size);
void efi_handle_post_ebs_state(void);
enum efi_secureboot_mode efi_get_secureboot(void);
#ifdef CONFIG_RESET_ATTACK_MITIGATION
void efi_enable_reset_attack_mitigation(void);
#else
static inline void
efi_enable_reset_attack_mitigation(void) { }
#endif
void efi_retrieve_eventlog(void);
struct screen_info *alloc_screen_info(void);
struct screen_info *__alloc_screen_info(void);
void free_screen_info(struct screen_info *si);
void efi_cache_sync_image(unsigned long image_base,
unsigned long alloc_size);
struct efi_smbios_record { … };
const struct efi_smbios_record *efi_get_smbios_record(u8 type);
struct efi_smbios_type1_record { … };
struct efi_smbios_type4_record { … };
#define efi_get_smbios_string(__record, __field) …
const u8 *__efi_get_smbios_string(const struct efi_smbios_record *record,
const u8 *offset);
void efi_remap_image(unsigned long image_base, unsigned alloc_size,
unsigned long code_size);
efi_status_t efi_kaslr_relocate_kernel(unsigned long *image_addr,
unsigned long *reserve_addr,
unsigned long *reserve_size,
unsigned long kernel_size,
unsigned long kernel_codesize,
unsigned long kernel_memsize,
u32 phys_seed);
u32 efi_kaslr_get_phys_seed(efi_handle_t image_handle);
asmlinkage efi_status_t __efiapi
efi_zboot_entry(efi_handle_t handle, efi_system_table_t *systab);
efi_status_t allocate_unaccepted_bitmap(__u32 nr_desc,
struct efi_boot_memmap *map);
void process_unaccepted_memory(u64 start, u64 end);
void accept_memory(phys_addr_t start, unsigned long size);
void arch_accept_memory(phys_addr_t start, phys_addr_t end);
#endif