aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/platform/efi
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-12-15 18:15:24 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-15 18:20:41 -0500
commit11520e5e7c1855fc3bf202bb3be35a39d9efa034 (patch)
tree734ea170f825000dceef3f724dff474b46fce11d /arch/x86/platform/efi
parent5bd665f28db2b04a8d6fe277342479906fc60b62 (diff)
Revert "x86-64/efi: Use EFI to deal with platform wall clock (again)"
This reverts commit bd52276fa1d4 ("x86-64/efi: Use EFI to deal with platform wall clock (again)"), and the two supporting commits: da5a108d05b4: "x86/kernel: remove tboot 1:1 page table creation code" 185034e72d59: "x86, efi: 1:1 pagetable mapping for virtual EFI calls") as they all depend semantically on commit 53b87cf088e2 ("x86, mm: Include the entire kernel memory map in trampoline_pgd") that got reverted earlier due to the problems it caused. This was pointed out by Yinghai Lu, and verified by me on my Macbook Air that uses EFI. Pointed-out-by: Yinghai Lu <yinghai@kernel.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/x86/platform/efi')
-rw-r--r--arch/x86/platform/efi/efi.c30
-rw-r--r--arch/x86/platform/efi/efi_64.c15
2 files changed, 26 insertions, 19 deletions
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index 0a34d9e9c263..ad4439145f85 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -239,7 +239,22 @@ static efi_status_t __init phys_efi_set_virtual_address_map(
239 return status; 239 return status;
240} 240}
241 241
242static int efi_set_rtc_mmss(unsigned long nowtime) 242static efi_status_t __init phys_efi_get_time(efi_time_t *tm,
243 efi_time_cap_t *tc)
244{
245 unsigned long flags;
246 efi_status_t status;
247
248 spin_lock_irqsave(&rtc_lock, flags);
249 efi_call_phys_prelog();
250 status = efi_call_phys2(efi_phys.get_time, virt_to_phys(tm),
251 virt_to_phys(tc));
252 efi_call_phys_epilog();
253 spin_unlock_irqrestore(&rtc_lock, flags);
254 return status;
255}
256
257int efi_set_rtc_mmss(unsigned long nowtime)
243{ 258{
244 int real_seconds, real_minutes; 259 int real_seconds, real_minutes;
245 efi_status_t status; 260 efi_status_t status;
@@ -268,7 +283,7 @@ static int efi_set_rtc_mmss(unsigned long nowtime)
268 return 0; 283 return 0;
269} 284}
270 285
271static unsigned long efi_get_time(void) 286unsigned long efi_get_time(void)
272{ 287{
273 efi_status_t status; 288 efi_status_t status;
274 efi_time_t eft; 289 efi_time_t eft;
@@ -624,13 +639,18 @@ static int __init efi_runtime_init(void)
624 } 639 }
625 /* 640 /*
626 * We will only need *early* access to the following 641 * We will only need *early* access to the following
627 * EFI runtime service before set_virtual_address_map 642 * two EFI runtime services before set_virtual_address_map
628 * is invoked. 643 * is invoked.
629 */ 644 */
645 efi_phys.get_time = (efi_get_time_t *)runtime->get_time;
630 efi_phys.set_virtual_address_map = 646 efi_phys.set_virtual_address_map =
631 (efi_set_virtual_address_map_t *) 647 (efi_set_virtual_address_map_t *)
632 runtime->set_virtual_address_map; 648 runtime->set_virtual_address_map;
633 649 /*
650 * Make efi_get_time can be called before entering
651 * virtual mode.
652 */
653 efi.get_time = phys_efi_get_time;
634 early_iounmap(runtime, sizeof(efi_runtime_services_t)); 654 early_iounmap(runtime, sizeof(efi_runtime_services_t));
635 655
636 return 0; 656 return 0;
@@ -716,10 +736,12 @@ void __init efi_init(void)
716 efi_enabled = 0; 736 efi_enabled = 0;
717 return; 737 return;
718 } 738 }
739#ifdef CONFIG_X86_32
719 if (efi_is_native()) { 740 if (efi_is_native()) {
720 x86_platform.get_wallclock = efi_get_time; 741 x86_platform.get_wallclock = efi_get_time;
721 x86_platform.set_wallclock = efi_set_rtc_mmss; 742 x86_platform.set_wallclock = efi_set_rtc_mmss;
722 } 743 }
744#endif
723 745
724#if EFI_DEBUG 746#if EFI_DEBUG
725 print_efi_memmap(); 747 print_efi_memmap();
diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
index 06c8b2e662ab..95fd505dfeb6 100644
--- a/arch/x86/platform/efi/efi_64.c
+++ b/arch/x86/platform/efi/efi_64.c
@@ -58,21 +58,6 @@ static void __init early_code_mapping_set_exec(int executable)
58 } 58 }
59} 59}
60 60
61unsigned long efi_call_virt_prelog(void)
62{
63 unsigned long saved;
64
65 saved = read_cr3();
66 write_cr3(real_mode_header->trampoline_pgd);
67
68 return saved;
69}
70
71void efi_call_virt_epilog(unsigned long saved)
72{
73 write_cr3(saved);
74}
75
76void __init efi_call_phys_prelog(void) 61void __init efi_call_phys_prelog(void)
77{ 62{
78 unsigned long vaddress; 63 unsigned long vaddress;