[U-Boot-Users] MPC8xx boards broken by commit some weeks ago

Hi all,
support for - at least some - MPC8xx boards seems broken. To prepare some new patches, I build a current U-Boot (top of tree) for our TQM885D board. With this U-Boot, some time after relocation to RAM the board hangs:
U-Boot 1.2.0-g668229de-dirty (Jul 13 2007 - 14:41:16)
CPU: MPC885ZPnn at 133 MHz [15.0...133.0 MHz] 8 kB I-Cache 8 kB D-Cache FEC present Board: TQM885DGEAAD39-E133 I2C: ready DRAM: 128 MB Top of RAM usable for U-Boot at: 08000000 Reserving 199k for U-Boot at: 07fce000 Reserving 288k for malloc() at: 07f86000 Reserving 60 Bytes for Board Info at: 07f85fc4 Reserving 52 Bytes for Global Data at: 07f85f90 Stack Pointer at: 07f85f78 New Stack Pointer is: 07f85f78 Now running in RAM - U-Boot at: 07fce000 -> board hangs
U-Boot runs till line 974 in function board_init_r() in lib_ppc/board.c:
/* Initialize from environment */ if ((s = getenv ("loadaddr")) != NULL) { load_addr = simple_strtoul (s, NULL, 16); }
Somewhere (at varying positions) in the getenv("loadaddr") function, the cpu gets stuck (the single step command in gdb does not return, and/or a SIGSTOP is received).
I tracked the problem down (git bisect is great!) to the commit "ppc4xx: Clean up 440 exceptions handling" from Stefan Roese on 15 Jun 2007 (efa35cf12d914d4caba942acd5a6c45f217de302).
More precisely to the following patch:
--- a/include/ppc_asm.tmpl +++ b/include/ppc_asm.tmpl @@ -217,7 +217,7 @@ * We assume sprg3 has the physical address of the current * task's thread_struct. */ -#define EXCEPTION_PROLOG \ +#define EXCEPTION_PROLOG(reg1, reg2) \ mtspr SPRG0,r20; \ mtspr SPRG1,r21; \ mfcr r20; \ @@ -235,8 +235,10 @@ stw r22,_CTR(r21); \ mfspr r20,XER; \ stw r20,_XER(r21); \ - mfspr r22,SRR0; \ - mfspr r23,SRR1; \ + mfspr r20,DEAR; \ <-- + stw r20,_DAR(r21); \ <-- + mfspr r22,reg1; \ + mfspr r23,reg2; \ stw r0,GPR0(r21); \ stw r1,GPR1(r21); \ stw r2,GPR2(r21); \
If I remove the marked assembler instructions, the board runs again. I could reproduce the same behaviour with a TQM866M board (without the marked instuctions, the board runs fine, with the instructions the board gets stuck some time after relocation to RAM).
Has someone encountered similar problems? What are the two newly added assembler commands good for?
Regards Martin Krause
-- Entwicklung Tel. +49 8153 93 08-157, Fax +49 8153 93 08-7157 mailto:martin.krause@tqs.de
TQ-Systems GmbH Muehlstrasse 2, Gut Delling, D-82229 Seefeld Amtsgericht Muenchen, HRB 105 018, UST-IdNr. DE 811 607 913 Geschaeftsfuehrer: Dipl.-Ing. (FH) Detlef Schneider, Dipl.-Ing. (FH) Ruediger Stahl http://www.tq-group.com

Hi Martin,
On Monday 16 July 2007, Martin Krause wrote:
support for - at least some - MPC8xx boards seems broken. To prepare some new patches, I build a current U-Boot (top of tree) for our TQM885D board. With this U-Boot, some time after relocation to RAM the board hangs:
<snip>
I tracked the problem down (git bisect is great!) to the commit "ppc4xx: Clean up 440 exceptions handling" from Stefan Roese on 15 Jun 2007 (efa35cf12d914d4caba942acd5a6c45f217de302).
More precisely to the following patch:
--- a/include/ppc_asm.tmpl +++ b/include/ppc_asm.tmpl @@ -217,7 +217,7 @@
- We assume sprg3 has the physical address of the current
- task's thread_struct.
*/ -#define EXCEPTION_PROLOG \ +#define EXCEPTION_PROLOG(reg1, reg2) \ mtspr SPRG0,r20; \ mtspr SPRG1,r21; \ mfcr r20; \ @@ -235,8 +235,10 @@ stw r22,_CTR(r21); \ mfspr r20,XER; \ stw r20,_XER(r21); \
mfspr r22,SRR0; \
mfspr r23,SRR1; \
mfspr r20,DEAR; \ <--
stw r20,_DAR(r21); \ <--
We are currently working on a fix for this. Sorry for the inconvenience.
Best regards, Stefan
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office@denx.de =====================================================================

