summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Dufour <ldufour@linux.vnet.ibm.com>2014-04-28 12:26:50 +0200
committerSimon Horman <horms@verge.net.au>2014-04-29 10:59:00 +0900
commit90853885a859e42b0ff6935199bf6fceda1c6a87 (patch)
treef89b73f4fb9c45b397e5fc122e4c190856a8970f
parent64df62873443eb3080c059fd366f1f38d3c380d4 (diff)
downloadkexec-tools-90853885a859e42b0ff6935199bf6fceda1c6a87.tar.gz
ppc64/purgatory: Device tree values should be read/stored in Big Endian
The purgatory code reads the device tree's version and stores if needed the currently running CPU number. These 2 values are stored in Big Endian format in the device tree and should be byte swapped when running in Little Endian mode. Without this fix, when running in SMP environment, kexec or kdump kernel may fail booting with the following message : Failed to identify boot CPU Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com> Signed-off-by: Simon Horman <horms@verge.net.au>
-rw-r--r--purgatory/arch/ppc64/v2wrap.S10
1 files changed, 10 insertions, 0 deletions
diff --git a/purgatory/arch/ppc64/v2wrap.S b/purgatory/arch/ppc64/v2wrap.S
index 6fc62e3..dc5034f 100644
--- a/purgatory/arch/ppc64/v2wrap.S
+++ b/purgatory/arch/ppc64/v2wrap.S
@@ -90,10 +90,20 @@ master:
LOADADDR(16, dt_offset)
ld 3,0(16) # load device-tree address
mr 16,3 # save dt address in reg16
+#ifdef __BIG_ENDIAN__
lwz 6,20(3) # fetch version number
+#else
+ li 4,20
+ lwbrx 6,3,4 # fetch BE version number
+#endif
cmpwi 0,6,2 # v2 ?
blt 80f
+#ifdef __BIG_ENDIAN__
stw 17,28(3) # save my cpu number as boot_cpu_phys
+#else
+ li 4,28
+ stwbrx 17,3,4 # Store my cpu as BE value
+#endif
80:
LOADADDR(6,opal_base) # For OPAL early debug
ld 8,0(6) # load the OPAL base address in r8