Skip to contentSkip to conversation

powerpc/85xx:Fix MSR[DE] bit in MSR to support debugger

PATCH Superseded Prabhakar Kushwaha 3 participants 6 messages Apr 25, 2012 – Apr 26, 2012 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH v2 2/4 powerpc/85xx:Fix MSR[DE] bit in MSR to support debugger

Debugging of e500 and e500v1 processer requires MSR[DE] bit to be set always. Where MSR = Machine State register

Make sure of MSR[DE] bit is set uniformaly across the different execution address space i.e. AS0 and AS1.

---
Based upon git://git.denx.de/u-boot.git branch master

Changes for v2:
- Avoid MSR_DE negation in arch_preboot
- Made MSR_DE set code independent of any #define

No change, Resending again

Tested on
- SoC having E500 Family processor (P1010RDB, BSC9131RDB)
- SoC having E500MC Family processor (P4080DS, P3041DS)

 arch/powerpc/cpu/mpc85xx/cpu_init.c |    2 +-
 arch/powerpc/cpu/mpc85xx/start.S    |    7 +++++--
 2 files changed, 6 insertions(+), 3 deletions(-)
arch/powerpc/cpu/mpc85xx/cpu_init.c +1 -1
index 2e4a06c..3bcbffa 100644
@@ -532,7 +532,7 @@ void arch_preboot_os(void)
 	 * disabled by the time we get called.
 	 */
 	msr = mfmsr();
-	msr &= ~(MSR_ME|MSR_CE|MSR_DE);
+	msr &= ~(MSR_ME|MSR_CE);
 	mtmsr(msr);
 
 	setup_ivors();
arch/powerpc/cpu/mpc85xx/start.S +5 -2
index 7bfa2d5..597151b 100644
@@ -82,6 +82,9 @@
 	.globl _start_e500
 
 _start_e500:
+/* Enable debug exception */
+	li	r1,MSR_DE
+	mtmsr 	r1
 
 #if defined(CONFIG_SECURE_BOOT) && defined(CONFIG_E500MC)
 	/* ISBC uses L2 as stack.
@@ -729,8 +732,8 @@ create_init_ram_area:
 	msync
 	tlbwe
 
-	lis	r6,MSR_IS|MSR_DS at h
-	ori	r6,r6,MSR_IS|MSR_DS at l
+	lis	r6,MSR_IS|MSR_DS|MSR_DE at h
+	ori	r6,r6,MSR_IS|MSR_DS|MSR_DE at l
 	lis	r7,switch_as at h
 	ori	r7,r7,switch_as at l
 
Signature · 1 line
1.7.5.4
#1 lore raw

PATCH v2 2/4 powerpc/85xx:Fix MSR[DE] bit in MSR to support debugger

Quoted 6 lines

Debugging of e500 and e500v1 processer requires MSR[DE] bit to be set always. Where MSR = Machine State register

Make sure of MSR[DE] bit is set uniformaly across the different execution address space i.e. AS0 and AS1.

Hi

We are trying to bring up our custom P2010 RDB based board. boot is NOR based and we cannot get past the rfi below.

	lis	r6,MSR_IS|MSR_DS at h
	ori	r6,r6,MSR_IS|MSR_DS at l
	lis	r7,switch_as at h
	ori	r7,r7,switch_as at l

	mtspr	SPRN_SRR0,r7
	mtspr	SPRN_SRR1,r6
	rfi

switch_as:

We end up with a TLB exception no matter what we do, even after applying this patch. Using a Abatron BDI3000 emluator

Any pointers as what to look for would be greatly appreciated. Have anyone on the list managed to get past this rfi instruction using BDI3000? What emulator config did you use?

Jocke

Quoted 69 lines

---
Based upon git://git.denx.de/u-boot.git branch master

Changes for v2:
- Avoid MSR_DE negation in arch_preboot
- Made MSR_DE set code independent of any #define

No change, Resending again

Tested on
- SoC having E500 Family processor (P1010RDB, BSC9131RDB)
- SoC having E500MC Family processor (P4080DS, P3041DS)

 arch/powerpc/cpu/mpc85xx/cpu_init.c |    2 +-
 arch/powerpc/cpu/mpc85xx/start.S    |    7 +++++--
 2 files changed, 6 insertions(+), 3 deletions(-)
arch/powerpc/cpu/mpc85xx/cpu_init.c +1 -1
index 2e4a06c..3bcbffa 100644
@@ -532,7 +532,7 @@ void arch_preboot_os(void)
     * disabled by the time we get called.
     */
    msr = mfmsr();
