aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorYinghai Lu <yhlu.kernel@gmail.com>2008-06-25 20:57:13 -0400
committerIngo Molnar <mingo@elte.hu>2008-07-08 07:10:51 -0400
commitccb4defa71744f086822950d8fa64a17c4e6eb04 (patch)
tree3afcc819b85b4b7cdbd153c543b4f60b4db9d488 /arch/x86
parent257b0fde99df0160db03e529dbfb3a4e46c07a88 (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')
-rw-r--r--arch/x86/kernel/setup.c58
-rw-r--r--arch/x86/kernel/setup_percpu.c57
2 files changed, 58 insertions, 57 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
408static 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
420void __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
456void __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
diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c
index 2f807503e030..a3a19ab0edef 100644
--- a/arch/x86/kernel/setup_percpu.c
+++ b/arch/x86/kernel/setup_percpu.c
@@ -387,63 +387,6 @@ EXPORT_SYMBOL(node_to_cpumask);
387 387
388#endif /* X86_64_NUMA */ 388#endif /* X86_64_NUMA */
389 389
390
391/*
392 * --------- Crashkernel reservation ------------------------------
393 */
394
395static inline unsigned long long get_total_mem(void)
396{
397 unsigned long long total;
398
399 total = max_low_pfn - min_low_pfn;
400#ifdef CONFIG_HIGHMEM
401 total += highend_pfn - highstart_pfn;
402#endif
403
404 return total << PAGE_SHIFT;
405}
406
407#ifdef CONFIG_KEXEC
408void __init reserve_crashkernel(void)
409{
410 unsigned long long total_mem;
411 unsigned long long crash_size, crash_base;
412 int ret;
413
414 total_mem = get_total_mem();
415
416 ret = parse_crashkernel(boot_command_line, total_mem,
417 &crash_size, &crash_base);
418 if (ret == 0 && crash_size > 0) {
419 if (crash_base <= 0) {
420 printk(KERN_INFO "crashkernel reservation failed - "
421 "you have to specify a base address\n");
422 return;
423 }
424
425 if (reserve_bootmem_generic(crash_base, crash_size,
426 BOOTMEM_EXCLUSIVE) < 0) {
427 printk(KERN_INFO "crashkernel reservation failed - "
428 "memory is in use\n");
429 return;
430 }
431
432 printk(KERN_INFO "Reserving %ldMB of memory at %ldMB "
433 "for crashkernel (System RAM: %ldMB)\n",
434 (unsigned long)(crash_size >> 20),
435 (unsigned long)(crash_base >> 20),
436 (unsigned long)(total_mem >> 20));
437
438 crashk_res.start = crash_base;
439 crashk_res.end = crash_base + crash_size - 1;
440 insert_resource(&iomem_resource, &crashk_res);
441 }
442}
443#else
444void __init reserve_crashkernel(void)
445{}
446#endif
447static struct resource standard_io_resources[] = { 390static struct resource standard_io_resources[] = {
448 { .name = "dma1", .start = 0x00, .end = 0x1f, 391 { .name = "dma1", .start = 0x00, .end = 0x1f,
449 .flags = IORESOURCE_BUSY | IORESOURCE_IO }, 392 .flags = IORESOURCE_BUSY | IORESOURCE_IO },