aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorArd Biesheuvel <ardb@kernel.org>2019-12-24 16:10:22 +0100
committerIngo Molnar <mingo@kernel.org>2019-12-25 10:49:24 +0100
commit99ea8b1db2d23ac856bf3ee0673628df088a21ea (patch)
tree37a457b8207ede189bd9f9512a393a8719dd397e /arch
parentefi/libstub: Drop protocol argument from efi_call_proto() macro (diff)
downloadlinux-dev-99ea8b1db2d23ac856bf3ee0673628df088a21ea.tar.xz
linux-dev-99ea8b1db2d23ac856bf3ee0673628df088a21ea.zip
efi/libstub: Drop 'table' argument from efi_table_attr() macro
None of the definitions of the efi_table_attr() still refer to their 'table' argument so let's get rid of it entirely. Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Cc: Arvind Sankar <nivedita@alum.mit.edu> Cc: Borislav Petkov <bp@alien8.de> Cc: James Morse <james.morse@arm.com> Cc: Matt Fleming <matt@codeblueprint.co.uk> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-efi@vger.kernel.org Link: https://lkml.kernel.org/r/20191224151025.32482-23-ardb@kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/include/asm/efi.h3
-rw-r--r--arch/arm64/include/asm/efi.h3
-rw-r--r--arch/x86/boot/compressed/eboot.c8
-rw-r--r--arch/x86/include/asm/efi.h25
4 files changed, 15 insertions, 24 deletions
diff --git a/arch/arm/include/asm/efi.h b/arch/arm/include/asm/efi.h
index bdc5288cc643..bc720024a260 100644
--- a/arch/arm/include/asm/efi.h
+++ b/arch/arm/include/asm/efi.h
@@ -54,8 +54,7 @@ void efi_virtmap_unload(void);
#define efi_call_runtime(f, ...) efi_system_table()->runtime->f(__VA_ARGS__)
#define efi_is_native() (true)
-#define efi_table_attr(table, attr, instance) \
- instance->attr
+#define efi_table_attr(inst, attr) (inst->attr)
#define efi_call_proto(inst, func, ...) inst->func(inst, ##__VA_ARGS__)
diff --git a/arch/arm64/include/asm/efi.h b/arch/arm64/include/asm/efi.h
index 4bc1e89671ab..6f041ae446d2 100644
--- a/arch/arm64/include/asm/efi.h
+++ b/arch/arm64/include/asm/efi.h
@@ -97,8 +97,7 @@ static inline unsigned long efi_get_max_initrd_addr(unsigned long dram_base,
#define efi_call_runtime(f, ...) efi_system_table()->runtime->f(__VA_ARGS__)
#define efi_is_native() (true)
-#define efi_table_attr(table, attr, instance) \
- instance->attr
+#define efi_table_attr(inst, attr) (inst->attr)
#define efi_call_proto(inst, func, ...) inst->func(inst, ##__VA_ARGS__)
diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
index 751fd5fc3367..cccd9e16b329 100644
--- a/arch/x86/boot/compressed/eboot.c
+++ b/arch/x86/boot/compressed/eboot.c
@@ -47,8 +47,8 @@ preserve_pci_rom_image(efi_pci_io_protocol_t *pci, struct pci_setup_rom **__rom)
* large romsize. The UEFI spec limits the size of option ROMs to 16
* MiB so we reject any ROMs over 16 MiB in size to catch this.
*/
- romimage = efi_table_attr(efi_pci_io_protocol, romimage, pci);
- romsize = efi_table_attr(efi_pci_io_protocol, romsize, pci);
+ romimage = efi_table_attr(pci, romimage);
+ romsize = efi_table_attr(pci, romsize);
if (!romimage || !romsize || romsize > SZ_16M)
return EFI_INVALID_PARAMETER;
@@ -183,7 +183,7 @@ static void retrieve_apple_device_properties(struct boot_params *boot_params)
if (status != EFI_SUCCESS)
return;
- if (efi_table_attr(apple_properties_protocol, version, p) != 0x10000) {
+ if (efi_table_attr(p, version) != 0x10000) {
efi_printk("Unsupported properties proto version\n");
return;
}
@@ -226,7 +226,7 @@ static const efi_char16_t apple[] = L"Apple";
static void setup_quirks(struct boot_params *boot_params)
{
efi_char16_t *fw_vendor = (efi_char16_t *)(unsigned long)
- efi_table_attr(efi_system_table, fw_vendor, sys_table);
+ efi_table_attr(efi_system_table(), fw_vendor);
if (!memcmp(fw_vendor, apple, sizeof(apple))) {
if (IS_ENABLED(CONFIG_APPLE_PROPERTIES))
diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
index b7cd14e3a634..39814a0a92f7 100644
--- a/arch/x86/include/asm/efi.h
+++ b/arch/x86/include/asm/efi.h
@@ -216,16 +216,11 @@ static inline bool efi_is_native(void)
__builtin_types_compatible_p(u32, __typeof__(attr)), \
(unsigned long)(attr), (attr))
-#define efi_table_attr(table, attr, instance) ({ \
- __typeof__(instance->attr) __ret; \
- if (efi_is_native()) { \
- __ret = instance->attr; \
- } else { \
- __ret = (__typeof__(__ret)) \
- efi_mixed_mode_cast(instance->mixed_mode.attr); \
- } \
- __ret; \
-})
+#define efi_table_attr(inst, attr) \
+ (efi_is_native() \
+ ? inst->attr \
+ : (__typeof__(inst->attr)) \
+ efi_mixed_mode_cast(inst->mixed_mode.attr))
#define efi_call_proto(inst, func, ...) \
(efi_is_native() \
@@ -235,16 +230,14 @@ static inline bool efi_is_native(void)
#define efi_call_early(f, ...) \
(efi_is_native() \
? efi_system_table()->boottime->f(__VA_ARGS__) \
- : efi64_thunk(efi_table_attr(efi_boot_services, \
- boottime, efi_system_table())->mixed_mode.f, \
- __VA_ARGS__))
+ : efi64_thunk(efi_table_attr(efi_system_table(), \
+ boottime)->mixed_mode.f, __VA_ARGS__))
#define efi_call_runtime(f, ...) \
(efi_is_native() \
? efi_system_table()->runtime->f(__VA_ARGS__) \
- : efi64_thunk(efi_table_attr(efi_runtime_services, \
- runtime, efi_system_table())->mixed_mode.f, \
- __VA_ARGS__))
+ : efi64_thunk(efi_table_attr(efi_system_table(), \
+ runtime)->mixed_mode.f, __VA_ARGS__))
extern bool efi_reboot_required(void);
extern bool efi_is_table_address(unsigned long phys_addr);