[PATCH] powerpc: Merge kexec
This patch merges, to some extent, the PPC32 and PPC64 kexec implementations.
We adopt the PPC32 approach of having ppc_md callbacks for the kexec functions.
The current PPC64 implementation becomes the "default" implementation for PPC64
which platforms can select if they need no special treatment.
I've added these default callbacks to pseries/maple/cell/powermac, this means
iSeries no longer supports kexec - but it never worked anyway.
I've renamed PPC32's machine_kexec_simple to default_machine_kexec, inline with
PPC64. Judging by the comments it might be better named machine_kexec_non_of,
or something, but at the moment it's the only implementation for PPC32 so it's
the "default".
Kexec requires machine_shutdown(), which is in machine_kexec.c on PPC32, but we
already have in setup-common.c on powerpc. All this does is call
ppc_md.nvram_sync, which only powermac implements, so instead make
machine_shutdown a ppc_md member and have it call core99_nvram_sync directly
on powermac.
I've also stuck relocate_kernel.S into misc_32.S for powerpc.
Built for ARCH=ppc, and 32 & 64 bit ARCH=powerpc, with KEXEC=y/n. Booted on
P5 LPAR and successfully kexec'ed.
Should apply on top of 493f25ef4087395891c99fcfe2c72e62e293e89f.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2005-11-14 12:35:00 +00:00
|
|
|
/*
|
|
|
|
* Code to handle transition of Linux booting another kernel.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2002-2003 Eric Biederman <ebiederm@xmission.com>
|
|
|
|
* GameCube/ppc32 port Copyright (C) 2004 Albert Herranz
|
|
|
|
* Copyright (C) 2005 IBM Corporation.
|
|
|
|
*
|
|
|
|
* This source code is licensed under the GNU General Public License,
|
|
|
|
* Version 2. See the file COPYING for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/kexec.h>
|
|
|
|
#include <linux/reboot.h>
|
|
|
|
#include <linux/threads.h>
|
2010-07-12 04:36:09 +00:00
|
|
|
#include <linux/memblock.h>
|
2008-12-16 06:22:59 +00:00
|
|
|
#include <linux/of.h>
|
2010-09-16 22:58:23 +00:00
|
|
|
#include <linux/irq.h>
|
2011-01-06 18:00:36 +00:00
|
|
|
#include <linux/ftrace.h>
|
2010-09-16 22:58:23 +00:00
|
|
|
|
[PATCH] powerpc: Merge kexec
This patch merges, to some extent, the PPC32 and PPC64 kexec implementations.
We adopt the PPC32 approach of having ppc_md callbacks for the kexec functions.
The current PPC64 implementation becomes the "default" implementation for PPC64
which platforms can select if they need no special treatment.
I've added these default callbacks to pseries/maple/cell/powermac, this means
iSeries no longer supports kexec - but it never worked anyway.
I've renamed PPC32's machine_kexec_simple to default_machine_kexec, inline with
PPC64. Judging by the comments it might be better named machine_kexec_non_of,
or something, but at the moment it's the only implementation for PPC32 so it's
the "default".
Kexec requires machine_shutdown(), which is in machine_kexec.c on PPC32, but we
already have in setup-common.c on powerpc. All this does is call
ppc_md.nvram_sync, which only powermac implements, so instead make
machine_shutdown a ppc_md member and have it call core99_nvram_sync directly
on powermac.
I've also stuck relocate_kernel.S into misc_32.S for powerpc.
Built for ARCH=ppc, and 32 & 64 bit ARCH=powerpc, with KEXEC=y/n. Booted on
P5 LPAR and successfully kexec'ed.
Should apply on top of 493f25ef4087395891c99fcfe2c72e62e293e89f.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2005-11-14 12:35:00 +00:00
|
|
|
#include <asm/machdep.h>
|
2008-02-14 00:56:49 +00:00
|
|
|
#include <asm/prom.h>
|
2008-12-16 06:22:59 +00:00
|
|
|
#include <asm/sections.h>
|
[PATCH] powerpc: Merge kexec
This patch merges, to some extent, the PPC32 and PPC64 kexec implementations.
We adopt the PPC32 approach of having ppc_md callbacks for the kexec functions.
The current PPC64 implementation becomes the "default" implementation for PPC64
which platforms can select if they need no special treatment.
I've added these default callbacks to pseries/maple/cell/powermac, this means
iSeries no longer supports kexec - but it never worked anyway.
I've renamed PPC32's machine_kexec_simple to default_machine_kexec, inline with
PPC64. Judging by the comments it might be better named machine_kexec_non_of,
or something, but at the moment it's the only implementation for PPC32 so it's
the "default".
Kexec requires machine_shutdown(), which is in machine_kexec.c on PPC32, but we
already have in setup-common.c on powerpc. All this does is call
ppc_md.nvram_sync, which only powermac implements, so instead make
machine_shutdown a ppc_md member and have it call core99_nvram_sync directly
on powermac.
I've also stuck relocate_kernel.S into misc_32.S for powerpc.
Built for ARCH=ppc, and 32 & 64 bit ARCH=powerpc, with KEXEC=y/n. Booted on
P5 LPAR and successfully kexec'ed.
Should apply on top of 493f25ef4087395891c99fcfe2c72e62e293e89f.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2005-11-14 12:35:00 +00:00
|
|
|
|
2010-09-16 22:58:23 +00:00
|
|
|
void machine_kexec_mask_interrupts(void) {
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
for_each_irq(i) {
|
|
|
|
struct irq_desc *desc = irq_to_desc(i);
|
2011-03-07 14:00:20 +00:00
|
|
|
struct irq_chip *chip;
|
2010-09-16 22:58:23 +00:00
|
|
|
|
2011-03-07 14:00:20 +00:00
|
|
|
if (!desc)
|
2010-09-16 22:58:23 +00:00
|
|
|
continue;
|
|
|
|
|
2011-03-25 15:45:20 +00:00
|
|
|
chip = irq_desc_get_chip(desc);
|
2011-03-07 14:00:20 +00:00
|
|
|
if (!chip)
|
|
|
|
continue;
|
|
|
|
|
2011-03-25 14:43:57 +00:00
|
|
|
if (chip->irq_eoi && irqd_irq_inprogress(&desc->irq_data))
|
2011-03-07 14:00:20 +00:00
|
|
|
chip->irq_eoi(&desc->irq_data);
|
2010-09-16 22:58:23 +00:00
|
|
|
|
2011-03-07 14:00:20 +00:00
|
|
|
if (chip->irq_mask)
|
|
|
|
chip->irq_mask(&desc->irq_data);
|
2010-09-16 22:58:23 +00:00
|
|
|
|
2011-03-25 14:43:57 +00:00
|
|
|
if (chip->irq_disable && !irqd_irq_disabled(&desc->irq_data))
|
2011-03-07 14:00:20 +00:00
|
|
|
chip->irq_disable(&desc->irq_data);
|
2010-09-16 22:58:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
[PATCH] powerpc: Merge kexec
This patch merges, to some extent, the PPC32 and PPC64 kexec implementations.
We adopt the PPC32 approach of having ppc_md callbacks for the kexec functions.
The current PPC64 implementation becomes the "default" implementation for PPC64
which platforms can select if they need no special treatment.
I've added these default callbacks to pseries/maple/cell/powermac, this means
iSeries no longer supports kexec - but it never worked anyway.
I've renamed PPC32's machine_kexec_simple to default_machine_kexec, inline with
PPC64. Judging by the comments it might be better named machine_kexec_non_of,
or something, but at the moment it's the only implementation for PPC32 so it's
the "default".
Kexec requires machine_shutdown(), which is in machine_kexec.c on PPC32, but we
already have in setup-common.c on powerpc. All this does is call
ppc_md.nvram_sync, which only powermac implements, so instead make
machine_shutdown a ppc_md member and have it call core99_nvram_sync directly
on powermac.
I've also stuck relocate_kernel.S into misc_32.S for powerpc.
Built for ARCH=ppc, and 32 & 64 bit ARCH=powerpc, with KEXEC=y/n. Booted on
P5 LPAR and successfully kexec'ed.
Should apply on top of 493f25ef4087395891c99fcfe2c72e62e293e89f.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2005-11-14 12:35:00 +00:00
|
|
|
void machine_crash_shutdown(struct pt_regs *regs)
|
|
|
|
{
|
2011-01-06 17:56:09 +00:00
|
|
|
default_machine_crash_shutdown(regs);
|
[PATCH] powerpc: Merge kexec
This patch merges, to some extent, the PPC32 and PPC64 kexec implementations.
We adopt the PPC32 approach of having ppc_md callbacks for the kexec functions.
The current PPC64 implementation becomes the "default" implementation for PPC64
which platforms can select if they need no special treatment.
I've added these default callbacks to pseries/maple/cell/powermac, this means
iSeries no longer supports kexec - but it never worked anyway.
I've renamed PPC32's machine_kexec_simple to default_machine_kexec, inline with
PPC64. Judging by the comments it might be better named machine_kexec_non_of,
or something, but at the moment it's the only implementation for PPC32 so it's
the "default".
Kexec requires machine_shutdown(), which is in machine_kexec.c on PPC32, but we
already have in setup-common.c on powerpc. All this does is call
ppc_md.nvram_sync, which only powermac implements, so instead make
machine_shutdown a ppc_md member and have it call core99_nvram_sync directly
on powermac.
I've also stuck relocate_kernel.S into misc_32.S for powerpc.
Built for ARCH=ppc, and 32 & 64 bit ARCH=powerpc, with KEXEC=y/n. Booted on
P5 LPAR and successfully kexec'ed.
Should apply on top of 493f25ef4087395891c99fcfe2c72e62e293e89f.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2005-11-14 12:35:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Do what every setup is needed on image and the
|
|
|
|
* reboot code buffer to allow us to avoid allocations
|
|
|
|
* later.
|
|
|
|
*/
|
|
|
|
int machine_kexec_prepare(struct kimage *image)
|
|
|
|
{
|
|
|
|
if (ppc_md.machine_kexec_prepare)
|
|
|
|
return ppc_md.machine_kexec_prepare(image);
|
2008-12-16 06:23:05 +00:00
|
|
|
else
|
|
|
|
return default_machine_kexec_prepare(image);
|
[PATCH] powerpc: Merge kexec
This patch merges, to some extent, the PPC32 and PPC64 kexec implementations.
We adopt the PPC32 approach of having ppc_md callbacks for the kexec functions.
The current PPC64 implementation becomes the "default" implementation for PPC64
which platforms can select if they need no special treatment.
I've added these default callbacks to pseries/maple/cell/powermac, this means
iSeries no longer supports kexec - but it never worked anyway.
I've renamed PPC32's machine_kexec_simple to default_machine_kexec, inline with
PPC64. Judging by the comments it might be better named machine_kexec_non_of,
or something, but at the moment it's the only implementation for PPC32 so it's
the "default".
Kexec requires machine_shutdown(), which is in machine_kexec.c on PPC32, but we
already have in setup-common.c on powerpc. All this does is call
ppc_md.nvram_sync, which only powermac implements, so instead make
machine_shutdown a ppc_md member and have it call core99_nvram_sync directly
on powermac.
I've also stuck relocate_kernel.S into misc_32.S for powerpc.
Built for ARCH=ppc, and 32 & 64 bit ARCH=powerpc, with KEXEC=y/n. Booted on
P5 LPAR and successfully kexec'ed.
Should apply on top of 493f25ef4087395891c99fcfe2c72e62e293e89f.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2005-11-14 12:35:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void machine_kexec_cleanup(struct kimage *image)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-07-13 03:46:09 +00:00
|
|
|
void arch_crash_save_vmcoreinfo(void)
|
|
|
|
{
|
|
|
|
|
|
|
|
#ifdef CONFIG_NEED_MULTIPLE_NODES
|
|
|
|
VMCOREINFO_SYMBOL(node_data);
|
|
|
|
VMCOREINFO_LENGTH(node_data, MAX_NUMNODES);
|
|
|
|
#endif
|
|
|
|
#ifndef CONFIG_NEED_MULTIPLE_NODES
|
|
|
|
VMCOREINFO_SYMBOL(contig_page_data);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
[PATCH] powerpc: Merge kexec
This patch merges, to some extent, the PPC32 and PPC64 kexec implementations.
We adopt the PPC32 approach of having ppc_md callbacks for the kexec functions.
The current PPC64 implementation becomes the "default" implementation for PPC64
which platforms can select if they need no special treatment.
I've added these default callbacks to pseries/maple/cell/powermac, this means
iSeries no longer supports kexec - but it never worked anyway.
I've renamed PPC32's machine_kexec_simple to default_machine_kexec, inline with
PPC64. Judging by the comments it might be better named machine_kexec_non_of,
or something, but at the moment it's the only implementation for PPC32 so it's
the "default".
Kexec requires machine_shutdown(), which is in machine_kexec.c on PPC32, but we
already have in setup-common.c on powerpc. All this does is call
ppc_md.nvram_sync, which only powermac implements, so instead make
machine_shutdown a ppc_md member and have it call core99_nvram_sync directly
on powermac.
I've also stuck relocate_kernel.S into misc_32.S for powerpc.
Built for ARCH=ppc, and 32 & 64 bit ARCH=powerpc, with KEXEC=y/n. Booted on
P5 LPAR and successfully kexec'ed.
Should apply on top of 493f25ef4087395891c99fcfe2c72e62e293e89f.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2005-11-14 12:35:00 +00:00
|
|
|
/*
|
|
|
|
* Do not allocate memory (or fail in any way) in machine_kexec().
|
|
|
|
* We are past the point of no return, committed to rebooting now.
|
|
|
|
*/
|
2008-07-26 02:45:07 +00:00
|
|
|
void machine_kexec(struct kimage *image)
|
[PATCH] powerpc: Merge kexec
This patch merges, to some extent, the PPC32 and PPC64 kexec implementations.
We adopt the PPC32 approach of having ppc_md callbacks for the kexec functions.
The current PPC64 implementation becomes the "default" implementation for PPC64
which platforms can select if they need no special treatment.
I've added these default callbacks to pseries/maple/cell/powermac, this means
iSeries no longer supports kexec - but it never worked anyway.
I've renamed PPC32's machine_kexec_simple to default_machine_kexec, inline with
PPC64. Judging by the comments it might be better named machine_kexec_non_of,
or something, but at the moment it's the only implementation for PPC32 so it's
the "default".
Kexec requires machine_shutdown(), which is in machine_kexec.c on PPC32, but we
already have in setup-common.c on powerpc. All this does is call
ppc_md.nvram_sync, which only powermac implements, so instead make
machine_shutdown a ppc_md member and have it call core99_nvram_sync directly
on powermac.
I've also stuck relocate_kernel.S into misc_32.S for powerpc.
Built for ARCH=ppc, and 32 & 64 bit ARCH=powerpc, with KEXEC=y/n. Booted on
P5 LPAR and successfully kexec'ed.
Should apply on top of 493f25ef4087395891c99fcfe2c72e62e293e89f.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2005-11-14 12:35:00 +00:00
|
|
|
{
|
2011-01-06 18:00:36 +00:00
|
|
|
int save_ftrace_enabled;
|
|
|
|
|
|
|
|
save_ftrace_enabled = __ftrace_enabled_save();
|
|
|
|
|
2011-02-23 12:46:16 +00:00
|
|
|
if (ppc_md.machine_kexec)
|
|
|
|
ppc_md.machine_kexec(image);
|
|
|
|
else
|
|
|
|
default_machine_kexec(image);
|
2008-12-16 06:23:05 +00:00
|
|
|
|
2011-01-06 18:00:36 +00:00
|
|
|
__ftrace_enabled_restore(save_ftrace_enabled);
|
|
|
|
|
2008-12-16 06:23:05 +00:00
|
|
|
/* Fall back to normal restart if we're still alive. */
|
|
|
|
machine_restart(NULL);
|
[PATCH] powerpc: Merge kexec
This patch merges, to some extent, the PPC32 and PPC64 kexec implementations.
We adopt the PPC32 approach of having ppc_md callbacks for the kexec functions.
The current PPC64 implementation becomes the "default" implementation for PPC64
which platforms can select if they need no special treatment.
I've added these default callbacks to pseries/maple/cell/powermac, this means
iSeries no longer supports kexec - but it never worked anyway.
I've renamed PPC32's machine_kexec_simple to default_machine_kexec, inline with
PPC64. Judging by the comments it might be better named machine_kexec_non_of,
or something, but at the moment it's the only implementation for PPC32 so it's
the "default".
Kexec requires machine_shutdown(), which is in machine_kexec.c on PPC32, but we
already have in setup-common.c on powerpc. All this does is call
ppc_md.nvram_sync, which only powermac implements, so instead make
machine_shutdown a ppc_md member and have it call core99_nvram_sync directly
on powermac.
I've also stuck relocate_kernel.S into misc_32.S for powerpc.
Built for ARCH=ppc, and 32 & 64 bit ARCH=powerpc, with KEXEC=y/n. Booted on
P5 LPAR and successfully kexec'ed.
Should apply on top of 493f25ef4087395891c99fcfe2c72e62e293e89f.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2005-11-14 12:35:00 +00:00
|
|
|
for(;;);
|
|
|
|
}
|
2006-07-05 04:39:42 +00:00
|
|
|
|
|
|
|
void __init reserve_crashkernel(void)
|
|
|
|
{
|
2007-10-19 06:41:01 +00:00
|
|
|
unsigned long long crash_size, crash_base;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
/* use common parsing */
|
2010-07-12 04:36:09 +00:00
|
|
|
ret = parse_crashkernel(boot_command_line, memblock_phys_mem_size(),
|
2007-10-19 06:41:01 +00:00
|
|
|
&crash_size, &crash_base);
|
|
|
|
if (ret == 0 && crash_size > 0) {
|
|
|
|
crashk_res.start = crash_base;
|
2008-04-30 04:47:12 +00:00
|
|
|
crashk_res.end = crash_base + crash_size - 1;
|
2007-10-19 06:41:01 +00:00
|
|
|
}
|
2006-07-05 04:39:42 +00:00
|
|
|
|
2008-04-30 04:47:12 +00:00
|
|
|
if (crashk_res.end == crashk_res.start) {
|
|
|
|
crashk_res.start = crashk_res.end = 0;
|
2006-07-05 04:39:42 +00:00
|
|
|
return;
|
2008-04-30 04:47:12 +00:00
|
|
|
}
|
2006-07-05 04:39:42 +00:00
|
|
|
|
|
|
|
/* We might have got these values via the command line or the
|
|
|
|
* device tree, either way sanitise them now. */
|
|
|
|
|
2011-06-09 16:13:32 +00:00
|
|
|
crash_size = resource_size(&crashk_res);
|
2008-04-30 04:47:12 +00:00
|
|
|
|
2011-12-14 22:57:15 +00:00
|
|
|
#ifndef CONFIG_NONSTATIC_KERNEL
|
2006-07-05 04:39:42 +00:00
|
|
|
if (crashk_res.start != KDUMP_KERNELBASE)
|
|
|
|
printk("Crash kernel location must be 0x%x\n",
|
|
|
|
KDUMP_KERNELBASE);
|
|
|
|
|
|
|
|
crashk_res.start = KDUMP_KERNELBASE;
|
2009-01-02 10:46:15 +00:00
|
|
|
#else
|
|
|
|
if (!crashk_res.start) {
|
2011-07-31 19:27:35 +00:00
|
|
|
#ifdef CONFIG_PPC64
|
2009-01-02 10:46:15 +00:00
|
|
|
/*
|
2011-07-31 19:27:35 +00:00
|
|
|
* On 64bit we split the RMO in half but cap it at half of
|
|
|
|
* a small SLB (128MB) since the crash kernel needs to place
|
|
|
|
* itself and some stacks to be in the first segment.
|
2009-01-02 10:46:15 +00:00
|
|
|
*/
|
2011-07-31 19:27:35 +00:00
|
|
|
crashk_res.start = min(0x80000000ULL, (ppc64_rma_size / 2));
|
|
|
|
#else
|
2009-01-02 10:46:15 +00:00
|
|
|
crashk_res.start = KDUMP_KERNELBASE;
|
2011-07-31 19:27:35 +00:00
|
|
|
#endif
|
2009-01-02 10:46:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
crash_base = PAGE_ALIGN(crashk_res.start);
|
|
|
|
if (crash_base != crashk_res.start) {
|
|
|
|
printk("Crash kernel base must be aligned to 0x%lx\n",
|
|
|
|
PAGE_SIZE);
|
|
|
|
crashk_res.start = crash_base;
|
|
|
|
}
|
|
|
|
|
2008-10-21 17:38:10 +00:00
|
|
|
#endif
|
2007-10-19 06:41:01 +00:00
|
|
|
crash_size = PAGE_ALIGN(crash_size);
|
|
|
|
crashk_res.end = crashk_res.start + crash_size - 1;
|
2006-07-05 04:39:42 +00:00
|
|
|
|
2009-01-02 10:46:15 +00:00
|
|
|
/* The crash region must not overlap the current kernel */
|
|
|
|
if (overlaps_crashkernel(__pa(_stext), _end - _stext)) {
|
|
|
|
printk(KERN_WARNING
|
|
|
|
"Crash kernel can not overlap current kernel\n");
|
|
|
|
crashk_res.start = crashk_res.end = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-07-05 04:39:42 +00:00
|
|
|
/* Crash kernel trumps memory limit */
|
|
|
|
if (memory_limit && memory_limit <= crashk_res.end) {
|
|
|
|
memory_limit = crashk_res.end + 1;
|
2009-05-08 12:19:27 +00:00
|
|
|
printk("Adjusted memory limit for crashkernel, now 0x%llx\n",
|
|
|
|
(unsigned long long)memory_limit);
|
2006-07-05 04:39:42 +00:00
|
|
|
}
|
|
|
|
|
2007-10-19 06:41:01 +00:00
|
|
|
printk(KERN_INFO "Reserving %ldMB of memory at %ldMB "
|
|
|
|
"for crashkernel (System RAM: %ldMB)\n",
|
|
|
|
(unsigned long)(crash_size >> 20),
|
|
|
|
(unsigned long)(crashk_res.start >> 20),
|
2010-07-12 04:36:09 +00:00
|
|
|
(unsigned long)(memblock_phys_mem_size() >> 20));
|
2007-10-19 06:41:01 +00:00
|
|
|
|
2010-07-12 04:36:09 +00:00
|
|
|
memblock_reserve(crashk_res.start, crash_size);
|
2006-07-05 04:39:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int overlaps_crashkernel(unsigned long start, unsigned long size)
|
|
|
|
{
|
|
|
|
return (start + size) > crashk_res.start && start <= crashk_res.end;
|
|
|
|
}
|
2008-12-16 06:22:59 +00:00
|
|
|
|
|
|
|
/* Values we need to export to the second kernel via the device tree. */
|
2010-07-21 11:14:54 +00:00
|
|
|
static phys_addr_t kernel_end;
|
|
|
|
static phys_addr_t crashk_size;
|
2008-12-16 06:22:59 +00:00
|
|
|
|
|
|
|
static struct property kernel_end_prop = {
|
|
|
|
.name = "linux,kernel-end",
|
2010-07-21 11:14:54 +00:00
|
|
|
.length = sizeof(phys_addr_t),
|
2008-12-16 06:22:59 +00:00
|
|
|
.value = &kernel_end,
|
|
|
|
};
|
|
|
|
|
2008-12-17 10:09:06 +00:00
|
|
|
static struct property crashk_base_prop = {
|
|
|
|
.name = "linux,crashkernel-base",
|
2010-07-21 11:14:54 +00:00
|
|
|
.length = sizeof(phys_addr_t),
|
2008-12-17 10:09:06 +00:00
|
|
|
.value = &crashk_res.start,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct property crashk_size_prop = {
|
|
|
|
.name = "linux,crashkernel-size",
|
2010-07-21 11:14:54 +00:00
|
|
|
.length = sizeof(phys_addr_t),
|
2008-12-17 10:09:06 +00:00
|
|
|
.value = &crashk_size,
|
|
|
|
};
|
|
|
|
|
|
|
|
static void __init export_crashk_values(struct device_node *node)
|
|
|
|
{
|
|
|
|
struct property *prop;
|
|
|
|
|
|
|
|
/* There might be existing crash kernel properties, but we can't
|
|
|
|
* be sure what's in them, so remove them. */
|
|
|
|
prop = of_find_property(node, "linux,crashkernel-base", NULL);
|
|
|
|
if (prop)
|
|
|
|
prom_remove_property(node, prop);
|
|
|
|
|
|
|
|
prop = of_find_property(node, "linux,crashkernel-size", NULL);
|
|
|
|
if (prop)
|
|
|
|
prom_remove_property(node, prop);
|
|
|
|
|
|
|
|
if (crashk_res.start != 0) {
|
|
|
|
prom_add_property(node, &crashk_base_prop);
|
2011-06-09 16:13:32 +00:00
|
|
|
crashk_size = resource_size(&crashk_res);
|
2008-12-17 10:09:06 +00:00
|
|
|
prom_add_property(node, &crashk_size_prop);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-16 06:22:59 +00:00
|
|
|
static int __init kexec_setup(void)
|
|
|
|
{
|
|
|
|
struct device_node *node;
|
|
|
|
struct property *prop;
|
|
|
|
|
|
|
|
node = of_find_node_by_path("/chosen");
|
|
|
|
if (!node)
|
|
|
|
return -ENOENT;
|
|
|
|
|
|
|
|
/* remove any stale properties so ours can be found */
|
|
|
|
prop = of_find_property(node, kernel_end_prop.name, NULL);
|
|
|
|
if (prop)
|
|
|
|
prom_remove_property(node, prop);
|
|
|
|
|
|
|
|
/* information needed by userspace when using default_machine_kexec */
|
|
|
|
kernel_end = __pa(_end);
|
|
|
|
prom_add_property(node, &kernel_end_prop);
|
|
|
|
|
2008-12-17 10:09:06 +00:00
|
|
|
export_crashk_values(node);
|
|
|
|
|
2008-12-16 06:22:59 +00:00
|
|
|
of_node_put(node);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
late_initcall(kexec_setup);
|