aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/platform
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2011-12-11 19:12:42 -0500
committerIngo Molnar <mingo@elte.hu>2011-12-12 12:25:56 -0500
commite1ad783b12ec8b69da83479c5d21a0d8180bc519 (patch)
tree9f514caae0da32ae9d1dbf71a2b93f5d5910c472 /arch/x86/platform
parent6d3e32e63f1fb47b3ba104d13dfac116df7b2bbb (diff)
Revert "x86, efi: Calling __pa() with an ioremap()ed address is invalid"
This hangs my MacBook Air at boot time; I get no console messages at all. I reverted this on top of -rc5 and my machine boots again. This reverts commit e8c7106280a305e1ff2a3a8a4dfce141469fb039. Signed-off-by: Matt Fleming <matt.fleming@intel.com> Signed-off-by: Keith Packard <keithp@keithp.com> Acked-by: H. Peter Anvin <hpa@zytor.com> Cc: Matthew Garrett <mjg@redhat.com> Cc: Zhang Rui <rui.zhang@intel.com> Cc: Huang Ying <huang.ying.caritas@gmail.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Andrew Morton <akpm@linux-foundation.org> Link: http://lkml.kernel.org/r/1321621751-3650-1-git-send-email-matt@console Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/platform')
-rw-r--r--arch/x86/platform/efi/efi.c29
-rw-r--r--arch/x86/platform/efi/efi_64.c17
2 files changed, 28 insertions, 18 deletions
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index c9718a16be15..37718f0f053d 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -323,13 +323,10 @@ static void __init do_add_efi_memmap(void)
323 case EFI_UNUSABLE_MEMORY: 323 case EFI_UNUSABLE_MEMORY:
324 e820_type = E820_UNUSABLE; 324 e820_type = E820_UNUSABLE;
325 break; 325 break;
326 case EFI_RUNTIME_SERVICES_DATA:
327 e820_type = E820_RESERVED_EFI;
328 break;
329 default: 326 default:
330 /* 327 /*
331 * EFI_RESERVED_TYPE EFI_RUNTIME_SERVICES_CODE 328 * EFI_RESERVED_TYPE EFI_RUNTIME_SERVICES_CODE
332 * EFI_MEMORY_MAPPED_IO 329 * EFI_RUNTIME_SERVICES_DATA EFI_MEMORY_MAPPED_IO
333 * EFI_MEMORY_MAPPED_IO_PORT_SPACE EFI_PAL_CODE 330 * EFI_MEMORY_MAPPED_IO_PORT_SPACE EFI_PAL_CODE
334 */ 331 */
335 e820_type = E820_RESERVED; 332 e820_type = E820_RESERVED;
@@ -674,21 +671,10 @@ void __init efi_enter_virtual_mode(void)
674 end_pfn = PFN_UP(end); 671 end_pfn = PFN_UP(end);
675 if (end_pfn <= max_low_pfn_mapped 672 if (end_pfn <= max_low_pfn_mapped
676 || (end_pfn > (1UL << (32 - PAGE_SHIFT)) 673 || (end_pfn > (1UL << (32 - PAGE_SHIFT))
677 && end_pfn <= max_pfn_mapped)) { 674 && end_pfn <= max_pfn_mapped))
678 va = __va(md->phys_addr); 675 va = __va(md->phys_addr);
679 676 else
680 if (!(md->attribute & EFI_MEMORY_WB)) { 677 va = efi_ioremap(md->phys_addr, size, md->type);
681 addr = (u64) (unsigned long)va;
682 npages = md->num_pages;
683 memrange_efi_to_native(&addr, &npages);
684 set_memory_uc(addr, npages);
685 }
686 } else {
687 if (!(md->attribute & EFI_MEMORY_WB))
688 va = ioremap_nocache(md->phys_addr, size);
689 else
690 va = ioremap_cache(md->phys_addr, size);
691 }
692 678
693 md->virt_addr = (u64) (unsigned long) va; 679 md->virt_addr = (u64) (unsigned long) va;
694 680
@@ -698,6 +684,13 @@ void __init efi_enter_virtual_mode(void)
698 continue; 684 continue;
699 } 685 }
700 686
687 if (!(md->attribute & EFI_MEMORY_WB)) {
688 addr = md->virt_addr;
689 npages = md->num_pages;
690 memrange_efi_to_native(&addr, &npages);
691 set_memory_uc(addr, npages);
692 }
693
701 systab = (u64) (unsigned long) efi_phys.systab; 694 systab = (u64) (unsigned long) efi_phys.systab;
702 if (md->phys_addr <= systab && systab < end) { 695 if (md->phys_addr <= systab && systab < end) {
703 systab += md->virt_addr - md->phys_addr; 696 systab += md->virt_addr - md->phys_addr;
diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
index 312250c6b2de..ac3aa54e2654 100644
--- a/arch/x86/platform/efi/efi_64.c
+++ b/arch/x86/platform/efi/efi_64.c
@@ -80,3 +80,20 @@ void __init efi_call_phys_epilog(void)
80 local_irq_restore(efi_flags); 80 local_irq_restore(efi_flags);
81 early_code_mapping_set_exec(0); 81 early_code_mapping_set_exec(0);
82} 82}
83
84void __iomem *__init efi_ioremap(unsigned long phys_addr, unsigned long size,
85 u32 type)
86{
87 unsigned long last_map_pfn;
88
89 if (type == EFI_MEMORY_MAPPED_IO)
90 return ioremap(phys_addr, size);
91
92 last_map_pfn = init_memory_mapping(phys_addr, phys_addr + size);
93 if ((last_map_pfn << PAGE_SHIFT) < phys_addr + size) {
94 unsigned long top = last_map_pfn << PAGE_SHIFT;
95 efi_ioremap(top, size - (top - phys_addr), type);
96 }
97
98 return (void __iomem *)__va(phys_addr);
99}