aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorHuang, Ying <ying.huang@intel.com>2008-01-30 07:34:10 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-30 07:34:10 -0500
commita3828064be4ed8e95907d3943e7af13cb709694d (patch)
treeb5458f61681a0bf4c3640f28c51ccd0a24c0c6b5 /arch
parentbed23c67fe077b4d66cb3329263d7cfa33b3fd67 (diff)
x86: fixes some bugs about EFI memory map handling
This patch fixes some bugs of EFI memory handing code. - On x86_64, it is possible that EFI memory map can not be mapped via identity map, so efi_map_memmap is removed, just use early_ioremap. - On i386, the EFI memory map mapping take effect cross paging_init, so it is not necessary to use efi_map_memmap. - EFI memory map is unmapped in efi_enter_virtual_mode to avoid early_ioremap leak. Signed-off-by: Huang Ying <ying.huang@intel.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kernel/efi.c2
-rw-r--r--arch/x86/kernel/efi_32.c15
-rw-r--r--arch/x86/kernel/efi_64.c9
-rw-r--r--arch/x86/kernel/setup_32.c2
-rw-r--r--arch/x86/kernel/setup_64.c4
5 files changed, 3 insertions, 29 deletions
diff --git a/arch/x86/kernel/efi.c b/arch/x86/kernel/efi.c
index 174b067b9d03..1411324a625c 100644
--- a/arch/x86/kernel/efi.c
+++ b/arch/x86/kernel/efi.c
@@ -474,6 +474,8 @@ void __init efi_enter_virtual_mode(void)
474 efi.reset_system = virt_efi_reset_system; 474 efi.reset_system = virt_efi_reset_system;
475 efi.set_virtual_address_map = virt_efi_set_virtual_address_map; 475 efi.set_virtual_address_map = virt_efi_set_virtual_address_map;
476 runtime_code_page_mkexec(); 476 runtime_code_page_mkexec();
477 early_iounmap(memmap.map, memmap.nr_map * memmap.desc_size);
478 memmap.map = NULL;
477} 479}
478 480
479/* 481/*
diff --git a/arch/x86/kernel/efi_32.c b/arch/x86/kernel/efi_32.c
index 114b896d7573..cb91f985b4a1 100644
--- a/arch/x86/kernel/efi_32.c
+++ b/arch/x86/kernel/efi_32.c
@@ -109,18 +109,3 @@ void efi_call_phys_epilog(void)
109 109
110 local_irq_restore(efi_rt_eflags); 110 local_irq_restore(efi_rt_eflags);
111} 111}
112
113/*
114 * We need to map the EFI memory map again after paging_init().
115 */
116void __init efi_map_memmap(void)
117{
118 memmap.map = NULL;
119
120 memmap.map = early_ioremap((unsigned long) memmap.phys_map,
121 (memmap.nr_map * memmap.desc_size));
122 if (memmap.map == NULL)
123 printk(KERN_ERR "Could not remap the EFI memmap!\n");
124
125 memmap.map_end = memmap.map + (memmap.nr_map * memmap.desc_size);
126}
diff --git a/arch/x86/kernel/efi_64.c b/arch/x86/kernel/efi_64.c
index 9f8a75594398..4b73992c1e11 100644
--- a/arch/x86/kernel/efi_64.c
+++ b/arch/x86/kernel/efi_64.c
@@ -103,15 +103,6 @@ void __init efi_call_phys_epilog(void)
103 local_irq_restore(efi_flags); 103 local_irq_restore(efi_flags);
104} 104}
105 105
106/*
107 * We need to map the EFI memory map again after init_memory_mapping().
108 */
109void __init efi_map_memmap(void)
110{
111 memmap.map = __va(memmap.phys_map);
112 memmap.map_end = memmap.map + (memmap.nr_map * memmap.desc_size);
113}
114
115void __init efi_reserve_bootmem(void) 106void __init efi_reserve_bootmem(void)
116{ 107{
117 reserve_bootmem_generic((unsigned long)memmap.phys_map, 108 reserve_bootmem_generic((unsigned long)memmap.phys_map,
diff --git a/arch/x86/kernel/setup_32.c b/arch/x86/kernel/setup_32.c
index c038b09b1723..9c0ef4945a58 100644
--- a/arch/x86/kernel/setup_32.c
+++ b/arch/x86/kernel/setup_32.c
@@ -808,8 +808,6 @@ void __init setup_arch(char **cmdline_p)
808#ifdef CONFIG_X86_GENERICARCH 808#ifdef CONFIG_X86_GENERICARCH
809 generic_apic_probe(); 809 generic_apic_probe();
810#endif 810#endif
811 if (efi_enabled)
812 efi_map_memmap();
813 811
814#ifdef CONFIG_ACPI 812#ifdef CONFIG_ACPI
815 /* 813 /*
diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c
index 4ccad185ab7e..697533e86822 100644
--- a/arch/x86/kernel/setup_64.c
+++ b/arch/x86/kernel/setup_64.c
@@ -378,10 +378,8 @@ void __init setup_arch(char **cmdline_p)
378 acpi_reserve_bootmem(); 378 acpi_reserve_bootmem();
379#endif 379#endif
380 380
381 if (efi_enabled) { 381 if (efi_enabled)
382 efi_map_memmap();
383 efi_reserve_bootmem(); 382 efi_reserve_bootmem();
384 }
385 383
386 /* 384 /*
387 * Find and reserve possible boot-time SMP configuration: 385 * Find and reserve possible boot-time SMP configuration: