summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorArd Biesheuvel <ardb@kernel.org>2019-12-24 18:10:15 +0300
committerIngo Molnar <mingo@kernel.org>2019-12-25 12:49:21 +0300
commit2fcdad2a80a6d6fd0f77205108232d1adc709a84 (patch)
tree4d12a5ef34b8ad820b6d3da89a967087cf9eb843 /arch
parent14e900c7e4033d6ee3398b9f133e1716cc072401 (diff)
downloadlinux-2fcdad2a80a6d6fd0f77205108232d1adc709a84.tar.xz
efi/libstub: Get rid of 'sys_table_arg' macro parameter
The efi_call macros on ARM have a dependency on a variable 'sys_table_arg' existing in the scope of the macro instantiation. Since this variable always points to the same data structure, let's create a global getter for it and use that instead. Note that the use of a global variable with external linkage is avoided, given the problems we had in the past with early processing of the GOT tables. While at it, drop the redundant casts in the efi_table_attr and efi_call_proto macros. 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-16-ardb@kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/include/asm/efi.h8
-rw-r--r--arch/arm64/include/asm/efi.h8
-rw-r--r--arch/x86/boot/compressed/eboot.c5
3 files changed, 13 insertions, 8 deletions
diff --git a/arch/arm/include/asm/efi.h b/arch/arm/include/asm/efi.h
index 9b0c64c28bff..555364b7bd2a 100644
--- a/arch/arm/include/asm/efi.h
+++ b/arch/arm/include/asm/efi.h
@@ -50,15 +50,15 @@ void efi_virtmap_unload(void);
/* arch specific definitions used by the stub code */
-#define efi_call_early(f, ...) sys_table_arg->boottime->f(__VA_ARGS__)
-#define efi_call_runtime(f, ...) sys_table_arg->runtime->f(__VA_ARGS__)
+#define efi_call_early(f, ...) efi_system_table()->boottime->f(__VA_ARGS__)
+#define efi_call_runtime(f, ...) efi_system_table()->runtime->f(__VA_ARGS__)
#define efi_is_native() (true)
#define efi_table_attr(table, attr, instance) \
- ((table##_t *)instance)->attr
+ instance->attr
#define efi_call_proto(protocol, f, instance, ...) \
- ((protocol##_t *)instance)->f(instance, ##__VA_ARGS__)
+ instance->f(instance, ##__VA_ARGS__)
struct screen_info *alloc_screen_info(efi_system_table_t *sys_table_arg);
void free_screen_info(efi_system_table_t *sys_table, struct screen_info *si);
diff --git a/arch/arm64/include/asm/efi.h b/arch/arm64/include/asm/efi.h
index 189082c44c28..9aa518d67588 100644
--- a/arch/arm64/include/asm/efi.h
+++ b/arch/arm64/include/asm/efi.h
@@ -93,15 +93,15 @@ static inline unsigned long efi_get_max_initrd_addr(unsigned long dram_base,
return (image_addr & ~(SZ_1G - 1UL)) + (1UL << (VA_BITS_MIN - 1));
}
-#define efi_call_early(f, ...) sys_table_arg->boottime->f(__VA_ARGS__)
-#define efi_call_runtime(f, ...) sys_table_arg->runtime->f(__VA_ARGS__)
+#define efi_call_early(f, ...) efi_system_table()->boottime->f(__VA_ARGS__)
+#define efi_call_runtime(f, ...) efi_system_table()->runtime->f(__VA_ARGS__)
#define efi_is_native() (true)
#define efi_table_attr(table, attr, instance) \
- ((table##_t *)instance)->attr
+ instance->attr
#define efi_call_proto(protocol, f, instance, ...) \
- ((protocol##_t *)instance)->f(instance, ##__VA_ARGS__)
+ instance->f(instance, ##__VA_ARGS__)
#define alloc_screen_info(x...) &screen_info
diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
index 36a26d6e2af0..3a7c900b9c66 100644
--- a/arch/x86/boot/compressed/eboot.c
+++ b/arch/x86/boot/compressed/eboot.c
@@ -27,6 +27,11 @@ __pure const struct efi_config *__efi_early(void)
return efi_early;
}
+__pure efi_system_table_t *efi_system_table(void)
+{
+ return sys_table;
+}
+
#define BOOT_SERVICES(bits) \
static void setup_boot_services##bits(struct efi_config *c) \
{ \