]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
efi: x86: move efi_is_table_address() into arch/x86
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Tue, 25 Jun 2019 13:36:45 +0000 (15:36 +0200)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Thu, 8 Aug 2019 08:01:48 +0000 (11:01 +0300)
The function efi_is_table_address() and the associated array of table
pointers is specific to x86. Since we will be adding some more x86
specific tables, let's move this code out of the generic code first.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
arch/x86/include/asm/efi.h
arch/x86/mm/ioremap.c
arch/x86/platform/efi/efi.c
drivers/firmware/efi/efi.c
include/linux/efi.h

index 606a4b6a9812c3128a5d70fbcac1ef00f7fa0bbb..43a82e59c59d2657d9e319361e7285a15da2fac7 100644 (file)
@@ -242,6 +242,7 @@ static inline bool efi_is_64bit(void)
                __efi_early()->runtime_services), __VA_ARGS__)
 
 extern bool efi_reboot_required(void);
+extern bool efi_is_table_address(unsigned long phys_addr);
 
 #else
 static inline void parse_efi_setup(u64 phys_addr, u32 data_len) {}
@@ -249,6 +250,10 @@ static inline bool efi_reboot_required(void)
 {
        return false;
 }
+static inline  bool efi_is_table_address(unsigned long phys_addr)
+{
+       return false;
+}
 #endif /* CONFIG_EFI */
 
 #endif /* _ASM_X86_EFI_H */
index 63e99f15d7cf0eedc9b5b522b4d24e36a2708fde..a39dcdb5ae34e018393276f4e2fd502ade7f30e2 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <asm/set_memory.h>
 #include <asm/e820/api.h>
+#include <asm/efi.h>
 #include <asm/fixmap.h>
 #include <asm/pgtable.h>
 #include <asm/tlbflush.h>
index a7189a3b4d70f759ab9743f8b43c4a2b83c1e47f..8d9be97a560738a3e5a1d97a58d79deb2c8f6c91 100644 (file)
@@ -64,6 +64,25 @@ static efi_config_table_type_t arch_tables[] __initdata = {
        {NULL_GUID, NULL, NULL},
 };
 
+static const unsigned long * const efi_tables[] = {
+       &efi.mps,
+       &efi.acpi,
+       &efi.acpi20,
+       &efi.smbios,
+       &efi.smbios3,
+       &efi.sal_systab,
+       &efi.boot_info,
+       &efi.hcdp,
+       &efi.uga,
+       &efi.uv_systab,
+       &efi.fw_vendor,
+       &efi.runtime,
+       &efi.config_table,
+       &efi.esrt,
+       &efi.properties_table,
+       &efi.mem_attr_table,
+};
+
 u64 efi_setup;         /* efi setup_data physical address */
 
 static int add_efi_memmap __initdata;
@@ -1049,3 +1068,17 @@ static int __init arch_parse_efi_cmdline(char *str)
        return 0;
 }
 early_param("efi", arch_parse_efi_cmdline);
+
+bool efi_is_table_address(unsigned long phys_addr)
+{
+       unsigned int i;
+
+       if (phys_addr == EFI_INVALID_TABLE_ADDR)
+               return false;
+
+       for (i = 0; i < ARRAY_SIZE(efi_tables); i++)
+               if (*(efi_tables[i]) == phys_addr)
+                       return true;
+
+       return false;
+}
index ad3b1f4866b35951592dc4a4ecef92cf30cd4a1d..cbdbdbc8f9ebe2957c2be1f6f0ad6d3171a40952 100644 (file)
@@ -57,25 +57,6 @@ struct efi __read_mostly efi = {
 };
 EXPORT_SYMBOL(efi);
 
-static unsigned long *efi_tables[] = {
-       &efi.mps,
-       &efi.acpi,
-       &efi.acpi20,
-       &efi.smbios,
-       &efi.smbios3,
-       &efi.sal_systab,
-       &efi.boot_info,
-       &efi.hcdp,
-       &efi.uga,
-       &efi.uv_systab,
-       &efi.fw_vendor,
-       &efi.runtime,
-       &efi.config_table,
-       &efi.esrt,
-       &efi.properties_table,
-       &efi.mem_attr_table,
-};
-
 struct mm_struct efi_mm = {
        .mm_rb                  = RB_ROOT,
        .mm_users               = ATOMIC_INIT(2),
@@ -964,20 +945,6 @@ int efi_status_to_err(efi_status_t status)
        return err;
 }
 
-bool efi_is_table_address(unsigned long phys_addr)
-{
-       unsigned int i;
-
-       if (phys_addr == EFI_INVALID_TABLE_ADDR)
-               return false;
-
-       for (i = 0; i < ARRAY_SIZE(efi_tables); i++)
-               if (*(efi_tables[i]) == phys_addr)
-                       return true;
-
-       return false;
-}
-
 static DEFINE_SPINLOCK(efi_mem_reserve_persistent_lock);
 static struct linux_efi_memreserve *efi_memreserve_root __ro_after_init;
 
index f87fabea4a859fa36998538dbdc8a572033e7a24..60a6242765d892ab6d340db8911e0645a8331aad 100644 (file)
@@ -1211,8 +1211,6 @@ static inline bool efi_enabled(int feature)
        return test_bit(feature, &efi.flags) != 0;
 }
 extern void efi_reboot(enum reboot_mode reboot_mode, const char *__unused);
-
-extern bool efi_is_table_address(unsigned long phys_addr);
 #else
 static inline bool efi_enabled(int feature)
 {
@@ -1226,11 +1224,6 @@ efi_capsule_pending(int *reset_type)
 {
        return false;
 }
-
-static inline bool efi_is_table_address(unsigned long phys_addr)
-{
-       return false;
-}
 #endif
 
 extern int efi_status_to_err(efi_status_t status);