x86: fixes some bugs about EFI memory map handling
authorHuang, Ying <ying.huang@intel.com>
Wed, 30 Jan 2008 12:34:10 +0000 (13:34 +0100)
committerIngo Molnar <mingo@elte.hu>
Wed, 30 Jan 2008 12:34:10 +0000 (13:34 +0100)
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>
arch/x86/kernel/efi.c
arch/x86/kernel/efi_32.c
arch/x86/kernel/efi_64.c
arch/x86/kernel/setup_32.c
arch/x86/kernel/setup_64.c

index 174b067b9d03a5aa2c4dfc3824449a32f5d1047d..1411324a625ca5ae0060d49afbdbc897b9e70c68 100644 (file)
@@ -474,6 +474,8 @@ void __init efi_enter_virtual_mode(void)
        efi.reset_system = virt_efi_reset_system;
        efi.set_virtual_address_map = virt_efi_set_virtual_address_map;
        runtime_code_page_mkexec();
+       early_iounmap(memmap.map, memmap.nr_map * memmap.desc_size);
+       memmap.map = NULL;
 }
 
 /*
index 114b896d7573345eb4e5d29e71f1d7f06a237174..cb91f985b4a1f8520e021d995135977729e57481 100644 (file)
@@ -109,18 +109,3 @@ void efi_call_phys_epilog(void)
 
        local_irq_restore(efi_rt_eflags);
 }
-
-/*
- * We need to map the EFI memory map again after paging_init().
- */
-void __init efi_map_memmap(void)
-{
-       memmap.map = NULL;
-
-       memmap.map = early_ioremap((unsigned long) memmap.phys_map,
-                       (memmap.nr_map * memmap.desc_size));
-       if (memmap.map == NULL)
-               printk(KERN_ERR "Could not remap the EFI memmap!\n");
-
-       memmap.map_end = memmap.map + (memmap.nr_map * memmap.desc_size);
-}
index 9f8a7559439844d823c84a5b9da1a819ea34ae2b..4b73992c1e111945012993742b436fda177f51b8 100644 (file)
@@ -103,15 +103,6 @@ void __init efi_call_phys_epilog(void)
        local_irq_restore(efi_flags);
 }
 
-/*
- * We need to map the EFI memory map again after init_memory_mapping().
- */
-void __init efi_map_memmap(void)
-{
-       memmap.map = __va(memmap.phys_map);
-       memmap.map_end = memmap.map + (memmap.nr_map * memmap.desc_size);
-}
-
 void __init efi_reserve_bootmem(void)
 {
        reserve_bootmem_generic((unsigned long)memmap.phys_map,
index c038b09b1723d6c9f26047aa1609cbaa4debaa87..9c0ef4945a587040664329f349e1ff26a1c7fe33 100644 (file)
@@ -808,8 +808,6 @@ void __init setup_arch(char **cmdline_p)
 #ifdef CONFIG_X86_GENERICARCH
        generic_apic_probe();
 #endif
-       if (efi_enabled)
-               efi_map_memmap();
 
 #ifdef CONFIG_ACPI
        /*
index 4ccad185ab7e76ced570c7945ad6b9c41fa25d86..697533e86822f37766a735884175d18169829a5d 100644 (file)
@@ -378,10 +378,8 @@ void __init setup_arch(char **cmdline_p)
        acpi_reserve_bootmem();
 #endif
 
-       if (efi_enabled) {
-               efi_map_memmap();
+       if (efi_enabled)
                efi_reserve_bootmem();
-       }
 
        /*
        * Find and reserve possible boot-time SMP configuration: