Revert "powerpc/mpc85xx: SECURE BOOT - Bypass PAMU in case of secure boot"
Subsystems (2)
PATCH 1/2 Revert "powerpc/mpc85xx: SECURE BOOT - Bypass PAMU in case of secure boot"
This reverts commit 7cad2e38d61e27ea59fb7944f7e647e97ef292d3.
--- arch/powerpc/cpu/mpc85xx/cpu_init.c | 9 +-------- arch/powerpc/include/asm/immap_85xx.h | 1 - 2 files changed, 1 insertion(+), 9 deletions(-)
arch/powerpc/cpu/mpc85xx/cpu_init.c +1 -8
@@ -425,8 +425,7 @@ void fsl_erratum_a007212_workaround(void)ulong cpu_init_f (void ) {extern void m8560_cpm_reset (void ); -#if defined(CONFIG_SYS_DCSRBAR_PHYS ) || \ - (defined(CONFIG_SECURE_BOOT ) && defined(CONFIG_FSL_CORENET )) +#ifdef CONFIG_SYS_DCSRBAR_PHYS ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);#endif #if defined(CONFIG_SECURE_BOOT )
@@ -458,12 +457,6 @@ ulong cpu_init_f(void)#if defined(CONFIG_SYS_CPC_REINIT_F )disable_cpc_sram ();#endif - -#if defined(CONFIG_FSL_CORENET ) -/* Put PAMU in bypass mode */ -out_be32 (&gur->pamubypenr,FSL_CORENET_PAMU_BYPASS ); -#endif -#endif #ifdef CONFIG_CPM2
arch/powerpc/include/asm/immap_85xx.h +0 -1
@@ -1933,7 +1933,6 @@ defined(CONFIG_PPC_T1020) || defined(CONFIG_PPC_T1022)u8 res24[64 ];u32 pblsr;/* Preboot loader status */ u32 pamubypenr;/* PAMU bypass enable */ -#define FSL_CORENET_PAMU_BYPASS 0xffff0000u32 dmacr1;/* DMA control */ u8 res25[4 ];u32 gensr1;/* General status */
Signature · 1 line
1.8.1.4
PATCH 2/2 powerpc/SECURE_BOOT: Add PAMU driver
PAMU driver basic support for usage in Secure Boot. In secure boot PAMU is not in bypass mode. Hence to use any peripheral (SEC Job ring in our case), PAMU has to be configured.
The Header file pamu.h and few functions in driver have been derived from Freescale Libos.
--- arch/powerpc/cpu/mpc85xx/cpu_init.c | 9 + arch/powerpc/cpu/mpc8xxx/Makefile | 1 + arch/powerpc/cpu/mpc8xxx/fsl_pamu.c | 449 ++++++++++++++++++++++++++++++++++ arch/powerpc/cpu/mpc8xxx/pamu_table.c | 57 +++++ arch/powerpc/include/asm/fsl_pamu.h | 169 +++++++++++++ arch/powerpc/include/asm/immap_85xx.h | 18 ++ drivers/crypto/fsl/jr.c | 23 ++ 7 files changed, 726 insertions(+) create mode 100644 arch/powerpc/cpu/mpc8xxx/fsl_pamu.c create mode 100644 arch/powerpc/cpu/mpc8xxx/pamu_table.c create mode 100644 arch/powerpc/include/asm/fsl_pamu.h
arch/powerpc/cpu/mpc85xx/cpu_init.c +9 -0
@@ -30,6 +30,10 @@#ifdef CONFIG_FSL_CAAM #include <fsl_sec.h> #endif +#if defined(CONFIG_SECURE_BOOT ) && defined(CONFIG_FSL_CORENET ) +#include <asm/fsl_pamu.h> +#include <fsl_secboot_err.h> +#endif #ifdef CONFIG_SYS_QE_FMAN_FW_IN_NAND #include <nand.h> #include <errno.h>
@@ -933,6 +937,11 @@ int cpu_init_r(void)fman_enet_init ();#endif +#if defined(CONFIG_SECURE_BOOT ) && defined(CONFIG_FSL_CORENET ) +if (pamu_init () <0 ) +fsl_secboot_handle_error (ERROR_ESBC_PAMU_INIT ); +#endif +#ifdef CONFIG_FSL_CAAM sec_init ();#endif
arch/powerpc/cpu/mpc8xxx/Makefile +1 -0
@@ -24,5 +24,6 @@ obj-$(CONFIG_OF_LIBFDT) += fdt.o obj-$(CONFIG_FSL_LBC) += fsl_lbc.o obj-$(CONFIG_SYS_SRIO) += srio.o obj-$(CONFIG_FSL_LAW) += law.o +obj-$(CONFIG_FSL_CORENET) += fsl_pamu.o pamu_table.o endif
arch/powerpc/cpu/mpc8xxx/fsl_pamu.c new file +449 -0
449 lines not on this page · raw message
arch/powerpc/cpu/mpc8xxx/pamu_table.c new file +57 -0
57 lines not on this page · raw message
arch/powerpc/include/asm/fsl_pamu.h new file +169 -0
169 lines not on this page · raw message
arch/powerpc/include/asm/immap_85xx.h +18 -0
@@ -2770,6 +2770,21 @@ typedef struct ccsr_pme {u8 res4[0x400 ]; } ccsr_pme_t; +struct ccsr_pamu { +u32 ppbah; +u32 ppbal; +u32 pplah; +u32 pplal; +u32 spbah; +u32 spbal; +u32 splah; +u32 splal; +u32 obah; +u32 obal; +u32 olah; +u32 olal; +}; + #ifdef CONFIG_SYS_FSL_RAID_ENGINE struct ccsr_raide { u8 res0[0x543];
@@ -2850,6 +2865,7 @@ struct ccsr_pman {#define CONFIG_SYS_FSL_CORENET_SERDES4_OFFSET 0xED000#define CONFIG_SYS_FSL_CPC_OFFSET 0x10000#define CONFIG_SYS_FSL_SCFG_OFFSET 0xFC000 +#define CONFIG_SYS_FSL_PAMU_OFFSET 0x20000#define CONFIG_SYS_MPC85xx_DMA1_OFFSET 0x100000#define CONFIG_SYS_MPC85xx_DMA2_OFFSET 0x101000#define CONFIG_SYS_MPC85xx_DMA3_OFFSET 0x102000
@@ -3063,6 +3079,8 @@ struct ccsr_pman { (CONFIG_SYS_IMMR + CONFIG_SYS_FSL_FM2_OFFSET)#define CONFIG_SYS_FSL_SRIO_ADDR \ (CONFIG_SYS_IMMR + CONFIG_SYS_FSL_SRIO_OFFSET) +#define CONFIG_SYS_PAMU_ADDR \ + (CONFIG_SYS_IMMR + CONFIG_SYS_FSL_PAMU_OFFSET)#define CONFIG_SYS_PCI1_ADDR \ (CONFIG_SYS_IMMR + CONFIG_SYS_MPC85xx_PCI1_OFFSET)
drivers/crypto/fsl/jr.c +23 -0
@@ -12,6 +12,9 @@#include "jr.h" #include "jobdesc.h" #include "desc_constr.h" +#ifdef CONFIG_FSL_CORENET +#include <asm/fsl_pamu.h> +#endif #define CIRC_CNT (head, tail, size) (((head) - (tail)) & (size - 1))#define CIRC_SPACE (head, tail, size) CIRC_CNT((tail), (head) + 1, (size))
@@ -530,18 +533,38 @@ int sec_init(void)uint32_t mcr =sec_in32 (&sec->mcfgr);int ret =0 ; +#ifdef CONFIG_FSL_CORENET +uint32_t liodnr; +uint32_t liodn_ns; +uint32_t liodn_s; +#endif + mcr = (mcr & ~MCFGR_AWCACHE_MASK ) | (0x2 <<MCFGR_AWCACHE_SHIFT );#ifdef CONFIG_PHYS_64BIT mcr |= (1 <<MCFGR_PS_SHIFT );#endif sec_out32 (&sec->mcfgr, mcr); +#ifdef CONFIG_FSL_CORENET + liodnr =sec_in32 (&sec->jrliodnr[0 ].ls); + liodn_ns = (liodnr &JRNSLIODN_MASK ) >>JRNSLIODN_SHIFT ; + liodn_s = (liodnr &JRSLIODN_MASK ) >>JRSLIODN_SHIFT ; +#endif + ret =jr_init ();if (ret <0 ) {printf ("SEC initialization failed\n" );return -1 ; } +#ifdef CONFIG_FSL_CORENET + ret =sec_config_pamu_table (liodn_ns, liodn_s); +if (ret <0 ) +return -1 ; + +pamu_enable (); +#endif +if (get_rng_vid () >=4 ) {if (rng_init () <0 ) {printf ("RNG instantiation failed\n" );
Signature · 1 line
1.8.1.4
PATCH 2/2 powerpc/SECURE_BOOT: Add PAMU driver
Quoted 10 lines · Aneesh Bansal
PAMU driver basic support for usage in Secure Boot. In secure boot PAMU is not in bypass mode. Hence to use any peripheral (SEC Job ring in our case), PAMU has to be configured.
The Header file
pamu.hand few functions in driver have been derived from Freescale Libos.Signed-off-by Ruchika Gupta <[email protected]>Signed-off-by Aneesh Bansal <[email protected]>
[snip]
arch/powerpc/cpu/mpc8xxx/fsl_pamu.c line 172
Quoted 4 lines
arch/powerpc/cpu/mpc8xxx/fsl_pamu.c new file +4
-0+#ifdef DEBUG +printf ("sec_addr < end_addr is %llx < %llx\n" , sec_addr, + end_addr); +#endif
It seems like most DEBUG statements here are around printf's, please use debug() instead.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160114/fbbaf261/attachment.sig>
PATCH 1/2 Revert "powerpc/mpc85xx: SECURE BOOT - Bypass PAMU in case of secure boot"
In reply to Aneesh BansalQuoted 2 lines · Aneesh Bansal
This reverts commit
7cad2e38d61e27ea59fb7944f7e647e97ef292d3.
Could you please add some words in the commit message to explain the reason of this revert?
Quoted 39 lines
Signed-off-by Aneesh Bansal <[email protected]>CC Ruchika Gupta <[email protected]>--- arch/powerpc/cpu/mpc85xx/cpu_init.c | 9 +-------- arch/powerpc/include/asm/immap_85xx.h | 1 - 2 files changed, 1 insertion(+), 9 deletions(-)arch/powerpc/cpu/mpc85xx/cpu_init.c +1
-8@@ -425,8 +425,7 @@ void fsl_erratum_a007212_workaround(void)ulong cpu_init_f (void ) {extern void m8560_cpm_reset (void ); -#if defined(CONFIG_SYS_DCSRBAR_PHYS ) || \ - (defined(CONFIG_SECURE_BOOT ) && defined(CONFIG_FSL_CORENET )) +#ifdef CONFIG_SYS_DCSRBAR_PHYS ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);#endif #if defined(CONFIG_SECURE_BOOT )@@ -458,12 +457,6 @@ ulong cpu_init_f(void)#if defined(CONFIG_SYS_CPC_REINIT_F )disable_cpc_sram ();#endif - -#if defined(CONFIG_FSL_CORENET ) -/* Put PAMU in bypass mode */ -out_be32 (&gur->pamubypenr,FSL_CORENET_PAMU_BYPASS ); -#endif -#endif #ifdef CONFIG_CPM2 arch/powerpc/include/asm/immap_85xx.h +0
-0
arch/powerpc/include/asm/immap_85xx.h defined(CONFIG_PPC_T1020) || defined(CONFIG_PPC_T1022)
Quoted 8 lines
arch/powerpc/include/asm/immap_85xx.h +0
-2@@ -1933,7 +1933,6 @@ defined(CONFIG_PPC_T1020) || defined(CONFIG_PPC_T1022)u8 res24[64 ];u32 pblsr;/* Preboot loader status */ u32 pamubypenr;/* PAMU bypass enable */ -#define FSL_CORENET_PAMU_BYPASS 0xffff0000u32 dmacr1;/* DMA control */ u8 res25[4 ];u32 gensr1;/* General status */ --
Regards,
Bin
PATCH 1/2 Revert "powerpc/mpc85xx: SECURE BOOT - Bypass PAMU in case of secure boot"
In reply to Aneesh BansalDear Aneesh Bansal,
Quoted 1 line · In message <[email protected]> you wrote:
This reverts commit
7cad2e38d61e27ea59fb7944f7e647e97ef292d3.
Why?
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk 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 In C we had to code our own bugs, in C++ we can inherit them.
PATCH 1/2 Revert "powerpc/mpc85xx: SECURE BOOT - Bypass PAMU in case of secure boot"
Quoted 6 lines · Wolfgang Denk
Dear Aneesh Bansal,
Quoted 1 line · In message <[email protected]> you wrote:
This reverts commit
7cad2e38d61e27ea59fb7944f7e647e97ef292d3.Why?
A message is indeed missing, or perhaps simply folding this into 2/2 which in turn implements support for what the commit in question is bypassing. I would be fine with folding it in, btw.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160114/b033d709/attachment.sig>