[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 05:35:00 -07: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-11 22:36:09 -06:00
|
|
|
#include <linux/memblock.h>
|
2008-12-15 23:22:59 -07:00
|
|
|
#include <linux/of.h>
|
2010-09-16 16:58:23 -06:00
|
|
|
#include <linux/irq.h>
|
2011-01-06 11:00:36 -07:00
|
|
|
#include <linux/ftrace.h>
|
2010-09-16 16:58:23 -06: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 05:35:00 -07:00
|
|
|
#include <asm/machdep.h>
|
2008-02-13 17:56:49 -07:00
|
|
|
#include <asm/prom.h>
|
2008-12-15 23:22:59 -07: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 05:35:00 -07:00
|
|
|
|
2010-09-16 16:58:23 -06:00
|
|
|
void machine_kexec_mask_interrupts(void) {
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
for_each_irq(i) {
|
|
|
|
struct irq_desc *desc = irq_to_desc(i);
|
|
|
|
|
|
|
|
if (!desc || !desc->chip)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (desc->chip->eoi &&
|
|
|
|
desc->status & IRQ_INPROGRESS)
|
|
|
|
desc->chip->eoi(i);
|
|
|
|
|
|
|
|
if (desc->chip->mask)
|
|
|
|
desc->chip->mask(i);
|
|
|
|
|
|
|
|
if (desc->chip->disable &&
|
|
|
|
!(desc->status & IRQ_DISABLED))
|
|
|
|
desc->chip->disable(i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
[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 05:35:00 -07:00
|
|
|
void machine_crash_shutdown(struct pt_regs *regs)
|
|
|
|
{
|
2011-01-06 10:56:09 -07: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 05:35:00 -07: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-15 23:23:05 -07: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 05:35:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void machine_kexec_cleanup(struct kimage *image)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-07-12 21:46:09 -06: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 05:35:00 -07: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-25 20:45:07 -06: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 05:35:00 -07:00
|
|
|
{
|
2011-01-06 11:00:36 -07:00
|
|
|
int save_ftrace_enabled;
|
|
|
|
|
|
|
|
save_ftrace_enabled = __ftrace_enabled_save();
|
|
|
|
|
2011-01-06 10:55:36 -07:00
|
|
|
default_machine_kexec(image);
|
2008-12-15 23:23:05 -07:00
|
|
|
|
2011-01-06 11:00:36 -07:00
|
|
|
__ftrace_enabled_restore(save_ftrace_enabled);
|
|
|
|
|
2008-12-15 23:23:05 -07: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 05:35:00 -07:00
|
|
|
for(;;);
|
|
|
|
}
|
2006-07-04 22:39:42 -06:00
|
|
|
|
|
|
|
void __init reserve_crashkernel(void)
|
|
|
|
{
|
2007-10-19 00:41:01 -06:00
|
|
|
unsigned long long crash_size, crash_base;
|
|
|
|
int ret;
|
|
|
|
|
2010-07-11 22:36:09 -06:00
|
|
|
/* this is necessary because of memblock_phys_mem_size() */
|
|
|
|
memblock_analyze();
|
2007-10-19 00:41:01 -06:00
|
|
|
|
|
|
|
/* use common parsing */
|
2010-07-11 22:36:09 -06:00
|
|
|
ret = parse_crashkernel(boot_command_line, memblock_phys_mem_size(),
|
2007-10-19 00:41:01 -06:00
|
|
|
&crash_size, &crash_base);
|
|
|
|
if (ret == 0 && crash_size > 0) {
|
|
|
|
crashk_res.start = crash_base;
|
2008-04-29 22:47:12 -06:00
|
|
|
crashk_res.end = crash_base + crash_size - 1;
|
2007-10-19 00:41:01 -06:00
|
|
|
}
|
2006-07-04 22:39:42 -06:00
|
|
|
|
2008-04-29 22:47:12 -06:00
|
|
|
if (crashk_res.end == crashk_res.start) {
|
|
|
|
crashk_res.start = crashk_res.end = 0;
|
2006-07-04 22:39:42 -06:00
|
|
|
return;
|
2008-04-29 22:47:12 -06:00
|
|
|
}
|
2006-07-04 22:39:42 -06:00
|
|
|
|
|
|
|
/* We might have got these values via the command line or the
|
|
|
|
* device tree, either way sanitise them now. */
|
|
|
|
|
2008-04-29 22:47:12 -06:00
|
|
|
crash_size = crashk_res.end - crashk_res.start + 1;
|
|
|
|
|
2008-10-21 11:38:10 -06:00
|
|
|
#ifndef CONFIG_RELOCATABLE
|
2006-07-04 22:39:42 -06: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 03:46:15 -07:00
|
|
|
#else
|
|
|
|
if (!crashk_res.start) {
|
|
|
|
/*
|
|
|
|
* unspecified address, choose a region of specified size
|
|
|
|
* can overlap with initrd (ignoring corruption when retained)
|
|
|
|
* ppc64 requires kernel and some stacks to be in first segemnt
|
|
|
|
*/
|
|
|
|
crashk_res.start = KDUMP_KERNELBASE;
|
|
|
|
}
|
|
|
|
|
|
|
|
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 11:38:10 -06:00
|
|
|
#endif
|
2007-10-19 00:41:01 -06:00
|
|
|
crash_size = PAGE_ALIGN(crash_size);
|
|
|
|
crashk_res.end = crashk_res.start + crash_size - 1;
|
2006-07-04 22:39:42 -06:00
|
|
|
|
2009-01-02 03:46:15 -07: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-04 22:39:42 -06:00
|
|
|
/* Crash kernel trumps memory limit */
|
|
|
|
if (memory_limit && memory_limit <= crashk_res.end) {
|
|
|
|
memory_limit = crashk_res.end + 1;
|
2009-05-08 06:19:27 -06:00
|
|
|
printk("Adjusted memory limit for crashkernel, now 0x%llx\n",
|
|
|
|
(unsigned long long)memory_limit);
|
2006-07-04 22:39:42 -06:00
|
|
|
}
|
|
|
|
|
2007-10-19 00:41:01 -06: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-11 22:36:09 -06:00
|
|
|
(unsigned long)(memblock_phys_mem_size() >> 20));
|
2007-10-19 00:41:01 -06:00
|
|
|
|
2010-07-11 22:36:09 -06:00
|
|
|
memblock_reserve(crashk_res.start, crash_size);
|
2006-07-04 22:39:42 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
int overlaps_crashkernel(unsigned long start, unsigned long size)
|
|
|
|
{
|
|
|
|
return (start + size) > crashk_res.start && start <= crashk_res.end;
|
|
|
|
}
|
2008-12-15 23:22:59 -07:00
|
|
|
|
|
|
|
/* Values we need to export to the second kernel via the device tree. */
|
2010-07-21 05:14:54 -06:00
|
|
|
static phys_addr_t kernel_end;
|
|
|
|
static phys_addr_t crashk_size;
|
2008-12-15 23:22:59 -07:00
|
|
|
|
|
|
|
static struct property kernel_end_prop = {
|
|
|
|
.name = "linux,kernel-end",
|
2010-07-21 05:14:54 -06:00
|
|
|
.length = sizeof(phys_addr_t),
|
2008-12-15 23:22:59 -07:00
|
|
|
.value = &kernel_end,
|
|
|
|
};
|
|
|
|
|
2008-12-17 03:09:06 -07:00
|
|
|
static struct property crashk_base_prop = {
|
|
|
|
.name = "linux,crashkernel-base",
|
2010-07-21 05:14:54 -06:00
|
|
|
.length = sizeof(phys_addr_t),
|
2008-12-17 03:09:06 -07:00
|
|
|
.value = &crashk_res.start,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct property crashk_size_prop = {
|
|
|
|
.name = "linux,crashkernel-size",
|
2010-07-21 05:14:54 -06:00
|
|
|
.length = sizeof(phys_addr_t),
|
2008-12-17 03:09:06 -07: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);
|
|
|
|
crashk_size = crashk_res.end - crashk_res.start + 1;
|
|
|
|
prom_add_property(node, &crashk_size_prop);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-15 23:22:59 -07: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 03:09:06 -07:00
|
|
|
export_crashk_values(node);
|
|
|
|
|
2008-12-15 23:22:59 -07:00
|
|
|
of_node_put(node);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
late_initcall(kexec_setup);
|