diff options
Diffstat (limited to 'arch/x86/kernel/setup.c')
-rw-r--r-- | arch/x86/kernel/setup.c | 93 |
1 files changed, 33 insertions, 60 deletions
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index d3cfe26c0252..4be9b398470e 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c | |||
@@ -113,6 +113,7 @@ | |||
113 | #endif | 113 | #endif |
114 | #include <asm/mce.h> | 114 | #include <asm/mce.h> |
115 | #include <asm/alternative.h> | 115 | #include <asm/alternative.h> |
116 | #include <asm/prom.h> | ||
116 | 117 | ||
117 | /* | 118 | /* |
118 | * end_pfn only includes RAM, while max_pfn_mapped includes all e820 entries. | 119 | * end_pfn only includes RAM, while max_pfn_mapped includes all e820 entries. |
@@ -297,6 +298,9 @@ static void __init init_gbpages(void) | |||
297 | static inline void init_gbpages(void) | 298 | static inline void init_gbpages(void) |
298 | { | 299 | { |
299 | } | 300 | } |
301 | static void __init cleanup_highmap(void) | ||
302 | { | ||
303 | } | ||
300 | #endif | 304 | #endif |
301 | 305 | ||
302 | static void __init reserve_brk(void) | 306 | static void __init reserve_brk(void) |
@@ -429,16 +433,30 @@ static void __init parse_setup_data(void) | |||
429 | return; | 433 | return; |
430 | pa_data = boot_params.hdr.setup_data; | 434 | pa_data = boot_params.hdr.setup_data; |
431 | while (pa_data) { | 435 | while (pa_data) { |
432 | data = early_memremap(pa_data, PAGE_SIZE); | 436 | u32 data_len, map_len; |
437 | |||
438 | map_len = max(PAGE_SIZE - (pa_data & ~PAGE_MASK), | ||
439 | (u64)sizeof(struct setup_data)); | ||
440 | data = early_memremap(pa_data, map_len); | ||
441 | data_len = data->len + sizeof(struct setup_data); | ||
442 | if (data_len > map_len) { | ||
443 | early_iounmap(data, map_len); | ||
444 | data = early_memremap(pa_data, data_len); | ||
445 | map_len = data_len; | ||
446 | } | ||
447 | |||
433 | switch (data->type) { | 448 | switch (data->type) { |
434 | case SETUP_E820_EXT: | 449 | case SETUP_E820_EXT: |
435 | parse_e820_ext(data, pa_data); | 450 | parse_e820_ext(data); |
451 | break; | ||
452 | case SETUP_DTB: | ||
453 | add_dtb(pa_data); | ||
436 | break; | 454 | break; |
437 | default: | 455 | default: |
438 | break; | 456 | break; |
439 | } | 457 | } |
440 | pa_data = data->next; | 458 | pa_data = data->next; |
441 | early_iounmap(data, PAGE_SIZE); | 459 | early_iounmap(data, map_len); |
442 | } | 460 | } |
443 | } | 461 | } |
444 | 462 | ||
@@ -601,28 +619,6 @@ void __init reserve_standard_io_resources(void) | |||
601 | 619 | ||
602 | } | 620 | } |
603 | 621 | ||
604 | /* | ||
605 | * Note: elfcorehdr_addr is not just limited to vmcore. It is also used by | ||
606 | * is_kdump_kernel() to determine if we are booting after a panic. Hence | ||
607 | * ifdef it under CONFIG_CRASH_DUMP and not CONFIG_PROC_VMCORE. | ||
608 | */ | ||
609 | |||
610 | #ifdef CONFIG_CRASH_DUMP | ||
611 | /* elfcorehdr= specifies the location of elf core header | ||
612 | * stored by the crashed kernel. This option will be passed | ||
613 | * by kexec loader to the capture kernel. | ||
614 | */ | ||
615 | static int __init setup_elfcorehdr(char *arg) | ||
616 | { | ||
617 | char *end; | ||
618 | if (!arg) | ||
619 | return -EINVAL; | ||
620 | elfcorehdr_addr = memparse(arg, &end); | ||
621 | return end > arg ? 0 : -EINVAL; | ||
622 | } | ||
623 | early_param("elfcorehdr", setup_elfcorehdr); | ||
624 | #endif | ||
625 | |||
626 | static __init void reserve_ibft_region(void) | 622 | static __init void reserve_ibft_region(void) |
627 | { | 623 | { |
628 | unsigned long addr, size = 0; | 624 | unsigned long addr, size = 0; |
@@ -680,15 +676,6 @@ static int __init parse_reservelow(char *p) | |||
680 | 676 | ||
681 | early_param("reservelow", parse_reservelow); | 677 | early_param("reservelow", parse_reservelow); |
682 | 678 | ||
683 | static u64 __init get_max_mapped(void) | ||
684 | { | ||
685 | u64 end = max_pfn_mapped; | ||
686 | |||
687 | end <<= PAGE_SHIFT; | ||
688 | |||
689 | return end; | ||
690 | } | ||
691 | |||
692 | /* | 679 | /* |
693 | * Determine if we were loaded by an EFI loader. If so, then we have also been | 680 | * Determine if we were loaded by an EFI loader. If so, then we have also been |
694 | * passed the efi memmap, systab, etc., so we should use these data structures | 681 | * passed the efi memmap, systab, etc., so we should use these data structures |
@@ -704,8 +691,6 @@ static u64 __init get_max_mapped(void) | |||
704 | 691 | ||
705 | void __init setup_arch(char **cmdline_p) | 692 | void __init setup_arch(char **cmdline_p) |
706 | { | 693 | { |
707 | int acpi = 0; | ||
708 | int amd = 0; | ||
709 | unsigned long flags; | 694 | unsigned long flags; |
710 | 695 | ||
711 | #ifdef CONFIG_X86_32 | 696 | #ifdef CONFIG_X86_32 |
@@ -922,6 +907,8 @@ void __init setup_arch(char **cmdline_p) | |||
922 | */ | 907 | */ |
923 | reserve_brk(); | 908 | reserve_brk(); |
924 | 909 | ||
910 | cleanup_highmap(); | ||
911 | |||
925 | memblock.current_limit = get_max_mapped(); | 912 | memblock.current_limit = get_max_mapped(); |
926 | memblock_x86_fill(); | 913 | memblock_x86_fill(); |
927 | 914 | ||
@@ -935,15 +922,8 @@ void __init setup_arch(char **cmdline_p) | |||
935 | printk(KERN_DEBUG "initial memory mapped : 0 - %08lx\n", | 922 | printk(KERN_DEBUG "initial memory mapped : 0 - %08lx\n", |
936 | max_pfn_mapped<<PAGE_SHIFT); | 923 | max_pfn_mapped<<PAGE_SHIFT); |
937 | 924 | ||
938 | reserve_trampoline_memory(); | 925 | setup_trampolines(); |
939 | 926 | ||
940 | #ifdef CONFIG_ACPI_SLEEP | ||
941 | /* | ||
942 | * Reserve low memory region for sleep support. | ||
943 | * even before init_memory_mapping | ||
944 | */ | ||
945 | acpi_reserve_wakeup_memory(); | ||
946 | #endif | ||
947 | init_gbpages(); | 927 | init_gbpages(); |
948 | 928 | ||
949 | /* max_pfn_mapped is updated here */ | 929 | /* max_pfn_mapped is updated here */ |
@@ -984,19 +964,7 @@ void __init setup_arch(char **cmdline_p) | |||
984 | 964 | ||
985 | early_acpi_boot_init(); | 965 | early_acpi_boot_init(); |
986 | 966 | ||
987 | #ifdef CONFIG_ACPI_NUMA | 967 | initmem_init(); |
988 | /* | ||
989 | * Parse SRAT to discover nodes. | ||
990 | */ | ||
991 | acpi = acpi_numa_init(); | ||
992 | #endif | ||
993 | |||
994 | #ifdef CONFIG_AMD_NUMA | ||
995 | if (!acpi) | ||
996 | amd = !amd_numa_init(0, max_pfn); | ||
997 | #endif | ||
998 | |||
999 | initmem_init(0, max_pfn, acpi, amd); | ||
1000 | memblock_find_dma_reserve(); | 968 | memblock_find_dma_reserve(); |
1001 | dma32_reserve_bootmem(); | 969 | dma32_reserve_bootmem(); |
1002 | 970 | ||
@@ -1008,6 +976,11 @@ void __init setup_arch(char **cmdline_p) | |||
1008 | paging_init(); | 976 | paging_init(); |
1009 | x86_init.paging.pagetable_setup_done(swapper_pg_dir); | 977 | x86_init.paging.pagetable_setup_done(swapper_pg_dir); |
1010 | 978 | ||
979 | if (boot_cpu_data.cpuid_level >= 0) { | ||
980 | /* A CPU has %cr4 if and only if it has CPUID */ | ||
981 | mmu_cr4_features = read_cr4(); | ||
982 | } | ||
983 | |||
1011 | #ifdef CONFIG_X86_32 | 984 | #ifdef CONFIG_X86_32 |
1012 | /* sync back kernel address range */ | 985 | /* sync back kernel address range */ |
1013 | clone_pgd_range(initial_page_table + KERNEL_PGD_BOUNDARY, | 986 | clone_pgd_range(initial_page_table + KERNEL_PGD_BOUNDARY, |
@@ -1029,8 +1002,8 @@ void __init setup_arch(char **cmdline_p) | |||
1029 | * Read APIC and some other early information from ACPI tables. | 1002 | * Read APIC and some other early information from ACPI tables. |
1030 | */ | 1003 | */ |
1031 | acpi_boot_init(); | 1004 | acpi_boot_init(); |
1032 | |||
1033 | sfi_init(); | 1005 | sfi_init(); |
1006 | x86_dtb_init(); | ||
1034 | 1007 | ||
1035 | /* | 1008 | /* |
1036 | * get boot-time SMP configuration: | 1009 | * get boot-time SMP configuration: |
@@ -1040,9 +1013,7 @@ void __init setup_arch(char **cmdline_p) | |||
1040 | 1013 | ||
1041 | prefill_possible_map(); | 1014 | prefill_possible_map(); |
1042 | 1015 | ||
1043 | #ifdef CONFIG_X86_64 | ||
1044 | init_cpu_to_node(); | 1016 | init_cpu_to_node(); |
1045 | #endif | ||
1046 | 1017 | ||
1047 | init_apic_mappings(); | 1018 | init_apic_mappings(); |
1048 | ioapic_and_gsi_init(); | 1019 | ioapic_and_gsi_init(); |
@@ -1066,6 +1037,8 @@ void __init setup_arch(char **cmdline_p) | |||
1066 | #endif | 1037 | #endif |
1067 | x86_init.oem.banner(); | 1038 | x86_init.oem.banner(); |
1068 | 1039 | ||
1040 | x86_init.timers.wallclock_init(); | ||
1041 | |||
1069 | mcheck_init(); | 1042 | mcheck_init(); |
1070 | 1043 | ||
1071 | local_irq_save(flags); | 1044 | local_irq_save(flags); |