aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/setup.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kernel/setup.c')
-rw-r--r--arch/x86/kernel/setup.c46
1 files changed, 33 insertions, 13 deletions
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index b4ae4acbd031..bbe0aaf77494 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -31,6 +31,7 @@
31#include <linux/apm_bios.h> 31#include <linux/apm_bios.h>
32#include <linux/initrd.h> 32#include <linux/initrd.h>
33#include <linux/bootmem.h> 33#include <linux/bootmem.h>
34#include <linux/memblock.h>
34#include <linux/seq_file.h> 35#include <linux/seq_file.h>
35#include <linux/console.h> 36#include <linux/console.h>
36#include <linux/mca.h> 37#include <linux/mca.h>
@@ -614,7 +615,7 @@ static __init void reserve_ibft_region(void)
614 addr = find_ibft_region(&size); 615 addr = find_ibft_region(&size);
615 616
616 if (size) 617 if (size)
617 reserve_early_overlap_ok(addr, addr + size, "ibft"); 618 memblock_x86_reserve_range(addr, addr + size, "* ibft");
618} 619}
619 620
620#ifdef CONFIG_X86_RESERVE_LOW_64K 621#ifdef CONFIG_X86_RESERVE_LOW_64K
@@ -708,6 +709,15 @@ static void __init trim_bios_range(void)
708 sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map); 709 sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
709} 710}
710 711
712static u64 __init get_max_mapped(void)
713{
714 u64 end = max_pfn_mapped;
715
716 end <<= PAGE_SHIFT;
717
718 return end;
719}
720
711/* 721/*
712 * Determine if we were loaded by an EFI loader. If so, then we have also been 722 * Determine if we were loaded by an EFI loader. If so, then we have also been
713 * passed the efi memmap, systab, etc., so we should use these data structures 723 * passed the efi memmap, systab, etc., so we should use these data structures
@@ -891,8 +901,6 @@ void __init setup_arch(char **cmdline_p)
891 */ 901 */
892 max_pfn = e820_end_of_ram_pfn(); 902 max_pfn = e820_end_of_ram_pfn();
893 903
894 /* preallocate 4k for mptable mpc */
895 early_reserve_e820_mpc_new();
896 /* update e820 for memory not covered by WB MTRRs */ 904 /* update e820 for memory not covered by WB MTRRs */
897 mtrr_bp_init(); 905 mtrr_bp_init();
898 if (mtrr_trim_uncached_memory(max_pfn)) 906 if (mtrr_trim_uncached_memory(max_pfn))
@@ -917,15 +925,6 @@ void __init setup_arch(char **cmdline_p)
917 max_pfn_mapped = KERNEL_IMAGE_SIZE >> PAGE_SHIFT; 925 max_pfn_mapped = KERNEL_IMAGE_SIZE >> PAGE_SHIFT;
918#endif 926#endif
919 927
920#ifdef CONFIG_X86_CHECK_BIOS_CORRUPTION
921 setup_bios_corruption_check();
922#endif
923
924 printk(KERN_DEBUG "initial memory mapped : 0 - %08lx\n",
925 max_pfn_mapped<<PAGE_SHIFT);
926
927 reserve_brk();
928
929 /* 928 /*
930 * Find and reserve possible boot-time SMP configuration: 929 * Find and reserve possible boot-time SMP configuration:
931 */ 930 */
@@ -933,6 +932,26 @@ void __init setup_arch(char **cmdline_p)
933 932
934 reserve_ibft_region(); 933 reserve_ibft_region();
935 934
935 /*
936 * Need to conclude brk, before memblock_x86_fill()
937 * it could use memblock_find_in_range, could overlap with
938 * brk area.
939 */
940 reserve_brk();
941
942 memblock.current_limit = get_max_mapped();
943 memblock_x86_fill();
944
945 /* preallocate 4k for mptable mpc */
946 early_reserve_e820_mpc_new();
947
948#ifdef CONFIG_X86_CHECK_BIOS_CORRUPTION
949 setup_bios_corruption_check();
950#endif
951
952 printk(KERN_DEBUG "initial memory mapped : 0 - %08lx\n",
953 max_pfn_mapped<<PAGE_SHIFT);
954
936 reserve_trampoline_memory(); 955 reserve_trampoline_memory();
937 956
938#ifdef CONFIG_ACPI_SLEEP 957#ifdef CONFIG_ACPI_SLEEP
@@ -956,6 +975,7 @@ void __init setup_arch(char **cmdline_p)
956 max_low_pfn = max_pfn; 975 max_low_pfn = max_pfn;
957 } 976 }
958#endif 977#endif
978 memblock.current_limit = get_max_mapped();
959 979
960 /* 980 /*
961 * NOTE: On x86-32, only from this point on, fixmaps are ready for use. 981 * NOTE: On x86-32, only from this point on, fixmaps are ready for use.
@@ -995,7 +1015,7 @@ void __init setup_arch(char **cmdline_p)
995 1015
996 initmem_init(0, max_pfn, acpi, k8); 1016 initmem_init(0, max_pfn, acpi, k8);
997#ifndef CONFIG_NO_BOOTMEM 1017#ifndef CONFIG_NO_BOOTMEM
998 early_res_to_bootmem(0, max_low_pfn<<PAGE_SHIFT); 1018 memblock_x86_to_bootmem(0, max_low_pfn<<PAGE_SHIFT);
999#endif 1019#endif
1000 1020
1001 dma32_reserve_bootmem(); 1021 dma32_reserve_bootmem();