aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorBernhard Walle <bwalle@suse.de>2007-10-19 02:41:00 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-19 14:53:50 -0400
commitcb3808532eeb1719667356157fac9222ccb2c4ff (patch)
treeb86a8de1706db7e4b8968ddb587aa812d8da8084 /arch
parent5c3391f9f749023a49c64d607da4fb49263690eb (diff)
Use extended crashkernel command line on ia64
This patch adapts IA64 to use the generic parse_crashkernel() function instead of its own parsing for the crashkernel command line. Because the total amount of System RAM must be known when calling this function, efi_memmap_init() is modified to return its accumulated total_memory variable. Also, the crashkernel handling is moved in an own function in arch/ia64/kernel/setup.c to make the code more readable. [kamalesh@linux.vnet.ibm.com: build fix] Signed-off-by: Bernhard Walle <bwalle@suse.de> Cc: "Luck, Tony" <tony.luck@intel.com> Cc: Vivek Goyal <vgoyal@in.ibm.com> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/ia64/kernel/efi.c4
-rw-r--r--arch/ia64/kernel/setup.c88
2 files changed, 49 insertions, 43 deletions
diff --git a/arch/ia64/kernel/efi.c b/arch/ia64/kernel/efi.c
index 73ca86d03810..8e4894b205e2 100644
--- a/arch/ia64/kernel/efi.c
+++ b/arch/ia64/kernel/efi.c
@@ -967,7 +967,7 @@ find_memmap_space (void)
967 * to use. We can allocate partial granules only if the unavailable 967 * to use. We can allocate partial granules only if the unavailable
968 * parts exist, and are WB. 968 * parts exist, and are WB.
969 */ 969 */
970void 970unsigned long
971efi_memmap_init(unsigned long *s, unsigned long *e) 971efi_memmap_init(unsigned long *s, unsigned long *e)
972{ 972{
973 struct kern_memdesc *k, *prev = NULL; 973 struct kern_memdesc *k, *prev = NULL;
@@ -1084,6 +1084,8 @@ efi_memmap_init(unsigned long *s, unsigned long *e)
1084 /* reserve the memory we are using for kern_memmap */ 1084 /* reserve the memory we are using for kern_memmap */
1085 *s = (u64)kern_memmap; 1085 *s = (u64)kern_memmap;
1086 *e = (u64)++k; 1086 *e = (u64)++k;
1087
1088 return total_mem;
1087} 1089}
1088 1090
1089void 1091void
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index c5cfcfa4c87c..cbf67f1aa291 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -208,6 +208,48 @@ static int __init register_memory(void)
208 208
209__initcall(register_memory); 209__initcall(register_memory);
210 210
211
212#ifdef CONFIG_KEXEC
213static void __init setup_crashkernel(unsigned long total, int *n)
214{
215 unsigned long long base = 0, size = 0;
216 int ret;
217
218 ret = parse_crashkernel(boot_command_line, total,
219 &size, &base);
220 if (ret == 0 && size > 0) {
221 if (!base) {
222 sort_regions(rsvd_region, *n);
223 base = kdump_find_rsvd_region(size,
224 rsvd_region, *n);
225 }
226 if (base != ~0UL) {
227 printk(KERN_INFO "Reserving %ldMB of memory at %ldMB "
228 "for crashkernel (System RAM: %ldMB)\n",
229 (unsigned long)(size >> 20),
230 (unsigned long)(base >> 20),
231 (unsigned long)(total >> 20));
232 rsvd_region[*n].start =
233 (unsigned long)__va(base);
234 rsvd_region[*n].end =
235 (unsigned long)__va(base + size);
236 (*n)++;
237 crashk_res.start = base;
238 crashk_res.end = base + size - 1;
239 }
240 }
241 efi_memmap_res.start = ia64_boot_param->efi_memmap;
242 efi_memmap_res.end = efi_memmap_res.start +
243 ia64_boot_param->efi_memmap_size;
244 boot_param_res.start = __pa(ia64_boot_param);
245 boot_param_res.end = boot_param_res.start +
246 sizeof(*ia64_boot_param);
247}
248#else
249static inline void __init setup_crashkernel(unsigned long total, int *n)
250{}
251#endif
252
211/** 253/**
212 * reserve_memory - setup reserved memory areas 254 * reserve_memory - setup reserved memory areas
213 * 255 *
@@ -219,6 +261,7 @@ void __init
219reserve_memory (void) 261reserve_memory (void)
220{ 262{
221 int n = 0; 263 int n = 0;
264 unsigned long total_memory;
222 265
223 /* 266 /*
224 * none of the entries in this table overlap 267 * none of the entries in this table overlap
@@ -254,50 +297,11 @@ reserve_memory (void)
254 n++; 297 n++;
255#endif 298#endif
256 299
257 efi_memmap_init(&rsvd_region[n].start, &rsvd_region[n].end); 300 total_memory = efi_memmap_init(&rsvd_region[n].start, &rsvd_region[n].end);
258 n++; 301 n++;
259 302
260#ifdef CONFIG_KEXEC 303 setup_crashkernel(total_memory, &n);
261 /* crashkernel=size@offset specifies the size to reserve for a crash 304
262 * kernel. If offset is 0, then it is determined automatically.
263 * By reserving this memory we guarantee that linux never set's it
264 * up as a DMA target.Useful for holding code to do something
265 * appropriate after a kernel panic.
266 */
267 {
268 char *from = strstr(boot_command_line, "crashkernel=");
269 unsigned long base, size;
270 if (from) {
271 size = memparse(from + 12, &from);
272 if (*from == '@')
273 base = memparse(from+1, &from);
274 else
275 base = 0;
276 if (size) {
277 if (!base) {
278 sort_regions(rsvd_region, n);
279 base = kdump_find_rsvd_region(size,
280 rsvd_region, n);
281 }
282 if (base != ~0UL) {
283 rsvd_region[n].start =
284 (unsigned long)__va(base);
285 rsvd_region[n].end =
286 (unsigned long)__va(base + size);
287 n++;
288 crashk_res.start = base;
289 crashk_res.end = base + size - 1;
290 }
291 }
292 }
293 efi_memmap_res.start = ia64_boot_param->efi_memmap;
294 efi_memmap_res.end = efi_memmap_res.start +
295 ia64_boot_param->efi_memmap_size;
296 boot_param_res.start = __pa(ia64_boot_param);
297 boot_param_res.end = boot_param_res.start +
298 sizeof(*ia64_boot_param);
299 }
300#endif
301 /* end of memory marker */ 305 /* end of memory marker */
302 rsvd_region[n].start = ~0UL; 306 rsvd_region[n].start = ~0UL;
303 rsvd_region[n].end = ~0UL; 307 rsvd_region[n].end = ~0UL;