diff options
author | Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com> | 2013-02-13 19:07:35 -0500 |
---|---|---|
committer | Matt Fleming <matt.fleming@intel.com> | 2013-02-14 05:36:18 -0500 |
commit | 6b59e366e074d3962e04f01efb8acc10a33c0e1e (patch) | |
tree | 0cc0f5de6582ee866c249deed2afd8fa6dee1407 /arch/x86 | |
parent | da27a24383b2b10bf6ebd0db29b325548aafecb4 (diff) |
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: Satoru 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: Matt Fleming <matt.fleming@intel.com>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/include/asm/efi.h | 9 | ||||
-rw-r--r-- | arch/x86/kernel/setup.c | 3 | ||||
-rw-r--r-- | arch/x86/platform/efi/efi.c | 5 |
3 files changed, 9 insertions, 8 deletions
diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h index 28677c55113f..60c89f30c727 100644 --- a/arch/x86/include/asm/efi.h +++ b/arch/x86/include/asm/efi.h | |||
@@ -102,7 +102,14 @@ extern void efi_call_phys_epilog(void); | |||
102 | extern void efi_unmap_memmap(void); | 102 | extern void efi_unmap_memmap(void); |
103 | extern void efi_memory_uc(u64 addr, unsigned long size); | 103 | extern void efi_memory_uc(u64 addr, unsigned long size); |
104 | 104 | ||
105 | #ifndef CONFIG_EFI | 105 | #ifdef CONFIG_EFI |
106 | |||
107 | static inline bool efi_is_native(void) | ||
108 | { | ||
109 | return IS_ENABLED(CONFIG_X86_64) == efi_enabled(EFI_64BIT); | ||
110 | } | ||
111 | |||
112 | #else | ||
106 | /* | 113 | /* |
107 | * IF EFI is not configured, have the EFI calls return -ENOSYS. | 114 | * IF EFI is not configured, have the EFI calls return -ENOSYS. |
108 | */ | 115 | */ |
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 8b24289cc10c..1abb7969173a 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c | |||
@@ -1135,8 +1135,7 @@ void __init setup_arch(char **cmdline_p) | |||
1135 | * mismatched firmware/kernel archtectures since there is no | 1135 | * mismatched firmware/kernel archtectures since there is no |
1136 | * support for runtime services. | 1136 | * support for runtime services. |
1137 | */ | 1137 | */ |
1138 | if (efi_enabled(EFI_BOOT) && | 1138 | if (efi_enabled(EFI_BOOT) && !efi_is_native()) { |
1139 | IS_ENABLED(CONFIG_X86_64) != efi_enabled(EFI_64BIT)) { | ||
1140 | pr_info("efi: Setup done, disabling due to 32/64-bit mismatch\n"); | 1139 | pr_info("efi: Setup done, disabling due to 32/64-bit mismatch\n"); |
1141 | efi_unmap_memmap(); | 1140 | efi_unmap_memmap(); |
1142 | } | 1141 | } |
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c index 77cf0090c0a3..e075e474245b 100644 --- a/arch/x86/platform/efi/efi.c +++ b/arch/x86/platform/efi/efi.c | |||
@@ -69,11 +69,6 @@ struct efi_memory_map memmap; | |||
69 | static struct efi efi_phys __initdata; | 69 | static struct efi efi_phys __initdata; |
70 | static efi_system_table_t efi_systab __initdata; | 70 | static efi_system_table_t efi_systab __initdata; |
71 | 71 | ||
72 | static inline bool efi_is_native(void) | ||
73 | { | ||
74 | return IS_ENABLED(CONFIG_X86_64) == efi_enabled(EFI_64BIT); | ||
75 | } | ||
76 | |||
77 | unsigned long x86_efi_facility; | 72 | unsigned long x86_efi_facility; |
78 | 73 | ||
79 | /* | 74 | /* |