[PATCH 4/4 -v5] 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]> Index: linux-2.6.24-rc1/arch/x86/kernel/Makefile_32 === --- linux-2.6.24-rc1.orig/arch/x86/kernel/Makefile_32 2007-10-30 11:05:57.0 +0800 +++ linux-2.6.24-rc1/arch/x86/kernel/Makefile_322007-10-30 11:10:33.0 +0800 @@ -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 Index: linux-2.6.24-rc1/arch/x86/kernel/efi_32.c === --- linux-2.6.24-rc1.orig/arch/x86/kernel/efi_32.c 2007-10-30 11:05:57.0 +0800 +++ linux-2.6.24-rc1/arch/x86/kernel/efi_32.c 2007-10-30 11:10:33.0 +0800 @@ -39,21 +39,8 @@ #include #include -#define EFI_DEBUG 0 #define PFX"EFI: " -extern efi_status_t asmlinkage efi_call_phys(void *, ...); - -struct efi efi; -EXPORT_SYMBOL(efi); -static struct efi efi_phys; -struct efi_memory_map memmap; - -/* - * We require an early boot_ioremap mapping mechanism initially - */ -extern void * boot_ioremap(unsigned long, unsigned long); - /* * To make EFI call EFI runtime service in physical addressing mode we need * prelog/epilog before/after the invocation to disable interrupt, to @@ -65,7 +52,7 @@ static DEFINE_SPINLOCK(efi_rt_lock); static pgd_t efi_bak_pg_dir_pointer[2]; -static void efi_call_phys_prelog(void) __acquires(efi_rt_lock) +void efi_call_phys_prelog(void) __acquires(efi_rt_lock) { unsigned long cr4; unsigned long temp; @@ -108,7 +95,7 @@ load_gdt(_descr); } -static void efi_call_phys_epilog(void) __releases(efi_rt_lock) +void efi_call_phys_epilog(void) __releases(efi_rt_lock) { unsigned long cr4; struct Xgt_desc_struct gdt_descr; @@ -138,87 +125,6 @@ spin_unlock(_rt_lock); } -static efi_status_t -phys_efi_set_virtual_address_map(unsigned long memory_map_size, -unsigned long descriptor_size, -u32 descriptor_version, -efi_memory_desc_t *virtual_map) -{ - efi_status_t status; - - efi_call_phys_prelog(); - status = efi_call_phys(efi_phys.set_virtual_address_map, -memory_map_size, descriptor_size, -descriptor_version, virtual_map); - efi_call_phys_epilog(); - return status; -} - -static efi_status_t -phys_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc) -{ - efi_status_t status; - - efi_call_phys_prelog(); - status = efi_call_phys(efi_phys.get_time, tm, tc); - efi_call_phys_epilog(); - return status; -} - -inline int efi_set_rtc_mmss(unsigned long nowtime) -{ - int real_seconds, real_minutes; - efi_status_tstatus; - efi_time_t eft; - efi_time_cap_t cap; - - spin_lock(_rt_lock); - status = efi.get_time(, ); - spin_unlock(_rt_lock); - if (status != EFI_SUCCESS) - panic("Ooops, efitime: can't read time!\n"); - real_seconds = nowtime % 60; - real_minutes = nowtime / 60; - - if (((abs(real_minutes - eft.minute) + 15)/30) & 1) - real_minutes += 30; - real_minutes %= 60; - - eft.minute = real_minutes; - eft.second = real_seconds; - - if (status != EFI_SUCCESS) { - printk("Ooops: efitime: can't read time!\n"); - return -1; - } - return 0; -} -/* - * This is used during kernel init before runtime - * services have been remapped and also during suspend, therefore, - * we'll need to call both in physical and virtual modes. - */ -inline unsigned long efi_get_time(void) -{ - efi_status_t status; - efi_time_t eft; - efi_time_cap_t cap; - - if (efi.get_time) { - /* if we are in virtual mode use remapped function */ - status = efi.get_time(, ); - } else { - /* we are in physical mode */ - status = phys_efi_get_time(, ); - } - - if (status != EFI_SUCCESS) - printk("Oops: efitime: can't read time status: 0x%lx\n",status); - - return mktime(eft.year, eft.month,
[PATCH 4/4 -v5] 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] Index: linux-2.6.24-rc1/arch/x86/kernel/Makefile_32 === --- linux-2.6.24-rc1.orig/arch/x86/kernel/Makefile_32 2007-10-30 11:05:57.0 +0800 +++ linux-2.6.24-rc1/arch/x86/kernel/Makefile_322007-10-30 11:10:33.0 +0800 @@ -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 Index: linux-2.6.24-rc1/arch/x86/kernel/efi_32.c === --- linux-2.6.24-rc1.orig/arch/x86/kernel/efi_32.c 2007-10-30 11:05:57.0 +0800 +++ linux-2.6.24-rc1/arch/x86/kernel/efi_32.c 2007-10-30 11:10:33.0 +0800 @@ -39,21 +39,8 @@ #include asm/desc.h #include asm/tlbflush.h -#define EFI_DEBUG 0 #define PFXEFI: -extern efi_status_t asmlinkage efi_call_phys(void *, ...); - -struct efi efi; -EXPORT_SYMBOL(efi); -static struct efi efi_phys; -struct efi_memory_map memmap; - -/* - * We require an early boot_ioremap mapping mechanism initially - */ -extern void * boot_ioremap(unsigned long, unsigned long); - /* * To make EFI call EFI runtime service in physical addressing mode we need * prelog/epilog before/after the invocation to disable interrupt, to @@ -65,7 +52,7 @@ static DEFINE_SPINLOCK(efi_rt_lock); static pgd_t efi_bak_pg_dir_pointer[2]; -static void efi_call_phys_prelog(void) __acquires(efi_rt_lock) +void efi_call_phys_prelog(void) __acquires(efi_rt_lock) { unsigned long cr4; unsigned long temp; @@ -108,7 +95,7 @@ load_gdt(gdt_descr); } -static void efi_call_phys_epilog(void) __releases(efi_rt_lock) +void efi_call_phys_epilog(void) __releases(efi_rt_lock) { unsigned long cr4; struct Xgt_desc_struct gdt_descr; @@ -138,87 +125,6 @@ spin_unlock(efi_rt_lock); } -static efi_status_t -phys_efi_set_virtual_address_map(unsigned long memory_map_size, -unsigned long descriptor_size, -u32 descriptor_version, -efi_memory_desc_t *virtual_map) -{ - efi_status_t status; - - efi_call_phys_prelog(); - status = efi_call_phys(efi_phys.set_virtual_address_map, -memory_map_size, descriptor_size, -descriptor_version, virtual_map); - efi_call_phys_epilog(); - return status; -} - -static efi_status_t -phys_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc) -{ - efi_status_t status; - - efi_call_phys_prelog(); - status = efi_call_phys(efi_phys.get_time, tm, tc); - efi_call_phys_epilog(); - return status; -} - -inline int efi_set_rtc_mmss(unsigned long nowtime) -{ - int real_seconds, real_minutes; - efi_status_tstatus; - efi_time_t eft; - efi_time_cap_t cap; - - spin_lock(efi_rt_lock); - status = efi.get_time(eft, cap); - spin_unlock(efi_rt_lock); - if (status != EFI_SUCCESS) - panic(Ooops, efitime: can't read time!\n); - real_seconds = nowtime % 60; - real_minutes = nowtime / 60; - - if (((abs(real_minutes - eft.minute) + 15)/30) 1) - real_minutes += 30; - real_minutes %= 60; - - eft.minute = real_minutes; - eft.second = real_seconds; - - if (status != EFI_SUCCESS) { - printk(Ooops: efitime: can't read time!\n); - return -1; - } - return 0; -} -/* - * This is used during kernel init before runtime - * services have been remapped and also during suspend, therefore, - * we'll need to call both in physical and virtual modes. - */ -inline unsigned long efi_get_time(void) -{ - efi_status_t status; - efi_time_t eft; - efi_time_cap_t cap; - - if (efi.get_time) { - /* if we are in virtual mode use remapped function */ - status = efi.get_time(eft, cap); - } else { - /* we are in physical mode */ - status = phys_efi_get_time(eft, cap); - } - - if (status != EFI_SUCCESS) - printk(Oops: efitime: can't read time status: 0x%lx\n,status); - -