1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 21da177e4SLinus Torvalds #ifndef _LINUX_EFI_H 31da177e4SLinus Torvalds #define _LINUX_EFI_H 41da177e4SLinus Torvalds 51da177e4SLinus Torvalds /* 61da177e4SLinus Torvalds * Extensible Firmware Interface 71da177e4SLinus Torvalds * Based on 'Extensible Firmware Interface Specification' version 0.9, April 30, 1999 81da177e4SLinus Torvalds * 91da177e4SLinus Torvalds * Copyright (C) 1999 VA Linux Systems 101da177e4SLinus Torvalds * Copyright (C) 1999 Walt Drummond <drummond@valinux.com> 111da177e4SLinus Torvalds * Copyright (C) 1999, 2002-2003 Hewlett-Packard Co. 121da177e4SLinus Torvalds * David Mosberger-Tang <davidm@hpl.hp.com> 131da177e4SLinus Torvalds * Stephane Eranian <eranian@hpl.hp.com> 141da177e4SLinus Torvalds */ 151da177e4SLinus Torvalds #include <linux/init.h> 161da177e4SLinus Torvalds #include <linux/string.h> 171da177e4SLinus Torvalds #include <linux/time.h> 181da177e4SLinus Torvalds #include <linux/types.h> 191da177e4SLinus Torvalds #include <linux/proc_fs.h> 201da177e4SLinus Torvalds #include <linux/rtc.h> 211da177e4SLinus Torvalds #include <linux/ioport.h> 224a3575fdSHuang, Ying #include <linux/pfn.h> 235ee9c198SMatthew Garrett #include <linux/pstore.h> 2460863c0dSMatt Fleming #include <linux/range.h> 258562c99cSMatt Fleming #include <linux/reboot.h> 26ba7e34b1SAndy Shevchenko #include <linux/uuid.h> 272c23b73cSArd Biesheuvel #include <linux/screen_info.h> 281da177e4SLinus Torvalds 291da177e4SLinus Torvalds #include <asm/page.h> 301da177e4SLinus Torvalds 311da177e4SLinus Torvalds #define EFI_SUCCESS 0 321da177e4SLinus Torvalds #define EFI_LOAD_ERROR ( 1 | (1UL << (BITS_PER_LONG-1))) 331da177e4SLinus Torvalds #define EFI_INVALID_PARAMETER ( 2 | (1UL << (BITS_PER_LONG-1))) 341da177e4SLinus Torvalds #define EFI_UNSUPPORTED ( 3 | (1UL << (BITS_PER_LONG-1))) 351da177e4SLinus Torvalds #define EFI_BAD_BUFFER_SIZE ( 4 | (1UL << (BITS_PER_LONG-1))) 361da177e4SLinus Torvalds #define EFI_BUFFER_TOO_SMALL ( 5 | (1UL << (BITS_PER_LONG-1))) 375d9db883SMatthew Garrett #define EFI_NOT_READY ( 6 | (1UL << (BITS_PER_LONG-1))) 385d9db883SMatthew Garrett #define EFI_DEVICE_ERROR ( 7 | (1UL << (BITS_PER_LONG-1))) 395d9db883SMatthew Garrett #define EFI_WRITE_PROTECTED ( 8 | (1UL << (BITS_PER_LONG-1))) 405d9db883SMatthew Garrett #define EFI_OUT_OF_RESOURCES ( 9 | (1UL << (BITS_PER_LONG-1))) 411da177e4SLinus Torvalds #define EFI_NOT_FOUND (14 | (1UL << (BITS_PER_LONG-1))) 4214c574f3SArvind Sankar #define EFI_TIMEOUT (18 | (1UL << (BITS_PER_LONG-1))) 43dce48e35SArd Biesheuvel #define EFI_ABORTED (21 | (1UL << (BITS_PER_LONG-1))) 445d9db883SMatthew Garrett #define EFI_SECURITY_VIOLATION (26 | (1UL << (BITS_PER_LONG-1))) 451da177e4SLinus Torvalds 461da177e4SLinus Torvalds typedef unsigned long efi_status_t; 471da177e4SLinus Torvalds typedef u8 efi_bool_t; 481da177e4SLinus Torvalds typedef u16 efi_char16_t; /* UNICODE character */ 49ed37ddffSRoy Franz typedef u64 efi_physical_addr_t; 50ed37ddffSRoy Franz typedef void *efi_handle_t; 511da177e4SLinus Torvalds 5289ed4865SArd Biesheuvel #if defined(CONFIG_X86_64) 538f24f8c2SArd Biesheuvel #define __efiapi __attribute__((ms_abi)) 5489ed4865SArd Biesheuvel #elif defined(CONFIG_X86_32) 5589ed4865SArd Biesheuvel #define __efiapi __attribute__((regparm(0))) 568f24f8c2SArd Biesheuvel #else 578f24f8c2SArd Biesheuvel #define __efiapi 588f24f8c2SArd Biesheuvel #endif 598f24f8c2SArd Biesheuvel 60494c704fSArd Biesheuvel /* 61494c704fSArd Biesheuvel * The UEFI spec and EDK2 reference implementation both define EFI_GUID as 62494c704fSArd Biesheuvel * struct { u32 a; u16; b; u16 c; u8 d[8]; }; and so the implied alignment 63494c704fSArd Biesheuvel * is 32 bits not 8 bits like our guid_t. In some cases (i.e., on 32-bit ARM), 64494c704fSArd Biesheuvel * this means that firmware services invoked by the kernel may assume that 65494c704fSArd Biesheuvel * efi_guid_t* arguments are 32-bit aligned, and use memory accessors that 66494c704fSArd Biesheuvel * do not tolerate misalignment. So let's set the minimum alignment to 32 bits. 67494c704fSArd Biesheuvel * 68494c704fSArd Biesheuvel * Note that the UEFI spec as well as some comments in the EDK2 code base 69494c704fSArd Biesheuvel * suggest that EFI_GUID should be 64-bit aligned, but this appears to be 70494c704fSArd Biesheuvel * a mistake, given that no code seems to exist that actually enforces that 71494c704fSArd Biesheuvel * or relies on it. 72494c704fSArd Biesheuvel */ 73494c704fSArd Biesheuvel typedef guid_t efi_guid_t __aligned(__alignof__(u32)); 741da177e4SLinus Torvalds 751da177e4SLinus Torvalds #define EFI_GUID(a,b,c,d0,d1,d2,d3,d4,d5,d6,d7) \ 76c0020756SAndy Shevchenko GUID_INIT(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) 771da177e4SLinus Torvalds 781da177e4SLinus Torvalds /* 791da177e4SLinus Torvalds * Generic EFI table header 801da177e4SLinus Torvalds */ 811da177e4SLinus Torvalds typedef struct { 821da177e4SLinus Torvalds u64 signature; 831da177e4SLinus Torvalds u32 revision; 841da177e4SLinus Torvalds u32 headersize; 851da177e4SLinus Torvalds u32 crc32; 861da177e4SLinus Torvalds u32 reserved; 871da177e4SLinus Torvalds } efi_table_hdr_t; 881da177e4SLinus Torvalds 891da177e4SLinus Torvalds /* 901da177e4SLinus Torvalds * Memory map descriptor: 911da177e4SLinus Torvalds */ 921da177e4SLinus Torvalds 931da177e4SLinus Torvalds /* Memory types: */ 941da177e4SLinus Torvalds #define EFI_RESERVED_TYPE 0 951da177e4SLinus Torvalds #define EFI_LOADER_CODE 1 961da177e4SLinus Torvalds #define EFI_LOADER_DATA 2 971da177e4SLinus Torvalds #define EFI_BOOT_SERVICES_CODE 3 981da177e4SLinus Torvalds #define EFI_BOOT_SERVICES_DATA 4 991da177e4SLinus Torvalds #define EFI_RUNTIME_SERVICES_CODE 5 1001da177e4SLinus Torvalds #define EFI_RUNTIME_SERVICES_DATA 6 1011da177e4SLinus Torvalds #define EFI_CONVENTIONAL_MEMORY 7 1021da177e4SLinus Torvalds #define EFI_UNUSABLE_MEMORY 8 1031da177e4SLinus Torvalds #define EFI_ACPI_RECLAIM_MEMORY 9 1041da177e4SLinus Torvalds #define EFI_ACPI_MEMORY_NVS 10 1051da177e4SLinus Torvalds #define EFI_MEMORY_MAPPED_IO 11 1061da177e4SLinus Torvalds #define EFI_MEMORY_MAPPED_IO_PORT_SPACE 12 1071da177e4SLinus Torvalds #define EFI_PAL_CODE 13 108ad5fb870SDan Williams #define EFI_PERSISTENT_MEMORY 14 109ad5fb870SDan Williams #define EFI_MAX_MEMORY_TYPE 15 1101da177e4SLinus Torvalds 1111da177e4SLinus Torvalds /* Attribute values: */ 1121da177e4SLinus Torvalds #define EFI_MEMORY_UC ((u64)0x0000000000000001ULL) /* uncached */ 1131da177e4SLinus Torvalds #define EFI_MEMORY_WC ((u64)0x0000000000000002ULL) /* write-coalescing */ 1141da177e4SLinus Torvalds #define EFI_MEMORY_WT ((u64)0x0000000000000004ULL) /* write-through */ 1151da177e4SLinus Torvalds #define EFI_MEMORY_WB ((u64)0x0000000000000008ULL) /* write-back */ 1169c97e0bdSLaszlo Ersek #define EFI_MEMORY_UCE ((u64)0x0000000000000010ULL) /* uncached, exported */ 1171da177e4SLinus Torvalds #define EFI_MEMORY_WP ((u64)0x0000000000001000ULL) /* write-protect */ 1181da177e4SLinus Torvalds #define EFI_MEMORY_RP ((u64)0x0000000000002000ULL) /* read-protect */ 1191da177e4SLinus Torvalds #define EFI_MEMORY_XP ((u64)0x0000000000004000ULL) /* execute-protect */ 120c016ca08SRobert Elliott #define EFI_MEMORY_NV ((u64)0x0000000000008000ULL) /* non-volatile */ 121b05b9f5fSTony Luck #define EFI_MEMORY_MORE_RELIABLE \ 122b05b9f5fSTony Luck ((u64)0x0000000000010000ULL) /* higher reliability */ 12387db73aeSArd Biesheuvel #define EFI_MEMORY_RO ((u64)0x0000000000020000ULL) /* read-only */ 124fe3e5e65SDan Williams #define EFI_MEMORY_SP ((u64)0x0000000000040000ULL) /* soft reserved */ 1251da177e4SLinus Torvalds #define EFI_MEMORY_RUNTIME ((u64)0x8000000000000000ULL) /* range requires runtime mapping */ 1261da177e4SLinus Torvalds #define EFI_MEMORY_DESCRIPTOR_VERSION 1 1271da177e4SLinus Torvalds 1281da177e4SLinus Torvalds #define EFI_PAGE_SHIFT 12 129ed37ddffSRoy Franz #define EFI_PAGE_SIZE (1UL << EFI_PAGE_SHIFT) 1300100a3e6SPeter Jones #define EFI_PAGES_MAX (U64_MAX >> EFI_PAGE_SHIFT) 1311da177e4SLinus Torvalds 1321da177e4SLinus Torvalds typedef struct { 1331da177e4SLinus Torvalds u32 type; 1341da177e4SLinus Torvalds u32 pad; 1351da177e4SLinus Torvalds u64 phys_addr; 1361da177e4SLinus Torvalds u64 virt_addr; 1371da177e4SLinus Torvalds u64 num_pages; 1381da177e4SLinus Torvalds u64 attribute; 1391da177e4SLinus Torvalds } efi_memory_desc_t; 1401da177e4SLinus Torvalds 1413b370237SMatthew Garrett typedef struct { 1423b370237SMatthew Garrett efi_guid_t guid; 1433b370237SMatthew Garrett u32 headersize; 1443b370237SMatthew Garrett u32 flags; 1453b370237SMatthew Garrett u32 imagesize; 1463b370237SMatthew Garrett } efi_capsule_header_t; 1473b370237SMatthew Garrett 148bb05e4baSMatt Fleming /* 149f0133f3cSMatt Fleming * EFI capsule flags 150f0133f3cSMatt Fleming */ 151f0133f3cSMatt Fleming #define EFI_CAPSULE_PERSIST_ACROSS_RESET 0x00010000 152f0133f3cSMatt Fleming #define EFI_CAPSULE_POPULATE_SYSTEM_TABLE 0x00020000 153f0133f3cSMatt Fleming #define EFI_CAPSULE_INITIATE_RESET 0x00040000 154f0133f3cSMatt Fleming 1553fabd628SArd Biesheuvel struct capsule_info { 1563fabd628SArd Biesheuvel efi_capsule_header_t header; 157f24c4d47SArd Biesheuvel efi_capsule_header_t *capsule; 1583fabd628SArd Biesheuvel int reset_type; 1593fabd628SArd Biesheuvel long index; 1603fabd628SArd Biesheuvel size_t count; 1613fabd628SArd Biesheuvel size_t total_size; 162f24c4d47SArd Biesheuvel struct page **pages; 163f24c4d47SArd Biesheuvel phys_addr_t *phys; 1643fabd628SArd Biesheuvel size_t page_bytes_remain; 1653fabd628SArd Biesheuvel }; 1663fabd628SArd Biesheuvel 1673fabd628SArd Biesheuvel int __efi_capsule_setup_info(struct capsule_info *cap_info); 1683fabd628SArd Biesheuvel 169e088a4adSMatthew Wilcox typedef int (*efi_freemem_callback_t) (u64 start, u64 end, void *arg); 1701da177e4SLinus Torvalds 1711da177e4SLinus Torvalds /* 1721da177e4SLinus Torvalds * Types and defines for Time Services 1731da177e4SLinus Torvalds */ 1741da177e4SLinus Torvalds #define EFI_TIME_ADJUST_DAYLIGHT 0x1 1751da177e4SLinus Torvalds #define EFI_TIME_IN_DAYLIGHT 0x2 1761da177e4SLinus Torvalds #define EFI_UNSPECIFIED_TIMEZONE 0x07ff 1771da177e4SLinus Torvalds 1781da177e4SLinus Torvalds typedef struct { 1791da177e4SLinus Torvalds u16 year; 1801da177e4SLinus Torvalds u8 month; 1811da177e4SLinus Torvalds u8 day; 1821da177e4SLinus Torvalds u8 hour; 1831da177e4SLinus Torvalds u8 minute; 1841da177e4SLinus Torvalds u8 second; 1851da177e4SLinus Torvalds u8 pad1; 1861da177e4SLinus Torvalds u32 nanosecond; 1871da177e4SLinus Torvalds s16 timezone; 1881da177e4SLinus Torvalds u8 daylight; 1891da177e4SLinus Torvalds u8 pad2; 1901da177e4SLinus Torvalds } efi_time_t; 1911da177e4SLinus Torvalds 1921da177e4SLinus Torvalds typedef struct { 1931da177e4SLinus Torvalds u32 resolution; 1941da177e4SLinus Torvalds u32 accuracy; 1951da177e4SLinus Torvalds u8 sets_to_zero; 1961da177e4SLinus Torvalds } efi_time_cap_t; 1971da177e4SLinus Torvalds 1988166ec09SArd Biesheuvel typedef union efi_boot_services efi_boot_services_t; 19933b6d034SThiebaud Weksteen 200f30ca6baSMatt Fleming /* 2011da177e4SLinus Torvalds * Types and defines for EFI ResetSystem 2021da177e4SLinus Torvalds */ 2031da177e4SLinus Torvalds #define EFI_RESET_COLD 0 2041da177e4SLinus Torvalds #define EFI_RESET_WARM 1 2051da177e4SLinus Torvalds #define EFI_RESET_SHUTDOWN 2 2061da177e4SLinus Torvalds 2071da177e4SLinus Torvalds /* 2081da177e4SLinus Torvalds * EFI Runtime Services table 2091da177e4SLinus Torvalds */ 2101da177e4SLinus Torvalds #define EFI_RUNTIME_SERVICES_SIGNATURE ((u64)0x5652453544e5552ULL) 2111da177e4SLinus Torvalds #define EFI_RUNTIME_SERVICES_REVISION 0x00010000 2121da177e4SLinus Torvalds 2131da177e4SLinus Torvalds typedef struct { 2141da177e4SLinus Torvalds efi_table_hdr_t hdr; 215677703ceSMatt Fleming u32 get_time; 216677703ceSMatt Fleming u32 set_time; 217677703ceSMatt Fleming u32 get_wakeup_time; 218677703ceSMatt Fleming u32 set_wakeup_time; 219677703ceSMatt Fleming u32 set_virtual_address_map; 220677703ceSMatt Fleming u32 convert_pointer; 221677703ceSMatt Fleming u32 get_variable; 222677703ceSMatt Fleming u32 get_next_variable; 223677703ceSMatt Fleming u32 set_variable; 224677703ceSMatt Fleming u32 get_next_high_mono_count; 225677703ceSMatt Fleming u32 reset_system; 226677703ceSMatt Fleming u32 update_capsule; 227677703ceSMatt Fleming u32 query_capsule_caps; 228677703ceSMatt Fleming u32 query_variable_info; 229677703ceSMatt Fleming } efi_runtime_services_32_t; 230677703ceSMatt Fleming 2311da177e4SLinus Torvalds typedef efi_status_t efi_get_time_t (efi_time_t *tm, efi_time_cap_t *tc); 2321da177e4SLinus Torvalds typedef efi_status_t efi_set_time_t (efi_time_t *tm); 2331da177e4SLinus Torvalds typedef efi_status_t efi_get_wakeup_time_t (efi_bool_t *enabled, efi_bool_t *pending, 2341da177e4SLinus Torvalds efi_time_t *tm); 2351da177e4SLinus Torvalds typedef efi_status_t efi_set_wakeup_time_t (efi_bool_t enabled, efi_time_t *tm); 2361da177e4SLinus Torvalds typedef efi_status_t efi_get_variable_t (efi_char16_t *name, efi_guid_t *vendor, u32 *attr, 2371da177e4SLinus Torvalds unsigned long *data_size, void *data); 2381da177e4SLinus Torvalds typedef efi_status_t efi_get_next_variable_t (unsigned long *name_size, efi_char16_t *name, 2391da177e4SLinus Torvalds efi_guid_t *vendor); 2401da177e4SLinus Torvalds typedef efi_status_t efi_set_variable_t (efi_char16_t *name, efi_guid_t *vendor, 241f7a2d73fSMatthew Garrett u32 attr, unsigned long data_size, 2421da177e4SLinus Torvalds void *data); 2431da177e4SLinus Torvalds typedef efi_status_t efi_get_next_high_mono_count_t (u32 *count); 2441da177e4SLinus Torvalds typedef void efi_reset_system_t (int reset_type, efi_status_t status, 2451da177e4SLinus Torvalds unsigned long data_size, efi_char16_t *data); 2461da177e4SLinus Torvalds typedef efi_status_t efi_set_virtual_address_map_t (unsigned long memory_map_size, 2471da177e4SLinus Torvalds unsigned long descriptor_size, 2481da177e4SLinus Torvalds u32 descriptor_version, 2491da177e4SLinus Torvalds efi_memory_desc_t *virtual_map); 2503b370237SMatthew Garrett typedef efi_status_t efi_query_variable_info_t(u32 attr, 2513b370237SMatthew Garrett u64 *storage_space, 2523b370237SMatthew Garrett u64 *remaining_space, 2533b370237SMatthew Garrett u64 *max_variable_size); 2543b370237SMatthew Garrett typedef efi_status_t efi_update_capsule_t(efi_capsule_header_t **capsules, 2553b370237SMatthew Garrett unsigned long count, 2563b370237SMatthew Garrett unsigned long sg_list); 2573b370237SMatthew Garrett typedef efi_status_t efi_query_capsule_caps_t(efi_capsule_header_t **capsules, 2583b370237SMatthew Garrett unsigned long count, 2593b370237SMatthew Garrett u64 *max_size, 2603b370237SMatthew Garrett int *reset_type); 261ca0e30dcSArd Biesheuvel typedef efi_status_t efi_query_variable_store_t(u32 attributes, 262ca0e30dcSArd Biesheuvel unsigned long size, 263ca0e30dcSArd Biesheuvel bool nonblocking); 2641da177e4SLinus Torvalds 2651786e830SArd Biesheuvel typedef union { 2661786e830SArd Biesheuvel struct { 267c4c39c70SArd Biesheuvel efi_table_hdr_t hdr; 2688f24f8c2SArd Biesheuvel efi_get_time_t __efiapi *get_time; 2698f24f8c2SArd Biesheuvel efi_set_time_t __efiapi *set_time; 2708f24f8c2SArd Biesheuvel efi_get_wakeup_time_t __efiapi *get_wakeup_time; 2718f24f8c2SArd Biesheuvel efi_set_wakeup_time_t __efiapi *set_wakeup_time; 2728f24f8c2SArd Biesheuvel efi_set_virtual_address_map_t __efiapi *set_virtual_address_map; 273c4c39c70SArd Biesheuvel void *convert_pointer; 2748f24f8c2SArd Biesheuvel efi_get_variable_t __efiapi *get_variable; 2758f24f8c2SArd Biesheuvel efi_get_next_variable_t __efiapi *get_next_variable; 2768f24f8c2SArd Biesheuvel efi_set_variable_t __efiapi *set_variable; 2778f24f8c2SArd Biesheuvel efi_get_next_high_mono_count_t __efiapi *get_next_high_mono_count; 2788f24f8c2SArd Biesheuvel efi_reset_system_t __efiapi *reset_system; 2798f24f8c2SArd Biesheuvel efi_update_capsule_t __efiapi *update_capsule; 2808f24f8c2SArd Biesheuvel efi_query_capsule_caps_t __efiapi *query_capsule_caps; 2818f24f8c2SArd Biesheuvel efi_query_variable_info_t __efiapi *query_variable_info; 2821786e830SArd Biesheuvel }; 2831786e830SArd Biesheuvel efi_runtime_services_32_t mixed_mode; 284c4c39c70SArd Biesheuvel } efi_runtime_services_t; 285c4c39c70SArd Biesheuvel 286022ee6c5SArd Biesheuvel void efi_native_runtime_setup(void); 287022ee6c5SArd Biesheuvel 2881da177e4SLinus Torvalds /* 2891da177e4SLinus Torvalds * EFI Configuration Table and GUID definitions 29054fd11feSPeter Jones * 2917fb2b43cSIngo Molnar * These are all defined in a single line to make them easier to 2927fb2b43cSIngo Molnar * grep for and to see them at a glance - while still having a 2937fb2b43cSIngo Molnar * similar structure to the definitions in the spec. 2947fb2b43cSIngo Molnar * 2957fb2b43cSIngo Molnar * Here's how they are structured: 29654fd11feSPeter Jones * 29754fd11feSPeter Jones * GUID: 12345678-1234-1234-1234-123456789012 29854fd11feSPeter Jones * Spec: 29954fd11feSPeter Jones * #define EFI_SOME_PROTOCOL_GUID \ 30054fd11feSPeter Jones * {0x12345678,0x1234,0x1234,\ 30154fd11feSPeter Jones * {0x12,0x34,0x12,0x34,0x56,0x78,0x90,0x12}} 30254fd11feSPeter Jones * Here: 3037fb2b43cSIngo Molnar * #define SOME_PROTOCOL_GUID EFI_GUID(0x12345678, 0x1234, 0x1234, 0x12, 0x34, 0x12, 0x34, 0x56, 0x78, 0x90, 0x12) 3047fb2b43cSIngo Molnar * ^ tabs ^extra space 3057fb2b43cSIngo Molnar * 3067fb2b43cSIngo Molnar * Note that the 'extra space' separates the values at the same place 3077fb2b43cSIngo Molnar * where the UEFI SPEC breaks the line. 3081da177e4SLinus Torvalds */ 3097fb2b43cSIngo Molnar #define NULL_GUID EFI_GUID(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00) 3107fb2b43cSIngo Molnar #define MPS_TABLE_GUID EFI_GUID(0xeb9d2d2f, 0x2d88, 0x11d3, 0x9a, 0x16, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d) 3117fb2b43cSIngo Molnar #define ACPI_TABLE_GUID EFI_GUID(0xeb9d2d30, 0x2d88, 0x11d3, 0x9a, 0x16, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d) 3127fb2b43cSIngo Molnar #define ACPI_20_TABLE_GUID EFI_GUID(0x8868e871, 0xe4f1, 0x11d3, 0xbc, 0x22, 0x00, 0x80, 0xc7, 0x3c, 0x88, 0x81) 3137fb2b43cSIngo Molnar #define SMBIOS_TABLE_GUID EFI_GUID(0xeb9d2d31, 0x2d88, 0x11d3, 0x9a, 0x16, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d) 3147fb2b43cSIngo Molnar #define SMBIOS3_TABLE_GUID EFI_GUID(0xf2fd1544, 0x9794, 0x4a2c, 0x99, 0x2e, 0xe5, 0xbb, 0xcf, 0x20, 0xe3, 0x94) 3157fb2b43cSIngo Molnar #define SAL_SYSTEM_TABLE_GUID EFI_GUID(0xeb9d2d32, 0x2d88, 0x11d3, 0x9a, 0x16, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d) 3167fb2b43cSIngo Molnar #define HCDP_TABLE_GUID EFI_GUID(0xf951938d, 0x620b, 0x42ef, 0x82, 0x79, 0xa8, 0x4b, 0x79, 0x61, 0x78, 0x98) 3177fb2b43cSIngo Molnar #define UGA_IO_PROTOCOL_GUID EFI_GUID(0x61a4d49e, 0x6f68, 0x4f1b, 0xb9, 0x22, 0xa8, 0x6e, 0xed, 0x0b, 0x07, 0xa2) 3187fb2b43cSIngo Molnar #define EFI_GLOBAL_VARIABLE_GUID EFI_GUID(0x8be4df61, 0x93ca, 0x11d2, 0xaa, 0x0d, 0x00, 0xe0, 0x98, 0x03, 0x2b, 0x8c) 3197fb2b43cSIngo Molnar #define UV_SYSTEM_TABLE_GUID EFI_GUID(0x3b13a7d4, 0x633e, 0x11dd, 0x93, 0xec, 0xda, 0x25, 0x56, 0xd8, 0x95, 0x93) 3207fb2b43cSIngo Molnar #define LINUX_EFI_CRASH_GUID EFI_GUID(0xcfc8fc79, 0xbe2e, 0x4ddc, 0x97, 0xf0, 0x9f, 0x98, 0xbf, 0xe2, 0x98, 0xa0) 3217fb2b43cSIngo Molnar #define LOADED_IMAGE_PROTOCOL_GUID EFI_GUID(0x5b1b31a1, 0x9562, 0x11d2, 0x8e, 0x3f, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b) 3227fb2b43cSIngo Molnar #define EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID EFI_GUID(0x9042a9de, 0x23dc, 0x4a38, 0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a) 3237fb2b43cSIngo Molnar #define EFI_UGA_PROTOCOL_GUID EFI_GUID(0x982c298b, 0xf4fa, 0x41cb, 0xb8, 0x38, 0x77, 0xaa, 0x68, 0x8f, 0xb8, 0x39) 3247fb2b43cSIngo Molnar #define EFI_PCI_IO_PROTOCOL_GUID EFI_GUID(0x4cf5b200, 0x68b8, 0x4ca5, 0x9e, 0xec, 0xb2, 0x3e, 0x3f, 0x50, 0x02, 0x9a) 3257fb2b43cSIngo Molnar #define EFI_FILE_INFO_ID EFI_GUID(0x09576e92, 0x6d3f, 0x11d2, 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b) 3267fb2b43cSIngo Molnar #define EFI_SYSTEM_RESOURCE_TABLE_GUID EFI_GUID(0xb122a263, 0x3661, 0x4f68, 0x99, 0x29, 0x78, 0xf8, 0xb0, 0xd6, 0x21, 0x80) 3277fb2b43cSIngo Molnar #define EFI_FILE_SYSTEM_GUID EFI_GUID(0x964e5b22, 0x6459, 0x11d2, 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b) 3287fb2b43cSIngo Molnar #define DEVICE_TREE_GUID EFI_GUID(0xb1b621d5, 0xf19c, 0x41a5, 0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0xe0) 3297fb2b43cSIngo Molnar #define EFI_PROPERTIES_TABLE_GUID EFI_GUID(0x880aaca3, 0x4adc, 0x4a04, 0x90, 0x79, 0xb7, 0x47, 0x34, 0x08, 0x25, 0xe5) 3307fb2b43cSIngo Molnar #define EFI_RNG_PROTOCOL_GUID EFI_GUID(0x3152bca5, 0xeade, 0x433d, 0x86, 0x2e, 0xc0, 0x1c, 0xdc, 0x29, 0x1f, 0x44) 331568bc4e8SArd Biesheuvel #define EFI_RNG_ALGORITHM_RAW EFI_GUID(0xe43176d7, 0xb6e8, 0x4827, 0xb7, 0x84, 0x7f, 0xfd, 0xc4, 0xb6, 0x85, 0x61) 3327fb2b43cSIngo Molnar #define EFI_MEMORY_ATTRIBUTES_TABLE_GUID EFI_GUID(0xdcfa911d, 0x26eb, 0x469f, 0xa2, 0x20, 0x38, 0xb7, 0xdc, 0x46, 0x12, 0x20) 3337fb2b43cSIngo Molnar #define EFI_CONSOLE_OUT_DEVICE_GUID EFI_GUID(0xd3b36f2c, 0xd551, 0x11d4, 0x9a, 0x46, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d) 33458c5475aSLukas Wunner #define APPLE_PROPERTIES_PROTOCOL_GUID EFI_GUID(0x91bd12fe, 0xf6c3, 0x44fb, 0xa5, 0xb7, 0x51, 0x22, 0xab, 0x30, 0x3a, 0xe0) 33533b6d034SThiebaud Weksteen #define EFI_TCG2_PROTOCOL_GUID EFI_GUID(0x607f766c, 0x7455, 0x42be, 0x93, 0x0b, 0xe4, 0xd7, 0x6d, 0xb2, 0x72, 0x0f) 3362931d526SArd Biesheuvel #define EFI_LOAD_FILE_PROTOCOL_GUID EFI_GUID(0x56ec3091, 0x954c, 0x11d2, 0x8e, 0x3f, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b) 3372931d526SArd Biesheuvel #define EFI_LOAD_FILE2_PROTOCOL_GUID EFI_GUID(0x4006c0c1, 0xfcb3, 0x403e, 0x99, 0x6d, 0x4a, 0x6c, 0x87, 0x24, 0xe0, 0x6d) 338fe4db90aSArd Biesheuvel #define EFI_RT_PROPERTIES_TABLE_GUID EFI_GUID(0xeb66918a, 0x7eef, 0x402a, 0x84, 0x2e, 0x93, 0x1d, 0x21, 0xc3, 0x8a, 0xe9) 339fc372064SArd Biesheuvel 340e58910cdSJosh Boyer #define EFI_IMAGE_SECURITY_DATABASE_GUID EFI_GUID(0xd719b2cb, 0x3d3a, 0x4596, 0xa3, 0xbc, 0xda, 0xd0, 0x0e, 0x67, 0x65, 0x6f) 341e58910cdSJosh Boyer #define EFI_SHIM_LOCK_GUID EFI_GUID(0x605dab50, 0xe046, 0x4300, 0xab, 0xb6, 0x3d, 0xd8, 0x10, 0xdd, 0x8b, 0x23) 342e58910cdSJosh Boyer 3435c126ba2SDave Howells #define EFI_CERT_SHA256_GUID EFI_GUID(0xc1c41626, 0x504c, 0x4092, 0xac, 0xa9, 0x41, 0xf9, 0x36, 0x93, 0x43, 0x28) 3445c126ba2SDave Howells #define EFI_CERT_X509_GUID EFI_GUID(0xa5c059a1, 0x94e4, 0x4aa7, 0x87, 0xb5, 0xab, 0x15, 0x5c, 0x2b, 0xf0, 0x72) 3455c126ba2SDave Howells #define EFI_CERT_X509_SHA256_GUID EFI_GUID(0x3bd2a492, 0x96c0, 0x4079, 0xb4, 0x20, 0xfc, 0xf9, 0x8e, 0xf1, 0x03, 0xed) 3465c126ba2SDave Howells 347801820beSArd Biesheuvel /* 348801820beSArd Biesheuvel * This GUID is used to pass to the kernel proper the struct screen_info 349801820beSArd Biesheuvel * structure that was populated by the stub based on the GOP protocol instance 350801820beSArd Biesheuvel * associated with ConOut 351801820beSArd Biesheuvel */ 3527fb2b43cSIngo Molnar #define LINUX_EFI_ARM_SCREEN_INFO_TABLE_GUID EFI_GUID(0xe03fc20a, 0x85dc, 0x406e, 0xb9, 0x0e, 0x4a, 0xb5, 0x02, 0x37, 0x1d, 0x95) 3532a55280aSArd Biesheuvel #define LINUX_EFI_ARM_CPU_STATE_TABLE_GUID EFI_GUID(0xef79e4aa, 0x3c3d, 0x4989, 0xb9, 0x02, 0x07, 0xa9, 0x43, 0xe5, 0x50, 0xd2) 3547fb2b43cSIngo Molnar #define LINUX_EFI_LOADER_ENTRY_GUID EFI_GUID(0x4a67b082, 0x0a4c, 0x41cf, 0xb6, 0xc7, 0x44, 0x0b, 0x29, 0xbb, 0x8c, 0x4f) 35563625988SArd Biesheuvel #define LINUX_EFI_RANDOM_SEED_TABLE_GUID EFI_GUID(0x1ce1e5bc, 0x7ceb, 0x42f2, 0x81, 0xe5, 0x8a, 0xad, 0xf1, 0x80, 0xf5, 0x7b) 35633b6d034SThiebaud Weksteen #define LINUX_EFI_TPM_EVENT_LOG_GUID EFI_GUID(0xb7799cb0, 0xeca2, 0x4943, 0x96, 0x67, 0x1f, 0xae, 0x07, 0xb7, 0x47, 0xfa) 357c46f3405SMatthew Garrett #define LINUX_EFI_TPM_FINAL_LOG_GUID EFI_GUID(0x1e2ed096, 0x30e2, 0x4254, 0xbd, 0x89, 0x86, 0x3b, 0xbe, 0xf8, 0x23, 0x25) 35871e0940dSArd Biesheuvel #define LINUX_EFI_MEMRESERVE_TABLE_GUID EFI_GUID(0x888eb0c6, 0x8ede, 0x4ff5, 0xa8, 0xf0, 0x9a, 0xee, 0x5c, 0xb9, 0x77, 0xc2) 359ec93fc37SArd Biesheuvel #define LINUX_EFI_INITRD_MEDIA_GUID EFI_GUID(0x5568e427, 0x68fc, 0x4f3d, 0xac, 0x74, 0xca, 0x55, 0x52, 0x31, 0xcc, 0x68) 36006f7d4a1SCompostella, Jeremy 3611c5fecb6SNarendra K /* OEM GUIDs */ 3621c5fecb6SNarendra K #define DELLEMC_EFI_RCI2_TABLE_GUID EFI_GUID(0x2d9f28a2, 0xa886, 0x456a, 0x97, 0xa8, 0xf1, 0x1e, 0xf2, 0x4f, 0xf4, 0x55) 3631c5fecb6SNarendra K 3641da177e4SLinus Torvalds typedef struct { 3651da177e4SLinus Torvalds efi_guid_t guid; 3661adbfa35SOlof Johansson u64 table; 3671adbfa35SOlof Johansson } efi_config_table_64_t; 3681adbfa35SOlof Johansson 3691adbfa35SOlof Johansson typedef struct { 3701adbfa35SOlof Johansson efi_guid_t guid; 3711adbfa35SOlof Johansson u32 table; 3721adbfa35SOlof Johansson } efi_config_table_32_t; 3731adbfa35SOlof Johansson 3741786e830SArd Biesheuvel typedef union { 3751786e830SArd Biesheuvel struct { 3761adbfa35SOlof Johansson efi_guid_t guid; 377f958efe9SArd Biesheuvel void *table; 3781786e830SArd Biesheuvel }; 3791786e830SArd Biesheuvel efi_config_table_32_t mixed_mode; 3801da177e4SLinus Torvalds } efi_config_table_t; 3811da177e4SLinus Torvalds 382272686bfSLeif Lindholm typedef struct { 383272686bfSLeif Lindholm efi_guid_t guid; 384272686bfSLeif Lindholm unsigned long *ptr; 3854e9a0f73SArd Biesheuvel const char name[16]; 386272686bfSLeif Lindholm } efi_config_table_type_t; 387272686bfSLeif Lindholm 3881da177e4SLinus Torvalds #define EFI_SYSTEM_TABLE_SIGNATURE ((u64)0x5453595320494249ULL) 3891da177e4SLinus Torvalds 3903b370237SMatthew Garrett #define EFI_2_30_SYSTEM_TABLE_REVISION ((2 << 16) | (30)) 3913b370237SMatthew Garrett #define EFI_2_20_SYSTEM_TABLE_REVISION ((2 << 16) | (20)) 3923b370237SMatthew Garrett #define EFI_2_10_SYSTEM_TABLE_REVISION ((2 << 16) | (10)) 3933b370237SMatthew Garrett #define EFI_2_00_SYSTEM_TABLE_REVISION ((2 << 16) | (00)) 3943b370237SMatthew Garrett #define EFI_1_10_SYSTEM_TABLE_REVISION ((1 << 16) | (10)) 3953b370237SMatthew Garrett #define EFI_1_02_SYSTEM_TABLE_REVISION ((1 << 16) | (02)) 3963b370237SMatthew Garrett 3971da177e4SLinus Torvalds typedef struct { 3981da177e4SLinus Torvalds efi_table_hdr_t hdr; 3991adbfa35SOlof Johansson u64 fw_vendor; /* physical addr of CHAR16 vendor string */ 4001adbfa35SOlof Johansson u32 fw_revision; 4011adbfa35SOlof Johansson u32 __pad1; 4021adbfa35SOlof Johansson u64 con_in_handle; 4031adbfa35SOlof Johansson u64 con_in; 4041adbfa35SOlof Johansson u64 con_out_handle; 4051adbfa35SOlof Johansson u64 con_out; 4061adbfa35SOlof Johansson u64 stderr_handle; 4071adbfa35SOlof Johansson u64 stderr; 4081adbfa35SOlof Johansson u64 runtime; 4091adbfa35SOlof Johansson u64 boottime; 4101adbfa35SOlof Johansson u32 nr_tables; 4111adbfa35SOlof Johansson u32 __pad2; 4121adbfa35SOlof Johansson u64 tables; 4131adbfa35SOlof Johansson } efi_system_table_64_t; 4141adbfa35SOlof Johansson 4151adbfa35SOlof Johansson typedef struct { 4161adbfa35SOlof Johansson efi_table_hdr_t hdr; 4171adbfa35SOlof Johansson u32 fw_vendor; /* physical addr of CHAR16 vendor string */ 4181adbfa35SOlof Johansson u32 fw_revision; 4191adbfa35SOlof Johansson u32 con_in_handle; 4201adbfa35SOlof Johansson u32 con_in; 4211adbfa35SOlof Johansson u32 con_out_handle; 4221adbfa35SOlof Johansson u32 con_out; 4231adbfa35SOlof Johansson u32 stderr_handle; 4241adbfa35SOlof Johansson u32 stderr; 4251adbfa35SOlof Johansson u32 runtime; 4261adbfa35SOlof Johansson u32 boottime; 4271adbfa35SOlof Johansson u32 nr_tables; 4281adbfa35SOlof Johansson u32 tables; 4291adbfa35SOlof Johansson } efi_system_table_32_t; 4301adbfa35SOlof Johansson 4319b47c527SArvind Sankar typedef union efi_simple_text_input_protocol efi_simple_text_input_protocol_t; 432960a8d01SArd Biesheuvel typedef union efi_simple_text_output_protocol efi_simple_text_output_protocol_t; 433960a8d01SArd Biesheuvel 4341786e830SArd Biesheuvel typedef union { 4351786e830SArd Biesheuvel struct { 4361adbfa35SOlof Johansson efi_table_hdr_t hdr; 4371da177e4SLinus Torvalds unsigned long fw_vendor; /* physical addr of CHAR16 vendor string */ 4381da177e4SLinus Torvalds u32 fw_revision; 4391da177e4SLinus Torvalds unsigned long con_in_handle; 4409b47c527SArvind Sankar efi_simple_text_input_protocol_t *con_in; 4411da177e4SLinus Torvalds unsigned long con_out_handle; 442960a8d01SArd Biesheuvel efi_simple_text_output_protocol_t *con_out; 4431da177e4SLinus Torvalds unsigned long stderr_handle; 4441da177e4SLinus Torvalds unsigned long stderr; 4451da177e4SLinus Torvalds efi_runtime_services_t *runtime; 446f30ca6baSMatt Fleming efi_boot_services_t *boottime; 4471da177e4SLinus Torvalds unsigned long nr_tables; 4481da177e4SLinus Torvalds unsigned long tables; 4491786e830SArd Biesheuvel }; 4501786e830SArd Biesheuvel efi_system_table_32_t mixed_mode; 4511da177e4SLinus Torvalds } efi_system_table_t; 4521da177e4SLinus Torvalds 4539479c7ceSMatt Fleming /* 4549479c7ceSMatt Fleming * Architecture independent structure for describing a memory map for the 4551db91035SDan Williams * benefit of efi_memmap_init_early(), and for passing context between 4561db91035SDan Williams * efi_memmap_alloc() and efi_memmap_install(). 4579479c7ceSMatt Fleming */ 4589479c7ceSMatt Fleming struct efi_memory_map_data { 4599479c7ceSMatt Fleming phys_addr_t phys_map; 4609479c7ceSMatt Fleming unsigned long size; 4619479c7ceSMatt Fleming unsigned long desc_version; 4629479c7ceSMatt Fleming unsigned long desc_size; 46326c0e44aSDan Williams unsigned long flags; 4649479c7ceSMatt Fleming }; 4659479c7ceSMatt Fleming 4661da177e4SLinus Torvalds struct efi_memory_map { 46744511fb9SArd Biesheuvel phys_addr_t phys_map; 4687ae65fd3SMatt Tolentino void *map; 4697ae65fd3SMatt Tolentino void *map_end; 4701da177e4SLinus Torvalds int nr_map; 4711da177e4SLinus Torvalds unsigned long desc_version; 4727ae65fd3SMatt Tolentino unsigned long desc_size; 47326c0e44aSDan Williams #define EFI_MEMMAP_LATE (1UL << 0) 4741db91035SDan Williams #define EFI_MEMMAP_MEMBLOCK (1UL << 1) 4751db91035SDan Williams #define EFI_MEMMAP_SLAB (1UL << 2) 47626c0e44aSDan Williams unsigned long flags; 4771da177e4SLinus Torvalds }; 4781da177e4SLinus Torvalds 47960863c0dSMatt Fleming struct efi_mem_range { 48060863c0dSMatt Fleming struct range range; 48160863c0dSMatt Fleming u64 attribute; 4821da177e4SLinus Torvalds }; 4831da177e4SLinus Torvalds 484bf924863SArd Biesheuvel typedef struct { 485bf924863SArd Biesheuvel u32 version; 486bf924863SArd Biesheuvel u32 length; 487bf924863SArd Biesheuvel u64 memory_protection_attribute; 488bf924863SArd Biesheuvel } efi_properties_table_t; 489bf924863SArd Biesheuvel 490bf924863SArd Biesheuvel #define EFI_PROPERTIES_TABLE_VERSION 0x00010000 491bf924863SArd Biesheuvel #define EFI_PROPERTIES_RUNTIME_MEMORY_PROTECTION_NON_EXECUTABLE_PE_DATA 0x1 492bf924863SArd Biesheuvel 493fe4db90aSArd Biesheuvel typedef struct { 494fe4db90aSArd Biesheuvel u16 version; 495fe4db90aSArd Biesheuvel u16 length; 496fe4db90aSArd Biesheuvel u32 runtime_services_supported; 497fe4db90aSArd Biesheuvel } efi_rt_properties_table_t; 498fe4db90aSArd Biesheuvel 499fe4db90aSArd Biesheuvel #define EFI_RT_PROPERTIES_TABLE_VERSION 0x1 500fe4db90aSArd Biesheuvel 501b2c99e3cSBjorn Helgaas #define EFI_INVALID_TABLE_ADDR (~0UL) 502b2c99e3cSBjorn Helgaas 503a604af07SArd Biesheuvel typedef struct { 504a604af07SArd Biesheuvel u32 version; 505a604af07SArd Biesheuvel u32 num_entries; 506a604af07SArd Biesheuvel u32 desc_size; 507a604af07SArd Biesheuvel u32 reserved; 508a604af07SArd Biesheuvel efi_memory_desc_t entry[0]; 509a604af07SArd Biesheuvel } efi_memory_attributes_table_t; 510a604af07SArd Biesheuvel 5115c126ba2SDave Howells typedef struct { 5125c126ba2SDave Howells efi_guid_t signature_owner; 5135c126ba2SDave Howells u8 signature_data[]; 5145c126ba2SDave Howells } efi_signature_data_t; 5155c126ba2SDave Howells 5165c126ba2SDave Howells typedef struct { 5175c126ba2SDave Howells efi_guid_t signature_type; 5185c126ba2SDave Howells u32 signature_list_size; 5195c126ba2SDave Howells u32 signature_header_size; 5205c126ba2SDave Howells u32 signature_size; 5215c126ba2SDave Howells u8 signature_header[]; 5225c126ba2SDave Howells /* efi_signature_data_t signatures[][] */ 5235c126ba2SDave Howells } efi_signature_list_t; 5245c126ba2SDave Howells 5255c126ba2SDave Howells typedef u8 efi_sha256_hash_t[32]; 5265c126ba2SDave Howells 5275c126ba2SDave Howells typedef struct { 5285c126ba2SDave Howells efi_sha256_hash_t to_be_signed_hash; 5295c126ba2SDave Howells efi_time_t time_of_revocation; 5305c126ba2SDave Howells } efi_cert_x509_sha256_t; 5315c126ba2SDave Howells 532badc6198STom Lendacky extern unsigned long __ro_after_init efi_rng_seed; /* RNG Seed table */ 533badc6198STom Lendacky 5341da177e4SLinus Torvalds /* 5351da177e4SLinus Torvalds * All runtime access to EFI goes through this structure: 5361da177e4SLinus Torvalds */ 5371da177e4SLinus Torvalds extern struct efi { 53859f2a619SArd Biesheuvel const efi_runtime_services_t *runtime; /* EFI runtime services table */ 5393b370237SMatthew Garrett unsigned int runtime_version; /* Runtime services version */ 54096a3dd3dSArd Biesheuvel unsigned int runtime_supported_mask; 541fd268304SArd Biesheuvel 542b2c99e3cSBjorn Helgaas unsigned long acpi; /* ACPI table (IA64 ext 0.71) */ 543b2c99e3cSBjorn Helgaas unsigned long acpi20; /* ACPI table (ACPI 2.0) */ 544e1ccbbc9SArd Biesheuvel unsigned long smbios; /* SMBIOS table (32 bit entry point) */ 545e1ccbbc9SArd Biesheuvel unsigned long smbios3; /* SMBIOS table (64 bit entry point) */ 5460bb54905SPeter Jones unsigned long esrt; /* ESRT table */ 54733b6d034SThiebaud Weksteen unsigned long tpm_log; /* TPM2 Event Log table */ 548c46f3405SMatthew Garrett unsigned long tpm_final_log; /* TPM2 Final Events Log table */ 549fd268304SArd Biesheuvel 5501da177e4SLinus Torvalds efi_get_time_t *get_time; 5511da177e4SLinus Torvalds efi_set_time_t *set_time; 5521da177e4SLinus Torvalds efi_get_wakeup_time_t *get_wakeup_time; 5531da177e4SLinus Torvalds efi_set_wakeup_time_t *set_wakeup_time; 5541da177e4SLinus Torvalds efi_get_variable_t *get_variable; 5551da177e4SLinus Torvalds efi_get_next_variable_t *get_next_variable; 5561da177e4SLinus Torvalds efi_set_variable_t *set_variable; 55770d2a3cfSArd Biesheuvel efi_set_variable_t *set_variable_nonblocking; 5583b370237SMatthew Garrett efi_query_variable_info_t *query_variable_info; 559d3cac1f8SArd Biesheuvel efi_query_variable_info_t *query_variable_info_nonblocking; 5603b370237SMatthew Garrett efi_update_capsule_t *update_capsule; 5613b370237SMatthew Garrett efi_query_capsule_caps_t *query_capsule_caps; 5621da177e4SLinus Torvalds efi_get_next_high_mono_count_t *get_next_high_mono_count; 5631da177e4SLinus Torvalds efi_reset_system_t *reset_system; 564fd268304SArd Biesheuvel 565884f4f66SMatt Fleming struct efi_memory_map memmap; 5663e909599SMatt Fleming unsigned long flags; 5671da177e4SLinus Torvalds } efi; 5681da177e4SLinus Torvalds 56996a3dd3dSArd Biesheuvel #define EFI_RT_SUPPORTED_GET_TIME 0x0001 57096a3dd3dSArd Biesheuvel #define EFI_RT_SUPPORTED_SET_TIME 0x0002 57196a3dd3dSArd Biesheuvel #define EFI_RT_SUPPORTED_GET_WAKEUP_TIME 0x0004 57296a3dd3dSArd Biesheuvel #define EFI_RT_SUPPORTED_SET_WAKEUP_TIME 0x0008 57396a3dd3dSArd Biesheuvel #define EFI_RT_SUPPORTED_GET_VARIABLE 0x0010 57496a3dd3dSArd Biesheuvel #define EFI_RT_SUPPORTED_GET_NEXT_VARIABLE_NAME 0x0020 57596a3dd3dSArd Biesheuvel #define EFI_RT_SUPPORTED_SET_VARIABLE 0x0040 57696a3dd3dSArd Biesheuvel #define EFI_RT_SUPPORTED_SET_VIRTUAL_ADDRESS_MAP 0x0080 57796a3dd3dSArd Biesheuvel #define EFI_RT_SUPPORTED_CONVERT_POINTER 0x0100 57896a3dd3dSArd Biesheuvel #define EFI_RT_SUPPORTED_GET_NEXT_HIGH_MONOTONIC_COUNT 0x0200 57996a3dd3dSArd Biesheuvel #define EFI_RT_SUPPORTED_RESET_SYSTEM 0x0400 58096a3dd3dSArd Biesheuvel #define EFI_RT_SUPPORTED_UPDATE_CAPSULE 0x0800 58196a3dd3dSArd Biesheuvel #define EFI_RT_SUPPORTED_QUERY_CAPSULE_CAPABILITIES 0x1000 58296a3dd3dSArd Biesheuvel #define EFI_RT_SUPPORTED_QUERY_VARIABLE_INFO 0x2000 58396a3dd3dSArd Biesheuvel 58496a3dd3dSArd Biesheuvel #define EFI_RT_SUPPORTED_ALL 0x3fff 58596a3dd3dSArd Biesheuvel 58696a3dd3dSArd Biesheuvel #define EFI_RT_SUPPORTED_TIME_SERVICES 0x000f 58796a3dd3dSArd Biesheuvel #define EFI_RT_SUPPORTED_VARIABLE_SERVICES 0x0070 58896a3dd3dSArd Biesheuvel 5897e904a91SSai Praneeth extern struct mm_struct efi_mm; 5907e904a91SSai Praneeth 5911da177e4SLinus Torvalds static inline int 5921da177e4SLinus Torvalds efi_guidcmp (efi_guid_t left, efi_guid_t right) 5931da177e4SLinus Torvalds { 5941da177e4SLinus Torvalds return memcmp(&left, &right, sizeof (efi_guid_t)); 5951da177e4SLinus Torvalds } 5961da177e4SLinus Torvalds 5971da177e4SLinus Torvalds static inline char * 59826e02272SBorislav Petkov efi_guid_to_str(efi_guid_t *guid, char *out) 5991da177e4SLinus Torvalds { 600925ede0bSJoe Perches sprintf(out, "%pUl", guid->b); 6011da177e4SLinus Torvalds return out; 6021da177e4SLinus Torvalds } 6031da177e4SLinus Torvalds 6041da177e4SLinus Torvalds extern void efi_init (void); 6051da177e4SLinus Torvalds extern void *efi_get_pal_addr (void); 6061da177e4SLinus Torvalds extern void efi_map_pal_code (void); 6071da177e4SLinus Torvalds extern void efi_memmap_walk (efi_freemem_callback_t callback, void *arg); 60870f4f935SArnd Bergmann extern void efi_gettimeofday (struct timespec64 *ts); 609*2c547f9dSAndrey Konovalov #ifdef CONFIG_EFI 6101da177e4SLinus Torvalds extern void efi_enter_virtual_mode (void); /* switch EFI to virtual mode, if possible */ 611*2c547f9dSAndrey Konovalov #else 612*2c547f9dSAndrey Konovalov static inline void efi_enter_virtual_mode (void) {} 613*2c547f9dSAndrey Konovalov #endif 61478510792SJosh Triplett #ifdef CONFIG_X86 615ca0e30dcSArd Biesheuvel extern efi_status_t efi_query_variable_store(u32 attributes, 616ca0e30dcSArd Biesheuvel unsigned long size, 617ca0e30dcSArd Biesheuvel bool nonblocking); 61878510792SJosh Triplett #else 619a6e4d5a0SMatt Fleming 620ca0e30dcSArd Biesheuvel static inline efi_status_t efi_query_variable_store(u32 attributes, 621ca0e30dcSArd Biesheuvel unsigned long size, 622ca0e30dcSArd Biesheuvel bool nonblocking) 623a6e4d5a0SMatt Fleming { 624a6e4d5a0SMatt Fleming return EFI_SUCCESS; 625a6e4d5a0SMatt Fleming } 62678510792SJosh Triplett #endif 6277bc90e01SJosh Triplett extern void __iomem *efi_lookup_mapped_addr(u64 phys_addr); 6289479c7ceSMatt Fleming 6291db91035SDan Williams extern int __init efi_memmap_alloc(unsigned int num_entries, 6301db91035SDan Williams struct efi_memory_map_data *data); 631484a418dSDan Williams extern void __efi_memmap_free(u64 phys, unsigned long size, 632484a418dSDan Williams unsigned long flags); 6339479c7ceSMatt Fleming extern int __init efi_memmap_init_early(struct efi_memory_map_data *data); 634dca0f971SMatt Fleming extern int __init efi_memmap_init_late(phys_addr_t addr, unsigned long size); 6359479c7ceSMatt Fleming extern void __init efi_memmap_unmap(void); 6361db91035SDan Williams extern int __init efi_memmap_install(struct efi_memory_map_data *data); 63760863c0dSMatt Fleming extern int __init efi_memmap_split_count(efi_memory_desc_t *md, 63860863c0dSMatt Fleming struct range *range); 63960863c0dSMatt Fleming extern void __init efi_memmap_insert(struct efi_memory_map *old_memmap, 64060863c0dSMatt Fleming void *buf, struct efi_mem_range *mem); 6419479c7ceSMatt Fleming 6423846c158SPeter Jones #ifdef CONFIG_EFI_ESRT 6430bb54905SPeter Jones extern void __init efi_esrt_init(void); 6443846c158SPeter Jones #else 6453846c158SPeter Jones static inline void efi_esrt_init(void) { } 6463846c158SPeter Jones #endif 64706c0bd93SArd Biesheuvel extern int efi_config_parse_tables(const efi_config_table_t *config_tables, 64806c0bd93SArd Biesheuvel int count, 64906c0bd93SArd Biesheuvel const efi_config_table_type_t *arch_tables); 65014fb4209SArd Biesheuvel extern int efi_systab_check_header(const efi_table_hdr_t *systab_hdr, 65114fb4209SArd Biesheuvel int min_major_version); 65214fb4209SArd Biesheuvel extern void efi_systab_report_header(const efi_table_hdr_t *systab_hdr, 65314fb4209SArd Biesheuvel unsigned long fw_vendor); 6541da177e4SLinus Torvalds extern u64 efi_get_iobase (void); 655f99afd08STom Lendacky extern int efi_mem_type(unsigned long phys_addr); 6561da177e4SLinus Torvalds extern u64 efi_mem_attributes (unsigned long phys_addr); 65732e62c63SBjorn Helgaas extern u64 efi_mem_attribute (unsigned long phys_addr, unsigned long size); 6581da177e4SLinus Torvalds extern int __init efi_uart_console_only (void); 6590bb54905SPeter Jones extern u64 efi_mem_desc_end(efi_memory_desc_t *md); 6600bb54905SPeter Jones extern int efi_mem_desc_lookup(u64 phys_addr, efi_memory_desc_t *out_md); 661816e7612SMatt Fleming extern void efi_mem_reserve(phys_addr_t addr, u64 size); 662a23d3bb0SArd Biesheuvel extern int efi_mem_reserve_persistent(phys_addr_t addr, u64 size); 6631da177e4SLinus Torvalds extern void efi_initialize_iomem_resources(struct resource *code_resource, 66400bf4098SBernhard Walle struct resource *data_resource, struct resource *bss_resource); 6653b2e4b4cSArd Biesheuvel extern u64 efi_get_fdt_params(struct efi_memory_map_data *data); 6660bb54905SPeter Jones extern struct kobject *efi_kobj; 6671da177e4SLinus Torvalds 66844be28e9SMatt Fleming extern int efi_reboot_quirk_mode; 6690c5ed61aSMatt Fleming extern bool efi_poweroff_required(void); 6700c5ed61aSMatt Fleming 6710f96a99dSTaku Izumi #ifdef CONFIG_EFI_FAKE_MEMMAP 6720f96a99dSTaku Izumi extern void __init efi_fake_memmap(void); 6730f96a99dSTaku Izumi #else 6740f96a99dSTaku Izumi static inline void efi_fake_memmap(void) { } 6750f96a99dSTaku Izumi #endif 6760f96a99dSTaku Izumi 677a17e809eSArd Biesheuvel extern unsigned long efi_mem_attr_table; 678a17e809eSArd Biesheuvel 67910f0d2f5SArd Biesheuvel /* 68010f0d2f5SArd Biesheuvel * efi_memattr_perm_setter - arch specific callback function passed into 68110f0d2f5SArd Biesheuvel * efi_memattr_apply_permissions() that updates the 68210f0d2f5SArd Biesheuvel * mapping permissions described by the second 68310f0d2f5SArd Biesheuvel * argument in the page tables referred to by the 68410f0d2f5SArd Biesheuvel * first argument. 68510f0d2f5SArd Biesheuvel */ 68610f0d2f5SArd Biesheuvel typedef int (*efi_memattr_perm_setter)(struct mm_struct *, efi_memory_desc_t *); 68710f0d2f5SArd Biesheuvel 68810f0d2f5SArd Biesheuvel extern int efi_memattr_init(void); 68910f0d2f5SArd Biesheuvel extern int efi_memattr_apply_permissions(struct mm_struct *mm, 69010f0d2f5SArd Biesheuvel efi_memattr_perm_setter fn); 69110f0d2f5SArd Biesheuvel 69202e43c2dSBaoquan He /* 69302e43c2dSBaoquan He * efi_early_memdesc_ptr - get the n-th EFI memmap descriptor 69402e43c2dSBaoquan He * @map: the start of efi memmap 69502e43c2dSBaoquan He * @desc_size: the size of space for each EFI memmap descriptor 69602e43c2dSBaoquan He * @n: the index of efi memmap descriptor 69702e43c2dSBaoquan He * 69802e43c2dSBaoquan He * EFI boot service provides the GetMemoryMap() function to get a copy of the 69902e43c2dSBaoquan He * current memory map which is an array of memory descriptors, each of 70002e43c2dSBaoquan He * which describes a contiguous block of memory. It also gets the size of the 70102e43c2dSBaoquan He * map, and the size of each descriptor, etc. 70202e43c2dSBaoquan He * 70302e43c2dSBaoquan He * Note that per section 6.2 of UEFI Spec 2.6 Errata A, the returned size of 70402e43c2dSBaoquan He * each descriptor might not be equal to sizeof(efi_memory_memdesc_t), 70502e43c2dSBaoquan He * since efi_memory_memdesc_t may be extended in the future. Thus the OS 70602e43c2dSBaoquan He * MUST use the returned size of the descriptor to find the start of each 70702e43c2dSBaoquan He * efi_memory_memdesc_t in the memory map array. This should only be used 70802e43c2dSBaoquan He * during bootup since for_each_efi_memory_desc_xxx() is available after the 70902e43c2dSBaoquan He * kernel initializes the EFI subsystem to set up struct efi_memory_map. 71002e43c2dSBaoquan He */ 71102e43c2dSBaoquan He #define efi_early_memdesc_ptr(map, desc_size, n) \ 71202e43c2dSBaoquan He (efi_memory_desc_t *)((void *)(map) + ((n) * (desc_size))) 71302e43c2dSBaoquan He 714e885cd80SMark Salter /* Iterate through an efi_memory_map */ 71578ce248fSMatt Fleming #define for_each_efi_memory_desc_in_map(m, md) \ 716e885cd80SMark Salter for ((md) = (m)->map; \ 717d4c4fed0SJan Beulich (md) && ((void *)(md) + (m)->desc_size) <= (m)->map_end; \ 718e885cd80SMark Salter (md) = (void *)(md) + (m)->desc_size) 719e885cd80SMark Salter 72078ce248fSMatt Fleming /** 72178ce248fSMatt Fleming * for_each_efi_memory_desc - iterate over descriptors in efi.memmap 72278ce248fSMatt Fleming * @md: the efi_memory_desc_t * iterator 72378ce248fSMatt Fleming * 72478ce248fSMatt Fleming * Once the loop finishes @md must not be accessed. 72578ce248fSMatt Fleming */ 72678ce248fSMatt Fleming #define for_each_efi_memory_desc(md) \ 727884f4f66SMatt Fleming for_each_efi_memory_desc_in_map(&efi.memmap, md) 72878ce248fSMatt Fleming 72998d2a6caSLaszlo Ersek /* 73098d2a6caSLaszlo Ersek * Format an EFI memory descriptor's type and attributes to a user-provided 73198d2a6caSLaszlo Ersek * character buffer, as per snprintf(), and return the buffer. 73298d2a6caSLaszlo Ersek */ 73398d2a6caSLaszlo Ersek char * __init efi_md_typeattr_format(char *buf, size_t size, 73498d2a6caSLaszlo Ersek const efi_memory_desc_t *md); 73598d2a6caSLaszlo Ersek 7360bc9ae39SDave Howells 7370bc9ae39SDave Howells typedef void (*efi_element_handler_t)(const char *source, 7380bc9ae39SDave Howells const void *element_data, 7390bc9ae39SDave Howells size_t element_size); 7400bc9ae39SDave Howells extern int __init parse_efi_signature_list( 7410bc9ae39SDave Howells const char *source, 7420bc9ae39SDave Howells const void *data, size_t size, 7430bc9ae39SDave Howells efi_element_handler_t (*get_handler_for_guid)(const efi_guid_t *)); 7440bc9ae39SDave Howells 7451da177e4SLinus Torvalds /** 7461da177e4SLinus Torvalds * efi_range_is_wc - check the WC bit on an address range 7471da177e4SLinus Torvalds * @start: starting kvirt address 7481da177e4SLinus Torvalds * @len: length of range 7491da177e4SLinus Torvalds * 7501da177e4SLinus Torvalds * Consult the EFI memory map and make sure it's ok to set this range WC. 7511da177e4SLinus Torvalds * Returns true or false. 7521da177e4SLinus Torvalds */ 7531da177e4SLinus Torvalds static inline int efi_range_is_wc(unsigned long start, unsigned long len) 7541da177e4SLinus Torvalds { 755986a80d5SJesper Juhl unsigned long i; 7561da177e4SLinus Torvalds 7571da177e4SLinus Torvalds for (i = 0; i < len; i += (1UL << EFI_PAGE_SHIFT)) { 7581da177e4SLinus Torvalds unsigned long paddr = __pa(start + i); 7591da177e4SLinus Torvalds if (!(efi_mem_attributes(paddr) & EFI_MEMORY_WC)) 7601da177e4SLinus Torvalds return 0; 7611da177e4SLinus Torvalds } 7621da177e4SLinus Torvalds /* The range checked out */ 7631da177e4SLinus Torvalds return 1; 7641da177e4SLinus Torvalds } 7651da177e4SLinus Torvalds 7661da177e4SLinus Torvalds #ifdef CONFIG_EFI_PCDP 7671da177e4SLinus Torvalds extern int __init efi_setup_pcdp_console(char *); 7681da177e4SLinus Torvalds #endif 7691da177e4SLinus Torvalds 7701da177e4SLinus Torvalds /* 77183e68189SMatt Fleming * We play games with efi_enabled so that the compiler will, if 77283e68189SMatt Fleming * possible, remove EFI-related code altogether. 7731da177e4SLinus Torvalds */ 77483e68189SMatt Fleming #define EFI_BOOT 0 /* Were we booted from EFI? */ 77583e68189SMatt Fleming #define EFI_CONFIG_TABLES 2 /* Can we use EFI config tables? */ 77683e68189SMatt Fleming #define EFI_RUNTIME_SERVICES 3 /* Can we use runtime services? */ 77783e68189SMatt Fleming #define EFI_MEMMAP 4 /* Can we use EFI memory map? */ 77883e68189SMatt Fleming #define EFI_64BIT 5 /* Is the firmware 64-bit? */ 7799f27bc54SDaniel Kiper #define EFI_PARAVIRT 6 /* Access is via a paravirt interface */ 7809f27bc54SDaniel Kiper #define EFI_ARCH_1 7 /* First arch-specific bit */ 781fed6cefeSBorislav Petkov #define EFI_DBG 8 /* Print additional debug info at runtime */ 782a1041713SArd Biesheuvel #define EFI_NX_PE_DATA 9 /* Can runtime data regions be mapped non-executable? */ 783a19ebf59SSai Praneeth #define EFI_MEM_ATTR 10 /* Did firmware publish an EFI_MEMORY_ATTRIBUTES table? */ 784b617c526SDan Williams #define EFI_MEM_NO_SOFT_RESERVE 11 /* Is the kernel configured to ignore soft reservations? */ 7850e72a6a3SHans de Goede #define EFI_PRESERVE_BS_REGIONS 12 /* Are EFI boot-services memory segments available? */ 78683e68189SMatt Fleming 7871da177e4SLinus Torvalds #ifdef CONFIG_EFI 7883e909599SMatt Fleming /* 7893e909599SMatt Fleming * Test whether the above EFI_* bits are enabled. 7903e909599SMatt Fleming */ 7913e909599SMatt Fleming static inline bool efi_enabled(int feature) 79283e68189SMatt Fleming { 7933e909599SMatt Fleming return test_bit(feature, &efi.flags) != 0; 7943e909599SMatt Fleming } 7958562c99cSMatt Fleming extern void efi_reboot(enum reboot_mode reboot_mode, const char *__unused); 796b617c526SDan Williams 797b617c526SDan Williams bool __pure __efi_soft_reserve_enabled(void); 798b617c526SDan Williams 799b617c526SDan Williams static inline bool __pure efi_soft_reserve_enabled(void) 800b617c526SDan Williams { 801b617c526SDan Williams return IS_ENABLED(CONFIG_EFI_SOFT_RESERVE) 802b617c526SDan Williams && __efi_soft_reserve_enabled(); 803b617c526SDan Williams } 80496a3dd3dSArd Biesheuvel 80596a3dd3dSArd Biesheuvel static inline bool efi_rt_services_supported(unsigned int mask) 80696a3dd3dSArd Biesheuvel { 80796a3dd3dSArd Biesheuvel return (efi.runtime_supported_mask & mask) == mask; 80896a3dd3dSArd Biesheuvel } 8093e909599SMatt Fleming #else 8103e909599SMatt Fleming static inline bool efi_enabled(int feature) 8113e909599SMatt Fleming { 8123e909599SMatt Fleming return false; 81383e68189SMatt Fleming } 8148562c99cSMatt Fleming static inline void 8158562c99cSMatt Fleming efi_reboot(enum reboot_mode reboot_mode, const char *__unused) {} 81687615a34SMatt Fleming 81787615a34SMatt Fleming static inline bool 81887615a34SMatt Fleming efi_capsule_pending(int *reset_type) 81987615a34SMatt Fleming { 82087615a34SMatt Fleming return false; 82187615a34SMatt Fleming } 822b617c526SDan Williams 823b617c526SDan Williams static inline bool efi_soft_reserve_enabled(void) 824b617c526SDan Williams { 825b617c526SDan Williams return false; 826b617c526SDan Williams } 82796a3dd3dSArd Biesheuvel 82896a3dd3dSArd Biesheuvel static inline bool efi_rt_services_supported(unsigned int mask) 82996a3dd3dSArd Biesheuvel { 83096a3dd3dSArd Biesheuvel return false; 83196a3dd3dSArd Biesheuvel } 8321da177e4SLinus Torvalds #endif 8331da177e4SLinus Torvalds 834806b0351SMatt Fleming extern int efi_status_to_err(efi_status_t status); 835806b0351SMatt Fleming 8361da177e4SLinus Torvalds /* 8371da177e4SLinus Torvalds * Variable Attributes 8381da177e4SLinus Torvalds */ 8391da177e4SLinus Torvalds #define EFI_VARIABLE_NON_VOLATILE 0x0000000000000001 8401da177e4SLinus Torvalds #define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x0000000000000002 8411da177e4SLinus Torvalds #define EFI_VARIABLE_RUNTIME_ACCESS 0x0000000000000004 84241b3254cSMatthew Garrett #define EFI_VARIABLE_HARDWARE_ERROR_RECORD 0x0000000000000008 84341b3254cSMatthew Garrett #define EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS 0x0000000000000010 84441b3254cSMatthew Garrett #define EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS 0x0000000000000020 84541b3254cSMatthew Garrett #define EFI_VARIABLE_APPEND_WRITE 0x0000000000000040 8461da177e4SLinus Torvalds 84741b3254cSMatthew Garrett #define EFI_VARIABLE_MASK (EFI_VARIABLE_NON_VOLATILE | \ 84841b3254cSMatthew Garrett EFI_VARIABLE_BOOTSERVICE_ACCESS | \ 84941b3254cSMatthew Garrett EFI_VARIABLE_RUNTIME_ACCESS | \ 85041b3254cSMatthew Garrett EFI_VARIABLE_HARDWARE_ERROR_RECORD | \ 85141b3254cSMatthew Garrett EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS | \ 85241b3254cSMatthew Garrett EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS | \ 85341b3254cSMatthew Garrett EFI_VARIABLE_APPEND_WRITE) 8541da177e4SLinus Torvalds /* 855e14ab23dSMatt Fleming * Length of a GUID string (strlen("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee")) 856e14ab23dSMatt Fleming * not including trailing NUL 857e14ab23dSMatt Fleming */ 858ba7e34b1SAndy Shevchenko #define EFI_VARIABLE_GUID_LEN UUID_STRING_LEN 859e14ab23dSMatt Fleming 860e14ab23dSMatt Fleming /* 8611da177e4SLinus Torvalds * EFI Device Path information 8621da177e4SLinus Torvalds */ 8631da177e4SLinus Torvalds #define EFI_DEV_HW 0x01 8641da177e4SLinus Torvalds #define EFI_DEV_PCI 1 8651da177e4SLinus Torvalds #define EFI_DEV_PCCARD 2 8661da177e4SLinus Torvalds #define EFI_DEV_MEM_MAPPED 3 8671da177e4SLinus Torvalds #define EFI_DEV_VENDOR 4 8681da177e4SLinus Torvalds #define EFI_DEV_CONTROLLER 5 8691da177e4SLinus Torvalds #define EFI_DEV_ACPI 0x02 8701da177e4SLinus Torvalds #define EFI_DEV_BASIC_ACPI 1 8711da177e4SLinus Torvalds #define EFI_DEV_EXPANDED_ACPI 2 8721da177e4SLinus Torvalds #define EFI_DEV_MSG 0x03 8731da177e4SLinus Torvalds #define EFI_DEV_MSG_ATAPI 1 8741da177e4SLinus Torvalds #define EFI_DEV_MSG_SCSI 2 8751da177e4SLinus Torvalds #define EFI_DEV_MSG_FC 3 8761da177e4SLinus Torvalds #define EFI_DEV_MSG_1394 4 8771da177e4SLinus Torvalds #define EFI_DEV_MSG_USB 5 8781da177e4SLinus Torvalds #define EFI_DEV_MSG_USB_CLASS 15 8791da177e4SLinus Torvalds #define EFI_DEV_MSG_I20 6 8801da177e4SLinus Torvalds #define EFI_DEV_MSG_MAC 11 8811da177e4SLinus Torvalds #define EFI_DEV_MSG_IPV4 12 8821da177e4SLinus Torvalds #define EFI_DEV_MSG_IPV6 13 8831da177e4SLinus Torvalds #define EFI_DEV_MSG_INFINIBAND 9 8841da177e4SLinus Torvalds #define EFI_DEV_MSG_UART 14 8851da177e4SLinus Torvalds #define EFI_DEV_MSG_VENDOR 10 8861da177e4SLinus Torvalds #define EFI_DEV_MEDIA 0x04 8871da177e4SLinus Torvalds #define EFI_DEV_MEDIA_HARD_DRIVE 1 8881da177e4SLinus Torvalds #define EFI_DEV_MEDIA_CDROM 2 8891da177e4SLinus Torvalds #define EFI_DEV_MEDIA_VENDOR 3 8901da177e4SLinus Torvalds #define EFI_DEV_MEDIA_FILE 4 8911da177e4SLinus Torvalds #define EFI_DEV_MEDIA_PROTOCOL 5 8921da177e4SLinus Torvalds #define EFI_DEV_BIOS_BOOT 0x05 8931da177e4SLinus Torvalds #define EFI_DEV_END_PATH 0x7F 8941da177e4SLinus Torvalds #define EFI_DEV_END_PATH2 0xFF 8951da177e4SLinus Torvalds #define EFI_DEV_END_INSTANCE 0x01 8961da177e4SLinus Torvalds #define EFI_DEV_END_ENTIRE 0xFF 8971da177e4SLinus Torvalds 8981da177e4SLinus Torvalds struct efi_generic_dev_path { 8991da177e4SLinus Torvalds u8 type; 9001da177e4SLinus Torvalds u8 sub_type; 9011da177e4SLinus Torvalds u16 length; 902db8952e7SArd Biesheuvel } __packed; 9031da177e4SLinus Torvalds 904db8952e7SArd Biesheuvel struct efi_acpi_dev_path { 905db8952e7SArd Biesheuvel struct efi_generic_dev_path header; 90646cd4b75SLukas Wunner u32 hid; 90746cd4b75SLukas Wunner u32 uid; 908db8952e7SArd Biesheuvel } __packed; 909db8952e7SArd Biesheuvel 910db8952e7SArd Biesheuvel struct efi_pci_dev_path { 911db8952e7SArd Biesheuvel struct efi_generic_dev_path header; 91246cd4b75SLukas Wunner u8 fn; 91346cd4b75SLukas Wunner u8 dev; 914db8952e7SArd Biesheuvel } __packed; 91546cd4b75SLukas Wunner 916db8952e7SArd Biesheuvel struct efi_vendor_dev_path { 917db8952e7SArd Biesheuvel struct efi_generic_dev_path header; 918db8952e7SArd Biesheuvel efi_guid_t vendorguid; 919db8952e7SArd Biesheuvel u8 vendordata[]; 920db8952e7SArd Biesheuvel } __packed; 921db8952e7SArd Biesheuvel 922db8952e7SArd Biesheuvel struct efi_dev_path { 923db8952e7SArd Biesheuvel union { 924db8952e7SArd Biesheuvel struct efi_generic_dev_path header; 925db8952e7SArd Biesheuvel struct efi_acpi_dev_path acpi; 926db8952e7SArd Biesheuvel struct efi_pci_dev_path pci; 927db8952e7SArd Biesheuvel struct efi_vendor_dev_path vendor; 928db8952e7SArd Biesheuvel }; 929db8952e7SArd Biesheuvel } __packed; 930db8952e7SArd Biesheuvel 931db8952e7SArd Biesheuvel struct device *efi_get_device_by_path(const struct efi_dev_path **node, 932db8952e7SArd Biesheuvel size_t *len); 93346cd4b75SLukas Wunner 9344a3575fdSHuang, Ying static inline void memrange_efi_to_native(u64 *addr, u64 *npages) 9354a3575fdSHuang, Ying { 9364a3575fdSHuang, Ying *npages = PFN_UP(*addr + (*npages<<EFI_PAGE_SHIFT)) - PFN_DOWN(*addr); 9374a3575fdSHuang, Ying *addr &= PAGE_MASK; 9384a3575fdSHuang, Ying } 9394a3575fdSHuang, Ying 94004851772SMatt Fleming /* 9414fc756bdSMike Waychison * EFI Variable support. 9424fc756bdSMike Waychison * 9434fc756bdSMike Waychison * Different firmware drivers can expose their EFI-like variables using 9444fc756bdSMike Waychison * the following. 9454fc756bdSMike Waychison */ 9464fc756bdSMike Waychison 9474fc756bdSMike Waychison struct efivar_operations { 9484fc756bdSMike Waychison efi_get_variable_t *get_variable; 9494fc756bdSMike Waychison efi_get_next_variable_t *get_next_variable; 9504fc756bdSMike Waychison efi_set_variable_t *set_variable; 95170d2a3cfSArd Biesheuvel efi_set_variable_t *set_variable_nonblocking; 952a6e4d5a0SMatt Fleming efi_query_variable_store_t *query_variable_store; 9534fc756bdSMike Waychison }; 9544fc756bdSMike Waychison 9554fc756bdSMike Waychison struct efivars { 9564fc756bdSMike Waychison struct kset *kset; 957605e70c7SLee, Chun-Yi struct kobject *kobject; 9584fc756bdSMike Waychison const struct efivar_operations *ops; 9594fc756bdSMike Waychison }; 9604fc756bdSMike Waychison 961e14ab23dSMatt Fleming /* 962e14ab23dSMatt Fleming * The maximum size of VariableName + Data = 1024 963e14ab23dSMatt Fleming * Therefore, it's reasonable to save that much 964e14ab23dSMatt Fleming * space in each part of the structure, 965e14ab23dSMatt Fleming * and we use a page for reading/writing. 966e14ab23dSMatt Fleming */ 967e14ab23dSMatt Fleming 968a5d92ad3SMatt Fleming #define EFI_VAR_NAME_LEN 1024 969a5d92ad3SMatt Fleming 970e14ab23dSMatt Fleming struct efi_variable { 971a5d92ad3SMatt Fleming efi_char16_t VariableName[EFI_VAR_NAME_LEN/sizeof(efi_char16_t)]; 972e14ab23dSMatt Fleming efi_guid_t VendorGuid; 973e14ab23dSMatt Fleming unsigned long DataSize; 974e14ab23dSMatt Fleming __u8 Data[1024]; 975e14ab23dSMatt Fleming efi_status_t Status; 976e14ab23dSMatt Fleming __u32 Attributes; 977e14ab23dSMatt Fleming } __attribute__((packed)); 978e14ab23dSMatt Fleming 979e14ab23dSMatt Fleming struct efivar_entry { 980e14ab23dSMatt Fleming struct efi_variable var; 981e14ab23dSMatt Fleming struct list_head list; 982e14ab23dSMatt Fleming struct kobject kobj; 983e0d59733SSeiji Aguchi bool scanning; 984e0d59733SSeiji Aguchi bool deleting; 985e14ab23dSMatt Fleming }; 986e14ab23dSMatt Fleming 98704851772SMatt Fleming extern struct list_head efivar_sysfs_list; 98804851772SMatt Fleming 98904851772SMatt Fleming static inline void 99004851772SMatt Fleming efivar_unregister(struct efivar_entry *var) 99104851772SMatt Fleming { 99204851772SMatt Fleming kobject_put(&var->kobj); 99304851772SMatt Fleming } 99404851772SMatt Fleming 995e14ab23dSMatt Fleming int efivars_register(struct efivars *efivars, 9964fc756bdSMike Waychison const struct efivar_operations *ops, 997e14ab23dSMatt Fleming struct kobject *kobject); 998e14ab23dSMatt Fleming int efivars_unregister(struct efivars *efivars); 999e14ab23dSMatt Fleming struct kobject *efivars_kobject(void); 1000e14ab23dSMatt Fleming 1001f88814ccSArd Biesheuvel int efivar_supports_writes(void); 1002e14ab23dSMatt Fleming int efivar_init(int (*func)(efi_char16_t *, efi_guid_t, unsigned long, void *), 10031cfd6316SJulia Lawall void *data, bool duplicates, struct list_head *head); 1004e14ab23dSMatt Fleming 100521b3ddd3SSylvain Chouleur int efivar_entry_add(struct efivar_entry *entry, struct list_head *head); 100621b3ddd3SSylvain Chouleur int efivar_entry_remove(struct efivar_entry *entry); 1007e14ab23dSMatt Fleming 1008e14ab23dSMatt Fleming int __efivar_entry_delete(struct efivar_entry *entry); 1009e14ab23dSMatt Fleming int efivar_entry_delete(struct efivar_entry *entry); 1010e14ab23dSMatt Fleming 1011e14ab23dSMatt Fleming int efivar_entry_size(struct efivar_entry *entry, unsigned long *size); 10128a415b8cSMatt Fleming int __efivar_entry_get(struct efivar_entry *entry, u32 *attributes, 10138a415b8cSMatt Fleming unsigned long *size, void *data); 1014e14ab23dSMatt Fleming int efivar_entry_get(struct efivar_entry *entry, u32 *attributes, 1015e14ab23dSMatt Fleming unsigned long *size, void *data); 1016e14ab23dSMatt Fleming int efivar_entry_set(struct efivar_entry *entry, u32 attributes, 1017e14ab23dSMatt Fleming unsigned long size, void *data, struct list_head *head); 1018e14ab23dSMatt Fleming int efivar_entry_set_get_size(struct efivar_entry *entry, u32 attributes, 1019e14ab23dSMatt Fleming unsigned long *size, void *data, bool *set); 1020e14ab23dSMatt Fleming int efivar_entry_set_safe(efi_char16_t *name, efi_guid_t vendor, u32 attributes, 1021e14ab23dSMatt Fleming bool block, unsigned long size, void *data); 1022e14ab23dSMatt Fleming 102321b3ddd3SSylvain Chouleur int efivar_entry_iter_begin(void); 1024e14ab23dSMatt Fleming void efivar_entry_iter_end(void); 1025e14ab23dSMatt Fleming 1026e14ab23dSMatt Fleming int __efivar_entry_iter(int (*func)(struct efivar_entry *, void *), 1027e14ab23dSMatt Fleming struct list_head *head, void *data, 1028e14ab23dSMatt Fleming struct efivar_entry **prev); 1029e14ab23dSMatt Fleming int efivar_entry_iter(int (*func)(struct efivar_entry *, void *), 1030e14ab23dSMatt Fleming struct list_head *head, void *data); 1031e14ab23dSMatt Fleming 1032e14ab23dSMatt Fleming struct efivar_entry *efivar_entry_find(efi_char16_t *name, efi_guid_t guid, 1033e14ab23dSMatt Fleming struct list_head *head, bool remove); 1034e14ab23dSMatt Fleming 10358282f5d9SPeter Jones bool efivar_validate(efi_guid_t vendor, efi_char16_t *var_name, u8 *data, 10368282f5d9SPeter Jones unsigned long data_size); 1037ed8b0de5SPeter Jones bool efivar_variable_is_removable(efi_guid_t vendor, const char *name, 1038ed8b0de5SPeter Jones size_t len); 1039e14ab23dSMatt Fleming 1040a9499fa7STom Gundersen extern struct work_struct efivar_work; 104104851772SMatt Fleming void efivar_run_worker(void); 104204851772SMatt Fleming 1043a9499fa7STom Gundersen #if defined(CONFIG_EFI_VARS) || defined(CONFIG_EFI_VARS_MODULE) 1044e14ab23dSMatt Fleming int efivars_sysfs_init(void); 10454fc756bdSMike Waychison 1046e0d59733SSeiji Aguchi #define EFIVARS_DATA_SIZE_MAX 1024 1047e0d59733SSeiji Aguchi 10484fc756bdSMike Waychison #endif /* CONFIG_EFI_VARS */ 1049f0133f3cSMatt Fleming extern bool efi_capsule_pending(int *reset_type); 1050f0133f3cSMatt Fleming 1051f0133f3cSMatt Fleming extern int efi_capsule_supported(efi_guid_t guid, u32 flags, 1052f0133f3cSMatt Fleming size_t size, int *reset); 1053f0133f3cSMatt Fleming 1054f0133f3cSMatt Fleming extern int efi_capsule_update(efi_capsule_header_t *capsule, 10552a457fb3SArd Biesheuvel phys_addr_t *pages); 10564fc756bdSMike Waychison 1057926172d4SDave Young #ifdef CONFIG_EFI_RUNTIME_MAP 1058926172d4SDave Young int efi_runtime_map_init(struct kobject *); 10596a2c20e7SVivek Goyal int efi_get_runtime_map_size(void); 10606a2c20e7SVivek Goyal int efi_get_runtime_map_desc_size(void); 10616a2c20e7SVivek Goyal int efi_runtime_map_copy(void *buf, size_t bufsz); 1062926172d4SDave Young #else 1063926172d4SDave Young static inline int efi_runtime_map_init(struct kobject *kobj) 1064926172d4SDave Young { 1065926172d4SDave Young return 0; 1066926172d4SDave Young } 1067926172d4SDave Young 10686a2c20e7SVivek Goyal static inline int efi_get_runtime_map_size(void) 10696a2c20e7SVivek Goyal { 10706a2c20e7SVivek Goyal return 0; 10716a2c20e7SVivek Goyal } 10726a2c20e7SVivek Goyal 10736a2c20e7SVivek Goyal static inline int efi_get_runtime_map_desc_size(void) 10746a2c20e7SVivek Goyal { 10756a2c20e7SVivek Goyal return 0; 10766a2c20e7SVivek Goyal } 10776a2c20e7SVivek Goyal 10786a2c20e7SVivek Goyal static inline int efi_runtime_map_copy(void *buf, size_t bufsz) 10796a2c20e7SVivek Goyal { 10806a2c20e7SVivek Goyal return 0; 10816a2c20e7SVivek Goyal } 10826a2c20e7SVivek Goyal 1083926172d4SDave Young #endif 1084926172d4SDave Young 10850082517fSJian-Hong Pan #ifdef CONFIG_EFI 10860082517fSJian-Hong Pan extern bool efi_runtime_disabled(void); 10870082517fSJian-Hong Pan #else 10880082517fSJian-Hong Pan static inline bool efi_runtime_disabled(void) { return true; } 10890082517fSJian-Hong Pan #endif 10900082517fSJian-Hong Pan 109180e75596SAlex Thorlton extern void efi_call_virt_check_flags(unsigned long flags, const char *call); 109213b210ddSJulien Thierry extern unsigned long efi_call_virt_save_flags(void); 109380e75596SAlex Thorlton 1094de8cb458SDavid Howells enum efi_secureboot_mode { 1095de8cb458SDavid Howells efi_secureboot_mode_unset, 1096de8cb458SDavid Howells efi_secureboot_mode_unknown, 1097de8cb458SDavid Howells efi_secureboot_mode_disabled, 1098de8cb458SDavid Howells efi_secureboot_mode_enabled, 1099de8cb458SDavid Howells }; 1100cd33a5c1SArd Biesheuvel enum efi_secureboot_mode efi_get_secureboot(void); 1101de8cb458SDavid Howells 1102ccc829baSMatthew Garrett #ifdef CONFIG_RESET_ATTACK_MITIGATION 1103cd33a5c1SArd Biesheuvel void efi_enable_reset_attack_mitigation(void); 1104ccc829baSMatthew Garrett #else 1105ccc829baSMatthew Garrett static inline void 1106cd33a5c1SArd Biesheuvel efi_enable_reset_attack_mitigation(void) { } 1107ccc829baSMatthew Garrett #endif 1108ccc829baSMatthew Garrett 1109f0df68d5SHans de Goede #ifdef CONFIG_EFI_EMBEDDED_FIRMWARE 1110f0df68d5SHans de Goede void efi_check_for_embedded_firmwares(void); 1111f0df68d5SHans de Goede #else 1112f0df68d5SHans de Goede static inline void efi_check_for_embedded_firmwares(void) { } 1113f0df68d5SHans de Goede #endif 1114f0df68d5SHans de Goede 1115cd33a5c1SArd Biesheuvel efi_status_t efi_random_get_seed(void); 11160d959814SDominik Brodowski 1117cd33a5c1SArd Biesheuvel void efi_retrieve_tpm2_eventlog(void); 111833b6d034SThiebaud Weksteen 111980e75596SAlex Thorlton /* 112080e75596SAlex Thorlton * Arch code can implement the following three template macros, avoiding 112180e75596SAlex Thorlton * reptition for the void/non-void return cases of {__,}efi_call_virt(): 112280e75596SAlex Thorlton * 112380e75596SAlex Thorlton * * arch_efi_call_virt_setup() 112480e75596SAlex Thorlton * 112580e75596SAlex Thorlton * Sets up the environment for the call (e.g. switching page tables, 112680e75596SAlex Thorlton * allowing kernel-mode use of floating point, if required). 112780e75596SAlex Thorlton * 112880e75596SAlex Thorlton * * arch_efi_call_virt() 112980e75596SAlex Thorlton * 113080e75596SAlex Thorlton * Performs the call. The last expression in the macro must be the call 113180e75596SAlex Thorlton * itself, allowing the logic to be shared by the void and non-void 113280e75596SAlex Thorlton * cases. 113380e75596SAlex Thorlton * 113480e75596SAlex Thorlton * * arch_efi_call_virt_teardown() 113580e75596SAlex Thorlton * 113680e75596SAlex Thorlton * Restores the usual kernel environment once the call has returned. 113780e75596SAlex Thorlton */ 113880e75596SAlex Thorlton 113980e75596SAlex Thorlton #define efi_call_virt_pointer(p, f, args...) \ 114080e75596SAlex Thorlton ({ \ 114180e75596SAlex Thorlton efi_status_t __s; \ 114280e75596SAlex Thorlton unsigned long __flags; \ 114380e75596SAlex Thorlton \ 114480e75596SAlex Thorlton arch_efi_call_virt_setup(); \ 114580e75596SAlex Thorlton \ 114613b210ddSJulien Thierry __flags = efi_call_virt_save_flags(); \ 114780e75596SAlex Thorlton __s = arch_efi_call_virt(p, f, args); \ 114880e75596SAlex Thorlton efi_call_virt_check_flags(__flags, __stringify(f)); \ 114980e75596SAlex Thorlton \ 115080e75596SAlex Thorlton arch_efi_call_virt_teardown(); \ 115180e75596SAlex Thorlton \ 115280e75596SAlex Thorlton __s; \ 115380e75596SAlex Thorlton }) 115480e75596SAlex Thorlton 115580e75596SAlex Thorlton #define __efi_call_virt_pointer(p, f, args...) \ 115680e75596SAlex Thorlton ({ \ 115780e75596SAlex Thorlton unsigned long __flags; \ 115880e75596SAlex Thorlton \ 115980e75596SAlex Thorlton arch_efi_call_virt_setup(); \ 116080e75596SAlex Thorlton \ 116113b210ddSJulien Thierry __flags = efi_call_virt_save_flags(); \ 116280e75596SAlex Thorlton arch_efi_call_virt(p, f, args); \ 116380e75596SAlex Thorlton efi_call_virt_check_flags(__flags, __stringify(f)); \ 116480e75596SAlex Thorlton \ 116580e75596SAlex Thorlton arch_efi_call_virt_teardown(); \ 116680e75596SAlex Thorlton }) 116780e75596SAlex Thorlton 1168c2ceb5fdSArd Biesheuvel #define EFI_RANDOM_SEED_SIZE 64U 1169c2ceb5fdSArd Biesheuvel 117063625988SArd Biesheuvel struct linux_efi_random_seed { 117163625988SArd Biesheuvel u32 size; 117263625988SArd Biesheuvel u8 bits[]; 117363625988SArd Biesheuvel }; 117463625988SArd Biesheuvel 117533b6d034SThiebaud Weksteen struct linux_efi_tpm_eventlog { 117633b6d034SThiebaud Weksteen u32 size; 1177166a2809SMatthew Garrett u32 final_events_preboot_size; 117833b6d034SThiebaud Weksteen u8 version; 117933b6d034SThiebaud Weksteen u8 log[]; 118033b6d034SThiebaud Weksteen }; 118133b6d034SThiebaud Weksteen 118233b6d034SThiebaud Weksteen extern int efi_tpm_eventlog_init(void); 118333b6d034SThiebaud Weksteen 1184c46f3405SMatthew Garrett struct efi_tcg2_final_events_table { 1185c46f3405SMatthew Garrett u64 version; 1186c46f3405SMatthew Garrett u64 nr_events; 1187c46f3405SMatthew Garrett u8 events[]; 1188c46f3405SMatthew Garrett }; 1189c46f3405SMatthew Garrett extern int efi_tpm_final_log_size; 1190c46f3405SMatthew Garrett 11911c5fecb6SNarendra K extern unsigned long rci2_table_phys; 11921c5fecb6SNarendra K 11933425d934SSai Praneeth /* 11943425d934SSai Praneeth * efi_runtime_service() function identifiers. 11953425d934SSai Praneeth * "NONE" is used by efi_recover_from_page_fault() to check if the page 11963425d934SSai Praneeth * fault happened while executing an efi runtime service. 11973425d934SSai Praneeth */ 11989dbbedaaSSai Praneeth enum efi_rts_ids { 11995c418dc7SAnders Roxell EFI_NONE, 12005c418dc7SAnders Roxell EFI_GET_TIME, 12015c418dc7SAnders Roxell EFI_SET_TIME, 12025c418dc7SAnders Roxell EFI_GET_WAKEUP_TIME, 12035c418dc7SAnders Roxell EFI_SET_WAKEUP_TIME, 12045c418dc7SAnders Roxell EFI_GET_VARIABLE, 12055c418dc7SAnders Roxell EFI_GET_NEXT_VARIABLE, 12065c418dc7SAnders Roxell EFI_SET_VARIABLE, 12075c418dc7SAnders Roxell EFI_QUERY_VARIABLE_INFO, 12085c418dc7SAnders Roxell EFI_GET_NEXT_HIGH_MONO_COUNT, 12095c418dc7SAnders Roxell EFI_RESET_SYSTEM, 12105c418dc7SAnders Roxell EFI_UPDATE_CAPSULE, 12115c418dc7SAnders Roxell EFI_QUERY_CAPSULE_CAPS, 12129dbbedaaSSai Praneeth }; 12139dbbedaaSSai Praneeth 12149dbbedaaSSai Praneeth /* 12159dbbedaaSSai Praneeth * efi_runtime_work: Details of EFI Runtime Service work 12169dbbedaaSSai Praneeth * @arg<1-5>: EFI Runtime Service function arguments 12179dbbedaaSSai Praneeth * @status: Status of executing EFI Runtime Service 12189dbbedaaSSai Praneeth * @efi_rts_id: EFI Runtime Service function identifier 12199dbbedaaSSai Praneeth * @efi_rts_comp: Struct used for handling completions 12209dbbedaaSSai Praneeth */ 12219dbbedaaSSai Praneeth struct efi_runtime_work { 12229dbbedaaSSai Praneeth void *arg1; 12239dbbedaaSSai Praneeth void *arg2; 12249dbbedaaSSai Praneeth void *arg3; 12259dbbedaaSSai Praneeth void *arg4; 12269dbbedaaSSai Praneeth void *arg5; 12279dbbedaaSSai Praneeth efi_status_t status; 12289dbbedaaSSai Praneeth struct work_struct work; 12299dbbedaaSSai Praneeth enum efi_rts_ids efi_rts_id; 12309dbbedaaSSai Praneeth struct completion efi_rts_comp; 12319dbbedaaSSai Praneeth }; 12329dbbedaaSSai Praneeth 12339dbbedaaSSai Praneeth extern struct efi_runtime_work efi_rts_work; 12349dbbedaaSSai Praneeth 12353eb420e7SSai Praneeth /* Workqueue to queue EFI Runtime Services */ 12363eb420e7SSai Praneeth extern struct workqueue_struct *efi_rts_wq; 12373eb420e7SSai Praneeth 123871e0940dSArd Biesheuvel struct linux_efi_memreserve { 12395f0b0ecfSArd Biesheuvel int size; // allocated size of the array 12405f0b0ecfSArd Biesheuvel atomic_t count; // number of entries used 12415f0b0ecfSArd Biesheuvel phys_addr_t next; // pa of next struct instance 12425f0b0ecfSArd Biesheuvel struct { 124371e0940dSArd Biesheuvel phys_addr_t base; 124471e0940dSArd Biesheuvel phys_addr_t size; 124529637951SGustavo A. R. Silva } entry[]; 124671e0940dSArd Biesheuvel }; 124771e0940dSArd Biesheuvel 124880424b02SArd Biesheuvel #define EFI_MEMRESERVE_COUNT(size) (((size) - sizeof(struct linux_efi_memreserve)) \ 124929637951SGustavo A. R. Silva / sizeof_field(struct linux_efi_memreserve, entry[0])) 125080424b02SArd Biesheuvel 1251860f89e6SBenjamin Thiel void __init efi_arch_mem_reserve(phys_addr_t addr, u64 size); 1252860f89e6SBenjamin Thiel 1253e8da08a0SBenjamin Thiel char *efi_systab_show_arch(char *str); 1254e8da08a0SBenjamin Thiel 12551da177e4SLinus Torvalds #endif /* _LINUX_EFI_H */ 1256