diff options
Diffstat (limited to 'arch/x86/kernel/setup.c')
-rw-r--r-- | arch/x86/kernel/setup.c | 76 |
1 files changed, 46 insertions, 30 deletions
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index d3cfe26c025..b176f2b1f45 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. |
@@ -293,10 +294,32 @@ static void __init init_gbpages(void) | |||
293 | else | 294 | else |
294 | direct_gbpages = 0; | 295 | direct_gbpages = 0; |
295 | } | 296 | } |
297 | |||
298 | static void __init cleanup_highmap_brk_end(void) | ||
299 | { | ||
300 | pud_t *pud; | ||
301 | pmd_t *pmd; | ||
302 | |||
303 | mmu_cr4_features = read_cr4(); | ||
304 | |||
305 | /* | ||
306 | * _brk_end cannot change anymore, but it and _end may be | ||
307 | * located on different 2M pages. cleanup_highmap(), however, | ||
308 | * can only consider _end when it runs, so destroy any | ||
309 | * mappings beyond _brk_end here. | ||
310 | */ | ||
311 | pud = pud_offset(pgd_offset_k(_brk_end), _brk_end); | ||
312 | pmd = pmd_offset(pud, _brk_end - 1); | ||
313 | while (++pmd <= pmd_offset(pud, (unsigned long)_end - 1)) | ||
314 | pmd_clear(pmd); | ||
315 | } | ||
296 | #else | 316 | #else |
297 | static inline void init_gbpages(void) | 317 | static inline void init_gbpages(void) |
298 | { | 318 | { |
299 | } | 319 | } |
320 | static inline void cleanup_highmap_brk_end(void) | ||
321 | { | ||
322 | } | ||
300 | #endif | 323 | #endif |
301 | 324 | ||
302 | static void __init reserve_brk(void) | 325 | static void __init reserve_brk(void) |
@@ -307,6 +330,8 @@ static void __init reserve_brk(void) | |||
307 | /* Mark brk area as locked down and no longer taking any | 330 | /* Mark brk area as locked down and no longer taking any |
308 | new allocations */ | 331 | new allocations */ |
309 | _brk_start = 0; | 332 | _brk_start = 0; |
333 | |||
334 | cleanup_highmap_brk_end(); | ||
310 | } | 335 | } |
311 | 336 | ||
312 | #ifdef CONFIG_BLK_DEV_INITRD | 337 | #ifdef CONFIG_BLK_DEV_INITRD |
@@ -429,16 +454,30 @@ static void __init parse_setup_data(void) | |||
429 | return; | 454 | return; |
430 | pa_data = boot_params.hdr.setup_data; | 455 | pa_data = boot_params.hdr.setup_data; |
431 | while (pa_data) { | 456 | while (pa_data) { |
432 | data = early_memremap(pa_data, PAGE_SIZE); | 457 | u32 data_len, map_len; |
458 | |||
459 | map_len = max(PAGE_SIZE - (pa_data & ~PAGE_MASK), | ||
460 | (u64)sizeof(struct setup_data)); | ||
461 | data = early_memremap(pa_data, map_len); | ||
462 | data_len = data->len + sizeof(struct setup_data); | ||
463 | if (data_len > map_len) { | ||
464 | early_iounmap(data, map_len); | ||
465 | data = early_memremap(pa_data, data_len); | ||
466 | map_len = data_len; | ||
467 | } | ||
468 | |||
433 | switch (data->type) { | 469 | switch (data->type) { |
434 | case SETUP_E820_EXT: | 470 | case SETUP_E820_EXT: |
435 | parse_e820_ext(data, pa_data); | 471 | parse_e820_ext(data); |
472 | break; | ||
473 | case SETUP_DTB: | ||
474 | add_dtb(pa_data); | ||
436 | break; | 475 | break; |
437 | default: | 476 | default: |
438 | break; | 477 | break; |
439 | } | 478 | } |
440 | pa_data = data->next; | 479 | pa_data = data->next; |
441 | early_iounmap(data, PAGE_SIZE); | 480 | early_iounmap(data, map_len); |
442 | } | 481 | } |
443 | } | 482 | } |
444 | 483 | ||
@@ -680,15 +719,6 @@ static int __init parse_reservelow(char *p) | |||
680 | 719 | ||
681 | early_param("reservelow", parse_reservelow); | 720 | early_param("reservelow", parse_reservelow); |
682 | 721 | ||
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 | /* | 722 | /* |
693 | * Determine if we were loaded by an EFI loader. If so, then we have also been | 723 | * 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 | 724 | * passed the efi memmap, systab, etc., so we should use these data structures |
@@ -704,8 +734,6 @@ static u64 __init get_max_mapped(void) | |||
704 | 734 | ||
705 | void __init setup_arch(char **cmdline_p) | 735 | void __init setup_arch(char **cmdline_p) |
706 | { | 736 | { |
707 | int acpi = 0; | ||
708 | int amd = 0; | ||
709 | unsigned long flags; | 737 | unsigned long flags; |
710 | 738 | ||
711 | #ifdef CONFIG_X86_32 | 739 | #ifdef CONFIG_X86_32 |
@@ -984,19 +1012,7 @@ void __init setup_arch(char **cmdline_p) | |||
984 | 1012 | ||
985 | early_acpi_boot_init(); | 1013 | early_acpi_boot_init(); |
986 | 1014 | ||
987 | #ifdef CONFIG_ACPI_NUMA | 1015 | 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(); | 1016 | memblock_find_dma_reserve(); |
1001 | dma32_reserve_bootmem(); | 1017 | dma32_reserve_bootmem(); |
1002 | 1018 | ||
@@ -1029,8 +1045,8 @@ void __init setup_arch(char **cmdline_p) | |||
1029 | * Read APIC and some other early information from ACPI tables. | 1045 | * Read APIC and some other early information from ACPI tables. |
1030 | */ | 1046 | */ |
1031 | acpi_boot_init(); | 1047 | acpi_boot_init(); |
1032 | |||
1033 | sfi_init(); | 1048 | sfi_init(); |
1049 | x86_dtb_init(); | ||
1034 | 1050 | ||
1035 | /* | 1051 | /* |
1036 | * get boot-time SMP configuration: | 1052 | * get boot-time SMP configuration: |
@@ -1040,9 +1056,7 @@ void __init setup_arch(char **cmdline_p) | |||
1040 | 1056 | ||
1041 | prefill_possible_map(); | 1057 | prefill_possible_map(); |
1042 | 1058 | ||
1043 | #ifdef CONFIG_X86_64 | ||
1044 | init_cpu_to_node(); | 1059 | init_cpu_to_node(); |
1045 | #endif | ||
1046 | 1060 | ||
1047 | init_apic_mappings(); | 1061 | init_apic_mappings(); |
1048 | ioapic_and_gsi_init(); | 1062 | ioapic_and_gsi_init(); |
@@ -1066,6 +1080,8 @@ void __init setup_arch(char **cmdline_p) | |||
1066 | #endif | 1080 | #endif |
1067 | x86_init.oem.banner(); | 1081 | x86_init.oem.banner(); |
1068 | 1082 | ||
1083 | x86_init.timers.wallclock_init(); | ||
1084 | |||
1069 | mcheck_init(); | 1085 | mcheck_init(); |
1070 | 1086 | ||
1071 | local_irq_save(flags); | 1087 | local_irq_save(flags); |