Hi Stefan,
Stefan Roese wrote on Tuesday, July 17, 2007 1:15 PM:
Hi Martin,
On Monday 16 July 2007, Martin Krause wrote:
support for - at least some - MPC8xx boards seems broken. To prepare some new patches, I build a current U-Boot (top of tree) for our TQM885D board. With this U-Boot, some time after relocation to RAM the board hangs:
<snip>
I tracked the problem down (git bisect is great!) to the commit "ppc4xx: Clean up 440 exceptions handling" from Stefan Roese on 15 Jun 2007 (efa35cf12d914d4caba942acd5a6c45f217de302).
More precisely to the following patch:
--- a/include/ppc_asm.tmpl +++ b/include/ppc_asm.tmpl @@ -217,7 +217,7 @@
- We assume sprg3 has the physical address of the current
- task's thread_struct.
*/ -#define EXCEPTION_PROLOG \ +#define EXCEPTION_PROLOG(reg1, reg2) \ mtspr SPRG0,r20; \ mtspr SPRG1,r21; \ mfcr r20; \ @@ -235,8 +235,10 @@ stw r22,_CTR(r21); \ mfspr r20,XER; \ stw r20,_XER(r21); \
mfspr r22,SRR0; \
mfspr r23,SRR1; \
mfspr r20,DEAR; \ <--
stw r20,_DAR(r21); \ <--
We are currently working on a fix for this. Sorry for the
Great! I tried to figure out what's going on myself, but get stuck because I'm no ppc assembler expert. It seems, that the "DEAR" special purpose register is not available on the MPC885D (and other MPC8xx processors?)?
Best regards, Martin Krause
Development Tel. +49 8153 93 08-157, Fax +49 8153 93 08-7157 mailto:martin.krause@tqs.de
TQ-Systems GmbH Muehlstrasse 2, Gut Delling, D-82229 Seefeld Amtsgericht Muenchen, HRB 105 018, UST-IdNr. DE 811 607 913 Geschaeftsfuehrer: Dipl.-Ing. (FH) Detlef Schneider, Dipl.-Ing. (FH) Ruediger Stahl http://www.tq-group.com

HI Martin,
On Tuesday 17 July 2007, Martin Krause wrote:
@@ -235,8 +235,10 @@ stw r22,_CTR(r21); \ mfspr r20,XER; \ stw r20,_XER(r21); \
mfspr r22,SRR0; \
mfspr r23,SRR1; \
mfspr r20,DEAR; \ <--
stw r20,_DAR(r21); \ <--
We are currently working on a fix for this. Sorry for the
Great! I tried to figure out what's going on myself, but get stuck because I'm no ppc assembler expert. It seems, that the "DEAR" special purpose register is not available on the MPC885D (and other MPC8xx processors?)?
Yep, that's the case and as it seems the cause of this problem.
Best regards, Stefan
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office@denx.de =====================================================================

Martin Krause wrote:
Great! I tried to figure out what's going on myself, but get stuck because I'm no ppc assembler expert. It seems, that the "DEAR" special purpose register is not available on the MPC885D (and other MPC8xx processors?)?
Hi Martin,
Could you please test with the attached patch? This switches to using DAR on all PPC variants that do not really have DEAR.
kind reagards, Rafal
diff --git a/include/asm-ppc/processor.h b/include/asm-ppc/processor.h index 9780fe1..4898dd4 100644 --- a/include/asm-ppc/processor.h +++ b/include/asm-ppc/processor.h @@ -628,6 +628,12 @@ #define MAS6 SPRN_MAS6 #define MAS7 SPRN_MAS7
+#if defined(CONFIG_4xx) || defined(CONFIG_44x) || defined(CONFIG_MPC85xx) +#define DAR_DEAR DEAR +#else +#define DAR_DEAR DAR +#endif + /* Device Control Registers */
#define DCRN_BEAR 0x090 /* Bus Error Address Register */ diff --git a/include/ppc_asm.tmpl b/include/ppc_asm.tmpl index 9f4029f..ac8f317 100644 --- a/include/ppc_asm.tmpl +++ b/include/ppc_asm.tmpl @@ -235,7 +235,7 @@ stw r22,_CTR(r21); \ mfspr r20,XER; \ stw r20,_XER(r21); \ - mfspr r20,DEAR; \ + mfspr r20, DAR_DEAR; \ stw r20,_DAR(r21); \ mfspr r22,reg1; \ mfspr r23,reg2; \

Hi Rafal,
Could you please test with the attached patch? This switches to using DAR on all PPC variants that do not really have DEAR.
Thanks, merged.
Cheers Detlev
participants (4)
-
Detlev Zundel
-
Martin Krause
-
Rafal Jaworowski
-
Stefan Roese