diff options
author | Yinghai Lu <yhlu.kernel@gmail.com> | 2008-06-23 06:05:30 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-07-08 06:50:20 -0400 |
commit | 2ec65f8b89ea003c27ff7723525a2ee335a2b393 (patch) | |
tree | 9b8718be2017f619b2a0185492315b85ea1731fa /arch/x86/kernel/setup_32.c | |
parent | bef1568d9714f1162086c32583ba7984a7ca8e3e (diff) |
x86: clean up using max_low_pfn on 32-bit
so that max_low_pfn is not changed after it is set.
so we can move that early and out of initmem_init.
could call find_low_pfn_range just after max_pfn is set.
also could move reserve_initrd out of setup_bootmem_allocator
so 32bit is more like 64bit.
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/setup_32.c')
-rw-r--r-- | arch/x86/kernel/setup_32.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/arch/x86/kernel/setup_32.c b/arch/x86/kernel/setup_32.c index 9a08490a3889..b42f570a5a56 100644 --- a/arch/x86/kernel/setup_32.c +++ b/arch/x86/kernel/setup_32.c | |||
@@ -188,13 +188,14 @@ static inline void copy_edd(void) | |||
188 | 188 | ||
189 | static bool do_relocate_initrd = false; | 189 | static bool do_relocate_initrd = false; |
190 | 190 | ||
191 | void __init reserve_initrd(void) | 191 | static void __init reserve_initrd(void) |
192 | { | 192 | { |
193 | u64 ramdisk_image = boot_params.hdr.ramdisk_image; | 193 | u64 ramdisk_image = boot_params.hdr.ramdisk_image; |
194 | u64 ramdisk_size = boot_params.hdr.ramdisk_size; | 194 | u64 ramdisk_size = boot_params.hdr.ramdisk_size; |
195 | u64 ramdisk_end = ramdisk_image + ramdisk_size; | 195 | u64 ramdisk_end = ramdisk_image + ramdisk_size; |
196 | u64 end_of_lowmem = max_low_pfn << PAGE_SHIFT; | 196 | u64 end_of_lowmem = max_low_pfn << PAGE_SHIFT; |
197 | u64 ramdisk_here; | 197 | u64 ramdisk_here; |
198 | u64 ramdisk_target; | ||
198 | 199 | ||
199 | if (!boot_params.hdr.type_of_loader || | 200 | if (!boot_params.hdr.type_of_loader || |
200 | !ramdisk_image || !ramdisk_size) | 201 | !ramdisk_image || !ramdisk_size) |
@@ -202,7 +203,7 @@ void __init reserve_initrd(void) | |||
202 | 203 | ||
203 | initrd_start = 0; | 204 | initrd_start = 0; |
204 | 205 | ||
205 | if (ramdisk_size >= end_of_lowmem/2) { | 206 | if (ramdisk_size >= (end_of_lowmem>>1)) { |
206 | free_early(ramdisk_image, ramdisk_end); | 207 | free_early(ramdisk_image, ramdisk_end); |
207 | printk(KERN_ERR "initrd too large to handle, " | 208 | printk(KERN_ERR "initrd too large to handle, " |
208 | "disabling initrd\n"); | 209 | "disabling initrd\n"); |
@@ -225,7 +226,8 @@ void __init reserve_initrd(void) | |||
225 | } | 226 | } |
226 | 227 | ||
227 | /* We need to move the initrd down into lowmem */ | 228 | /* We need to move the initrd down into lowmem */ |
228 | ramdisk_here = find_e820_area(min_low_pfn<<PAGE_SHIFT, | 229 | ramdisk_target = max_pfn_mapped<<PAGE_SHIFT; |
230 | ramdisk_here = find_e820_area(min(ramdisk_target, end_of_lowmem>>1), | ||
229 | end_of_lowmem, ramdisk_size, | 231 | end_of_lowmem, ramdisk_size, |
230 | PAGE_SIZE); | 232 | PAGE_SIZE); |
231 | 233 | ||
@@ -346,8 +348,6 @@ static void set_mca_bus(int x) { } | |||
346 | */ | 348 | */ |
347 | void __init setup_arch(char **cmdline_p) | 349 | void __init setup_arch(char **cmdline_p) |
348 | { | 350 | { |
349 | unsigned long max_low_pfn; | ||
350 | |||
351 | memcpy(&boot_cpu_data, &new_cpu_data, sizeof(new_cpu_data)); | 351 | memcpy(&boot_cpu_data, &new_cpu_data, sizeof(new_cpu_data)); |
352 | pre_setup_arch_hook(); | 352 | pre_setup_arch_hook(); |
353 | early_cpu_init(); | 353 | early_cpu_init(); |
@@ -450,6 +450,10 @@ void __init setup_arch(char **cmdline_p) | |||
450 | max_pfn = e820_end_of_ram(); | 450 | max_pfn = e820_end_of_ram(); |
451 | } | 451 | } |
452 | 452 | ||
453 | find_low_pfn_range(); | ||
454 | |||
455 | reserve_initrd(); | ||
456 | |||
453 | dmi_scan_machine(); | 457 | dmi_scan_machine(); |
454 | 458 | ||
455 | io_delay_init(); | 459 | io_delay_init(); |
@@ -466,7 +470,7 @@ void __init setup_arch(char **cmdline_p) | |||
466 | acpi_numa_init(); | 470 | acpi_numa_init(); |
467 | #endif | 471 | #endif |
468 | 472 | ||
469 | max_low_pfn = initmem_init(0, max_pfn); | 473 | initmem_init(0, max_pfn); |
470 | 474 | ||
471 | #ifdef CONFIG_ACPI_SLEEP | 475 | #ifdef CONFIG_ACPI_SLEEP |
472 | /* | 476 | /* |