Commit 6b59e366 authored by Satoru Takeuchi's avatar Satoru Takeuchi Committed by Matt Fleming

x86, efi: remove duplicate code in setup_arch() by using, efi_is_native()

The check, "IS_ENABLED(CONFIG_X86_64) != efi_enabled(EFI_64BIT)",
in setup_arch() can be replaced by efi_is_enabled(). This change
remove duplicate code and improve readability.
Signed-off-by: default avatarSatoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Olof Johansson <olof@lixom.net>
Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
parent da27a243
...@@ -102,7 +102,14 @@ extern void efi_call_phys_epilog(void); ...@@ -102,7 +102,14 @@ extern void efi_call_phys_epilog(void);
extern void efi_unmap_memmap(void); extern void efi_unmap_memmap(void);
extern void efi_memory_uc(u64 addr, unsigned long size); extern void efi_memory_uc(u64 addr, unsigned long size);
#ifndef CONFIG_EFI #ifdef CONFIG_EFI
static inline bool efi_is_native(void)
{
return IS_ENABLED(CONFIG_X86_64) == efi_enabled(EFI_64BIT);
}
#else
/* /*
* IF EFI is not configured, have the EFI calls return -ENOSYS. * IF EFI is not configured, have the EFI calls return -ENOSYS.
*/ */
......
...@@ -1135,8 +1135,7 @@ void __init setup_arch(char **cmdline_p) ...@@ -1135,8 +1135,7 @@ void __init setup_arch(char **cmdline_p)
* mismatched firmware/kernel archtectures since there is no * mismatched firmware/kernel archtectures since there is no
* support for runtime services. * support for runtime services.
*/ */
if (efi_enabled(EFI_BOOT) && if (efi_enabled(EFI_BOOT) && !efi_is_native()) {
IS_ENABLED(CONFIG_X86_64) != efi_enabled(EFI_64BIT)) {
pr_info("efi: Setup done, disabling due to 32/64-bit mismatch\n"); pr_info("efi: Setup done, disabling due to 32/64-bit mismatch\n");
efi_unmap_memmap(); efi_unmap_memmap();
} }
......
...@@ -69,11 +69,6 @@ struct efi_memory_map memmap; ...@@ -69,11 +69,6 @@ struct efi_memory_map memmap;
static struct efi efi_phys __initdata; static struct efi efi_phys __initdata;
static efi_system_table_t efi_systab __initdata; static efi_system_table_t efi_systab __initdata;
static inline bool efi_is_native(void)
{
return IS_ENABLED(CONFIG_X86_64) == efi_enabled(EFI_64BIT);
}
unsigned long x86_efi_facility; unsigned long x86_efi_facility;
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment