aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/platform
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-12-14 13:08:40 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-14 13:08:40 -0500
commitd42b3a2906a10b732ea7d7f849d49be79d242ef0 (patch)
tree1f4f2387bf53f8015aa87eb9c05ba8316cb5ed50 /arch/x86/platform
parent18dd0bf22b6f0c1bd5e4e813a42245ed86ec57b6 (diff)
parente83af1f18c78c7b6aa720beecc927ecc8afd3647 (diff)
Merge branch 'core-efi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 EFI update from Peter Anvin: "EFI tree, from Matt Fleming. Most of the patches are the new efivarfs filesystem by Matt Garrett & co. The balance are support for EFI wallclock in the absence of a hardware-specific driver, and various fixes and cleanups." * 'core-efi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (24 commits) efivarfs: Make efivarfs_fill_super() static x86, efi: Check table header length in efi_bgrt_init() efivarfs: Use query_variable_info() to limit kmalloc() efivarfs: Fix return value of efivarfs_file_write() efivarfs: Return a consistent error when efivarfs_get_inode() fails efivarfs: Make 'datasize' unsigned long efivarfs: Add unique magic number efivarfs: Replace magic number with sizeof(attributes) efivarfs: Return an error if we fail to read a variable efi: Clarify GUID length calculations efivarfs: Implement exclusive access for {get,set}_variable efivarfs: efivarfs_fill_super() ensure we clean up correctly on error efivarfs: efivarfs_fill_super() ensure we free our temporary name efivarfs: efivarfs_fill_super() fix inode reference counts efivarfs: efivarfs_create() ensure we drop our reference on inode on error efivarfs: efivarfs_file_read ensure we free data in error paths x86-64/efi: Use EFI to deal with platform wall clock (again) x86/kernel: remove tboot 1:1 page table creation code x86, efi: 1:1 pagetable mapping for virtual EFI calls x86, mm: Include the entire kernel memory map in trampoline_pgd ...
Diffstat (limited to 'arch/x86/platform')
-rw-r--r--arch/x86/platform/efi/efi-bgrt.c2
-rw-r--r--arch/x86/platform/efi/efi.c30
-rw-r--r--arch/x86/platform/efi/efi_64.c15
3 files changed, 21 insertions, 26 deletions
diff --git a/arch/x86/platform/efi/efi-bgrt.c b/arch/x86/platform/efi/efi-bgrt.c
index f6a0c1b8e518..d9c1b95af17c 100644
--- a/arch/x86/platform/efi/efi-bgrt.c
+++ b/arch/x86/platform/efi/efi-bgrt.c
@@ -39,6 +39,8 @@ void efi_bgrt_init(void)
39 if (ACPI_FAILURE(status)) 39 if (ACPI_FAILURE(status))
40 return; 40 return;
41 41
42 if (bgrt_tab->header.length < sizeof(*bgrt_tab))
43 return;
42 if (bgrt_tab->version != 1) 44 if (bgrt_tab->version != 1)
43 return; 45 return;
44 if (bgrt_tab->image_type != 0 || !bgrt_tab->image_address) 46 if (bgrt_tab->image_type != 0 || !bgrt_tab->image_address)
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index ad4439145f85..0a34d9e9c263 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -239,22 +239,7 @@ static efi_status_t __init phys_efi_set_virtual_address_map(
239 return status; 239 return status;
240} 240}
241 241
242static efi_status_t __init phys_efi_get_time(efi_time_t *tm, 242static int efi_set_rtc_mmss(unsigned long nowtime)
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)
258{ 243{
259 int real_seconds, real_minutes; 244 int real_seconds, real_minutes;
260 efi_status_t status; 245 efi_status_t status;
@@ -283,7 +268,7 @@ int efi_set_rtc_mmss(unsigned long nowtime)
283 return 0; 268 return 0;
284} 269}
285 270
286unsigned long efi_get_time(void) 271static unsigned long efi_get_time(void)
287{ 272{
288 efi_status_t status; 273 efi_status_t status;
289 efi_time_t eft; 274 efi_time_t eft;
@@ -639,18 +624,13 @@ static int __init efi_runtime_init(void)
639 } 624 }
640 /* 625 /*
641 * We will only need *early* access to the following 626 * We will only need *early* access to the following
642 * two EFI runtime services before set_virtual_address_map 627 * EFI runtime service before set_virtual_address_map
643 * is invoked. 628 * is invoked.
644 */ 629 */
645 efi_phys.get_time = (efi_get_time_t *)runtime->get_time;
646 efi_phys.set_virtual_address_map = 630 efi_phys.set_virtual_address_map =
647 (efi_set_virtual_address_map_t *) 631 (efi_set_virtual_address_map_t *)
648 runtime->set_virtual_address_map; 632 runtime->set_virtual_address_map;
649 /* 633
650 * Make efi_get_time can be called before entering
651 * virtual mode.
652 */
653 efi.get_time = phys_efi_get_time;
654 early_iounmap(runtime, sizeof(efi_runtime_services_t)); 634 early_iounmap(runtime, sizeof(efi_runtime_services_t));
655 635
656 return 0; 636 return 0;
@@ -736,12 +716,10 @@ void __init efi_init(void)
736 efi_enabled = 0; 716 efi_enabled = 0;
737 return; 717 return;
738 } 718 }
739#ifdef CONFIG_X86_32
740 if (efi_is_native()) { 719 if (efi_is_native()) {
741 x86_platform.get_wallclock = efi_get_time; 720 x86_platform.get_wallclock = efi_get_time;
742 x86_platform.set_wallclock = efi_set_rtc_mmss; 721 x86_platform.set_wallclock = efi_set_rtc_mmss;
743 } 722 }
744#endif
745 723
746#if EFI_DEBUG 724#if EFI_DEBUG
747 print_efi_memmap(); 725 print_efi_memmap();
diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
index 95fd505dfeb6..06c8b2e662ab 100644
--- a/arch/x86/platform/efi/efi_64.c
+++ b/arch/x86/platform/efi/efi_64.c
@@ -58,6 +58,21 @@ 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
61void __init efi_call_phys_prelog(void) 76void __init efi_call_phys_prelog(void)
62{ 77{
63 unsigned long vaddress; 78 unsigned long vaddress;