diff options
author | Yinghai Lu <yhlu.kernel@gmail.com> | 2008-06-25 20:57:13 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-07-08 07:10:51 -0400 |
commit | ccb4defa71744f086822950d8fa64a17c4e6eb04 (patch) | |
tree | 3afcc819b85b4b7cdbd153c543b4f60b4db9d488 /arch/x86/kernel/setup.c | |
parent | 257b0fde99df0160db03e529dbfb3a4e46c07a88 (diff) |
x86: move back crashkernel back to setup.c
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.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 | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 4b00c8347bb7..75d35401a8c7 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c | |||
@@ -401,6 +401,64 @@ void __init parse_setup_data(void) | |||
401 | } | 401 | } |
402 | 402 | ||
403 | /* | 403 | /* |
404 | * --------- Crashkernel reservation ------------------------------ | ||
405 | */ | ||
406 | |||
407 | #ifdef CONFIG_KEXEC | ||
408 | static inline unsigned long long get_total_mem(void) | ||
409 | { | ||
410 | unsigned long long total; | ||
411 | |||
412 | total = max_low_pfn - min_low_pfn; | ||
413 | #ifdef CONFIG_HIGHMEM | ||
414 | total += highend_pfn - highstart_pfn; | ||
415 | #endif | ||
416 | |||
417 | return total << PAGE_SHIFT; | ||
418 | } | ||
419 | |||
420 | void __init reserve_crashkernel(void) | ||
421 | { | ||
422 | unsigned long long total_mem; | ||
423 | unsigned long long crash_size, crash_base; | ||
424 | int ret; | ||
425 | |||
426 | total_mem = get_total_mem(); | ||
427 | |||
428 | ret = parse_crashkernel(boot_command_line, total_mem, | ||
429 | &crash_size, &crash_base); | ||
430 | if (ret == 0 && crash_size > 0) { | ||
431 | if (crash_base <= 0) { | ||
432 | printk(KERN_INFO "crashkernel reservation failed - " | ||
433 | "you have to specify a base address\n"); | ||
434 | return; | ||
435 | } | ||
436 | |||
437 | if (reserve_bootmem_generic(crash_base, crash_size, | ||
438 | BOOTMEM_EXCLUSIVE) < 0) { | ||
439 | printk(KERN_INFO "crashkernel reservation failed - " | ||
440 | "memory is in use\n"); | ||
441 | return; | ||
442 | } | ||
443 | |||
444 | printk(KERN_INFO "Reserving %ldMB of memory at %ldMB " | ||
445 | "for crashkernel (System RAM: %ldMB)\n", | ||
446 | (unsigned long)(crash_size >> 20), | ||
447 | (unsigned long)(crash_base >> 20), | ||
448 | (unsigned long)(total_mem >> 20)); | ||
449 | |||
450 | crashk_res.start = crash_base; | ||
451 | crashk_res.end = crash_base + crash_size - 1; | ||
452 | insert_resource(&iomem_resource, &crashk_res); | ||
453 | } | ||
454 | } | ||
455 | #else | ||
456 | void __init reserve_crashkernel(void) | ||
457 | { | ||
458 | } | ||
459 | #endif | ||
460 | |||
461 | /* | ||
404 | * Determine if we were loaded by an EFI loader. If so, then we have also been | 462 | * Determine if we were loaded by an EFI loader. If so, then we have also been |
405 | * passed the efi memmap, systab, etc., so we should use these data structures | 463 | * passed the efi memmap, systab, etc., so we should use these data structures |
406 | * for initialization. Note, the efi init code path is determined by the | 464 | * for initialization. Note, the efi init code path is determined by the |