x86, mm: Move init_memory_mapping calling out of setup.c
[deliverable/linux.git] / arch / x86 / kernel / setup.c
index 468e98dfd44e72fd7d0b29690b4bb777356a52a5..23b079fb93fc0e237438aed52b3a1b46e8ab33b8 100644 (file)
@@ -914,31 +914,8 @@ void __init setup_arch(char **cmdline_p)
 
        init_gbpages();
 
-       /* max_pfn_mapped is updated here */
-       max_low_pfn_mapped = init_memory_mapping(0, max_low_pfn<<PAGE_SHIFT);
-       max_pfn_mapped = max_low_pfn_mapped;
+       init_mem_mapping();
 
-#ifdef CONFIG_X86_64
-       if (max_pfn > max_low_pfn) {
-               int i;
-               for (i = 0; i < e820.nr_map; i++) {
-                       struct e820entry *ei = &e820.map[i];
-
-                       if (ei->addr + ei->size <= 1UL << 32)
-                               continue;
-
-                       if (ei->type == E820_RESERVED)
-                               continue;
-
-                       max_pfn_mapped = init_memory_mapping(
-                               ei->addr < 1UL << 32 ? 1UL << 32 : ei->addr,
-                               ei->addr + ei->size);
-               }
-
-               /* can we preseve max_low_pfn ?*/
-               max_low_pfn = max_pfn;
-       }
-#endif
        memblock.current_limit = get_max_mapped();
        dma_contiguous_reserve(0);
 
@@ -1048,6 +1025,18 @@ void __init setup_arch(char **cmdline_p)
        arch_init_ideal_nops();
 
        register_refined_jiffies(CLOCK_TICK_RATE);
+
+#ifdef CONFIG_EFI
+       /* Once setup is done above, disable efi_enabled on mismatched
+        * firmware/kernel archtectures since there is no support for
+        * runtime services.
+        */
+       if (efi_enabled && IS_ENABLED(CONFIG_X86_64) != efi_64bit) {
+               pr_info("efi: Setup done, disabling due to 32/64-bit mismatch\n");
+               efi_unmap_memmap();
+               efi_enabled = 0;
+       }
+#endif
 }
 
 #ifdef CONFIG_X86_32
This page took 0.024653 seconds and 5 git commands to generate.