Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 201417
b: refs/heads/master
c: 3c57fb4
h: refs/heads/master
i:
  201415: 824529c
v: v3
  • Loading branch information
Mika Westerberg authored and Russell King committed Jul 9, 2010
1 parent d8dc87c commit 81a51d8
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f159f4ed55bb0fa5470800641e03a13a7e0eae6e
refs/heads/master: 3c57fb43c8fcbe46541d3a0274f0b4c802c68927
51 changes: 51 additions & 0 deletions trunk/arch/arm/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <linux/seq_file.h>
#include <linux/screen_info.h>
#include <linux/init.h>
#include <linux/kexec.h>
#include <linux/root_dev.h>
#include <linux/cpu.h>
#include <linux/interrupt.h>
Expand Down Expand Up @@ -680,6 +681,55 @@ static int __init customize_machine(void)
}
arch_initcall(customize_machine);

#ifdef CONFIG_KEXEC
static inline unsigned long long get_total_mem(void)
{
unsigned long total;

total = max_low_pfn - min_low_pfn;
return total << PAGE_SHIFT;
}

/**
* reserve_crashkernel() - reserves memory are for crash kernel
*
* This function reserves memory area given in "crashkernel=" kernel command
* line parameter. The memory reserved is used by a dump capture kernel when
* primary kernel is crashing.
*/
static void __init reserve_crashkernel(void)
{
unsigned long long crash_size, crash_base;
unsigned long long total_mem;
int ret;

total_mem = get_total_mem();
ret = parse_crashkernel(boot_command_line, total_mem,
&crash_size, &crash_base);
if (ret)
return;

ret = reserve_bootmem(crash_base, crash_size, BOOTMEM_EXCLUSIVE);
if (ret < 0) {
printk(KERN_WARNING "crashkernel reservation failed - "
"memory is in use (0x%lx)\n", (unsigned long)crash_base);
return;
}

printk(KERN_INFO "Reserving %ldMB of memory at %ldMB "
"for crashkernel (System RAM: %ldMB)\n",
(unsigned long)(crash_size >> 20),
(unsigned long)(crash_base >> 20),
(unsigned long)(total_mem >> 20));

crashk_res.start = crash_base;
crashk_res.end = crash_base + crash_size - 1;
insert_resource(&iomem_resource, &crashk_res);
}
#else
static inline void reserve_crashkernel(void) {}
#endif /* CONFIG_KEXEC */

void __init setup_arch(char **cmdline_p)
{
struct tag *tags = (struct tag *)&init_tags;
Expand Down Expand Up @@ -739,6 +789,7 @@ void __init setup_arch(char **cmdline_p)
#ifdef CONFIG_SMP
smp_init_cpus();
#endif
reserve_crashkernel();

cpu_init();
tcm_init();
Expand Down

0 comments on commit 81a51d8

Please sign in to comment.