diff options
author | Michael Ellerman <michael@ellerman.id.au> | 2005-12-04 02:39:48 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-01-08 22:52:31 -0500 |
commit | dcee30361d25ea83499a99f921f9a56b4a1a79e7 (patch) | |
tree | 3ec01e42ba916047c370925e6d8ede1ae96293bf /arch/powerpc/kernel | |
parent | cc53291521701f9c7c7265bbb3c140563174d8b2 (diff) |
[PATCH] powerpc: Parse crashkernel= parameter in first kernel
This patch adds code to parse and setup the crash kernel resource in the
first kernel. PPC64 ignores the @x part, we always run at 32 MB.
Signed-off-by: Haren Myneni <haren@us.ibm.com>
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel')
-rw-r--r-- | arch/powerpc/kernel/prom.c | 11 | ||||
-rw-r--r-- | arch/powerpc/kernel/prom_init.c | 53 |
2 files changed, 64 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index 9aac77ca3167..fddc9c13bff5 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/initrd.h> | 29 | #include <linux/initrd.h> |
30 | #include <linux/bitops.h> | 30 | #include <linux/bitops.h> |
31 | #include <linux/module.h> | 31 | #include <linux/module.h> |
32 | #include <linux/kexec.h> | ||
32 | 33 | ||
33 | #include <asm/prom.h> | 34 | #include <asm/prom.h> |
34 | #include <asm/rtas.h> | 35 | #include <asm/rtas.h> |
@@ -1198,6 +1199,16 @@ static int __init early_init_dt_scan_chosen(unsigned long node, | |||
1198 | } | 1199 | } |
1199 | #endif /* CONFIG_PPC_RTAS */ | 1200 | #endif /* CONFIG_PPC_RTAS */ |
1200 | 1201 | ||
1202 | #ifdef CONFIG_KEXEC | ||
1203 | lprop = (u64*)of_get_flat_dt_prop(node, "linux,crashkernel-base", NULL); | ||
1204 | if (lprop) | ||
1205 | crashk_res.start = *lprop; | ||
1206 | |||
1207 | lprop = (u64*)of_get_flat_dt_prop(node, "linux,crashkernel-size", NULL); | ||
1208 | if (lprop) | ||
1209 | crashk_res.end = crashk_res.start + *lprop - 1; | ||
1210 | #endif | ||
1211 | |||
1201 | /* break now */ | 1212 | /* break now */ |
1202 | return 1; | 1213 | return 1; |
1203 | } | 1214 | } |
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c index 369e1a6cdd40..2ae860c306d7 100644 --- a/arch/powerpc/kernel/prom_init.c +++ b/arch/powerpc/kernel/prom_init.c | |||
@@ -192,6 +192,11 @@ static unsigned long __initdata alloc_bottom; | |||
192 | static unsigned long __initdata rmo_top; | 192 | static unsigned long __initdata rmo_top; |
193 | static unsigned long __initdata ram_top; | 193 | static unsigned long __initdata ram_top; |
194 | 194 | ||
195 | #ifdef CONFIG_KEXEC | ||
196 | static unsigned long __initdata prom_crashk_base; | ||
197 | static unsigned long __initdata prom_crashk_size; | ||
198 | #endif | ||
199 | |||
195 | static struct mem_map_entry __initdata mem_reserve_map[MEM_RESERVE_MAP_SIZE]; | 200 | static struct mem_map_entry __initdata mem_reserve_map[MEM_RESERVE_MAP_SIZE]; |
196 | static int __initdata mem_reserve_cnt; | 201 | static int __initdata mem_reserve_cnt; |
197 | 202 | ||
@@ -590,6 +595,34 @@ static void __init early_cmdline_parse(void) | |||
590 | RELOC(prom_memory_limit) = ALIGN(RELOC(prom_memory_limit), 0x1000000); | 595 | RELOC(prom_memory_limit) = ALIGN(RELOC(prom_memory_limit), 0x1000000); |
591 | #endif | 596 | #endif |
592 | } | 597 | } |
598 | |||
599 | #ifdef CONFIG_KEXEC | ||
600 | /* | ||
601 | * crashkernel=size@addr specifies the location to reserve for | ||
602 | * crash kernel. | ||
603 | */ | ||
604 | opt = strstr(RELOC(prom_cmd_line), RELOC("crashkernel=")); | ||
605 | if (opt) { | ||
606 | opt += 12; | ||
607 | RELOC(prom_crashk_size) = prom_memparse(opt, &opt); | ||
608 | |||
609 | if (ALIGN(RELOC(prom_crashk_size), 0x1000000) != | ||
610 | RELOC(prom_crashk_size)) { | ||
611 | prom_printf("Warning: crashkernel size is not " | ||
612 | "aligned to 16MB\n"); | ||
613 | } | ||
614 | |||
615 | /* | ||
616 | * At present, the crash kernel always run at 32MB. | ||
617 | * Just ignore whatever user passed. | ||
618 | */ | ||
619 | RELOC(prom_crashk_base) = 0x2000000; | ||
620 | if (*opt == '@') { | ||
621 | prom_printf("Warning: PPC64 kdump kernel always runs " | ||
622 | "at 32 MB\n"); | ||
623 | } | ||
624 | } | ||
625 | #endif | ||
593 | } | 626 | } |
594 | 627 | ||
595 | #ifdef CONFIG_PPC_PSERIES | 628 | #ifdef CONFIG_PPC_PSERIES |
@@ -1011,6 +1044,12 @@ static void __init prom_init_mem(void) | |||
1011 | prom_printf(" alloc_top_hi : %x\n", RELOC(alloc_top_high)); | 1044 | prom_printf(" alloc_top_hi : %x\n", RELOC(alloc_top_high)); |
1012 | prom_printf(" rmo_top : %x\n", RELOC(rmo_top)); | 1045 | prom_printf(" rmo_top : %x\n", RELOC(rmo_top)); |
1013 | prom_printf(" ram_top : %x\n", RELOC(ram_top)); | 1046 | prom_printf(" ram_top : %x\n", RELOC(ram_top)); |
1047 | #ifdef CONFIG_KEXEC | ||
1048 | if (RELOC(prom_crashk_base)) { | ||
1049 | prom_printf(" crashk_base : %x\n", RELOC(prom_crashk_base)); | ||
1050 | prom_printf(" crashk_size : %x\n", RELOC(prom_crashk_size)); | ||
1051 | } | ||
1052 | #endif | ||
1014 | } | 1053 | } |
1015 | 1054 | ||
1016 | 1055 | ||
@@ -2094,6 +2133,10 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4, | |||
2094 | */ | 2133 | */ |
2095 | prom_init_mem(); | 2134 | prom_init_mem(); |
2096 | 2135 | ||
2136 | #ifdef CONFIG_KEXEC | ||
2137 | if (RELOC(prom_crashk_base)) | ||
2138 | reserve_mem(RELOC(prom_crashk_base), RELOC(prom_crashk_size)); | ||
2139 | #endif | ||
2097 | /* | 2140 | /* |
2098 | * Determine which cpu is actually running right _now_ | 2141 | * Determine which cpu is actually running right _now_ |
2099 | */ | 2142 | */ |
@@ -2150,6 +2193,16 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4, | |||
2150 | } | 2193 | } |
2151 | #endif | 2194 | #endif |
2152 | 2195 | ||
2196 | #ifdef CONFIG_KEXEC | ||
2197 | if (RELOC(prom_crashk_base)) { | ||
2198 | prom_setprop(_prom->chosen, "/chosen", "linux,crashkernel-base", | ||
2199 | PTRRELOC(&prom_crashk_base), | ||
2200 | sizeof(RELOC(prom_crashk_base))); | ||
2201 | prom_setprop(_prom->chosen, "/chosen", "linux,crashkernel-size", | ||
2202 | PTRRELOC(&prom_crashk_size), | ||
2203 | sizeof(RELOC(prom_crashk_size))); | ||
2204 | } | ||
2205 | #endif | ||
2153 | /* | 2206 | /* |
2154 | * Fixup any known bugs in the device-tree | 2207 | * Fixup any known bugs in the device-tree |
2155 | */ | 2208 | */ |