[PATCH] ppc64/purgatory: Device tree values should be read/stored in Big Endian

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 at linux.vnet.ibm.com>
---
 purgatory/arch/ppc64/v2wrap.S |   10 ++++++++++
 1 file changed, 10 insertions(+)

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




[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux