]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/x86/kernel/efi.c
x86: use WARN() in arch/x86/kernel
[linux-2.6-omap-h63xx.git] / arch / x86 / kernel / efi.c
index d5c7fcdd18610690fe51e116105198736b096f7f..06cc8d4254b180f622a33c879bca97f2c05b1643 100644 (file)
@@ -64,6 +64,17 @@ static int __init setup_noefi(char *arg)
 }
 early_param("noefi", setup_noefi);
 
+int add_efi_memmap;
+EXPORT_SYMBOL(add_efi_memmap);
+
+static int __init setup_add_efi_memmap(char *arg)
+{
+       add_efi_memmap = 1;
+       return 0;
+}
+early_param("add_efi_memmap", setup_add_efi_memmap);
+
+
 static efi_status_t virt_efi_get_time(efi_time_t *tm, efi_time_cap_t *tc)
 {
        return efi_call_virt2(get_time, tm, tc);
@@ -219,7 +230,7 @@ unsigned long efi_get_time(void)
  * (zeropage) memory map.
  */
 
-static void __init add_efi_memmap(void)
+static void __init do_add_efi_memmap(void)
 {
        void *p;
 
@@ -233,7 +244,7 @@ static void __init add_efi_memmap(void)
                        e820_type = E820_RAM;
                else
                        e820_type = E820_RESERVED;
-               add_memory_region(start, size, e820_type);
+               e820_add_region(start, size, e820_type);
        }
        sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
 }
@@ -242,9 +253,11 @@ void __init efi_reserve_early(void)
 {
        unsigned long pmap;
 
+#ifdef CONFIG_X86_32
        pmap = boot_params.efi_info.efi_memmap;
-#ifdef CONFIG_X86_64
-       pmap += (__u64)boot_params.efi_info.efi_memmap_hi << 32;
+#else
+       pmap = (boot_params.efi_info.efi_memmap |
+               ((__u64)boot_params.efi_info.efi_memmap_hi<<32));
 #endif
        memmap.phys_map = (void *)pmap;
        memmap.nr_map = boot_params.efi_info.efi_memmap_size /
@@ -284,10 +297,12 @@ void __init efi_init(void)
        int i = 0;
        void *tmp;
 
+#ifdef CONFIG_X86_32
        efi_phys.systab = (efi_system_table_t *)boot_params.efi_info.efi_systab;
-#ifdef CONFIG_X86_64
-       efi_phys.systab = (void *)efi_phys.systab +
-               ((__u64)boot_params.efi_info.efi_systab_hi<<32);
+#else
+       efi_phys.systab = (efi_system_table_t *)
+               (boot_params.efi_info.efi_systab |
+                ((__u64)boot_params.efi_info.efi_systab_hi<<32));
 #endif
 
        efi.systab = early_ioremap((unsigned long)efi_phys.systab,
@@ -402,7 +417,8 @@ void __init efi_init(void)
        if (memmap.desc_size != sizeof(efi_memory_desc_t))
                printk(KERN_WARNING "Kernel-defined memdesc"
                       "doesn't match the one from EFI!\n");
-       add_efi_memmap();
+       if (add_efi_memmap)
+               do_add_efi_memmap();
 
        /* Setup for EFI runtime service */
        reboot_type = BOOT_EFI;
@@ -457,7 +473,7 @@ void __init efi_enter_virtual_mode(void)
                size = md->num_pages << EFI_PAGE_SHIFT;
                end = md->phys_addr + size;
 
-               if (PFN_UP(end) <= max_pfn_mapped)
+               if (PFN_UP(end) <= max_low_pfn_mapped)
                        va = __va(md->phys_addr);
                else
                        va = efi_ioremap(md->phys_addr, size);