x86_64 EFI runtime service support: remove duplicated code from efi_32.c
PATCH 4/4 x86_64 EFI runtime service support: remove duplicated code from efi_32.c
This patch removes the duplicated code between efi_32.c and efi.c.
---
arch/x86/kernel/Makefile_32 | 2 arch/x86/kernel/e820_32.c | 5 arch/x86/kernel/efi_32.c | 430 -------------------------------------------- arch/x86/kernel/setup_32.c | 11 - include/asm-x86/efi.h | 37 +++ 5 files changed, 42 insertions(+), 443 deletions(-)
Signed-off-by Huang Ying <[email protected]>
arch/x86/kernel/Makefile_32 +1 -1
@@ -34,7 +34,7 @@ obj-$(CONFIG_MODULES) += module_32.o obj-y += sysenter_32.o vsyscall_32.o obj-$(CONFIG_ACPI_SRAT) += srat_32.o -obj-$(CONFIG_EFI) += efi_32.o efi_stub_32.o +obj-$(CONFIG_EFI) += efi.o efi_32.o efi_stub_32.o obj-$(CONFIG_DOUBLEFAULT) += doublefault_32.o obj-$(CONFIG_VM86) += vm86_32.o obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
arch/x86/kernel/efi_32.c +2 -428
471 lines not on this page · raw message
arch/x86/kernel/e820_32.c +0 -5
@@ -17,11 +17,6 @@#include <asm/e820.h> #include <asm/setup.h> -#ifdef CONFIG_EFI -int efi_enabled =0 ; -EXPORT_SYMBOL (efi_enabled); -#endif -struct e820map e820;struct change_member {struct e820entry *pbios;/* pointer to original bios entry */
include/asm-x86/efi.h +37 -0
@@ -2,6 +2,43 @@#define _ASM_X86_EFI_H#ifdef CONFIG_X86_32 + +extern unsigned long asmlinkage efi_call_phys (void *, ...); + +#define efi_call_phys0 (f) efi_call_phys(f) +#define efi_call_phys1 (f,a1) efi_call_phys(f,a1) +#define efi_call_phys2 (f,a1,a2) efi_call_phys(f,a1,a2) +#define efi_call_phys3 (f,a1,a2,a3) efi_call_phys(f,a1,a2,a3) +#define efi_call_phys4 (f,a1,a2,a3,a4) efi_call_phys(f,a1,a2,a3,a4) +#define efi_call_phys5 (f,a1,a2,a3,a4,a5) efi_call_phys(f,a1,a2,a3,a4,a5) +#define efi_call_phys6 (f,a1,a2,a3,a4,a5,a6) efi_call_phys(f,a1,a2,a3,a4, \ + a5,a6) +/* +* Wrap all the virtual calls in a way that forces the parameters on the stack. +*/ + +#define efi_call_virt(f, args...) \ + ((efi_##f##_t __attribute__((regparm(0)))*)efi.systab->runtime->f)(args) + +#define efi_call_virt0 (f) efi_call_virt(f) +#define efi_call_virt1 (f,a1) efi_call_virt(f,a1) +#define efi_call_virt2 (f,a1,a2) efi_call_virt(f,a1,a2) +#define efi_call_virt3 (f,a1,a2,a3) efi_call_virt(f,a1,a2,a3) +#define efi_call_virt4 (f,a1,a2,a3,a4) efi_call_virt(f,a1,a2,a3,a4) +#define efi_call_virt5 (f,a1,a2,a3,a4,a5) efi_call_virt(f,a1,a2,a3,a4,a5) +#define efi_call_virt6 (f,a1,a2,a3,a4,a5,a6) efi_call_virt(f,a1,a2,a3,a4, \ + a5,a6) +/* +* We require an early boot_ioremap mapping mechanism initially +*/ +extern void *boot_ioremap (unsigned long ,unsigned long ); + +#define efi_early_ioremap (addr,size) boot_ioremap(addr,size) +#define efi_early_iounmap (vaddr,size) + +#define efi_memremap (addr,size) ioremap(addr,size) +#define efi_ioremap (addr,size) ioremap(addr,size) +#else /* !CONFIG_X86_32 */ #define MAX_EFI_IO_PAGES 100
arch/x86/kernel/setup_32.c +2 -9
@@ -549,16 +549,9 @@pre_setup_arch_hook ();early_cpu_init (); -/* -* FIXME: This isn't an official loader_type right -* now but does currently work with elilo. -* If we were configured as an EFI kernel, check to make -* sure that we were loaded correctly from elilo and that -* the system table is valid. If not, then initialize normally. -*/ #ifdef CONFIG_EFI -if ((boot_params.hdr.type_of_loader ==0x50 ) && - boot_params.efi_info.efi_systab) +if (!strncmp ((char *)&boot_params.efi_info.efi_loader_signature, +"EL32" ,4 )) efi_enabled =1 ;#endif