powerpc/85xx:Update NOR code base to support debugger
PATCH 3/4 powerpc/85xx:Update NOR code base to support debugger
Update the NOR code base to support NOR-boot debugging.
It ovecome e500 and e500v2's second limitation i.e. IVPR + IVOR15 should be valid fetchable OP code address.
While executing in translated space (AS=1), whenever a debug exception is generated, the MSR[DS/IS] gets cleared and the processor tries to fetch an instruction from the debug exception vector (IVPR|IVOR15); since now we are in AS=0, the application needs to ensure the proper configuration to have IVOR|IVOR15 accessible from AS=0 also.
---
Applies on http://git.denx.de/u-boot.git branch master
arch/powerpc/cpu/mpc85xx/cpu_init_early.c | 32 +++++++++++++++++++++- arch/powerpc/cpu/mpc85xx/start.S | 42 +++++++++++++++++++++++++++++ arch/powerpc/include/asm/config_mpc85xx.h | 3 +- 3 files changed, 75 insertions(+), 2 deletions(-)
arch/powerpc/cpu/mpc85xx/cpu_init_early.c +31 -1
@@ -1,5 +1,5 @@/* -* Copyright 2009-2011 Freescale Semiconductor, Inc +* Copyright 2009-2012 Freescale Semiconductor, Inc * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as
@@ -53,6 +53,36 @@ void setup_ifc(void) asmvolatile ("isync;msync;tlbwe;isync" ); +#if defined(CONFIG_E500_V1_V2 ) +/* +* TLB for debuggging in AS1 +* Create temporary TLB in AS0 to handle debug exception +* As on debug exception MSR is cleared i.e. Address space is changed +* to 0. A TLB (in AS0) is required to handle debug exception generated +* in AS1. +* +* TLB is created for IVPR + IVOR15 to map on valid OP code address +* bacause flash's physical address is going to change as +* CONFIG_SYS_FLASH_BASE_PHYS. +*/ + _mas0 =MAS0_TLBSEL (1 ) | +MAS0_ESEL (CONFIG_DEBUGGER_TEMP_TLB ); + _mas1 =MAS1_VALID |MAS1_TID (0 ) |MAS1_IPROT | +MAS1_TSIZE (BOOKE_PAGESZ_4M ); + _mas2 =FSL_BOOKE_MAS2 (CONFIG_SYS_TEXT_BASE ,MAS2_I |MAS2_G ); + _mas3 =FSL_BOOKE_MAS3 (flash_phys,0 ,MAS3_SW |MAS3_SR |MAS3_SX ); + _mas7 =FSL_BOOKE_MAS7 (flash_phys); + +mtspr (MAS0 , _mas0); +mtspr (MAS1 , _mas1); +mtspr (MAS2 , _mas2); +mtspr (MAS3 , _mas3); +mtspr (MAS7 , _mas7); + + asmvolatile ("isync;msync;tlbwe;isync" ); +#endif + +/* Change flash's physical address */ out_be32 (&(ifc_regs->cspr_cs[0 ].cspr),CONFIG_SYS_CSPR0 );out_be32 (&(ifc_regs->csor_cs[0 ].csor),CONFIG_SYS_CSOR0 );out_be32 (&(ifc_regs->amask_cs[0 ].amask),CONFIG_SYS_AMASK0 );
arch/powerpc/cpu/mpc85xx/start.S +42 -0
48 lines not on this page · raw message
arch/powerpc/include/asm/config_mpc85xx.h +2 -1
@@ -1,5 +1,5 @@/* -* Copyright 2011 Freescale Semiconductor, Inc. +* Copyright 2011-2012 Freescale Semiconductor, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as
@@ -107,6 +107,7 @@#define CONFIG_MAX_CPUS 1#define CONFIG_FSL_SDHC_V2_3 #define CONFIG_SYS_FSL_NUM_LAWS 12 +#define CONFIG_DEBUGGER_TEMP_TLB 3#define CONFIG_TSECV2 #define CONFIG_SYS_FSL_SEC_COMPAT 4#define CONFIG_FSL_SATA_V2
Signature · 1 line
1.7.5.4
PATCH 3/4 powerpc/85xx:Update NOR code base to support debugger
Dear Prabhakar Kushwaha,
Quoted 12 lines · In message <[email protected]> you…
Update the NOR code base to support NOR-boot debugging.
It ovecome e500 and e500v2's second limitation i.e. IVPR + IVOR15 should be valid fetchable OP code address.While executing in translated space (AS=1), whenever a debug exception is generated, the MSR[DS/IS] gets cleared and the processor tries to fetch an instruction from the debug exception vector (IVPR|IVOR15); since now we are in AS=0, the application needs to ensure the proper configuration to have IVOR|IVOR15 accessible from AS=0 also.
Signed-off-by Radu Lazarescu <[email protected]>Signed-off-by Prabhakar Kushwaha <[email protected]>
...
arch/powerpc/cpu/mpc85xx/cpu_init_early.c void setup_ifc(void) · line 69
Quoted 2 lines
arch/powerpc/cpu/mpc85xx/cpu_init_early.c +2
-0+ _mas0 =MAS0_TLBSEL (1 ) | +MAS0_ESEL (CONFIG_DEBUGGER_TEMP_TLB );
You are using an undocumented CONFIG_ option here.
arch/powerpc/cpu/mpc85xx/start.S l2_disabled: · line 187
Quoted 6 lines
+++
b/arch/powerpc/cpu/mpc85xx/start.Sarch/powerpc/cpu/mpc85xx/start.S +1
-0@@ -184,6 +184,48 @@ l2_disabled: andi. r1,r3,L1CSR0_DCE at l beq 2b +#if defined(CONFIG_E500_V1_V2) && !defined(CONFIG_SYS_RAMBOOT)
What if no such debug support is needed, and code size hurts?
arch/powerpc/include/asm/config_mpc85xx.h line 110
Quoted 5 lines
arch/powerpc/include/asm/config_mpc85xx.h +1
-0@@ -107,6 +107,7 @@#define CONFIG_MAX_CPUS 1#define CONFIG_FSL_SDHC_V2_3 #define CONFIG_SYS_FSL_NUM_LAWS 12 +#define CONFIG_DEBUGGER_TEMP_TLB 3
Undocumented!
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de If at first you don't succeed, you are running about average.
PATCH 3/4 powerpc/85xx:Update NOR code base to support debugger
Hi Wolfgang,
Quoted 13 lines · Wolfgang Denk
Dear Prabhakar Kushwaha,
Quoted 10 lines · In message<[email protected]> you…
Update the NOR code base to support NOR-boot debugging.
It ovecome e500 and e500v2's second limitation i.e. IVPR + IVOR15 should be valid fetchable OP code address.While executing in translated space (AS=1), whenever a debug exception is generated, the MSR[DS/IS] gets cleared and the processor tries to fetch an instruction from the debug exception vector (IVPR|IVOR15); since now we are in AS=0, the application needs to ensure the proper configuration to have IVOR|IVOR15 accessible from AS=0 also.
Quoted 6 lines
Quoted 2 lines
Signed-off-by Radu Lazarescu<[email protected]>Signed-off-by Prabhakar Kushwaha<[email protected]>...
arch/powerpc/cpu/mpc85xx/cpu_init_early.c void setup_ifc(void) · line 69
Quoted 2 lines
arch/powerpc/cpu/mpc85xx/cpu_init_early.c +2
-0+ _mas0 =MAS0_TLBSEL (1 ) | +MAS0_ESEL (CONFIG_DEBUGGER_TEMP_TLB );You are using an undocumented
CONFIG_option here.
This CONFIG_ is defined as part of documentation patch sent in this series
Quoted 8 lines
arch/powerpc/cpu/mpc85xx/start.S l2_disabled: · line 187
Quoted 6 lines
+++
b/arch/powerpc/cpu/mpc85xx/start.Sarch/powerpc/cpu/mpc85xx/start.S +1
-0@@ -184,6 +184,48 @@ l2_disabled: andi. r1,r3,L1CSR0_DCE at l beq 2b +#if defined(CONFIG_E500_V1_V2)&& !defined(CONFIG_SYS_RAMBOOT)What if no such debug support is needed, and code size hurts?
sure it will. I agree with you.
But this piece of code overcome debug restriction of e500 and e500v2 cores and I think fixing restriction is a good way to go.
Quoted 7 lines
arch/powerpc/include/asm/config_mpc85xx.h line 110
Quoted 5 lines
arch/powerpc/include/asm/config_mpc85xx.h +1
-0@@ -107,6 +107,7 @@#define CONFIG_MAX_CPUS 1#define CONFIG_FSL_SDHC_V2_3 #define CONFIG_SYS_FSL_NUM_LAWS 12 +#define CONFIG_DEBUGGER_TEMP_TLB 3Undocumented!
This CONFIG_ is defined as part of documentation patch sent in this series
--Prabhakar
PATCH 3/4 powerpc/85xx:Update NOR code base to support debugger
Dear Prabhakar Kushwaha,
Quoted 6 lines · In message <[email protected]> you wrote:
Quoted 4 lines
arch/powerpc/cpu/mpc85xx/cpu_init_early.c void setup_ifc(void) · line 69
Quoted 3 lines
arch/powerpc/cpu/mpc85xx/cpu_init_early.c +2
-0+ _mas0 =MAS0_TLBSEL (1 ) | +MAS0_ESEL (CONFIG_DEBUGGER_TEMP_TLB );You are using an undocumented
CONFIG_option here.This
CONFIG_is defined as part of documentation patch sent in this series
CONFIG_ options must be documented in the README.
Quoted 6 lines
Quoted 2 lines
Quoted 1 line
+#if defined(CONFIG_E500_V1_V2)&& !defined(CONFIG_SYS_RAMBOOT)
What if no such debug support is needed, and code size hurts?
sure it will. I agree with you.
But this piece of code overcome debug restriction of e500 and e500v2 cores and I think fixing restriction is a good way to go.
What do we do to disable this code if no debug support is needed, and the code size is considered critical?
Quoted 4 lines
Quoted 3 lines
Quoted 1 line
+#define
CONFIG_DEBUGGER_TEMP_TLB3Undocumented!
This
CONFIG_is defined as part of documentation patch sent in this series
This is not sufficient, see above.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Virtue is a relative term. -- Spock, "Friday's Child", stardate 3499.1
PATCH 3/4 powerpc/85xx:Update NOR code base to support debugger
Hi Wolfgang,
Quoted 8 lines · Wolfgang Denk
Dear Prabhakar Kushwaha,
Quoted 4 lines · In message<[email protected]> you wrote:
Quoted 3 lines
arch/powerpc/cpu/mpc85xx/cpu_init_early.c void setup_ifc(void) · line 69
Quoted 2 lines
arch/powerpc/cpu/mpc85xx/cpu_init_early.c +2
-0+ _mas0 =MAS0_TLBSEL (1 ) | +MAS0_ESEL (CONFIG_DEBUGGER_TEMP_TLB );You are using an undocumented
CONFIG_option here.This
CONFIG_is defined as part of documentation patch sent in this series
CONFIG_options must be documented in the README.
Sure
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Quoted 1 line
+#if defined(CONFIG_E500_V1_V2)&& !defined(CONFIG_SYS_RAMBOOT)
What if no such debug support is needed, and code size hurts?
sure it will. I agree with you.
But this piece of code overcome debug restriction of e500 and e500v2 cores and I think fixing restriction is a good way to go.What do we do to disable this code if no debug support is needed, and the code size is considered critical?
i will put this piece of code under #if defined (CONFIG_DEBUGGER_TEMP_TLB).
This piece of code will only be enabled when someone wants debugging here. And the requirement is temporary TLB.
Quoted 5 lines
Quoted 4 lines
Quoted 3 lines
Quoted 1 line
+#define
CONFIG_DEBUGGER_TEMP_TLB3Undocumented!
This
CONFIG_is defined as part of documentation patch sent in this seriesThis is not sufficient, see above.
i will add the description.
Regards,
Prabhakar