diff options
author | Michael Ellerman <michael@ellerman.id.au> | 2006-05-17 21:16:11 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-05-19 01:02:18 -0400 |
commit | 35dd54326e857f1648c7cc1028e8d5e1dbe04992 (patch) | |
tree | dea05effa25bc751d1b777a0b80f0f46d3ff0b8e /arch/powerpc/kernel/machine_kexec_64.c | |
parent | 473104134b35ce1c3ca77b738c561d6c215adc1b (diff) |
[PATCH] powerpc: Move crashkernel= handling into the kernel.
This was missing a quilt ref.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel/machine_kexec_64.c')
-rw-r--r-- | arch/powerpc/kernel/machine_kexec_64.c | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c index 1ccb188ba40d..a8fa04ef27cd 100644 --- a/arch/powerpc/kernel/machine_kexec_64.c +++ b/arch/powerpc/kernel/machine_kexec_64.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <asm/machdep.h> | 21 | #include <asm/machdep.h> |
22 | #include <asm/cacheflush.h> | 22 | #include <asm/cacheflush.h> |
23 | #include <asm/paca.h> | 23 | #include <asm/paca.h> |
24 | #include <asm/lmb.h> | ||
24 | #include <asm/mmu.h> | 25 | #include <asm/mmu.h> |
25 | #include <asm/sections.h> /* _end */ | 26 | #include <asm/sections.h> /* _end */ |
26 | #include <asm/prom.h> | 27 | #include <asm/prom.h> |
@@ -335,9 +336,102 @@ static void __init export_htab_values(void) | |||
335 | of_node_put(node); | 336 | of_node_put(node); |
336 | } | 337 | } |
337 | 338 | ||
339 | static struct property crashk_base_prop = { | ||
340 | .name = "linux,crashkernel-base", | ||
341 | .length = sizeof(unsigned long), | ||
342 | .value = (unsigned char *)&crashk_res.start, | ||
343 | }; | ||
344 | |||
345 | static unsigned long crashk_size; | ||
346 | |||
347 | static struct property crashk_size_prop = { | ||
348 | .name = "linux,crashkernel-size", | ||
349 | .length = sizeof(unsigned long), | ||
350 | .value = (unsigned char *)&crashk_size, | ||
351 | }; | ||
352 | |||
353 | static void __init export_crashk_values(void) | ||
354 | { | ||
355 | struct device_node *node; | ||
356 | struct property *prop; | ||
357 | |||
358 | node = of_find_node_by_path("/chosen"); | ||
359 | if (!node) | ||
360 | return; | ||
361 | |||
362 | /* There might be existing crash kernel properties, but we can't | ||
363 | * be sure what's in them, so remove them. */ | ||
364 | prop = of_find_property(node, "linux,crashkernel-base", NULL); | ||
365 | if (prop) | ||
366 | prom_remove_property(node, prop); | ||
367 | |||
368 | prop = of_find_property(node, "linux,crashkernel-size", NULL); | ||
369 | if (prop) | ||
370 | prom_remove_property(node, prop); | ||
371 | |||
372 | if (crashk_res.start != 0) { | ||
373 | prom_add_property(node, &crashk_base_prop); | ||
374 | crashk_size = crashk_res.end - crashk_res.start + 1; | ||
375 | prom_add_property(node, &crashk_size_prop); | ||
376 | } | ||
377 | |||
378 | of_node_put(node); | ||
379 | } | ||
380 | |||
338 | void __init kexec_setup(void) | 381 | void __init kexec_setup(void) |
339 | { | 382 | { |
340 | export_htab_values(); | 383 | export_htab_values(); |
384 | export_crashk_values(); | ||
385 | } | ||
386 | |||
387 | static int __init early_parse_crashk(char *p) | ||
388 | { | ||
389 | unsigned long size; | ||
390 | |||
391 | if (!p) | ||
392 | return 1; | ||
393 | |||
394 | size = memparse(p, &p); | ||
395 | |||
396 | if (*p == '@') | ||
397 | crashk_res.start = memparse(p + 1, &p); | ||
398 | else | ||
399 | crashk_res.start = KDUMP_KERNELBASE; | ||
400 | |||
401 | crashk_res.end = crashk_res.start + size - 1; | ||
402 | |||
403 | return 0; | ||
404 | } | ||
405 | early_param("crashkernel", early_parse_crashk); | ||
406 | |||
407 | void __init reserve_crashkernel(void) | ||
408 | { | ||
409 | unsigned long size; | ||
410 | |||
411 | if (crashk_res.start == 0) | ||
412 | return; | ||
413 | |||
414 | /* We might have got these values via the command line or the | ||
415 | * device tree, either way sanitise them now. */ | ||
416 | |||
417 | size = crashk_res.end - crashk_res.start + 1; | ||
418 | |||
419 | if (crashk_res.start != KDUMP_KERNELBASE) | ||
420 | printk("Crash kernel location must be 0x%x\n", | ||
421 | KDUMP_KERNELBASE); | ||
422 | |||
423 | crashk_res.start = KDUMP_KERNELBASE; | ||
424 | size = PAGE_ALIGN(size); | ||
425 | crashk_res.end = crashk_res.start + size - 1; | ||
426 | |||
427 | /* Crash kernel trumps memory limit */ | ||
428 | if (memory_limit && memory_limit <= crashk_res.end) { | ||
429 | memory_limit = crashk_res.end + 1; | ||
430 | printk("Adjusted memory limit for crashkernel, now 0x%lx\n", | ||
431 | memory_limit); | ||
432 | } | ||
433 | |||
434 | lmb_reserve(crashk_res.start, size); | ||
341 | } | 435 | } |
342 | 436 | ||
343 | int overlaps_crashkernel(unsigned long start, unsigned long size) | 437 | int overlaps_crashkernel(unsigned long start, unsigned long size) |