summaryrefslogtreecommitdiffstats
path: root/purgatory
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2008-10-01 10:04:16 +0200
committerSebastian Andrzej Siewior <sebastian@breakpoint.cc>2010-03-07 10:05:13 +0100
commite2c28a627007fe372b2286fa366b497be6a94ea5 (patch)
treebe5b2816fdea5ded31f41d0f8c03d1900e365f81 /purgatory
parent3d06b10be52b2a5ddcd4328bc2da11c3cc25f809 (diff)
downloadkexec-tools-e2c28a627007fe372b2286fa366b497be6a94ea5.tar.gz
powerpc: dtb and purgatory support for ppc32
Some code dtb scanning & filling has been borrowed from ppc64. The old behavior is still available if compiled with GameCube, other PowerPC platform use the can purgatory and specify a new dtb. Booting a self contained elf image (incl. dtb / without the need for a bd sturct or the like) can be booted. The dtb support is currently optional. That means if the elf image does not contain a dtb file then the user has to supply a complete dtb (including mem size, command line, bus freq., mac addr, ...) Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Diffstat (limited to 'purgatory')
-rw-r--r--purgatory/arch/ppc/Makefile1
-rw-r--r--purgatory/arch/ppc/purgatory-ppc.c6
-rw-r--r--purgatory/arch/ppc/v2wrap.S66
3 files changed, 73 insertions, 0 deletions
diff --git a/purgatory/arch/ppc/Makefile b/purgatory/arch/ppc/Makefile
index 69fd46c2..0dd18b67 100644
--- a/purgatory/arch/ppc/Makefile
+++ b/purgatory/arch/ppc/Makefile
@@ -2,6 +2,7 @@
# Purgatory ppc
#
+ppc_PURGATORY_SRCS += purgatory/arch/ppc/v2wrap.S
ppc_PURGATORY_SRCS += purgatory/arch/ppc/misc.S
ppc_PURGATORY_SRCS += purgatory/arch/ppc/purgatory-ppc.c
ppc_PURGATORY_SRCS += purgatory/arch/ppc/console-ppc.c
diff --git a/purgatory/arch/ppc/purgatory-ppc.c b/purgatory/arch/ppc/purgatory-ppc.c
index 077f495a..01d0f386 100644
--- a/purgatory/arch/ppc/purgatory-ppc.c
+++ b/purgatory/arch/ppc/purgatory-ppc.c
@@ -1,6 +1,12 @@
#include <purgatory.h>
#include "purgatory-ppc.h"
+unsigned int pul_stack = 0;
+unsigned int dt_offset = 0;
+unsigned int kernel = 0;
+unsigned int epapr_magic = 0;
+unsigned int mem_size = 0;
+
void setup_arch(void)
{
/* Nothing for now */
diff --git a/purgatory/arch/ppc/v2wrap.S b/purgatory/arch/ppc/v2wrap.S
new file mode 100644
index 00000000..79d188f0
--- /dev/null
+++ b/purgatory/arch/ppc/v2wrap.S
@@ -0,0 +1,66 @@
+#
+# kexec: Linux boots Linux
+#
+# Copyright (C) 2004 - 2005, Milton D Miller II, IBM Corporation
+# Copyright (C) 2006, Mohan Kumar M (mohan@in.ibm.com), IBM Corporation
+# Copyright (C) 2008, Sebastian Andrzej Siewior (bigeasy@linutronix.de), linutronix
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation (version 2 of the License).
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+
+#include "ppc_asm.h"
+
+# v2wrap.S
+# a wrapper to call purgatory code
+# Invokes ppc kernel with the arguments according to ePAPR v1.0
+# It assumes that the MSR is allready correct.
+
+# calling convention:
+# no register are considred
+#
+
+#define LOADADDR(rn,name) \
+ lis rn,name##@h; \
+ ori rn,rn,name##@l; \
+
+ .globl purgatory_start
+purgatory_start:
+
+ LOADADDR(r6,pul_stack)
+ lwz r1,0(r6) #setup stack
+
+ subi r1, r1, 112
+ bl purgatory
+ nop
+
+ LOADADDR(r6,kernel)
+ lwz r4,0(r6) # load the kernel address
+ mtlr r4 # prepare branch too
+
+ LOADADDR(r6, dt_offset)
+ lwz r3, 0(r6) # load device-tree address
+
+ li r4, 0
+ li r5, 0
+
+ LOADADDR(r6, epapr_magic) # ePAPR magic value
+ lwz r6, 0(r6)
+
+ LOADADDR(r7, mem_size) # the Initial Mapped Area
+ lwz r7, 0(r6)
+
+ li r8, 0
+ li r9, 0
+
+ blr # start kernel