diff options
author | Yinghai Lu <yhlu.kernel@gmail.com> | 2008-06-30 19:20:54 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-07-08 07:16:14 -0400 |
commit | 28bb22379513ca3cac9d13766064a219c5fc21a9 (patch) | |
tree | e9b870bf99adbbb58e13c454a78366ff83292982 /arch/x86/kernel/setup.c | |
parent | 102d0a4b56d94e9b7eedfdfb488400271235543f (diff) |
x86: move reserve_setup_data to setup.c
Ying Huang would like setup_data to be reserved, but not included in the
no save range.
Here we try to modify the e820 table to reserve that range early.
also add that in early_res in case bootloader messes up with the ramdisk.
other solution would be
1. add early_res_to_highmem...
2. early_res_to_e820...
but they could reserve another type memory wrongly, if early_res has some
resource reserved early, and not needed later, but it is not removed from
early_res in time. Like the RAMDISK (already handled).
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Cc: andi@firstfloor.org
Tested-by: Huang, Ying <ying.huang@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/setup.c')
-rw-r--r-- | arch/x86/kernel/setup.c | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index caec79fb83a3..2ca12d4c88fb 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c | |||
@@ -389,14 +389,34 @@ static void __init parse_setup_data(void) | |||
389 | default: | 389 | default: |
390 | break; | 390 | break; |
391 | } | 391 | } |
392 | #ifndef CONFIG_DEBUG_BOOT_PARAMS | ||
393 | free_early(pa_data, pa_data+sizeof(*data)+data->len); | ||
394 | #endif | ||
395 | pa_data = data->next; | 392 | pa_data = data->next; |
396 | early_iounmap(data, PAGE_SIZE); | 393 | early_iounmap(data, PAGE_SIZE); |
397 | } | 394 | } |
398 | } | 395 | } |
399 | 396 | ||
397 | static void __init reserve_setup_data(void) | ||
398 | { | ||
399 | struct setup_data *data; | ||
400 | u64 pa_data; | ||
401 | char buf[32]; | ||
402 | |||
403 | if (boot_params.hdr.version < 0x0209) | ||
404 | return; | ||
405 | pa_data = boot_params.hdr.setup_data; | ||
406 | while (pa_data) { | ||
407 | data = early_ioremap(pa_data, sizeof(*data)); | ||
408 | sprintf(buf, "setup data %x", data->type); | ||
409 | reserve_early(pa_data, pa_data+sizeof(*data)+data->len, buf); | ||
410 | e820_update_range(pa_data, sizeof(*data)+data->len, | ||
411 | E820_RAM, E820_RESERVED_KERN); | ||
412 | pa_data = data->next; | ||
413 | early_iounmap(data, sizeof(*data)); | ||
414 | } | ||
415 | sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map); | ||
416 | printk(KERN_INFO "extended physical RAM map:\n"); | ||
417 | e820_print_map("reserve setup_data"); | ||
418 | } | ||
419 | |||
400 | /* | 420 | /* |
401 | * --------- Crashkernel reservation ------------------------------ | 421 | * --------- Crashkernel reservation ------------------------------ |
402 | */ | 422 | */ |
@@ -523,7 +543,6 @@ void __init setup_arch(char **cmdline_p) | |||
523 | memcpy(&boot_cpu_data, &new_cpu_data, sizeof(new_cpu_data)); | 543 | memcpy(&boot_cpu_data, &new_cpu_data, sizeof(new_cpu_data)); |
524 | pre_setup_arch_hook(); | 544 | pre_setup_arch_hook(); |
525 | early_cpu_init(); | 545 | early_cpu_init(); |
526 | reserve_setup_data(); | ||
527 | #else | 546 | #else |
528 | printk(KERN_INFO "Command line: %s\n", boot_command_line); | 547 | printk(KERN_INFO "Command line: %s\n", boot_command_line); |
529 | #endif | 548 | #endif |
@@ -567,6 +586,8 @@ void __init setup_arch(char **cmdline_p) | |||
567 | ARCH_SETUP | 586 | ARCH_SETUP |
568 | 587 | ||
569 | setup_memory_map(); | 588 | setup_memory_map(); |
589 | parse_setup_data(); | ||
590 | |||
570 | copy_edd(); | 591 | copy_edd(); |
571 | 592 | ||
572 | if (!boot_params.hdr.root_flags) | 593 | if (!boot_params.hdr.root_flags) |
@@ -593,10 +614,11 @@ void __init setup_arch(char **cmdline_p) | |||
593 | strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE); | 614 | strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE); |
594 | *cmdline_p = command_line; | 615 | *cmdline_p = command_line; |
595 | 616 | ||
596 | parse_setup_data(); | ||
597 | |||
598 | parse_early_param(); | 617 | parse_early_param(); |
599 | 618 | ||
619 | /* after early param, so could get panic from serial */ | ||
620 | reserve_setup_data(); | ||
621 | |||
600 | if (acpi_mps_check()) { | 622 | if (acpi_mps_check()) { |
601 | #ifdef CONFIG_X86_LOCAL_APIC | 623 | #ifdef CONFIG_X86_LOCAL_APIC |
602 | disable_apic = 1; | 624 | disable_apic = 1; |