diff options
Diffstat (limited to 'arch/x86/kernel/setup.c')
| -rw-r--r-- | arch/x86/kernel/setup.c | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index cb42109a55b4..c4851eff57b3 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c | |||
| @@ -55,7 +55,6 @@ | |||
| 55 | #include <linux/stddef.h> | 55 | #include <linux/stddef.h> |
| 56 | #include <linux/unistd.h> | 56 | #include <linux/unistd.h> |
| 57 | #include <linux/ptrace.h> | 57 | #include <linux/ptrace.h> |
| 58 | #include <linux/slab.h> | ||
| 59 | #include <linux/user.h> | 58 | #include <linux/user.h> |
| 60 | #include <linux/delay.h> | 59 | #include <linux/delay.h> |
| 61 | 60 | ||
| @@ -314,16 +313,17 @@ static void __init reserve_brk(void) | |||
| 314 | #define MAX_MAP_CHUNK (NR_FIX_BTMAPS << PAGE_SHIFT) | 313 | #define MAX_MAP_CHUNK (NR_FIX_BTMAPS << PAGE_SHIFT) |
| 315 | static void __init relocate_initrd(void) | 314 | static void __init relocate_initrd(void) |
| 316 | { | 315 | { |
| 317 | 316 | /* Assume only end is not page aligned */ | |
| 318 | u64 ramdisk_image = boot_params.hdr.ramdisk_image; | 317 | u64 ramdisk_image = boot_params.hdr.ramdisk_image; |
| 319 | u64 ramdisk_size = boot_params.hdr.ramdisk_size; | 318 | u64 ramdisk_size = boot_params.hdr.ramdisk_size; |
| 319 | u64 area_size = PAGE_ALIGN(ramdisk_size); | ||
| 320 | u64 end_of_lowmem = max_low_pfn_mapped << PAGE_SHIFT; | 320 | u64 end_of_lowmem = max_low_pfn_mapped << PAGE_SHIFT; |
| 321 | u64 ramdisk_here; | 321 | u64 ramdisk_here; |
| 322 | unsigned long slop, clen, mapaddr; | 322 | unsigned long slop, clen, mapaddr; |
| 323 | char *p, *q; | 323 | char *p, *q; |
| 324 | 324 | ||
| 325 | /* We need to move the initrd down into lowmem */ | 325 | /* We need to move the initrd down into lowmem */ |
| 326 | ramdisk_here = find_e820_area(0, end_of_lowmem, ramdisk_size, | 326 | ramdisk_here = find_e820_area(0, end_of_lowmem, area_size, |
| 327 | PAGE_SIZE); | 327 | PAGE_SIZE); |
| 328 | 328 | ||
| 329 | if (ramdisk_here == -1ULL) | 329 | if (ramdisk_here == -1ULL) |
| @@ -332,7 +332,7 @@ static void __init relocate_initrd(void) | |||
| 332 | 332 | ||
| 333 | /* Note: this includes all the lowmem currently occupied by | 333 | /* Note: this includes all the lowmem currently occupied by |
| 334 | the initrd, we rely on that fact to keep the data intact. */ | 334 | the initrd, we rely on that fact to keep the data intact. */ |
| 335 | reserve_early(ramdisk_here, ramdisk_here + ramdisk_size, | 335 | reserve_early(ramdisk_here, ramdisk_here + area_size, |
| 336 | "NEW RAMDISK"); | 336 | "NEW RAMDISK"); |
| 337 | initrd_start = ramdisk_here + PAGE_OFFSET; | 337 | initrd_start = ramdisk_here + PAGE_OFFSET; |
| 338 | initrd_end = initrd_start + ramdisk_size; | 338 | initrd_end = initrd_start + ramdisk_size; |
| @@ -376,9 +376,10 @@ static void __init relocate_initrd(void) | |||
| 376 | 376 | ||
| 377 | static void __init reserve_initrd(void) | 377 | static void __init reserve_initrd(void) |
| 378 | { | 378 | { |
| 379 | /* Assume only end is not page aligned */ | ||
| 379 | u64 ramdisk_image = boot_params.hdr.ramdisk_image; | 380 | u64 ramdisk_image = boot_params.hdr.ramdisk_image; |
| 380 | u64 ramdisk_size = boot_params.hdr.ramdisk_size; | 381 | u64 ramdisk_size = boot_params.hdr.ramdisk_size; |
| 381 | u64 ramdisk_end = ramdisk_image + ramdisk_size; | 382 | u64 ramdisk_end = PAGE_ALIGN(ramdisk_image + ramdisk_size); |
| 382 | u64 end_of_lowmem = max_low_pfn_mapped << PAGE_SHIFT; | 383 | u64 end_of_lowmem = max_low_pfn_mapped << PAGE_SHIFT; |
| 383 | 384 | ||
| 384 | if (!boot_params.hdr.type_of_loader || | 385 | if (!boot_params.hdr.type_of_loader || |
| @@ -606,6 +607,16 @@ static int __init setup_elfcorehdr(char *arg) | |||
| 606 | early_param("elfcorehdr", setup_elfcorehdr); | 607 | early_param("elfcorehdr", setup_elfcorehdr); |
| 607 | #endif | 608 | #endif |
| 608 | 609 | ||
| 610 | static __init void reserve_ibft_region(void) | ||
| 611 | { | ||
| 612 | unsigned long addr, size = 0; | ||
| 613 | |||
| 614 | addr = find_ibft_region(&size); | ||
| 615 | |||
| 616 | if (size) | ||
| 617 | reserve_early_overlap_ok(addr, addr + size, "ibft"); | ||
| 618 | } | ||
| 619 | |||
| 609 | #ifdef CONFIG_X86_RESERVE_LOW_64K | 620 | #ifdef CONFIG_X86_RESERVE_LOW_64K |
| 610 | static int __init dmi_low_memory_corruption(const struct dmi_system_id *d) | 621 | static int __init dmi_low_memory_corruption(const struct dmi_system_id *d) |
| 611 | { | 622 | { |
| @@ -908,6 +919,8 @@ void __init setup_arch(char **cmdline_p) | |||
| 908 | */ | 919 | */ |
| 909 | find_smp_config(); | 920 | find_smp_config(); |
| 910 | 921 | ||
| 922 | reserve_ibft_region(); | ||
| 923 | |||
| 911 | reserve_trampoline_memory(); | 924 | reserve_trampoline_memory(); |
| 912 | 925 | ||
| 913 | #ifdef CONFIG_ACPI_SLEEP | 926 | #ifdef CONFIG_ACPI_SLEEP |
| @@ -969,17 +982,11 @@ void __init setup_arch(char **cmdline_p) | |||
| 969 | #endif | 982 | #endif |
| 970 | 983 | ||
| 971 | initmem_init(0, max_pfn, acpi, k8); | 984 | initmem_init(0, max_pfn, acpi, k8); |
| 972 | 985 | #ifndef CONFIG_NO_BOOTMEM | |
| 973 | #ifdef CONFIG_X86_64 | 986 | early_res_to_bootmem(0, max_low_pfn<<PAGE_SHIFT); |
| 974 | /* | ||
| 975 | * dma32_reserve_bootmem() allocates bootmem which may conflict | ||
| 976 | * with the crashkernel command line, so do that after | ||
| 977 | * reserve_crashkernel() | ||
| 978 | */ | ||
| 979 | dma32_reserve_bootmem(); | ||
| 980 | #endif | 987 | #endif |
| 981 | 988 | ||
| 982 | reserve_ibft_region(); | 989 | dma32_reserve_bootmem(); |
| 983 | 990 | ||
| 984 | #ifdef CONFIG_KVM_CLOCK | 991 | #ifdef CONFIG_KVM_CLOCK |
| 985 | kvmclock_init(); | 992 | kvmclock_init(); |