-   msr &= ~(MSR_ME|MSR_CE|MSR_DE);
+   msr &= ~(MSR_ME|MSR_CE);
    mtmsr(msr);
 
    setup_ivors();
arch/powerpc/cpu/mpc85xx/start.S +5 -3
index 7bfa2d5..597151b 100644
@@ -82,6 +82,9 @@
    .globl _start_e500
 
 _start_e500:
+/* Enable debug exception */
+   li   r1,MSR_DE
+   mtmsr    r1
 
 #if defined(CONFIG_SECURE_BOOT) && defined(CONFIG_E500MC)
    /* ISBC uses L2 as stack.
@@ -729,8 +732,8 @@ create_init_ram_area:
    msync
    tlbwe
 
-   lis   r6,MSR_IS|MSR_DS at h
-   ori   r6,r6,MSR_IS|MSR_DS at l
+   lis   r6,MSR_IS|MSR_DS|MSR_DE at h
+   ori   r6,r6,MSR_IS|MSR_DS|MSR_DE at l
    lis   r7,switch_as at h
    ori   r7,r7,switch_as at l
 
--

1.7.5.4

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#2 lore raw

PATCH v2 2/4 powerpc/85xx:Fix MSR[DE] bit in MSR to support debugger

Quoted 20 lines · Joakim Tjernlund
Quoted 6 lines

Debugging of e500 and e500v1 processer requires MSR[DE] bit to be set always. Where MSR = Machine State register

Make sure of MSR[DE] bit is set uniformaly across the different execution address space i.e. AS0 and AS1.

Hi

We are trying to bring up our custom P2010 RDB based board. boot is NOR based and we cannot get past the rfi below.

	lis	r6,MSR_IS|MSR_DS at h
	ori	r6,r6,MSR_IS|MSR_DS at l
	lis	r7,switch_as at h
	ori	r7,r7,switch_as at l

	mtspr	SPRN_SRR0,r7
	mtspr	SPRN_SRR1,r6
	rfi
Quoted 3 lines

switch_as:

We end up with a TLB exception no matter what we do, even after applying this patch.

Did you apply the entire patchset, and define CONFIG_SYS_PPC_E500_DEBUG_TLB?

-Scott

#3 lore raw

PATCH v2 2/4 powerpc/85xx:Fix MSR[DE] bit in MSR to support debugger

Scott Wood <[email protected]> wrote on 2012/04/25 20:43:22:

Quoted 22 lines · Joakim Tjernlund
Quoted 20 lines
Quoted 6 lines

Debugging of e500 and e500v1 processer requires MSR[DE] bit to be set always. Where MSR = Machine State register

Make sure of MSR[DE] bit is set uniformaly across the different execution address space i.e. AS0 and AS1.

Hi

We are trying to bring up our custom P2010 RDB based board. boot is NOR based and we cannot get past the rfi below.

   lis   r6,MSR_IS|MSR_DS at h
   ori   r6,r6,MSR_IS|MSR_DS at l
   lis   r7,switch_as at h
   ori   r7,r7,switch_as at l

mtspr SPRN_SRR0,r7
mtspr SPRN_SRR1,r6
rfi

Quoted 5 lines
Quoted 3 lines

switch_as:

We end up with a TLB exception no matter what we do, even after applying this patch.

Did you apply the entire patchset, and define CONFIG_SYS_PPC_E500_DEBUG_TLB?

No, but this code is executed before any of the other parts of the patch. Anyhow, I just found the problem(really obvious once I found it).
During bring up we had to load uboot in the middle of the flash instead of
the end because we have a flash burn problem in the end of the flash that we do not understand yet. We think it may be related to DDR3 being misconfigured by the emulator(BDI3000). I do not understand why this emulator can not use the L2SRAM instead? Is there something magic behind the L2SRAM so it is impossible to use it as a work area for
flash burning?

Jocke

#4 lore raw

PATCH v2 2/4 powerpc/85xx:Fix MSR[DE] bit in MSR to support debugger

Quoted 30 lines · Joakim Tjernlund

Scott Wood <[email protected]> wrote on 2012/04/25 20:43:22:

Quoted 22 lines · Joakim Tjernlund
Quoted 20 lines
Quoted 6 lines

Debugging of e500 and e500v1 processer requires MSR[DE] bit to be set always. Where MSR = Machine State register

Make sure of MSR[DE] bit is set uniformaly across the different execution address space i.e. AS0 and AS1.

Hi

We are trying to bring up our custom P2010 RDB based board. boot is NOR based and we cannot get past the rfi below.

   lis   r6,MSR_IS|MSR_DS at h
   ori   r6,r6,MSR_IS|MSR_DS at l
   lis   r7,switch_as at h
   ori   r7,r7,switch_as at l

mtspr SPRN_SRR0,r7
mtspr SPRN_SRR1,r6
rfi

Quoted 5 lines
Quoted 3 lines

switch_as:

We end up with a TLB exception no matter what we do, even after applying this patch.

Did you apply the entire patchset, and define CONFIG_SYS_PPC_E500_DEBUG_TLB?

Quoted 8 lines

No, but this code is executed before any of the other parts of the patch. Anyhow, I just found the problem(really obvious once I found it).
During bring up we had to load uboot in the middle of the flash instead of
the end because we have a flash burn problem in the end of the flash that we do not understand yet. We think it may be related to DDR3 being misconfigured by the emulator(BDI3000). I do not understand why this emulator can not use the L2SRAM instead? Is there something magic behind the L2SRAM so it is impossible to use it as a work area for
flash burning?

I don't know of any reason L2SRAM couldn't be used for this. My guess is they just don't want to have to support more than one way of creating RAM.

-Scott

#5 lore raw

PATCH v2 2/4 powerpc/85xx:Fix MSR[DE] bit in MSR to support debugger

Scott Wood <[email protected]> wrote on 2012/04/25 20:59:22:

Quoted 41 lines · Joakim Tjernlund
Quoted 30 lines

Scott Wood <[email protected]> wrote on 2012/04/25 20:43:22:

Quoted 22 lines · Joakim Tjernlund
Quoted 20 lines
Quoted 6 lines

Debugging of e500 and e500v1 processer requires MSR[DE] bit to be set always. Where MSR = Machine State register

Make sure of MSR[DE] bit is set uniformaly across the different execution address space i.e. AS0 and AS1.

Hi

We are trying to bring up our custom P2010 RDB based board. boot is NOR based and we cannot get past the rfi below.

   lis   r6,MSR_IS|MSR_DS at h
   ori   r6,r6,MSR_IS|MSR_DS at l
   lis   r7,switch_as at h
   ori   r7,r7,switch_as at l

mtspr SPRN_SRR0,r7
mtspr SPRN_SRR1,r6
rfi

Quoted 5 lines
Quoted 3 lines

switch_as:

We end up with a TLB exception no matter what we do, even after applying this patch.

Did you apply the entire patchset, and define CONFIG_SYS_PPC_E500_DEBUG_TLB?

Quoted 8 lines

No, but this code is executed before any of the other parts of the patch. Anyhow, I just found the problem(really obvious once I found it).
During bring up we had to load uboot in the middle of the flash instead of
the end because we have a flash burn problem in the end of the flash that we do not understand yet. We think it may be related to DDR3 being misconfigured by the emulator(BDI3000). I do not understand why this emulator can not use the L2SRAM instead? Is there something magic behind the L2SRAM so it is impossible to use it as a work area for
flash burning?

Quoted 3 lines

I don't know of any reason L2SRAM couldn't be used for this. My guess is they just don't want to have to support more than one way of creating RAM.

Right, we will look into this some more then.

Back to our rfi problem. I think there is an bug in u-boot start.S.

This part is what you land in for NOR based boot:

#if !defined(CONFIG_SYS_RAMBOOT) && !defined(CONFIG_SECURE_BOOT)
	/* create a temp mapping in AS=1 to the 4M boot window */
	lis     r7,FSL_BOOKE_MAS1(1, 1, 0, 1, BOOKE_PAGESZ_4M)@h
	ori     r7,r7,FSL_BOOKE_MAS1(1, 1, 0, 1, BOOKE_PAGESZ_4M)@l

	lis     r8,FSL_BOOKE_MAS2(CONFIG_SYS_MONITOR_BASE & 0xffc00000, (MAS2_I|MAS2_G))@h
	ori     r8,r8,FSL_BOOKE_MAS2(CONFIG_SYS_MONITOR_BASE & 0xffc00000, (MAS2_I|MAS2_G))@l

	/* The 85xx has the default boot window 0xff800000 - 0xffffffff */
	lis     r9,FSL_BOOKE_MAS3(0xffc00000, 0, (MAS3_SX|MAS3_SW|MAS3_SR))@h
	ori     r9,r9,FSL_BOOKE_MAS3(0xffc00000, 0, (MAS3_SX|MAS3_SW|MAS3_SR))@l

Here r9 is fixed to 0xffc00000, this will only work for CONFIG_SYS_MONITOR_BASE >= 0xffc00000 (we had a lower value)
I don't know how this should be changed so it works for all boards, we just copied the values from the r8 settings to move on.

Jocke