imx: misc update and fix
v2 cover imx: misc update and fix
From: Peng Fan <[email protected]>
V2:
Update commit log for patch 21 Per Marek
This patchset includes some misc update and fix from NXP downstream
- i.MX8 SCU API usage correction
- Use ELE(EdgeLockSecure Enclave) public from NXP to replace S400 or Sentinel
- Secondary container support and header checking fix
- New ELE API to support secure fuse and lifecycle and DEK Blob
- Bootaux: update macro and support i.MX8
- i.MX8 AHAB code clean up to reuse common code
- ELE MU update
CI: https://source.denx.de/u-boot/custodians/u-boot-fsl-qoriq/-/pipelines/16469
Clement Faure (1):
imx: cmd_dek: add ELE DEK Blob generation support
Gaurav Jain (1):
imx: imx8: ahab: sha256: enable image verification using ARMv8 crypto
extension
Maximus Sun (1):
imx: priblob: Update to use structure
Nitin Garg (1):
imx: parse-container: Use malloc for container processing
Peng Fan (17):
imx: mach: correct SCU API usage
imx: toradex/apalis-imx8: correct SCU API usage
imx: toradex/colibri-imx8x: correct SCU API usage
imx: siemens/capricorn: correct SCU API usage
imx: advantech: correct SCU API usage
imx: congatec/cgtqmx8: correct SCU API usage
imx: scu_api: update to version 1.16 and add more APIs
imx: use generic name ele(EdgeLockSecure Enclave)
imx: parse-container: fix build warning
imx: ele_ahab: use hextoul
imx: ele_api: support program secure fuse and return lifecycle
imx: ele_api: add DEK Blob generation
imx: imx8ulp: start the ELE RNG at boot
imx: iamge-container: support secondary container
imx: bootaux: change names of MACROs used to boot MCU on iMX devices
imx: imx8m: clock: not configure reserved SRC register
imx: imx8m: add CAAM_BASE_ADDR
Utkarsh Gupta (1):
imx: fsl_sec: preprocessor casting issue with addresses involving math
Ye Li (8):
imx: cmd_dek: Fix Uninitialized pointer read
imx: misc: ele_mu: Update MU TR registers count
imx: misc: ele_mu: Update ELE MU driver
imx: hab: Fix coverity issue in HAB event decoding
imx: image-container: Fix container header checking
imx: bootaux: Fix bootaux issue when running on ARM64
imx: imx8: bootaux: Add i.MX8 M4 boot support
imx: ahab: Update AHAB for iMX8 and iMX8ULP
arch/arm/Kconfig | 4 +-
arch/arm/include/asm/arch-imx8m/imx-regs.h | 3 +-
arch/arm/include/asm/arch-imx9/ccm_regs.h | 2 +-
arch/arm/include/asm/arch-mx6/imx-regs.h | 2 +-
arch/arm/include/asm/arch-mx7/imx-regs.h | 2 +-
arch/arm/include/asm/global_data.h | 4 +-
arch/arm/include/asm/mach-imx/ahab.h | 15 +
.../asm/mach-imx/{s400_api.h => ele_api.h} | 53 +--
arch/arm/include/asm/mach-imx/sys_proto.h | 1 +
arch/arm/mach-imx/Kconfig | 9 +-
arch/arm/mach-imx/Makefile | 5 +
arch/arm/mach-imx/cmd_dek.c | 89 ++++-
arch/arm/mach-imx/ele_ahab.c | 91 ++++-
arch/arm/mach-imx/hab.c | 41 ++-
arch/arm/mach-imx/image-container.c | 96 ++++-
arch/arm/mach-imx/imx8/ahab.c | 161 ++++++---
arch/arm/mach-imx/imx8/cpu.c | 180 +++++++++-
arch/arm/mach-imx/imx8/fdt.c | 2 +-
arch/arm/mach-imx/imx8/snvs_security_sc.c | 175 +++++----
arch/arm/mach-imx/imx8m/clock_imx8mm.c | 1 -
arch/arm/mach-imx/imx8ulp/Makefile | 1 -
arch/arm/mach-imx/imx8ulp/rdc.c | 18 +-
arch/arm/mach-imx/imx8ulp/soc.c | 16 +-
arch/arm/mach-imx/imx8ulp/upower/upower_hal.c | 6 +-
arch/arm/mach-imx/imx9/clock.c | 8 +-
arch/arm/mach-imx/imx9/clock_root.c | 2 +-
arch/arm/mach-imx/imx9/imx_bootaux.c | 6 +-
arch/arm/mach-imx/imx9/soc.c | 16 +-
arch/arm/mach-imx/imx9/trdc.c | 14 +-
arch/arm/mach-imx/imx_bootaux.c | 45 ++-
arch/arm/mach-imx/parse-container.c | 119 ++-----
arch/arm/mach-imx/priblob.c | 10 +-
board/advantech/imx8qm_dmsse20_a1/spl.c | 6 +-
board/advantech/imx8qm_rom7720_a1/spl.c | 6 +-
board/congatec/cgtqmx8/cgtqmx8.c | 8 +-
board/freescale/imx8ulp_evk/spl.c | 20 +-
board/freescale/imx93_evk/spl.c | 1 -
board/kontron/sl-mx8mm/sl-mx8mm.c | 2 +-
board/kontron/sl-mx8mm/spl.c | 2 +-
board/siemens/capricorn/board.c | 12 +-
board/technexion/pico-imx8mq/pico-imx8mq.c | 2 +-
board/technexion/pico-imx8mq/spl.c | 2 +-
board/toradex/apalis-imx8/apalis-imx8.c | 10 +-
board/toradex/colibri-imx8x/colibri-imx8x.c | 10 +-
drivers/misc/Kconfig | 4 +-
drivers/misc/Makefile | 2 +-
drivers/misc/imx8/scu_api.c | 78 ++++
drivers/misc/{sentinel => imx_ele}/Makefile | 2 +-
.../s400_api.c => imx_ele/ele_api.c} | 333 ++++++++++++------
.../{sentinel/s4mu.c => imx_ele/ele_mu.c} | 38 +-
drivers/misc/{sentinel => imx_ele}/fuse.c | 40 +--
.../power/domain/imx8-power-domain-legacy.c | 9 +-
include/firmware/imx/sci/rpc.h | 27 +-
include/firmware/imx/sci/sci.h | 24 ++
include/firmware/imx/sci/svc/misc/api.h | 42 ++-
include/firmware/imx/sci/svc/pm/api.h | 94 +++++
include/firmware/imx/sci/svc/rm/api.h | 14 +-
include/firmware/imx/sci/svc/seco/api.h | 5 +-
include/firmware/imx/sci/svc/timer/api.h | 33 ++
include/fsl_sec.h | 4 +-
include/imx_sip.h | 6 +-
61 files changed, 1446 insertions(+), 587 deletions(-)
create mode 100644 arch/arm/include/asm/mach-imx/ahab.h
rename arch/arm/include/asm/mach-imx/{s400_api.h => ele_api.h} (74%)
rename drivers/misc/{sentinel => imx_ele}/Makefile (71%)
rename drivers/misc/{sentinel/s400_api.c => imx_ele/ele_api.c} (50%)
rename drivers/misc/{sentinel/s4mu.c => imx_ele/ele_mu.c} (85%)
rename drivers/misc/{sentinel => imx_ele}/fuse.c (84%)
create mode 100644 include/firmware/imx/sci/svc/timer/api.hSignature · 1 line
2.40.0
PATCH v2 1/30 imx: mach: correct SCU API usage
From: Peng Fan <[email protected]>
The return value is int type, not sc_err_t(u8), correct the usage.
--- arch/arm/mach-imx/cmd_dek.c | 2 +- arch/arm/mach-imx/imx8/ahab.c | 10 +- arch/arm/mach-imx/imx8/cpu.c | 6 +- arch/arm/mach-imx/imx8/fdt.c | 2 +- arch/arm/mach-imx/imx8/snvs_security_sc.c | 175 +++++++++--------- .../power/domain/imx8-power-domain-legacy.c | 9 +- 6 files changed, 98 insertions(+), 106 deletions(-)
arch/arm/mach-imx/cmd_dek.c +1 -1
@@ -154,7 +154,7 @@ error:static int blob_encap_dek (u32 src_addr,u32 dst_addr,u32 len) { -sc_err_t err; +int err;sc_rm_mr_t mr_input, mr_output;struct generate_key_blob_hdr hdr;u8 in_size, out_size;
arch/arm/mach-imx/imx8/ahab.c +5 -5
@@ -147,7 +147,7 @@ int authenticate_os_container(ulong addr) } exit: -if (sc_seco_authenticate (-1 ,SC_SECO_REL_CONTAINER ,0 ) !=SC_ERR_NONE ) +if (sc_seco_authenticate (-1 ,SC_SECO_REL_CONTAINER ,0 ))printf ("Error: release container failed!\n" );return ret;
@@ -263,7 +263,7 @@ static int do_ahab_status(struct cmd_tbl *cmdtp, int flag, int argc,u16 lc; err =sc_seco_chip_info (-1 , &lc,NULL ,NULL ,NULL ); -if (err !=SC_ERR_NONE ) { +if (err) {printf ("Error in get lifecycle\n" );return -EIO ; }
@@ -271,7 +271,7 @@ static int do_ahab_status(struct cmd_tbl *cmdtp, int flag, int argc,display_life_cycle (lc); err =sc_seco_get_event (-1 , idx, &event); -while (err ==SC_ERR_NONE ) { +while (!err) {printf ("SECO Event[%u] = 0x%08X\n" , idx, event);display_ahab_auth_event (event);
@@ -312,7 +312,7 @@ static int do_ahab_close(struct cmd_tbl *cmdtp, int flag, int argc,return -EACCES ; err =sc_seco_chip_info (-1 , &lc,NULL ,NULL ,NULL ); -if (err !=SC_ERR_NONE ) { +if (err) {printf ("Error in get lifecycle\n" );return -EIO ; }
@@ -324,7 +324,7 @@ static int do_ahab_close(struct cmd_tbl *cmdtp, int flag, int argc, } err =sc_seco_forward_lifecycle (-1 ,16 ); -if (err !=SC_ERR_NONE ) { +if (err) {printf ("Error in forward lifecycle to OEM closed\n" );return -EIO ; }
arch/arm/mach-imx/imx8/cpu.c +3 -3
@@ -195,7 +195,7 @@ enum boot_device get_boot_device(void)#define FUSE_UNIQUE_ID_WORD1 17void get_board_serial (struct tag_serialnr *serialnr) { -sc_err_t err; +int err;u32 val1 =0 , val2 =0 ;u32 word1, word2;
@@ -206,13 +206,13 @@ void get_board_serial(struct tag_serialnr *serialnr) word2 =FUSE_UNIQUE_ID_WORD1 ; err =sc_misc_otp_fuse_read (-1 , word1, &val1); -if (err !=SC_ERR_NONE ) { +if (err) {printf ("%s fuse %d read error: %d\n" , __func__, word1, err);return ; } err =sc_misc_otp_fuse_read (-1 , word2, &val2); -if (err !=SC_ERR_NONE ) { +if (err) {printf ("%s fuse %d read error: %d\n" , __func__, word2, err);return ; }
arch/arm/mach-imx/imx8/fdt.c +1 -1
@@ -110,7 +110,7 @@ static int config_smmu_resource_sid(int rsrc, int sid) err =sc_rm_set_master_sid (-1 , rsrc, sid);debug ("set_master_sid rsrc=%d sid=0x%x err=%d\n" , rsrc, sid, err); -if (err !=SC_ERR_NONE ) { +if (err) {if (!check_owned_resource (rsrc)) {printf ("%s rsrc[%d] not owned\n" , __func__, rsrc);return -1 ;
arch/arm/mach-imx/imx8/snvs_security_sc.c +84 -91
337 lines not on this page · raw message
drivers/power/domain/imx8-power-domain-legacy.c +4 -5
@@ -89,7 +89,6 @@ static int imx8_power_domain_on(struct power_domain *power_domain)struct udevice *dev = power_domain->dev;struct imx8_power_domain_plat *pdata;struct imx8_power_domain_priv *ppriv; -sc_err_t ret;int err;struct power_domain parent_domain;
@@ -117,11 +116,11 @@ static int imx8_power_domain_on(struct power_domain *power_domain)if (!sc_rm_is_resource_owned (-1 , pdata->resource_id))printf ("%s [%d] not owned by curr partition\n" , dev->name, pdata->resource_id); - ret =sc_pm_set_resource_power_mode (-1 , pdata->resource_id, + err =sc_pm_set_resource_power_mode (-1 , pdata->resource_id,SC_PM_PW_MODE_ON ); -if (ret) { +if (err) {printf ("Error: %s Power up failed! (error = %d)\n" , - dev->name, ret); + dev->name, err);return -EIO ; } }
@@ -139,7 +138,7 @@ static int imx8_power_domain_off_node(struct power_domain *power_domain)struct imx8_power_domain_priv *ppriv;struct imx8_power_domain_priv *child_ppriv;struct imx8_power_domain_plat *pdata; -sc_err_t ret; +int ret; ppriv =dev_get_priv (dev); pdata =dev_get_plat (dev);
Signature · 1 line
2.40.0
PATCH v2 1/30 imx: mach: correct SCU API usage
Quoted 3 lines
From: Peng Fan <[email protected]>
The return value is int type, notsc_err_t(u8), correct the usage.Signed-off-by Peng Fan <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected] =====================================================================
PATCH v2 2/30 imx: toradex/apalis-imx8: correct SCU API usage
In reply to Peng Fan (OSS)From: Peng Fan <[email protected]>
The return value is int type, not sc_err_t(u8), correct the usage.
--- board/toradex/apalis-imx8/apalis-imx8.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
board/toradex/apalis-imx8/apalis-imx8.c +5 -5
@@ -85,18 +85,18 @@ static void setup_iomux_uart(void)static uint32_t do_get_tdx_user_fuse (int a,int b) { -sc_err_t sciErr; +int sciErr;u32 val_a =0 ;u32 val_b =0 ; sciErr =sc_misc_otp_fuse_read (-1 , a, &val_a); -if (sciErr !=SC_ERR_NONE ) { +if (sciErr) {printf ("Error reading out user fuse %d\n" , a);return 0 ; } sciErr =sc_misc_otp_fuse_read (-1 , b, &val_b); -if (sciErr !=SC_ERR_NONE ) { +if (sciErr) {printf ("Error reading out user fuse %d\n" , b);return 0 ; }
@@ -131,9 +131,9 @@ void board_mem_get_layout(u64 *phys_sdram_1_start, {u32 is_quadplus =0 , val =0 ;struct tdx_user_fuses tdxramfuses; -sc_err_t scierr =sc_misc_otp_fuse_read (-1 ,6 , &val); +int scierr =sc_misc_otp_fuse_read (-1 ,6 , &val); -if (scierr ==SC_ERR_NONE ) { +if (scierr) {/* QP has one A72 core disabled */ is_quadplus = ((val >>4 ) &0x3 ) !=0x0 ; }
Signature · 1 line
2.40.0
PATCH v2 2/30 imx: toradex/apalis-imx8: correct SCU API usage
Quoted 3 lines
From: Peng Fan <[email protected]>
The return value is int type, notsc_err_t(u8), correct the usage.Signed-off-by Peng Fan <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected] =====================================================================
PATCH v2 3/30 imx: toradex/colibri-imx8x: correct SCU API usage
In reply to Peng Fan (OSS)From: Peng Fan <[email protected]>
The return value is int type, not sc_err_t(u8), correct the usage.
--- board/toradex/colibri-imx8x/colibri-imx8x.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
board/toradex/colibri-imx8x/colibri-imx8x.c +5 -5
@@ -43,9 +43,9 @@ static void setup_iomux_uart(void)static int is_imx8dx (void ) {u32 val =0 ; -sc_err_t sc_err =sc_misc_otp_fuse_read (-1 ,6 , &val); +int sc_err =sc_misc_otp_fuse_read (-1 ,6 , &val); -if (sc_err ==SC_ERR_NONE ) { +if (sc_err) {/* DX has two A35 cores disabled */ return (val &0xf ) !=0x0 ; }
@@ -70,7 +70,7 @@ void board_mem_get_layout(u64 *phys_sdram_1_start,int board_early_init_f (void ) {sc_pm_clock_rate_t rate; -sc_err_t err =0 ; +int err;/* * This works around that having only UART3 up the baudrate is 1.2M
@@ -78,13 +78,13 @@ int board_early_init_f(void)*/ rate =80000000 ; err =sc_pm_set_clock_rate (-1 ,SC_R_UART_0 ,SC_PM_CLK_PER , &rate); -if (err !=SC_ERR_NONE ) +if (err)return 0 ;/* Set UART3 clock root to 80 MHz and enable it */ rate =SC_80MHZ ; err =sc_pm_setup_uart (SC_R_UART_3 , rate); -if (err !=SC_ERR_NONE ) +if (err)return 0 ;setup_iomux_uart ();
Signature · 1 line
2.40.0
PATCH v2 3/30 imx: toradex/colibri-imx8x: correct SCU API usage
Quoted 3 lines
From: Peng Fan <[email protected]>
The return value is int type, notsc_err_t(u8), correct the usage.Signed-off-by Peng Fan <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected] =====================================================================
PATCH v2 4/30 imx: siemens/capricorn: correct SCU API usage
In reply to Peng Fan (OSS)From: Peng Fan <[email protected]>
The return value is int type, not sc_err_t(u8), correct the usage.
--- board/siemens/capricorn/board.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
board/siemens/capricorn/board.c +6 -6
@@ -147,7 +147,7 @@ static void enet_device_phy_reset(void)int setup_gpr_fec (void ) {sc_ipc_t ipc_handle =-1 ; -sc_err_t err =0 ; +int err =0 ;unsigned int test;/*
@@ -175,35 +175,35 @@ int setup_gpr_fec(void)*/ err =sc_misc_set_control (ipc_handle,SC_R_ENET_1 ,SC_C_TXCLK ,1 ); -if (err !=SC_ERR_NONE ) +if (err)printf ("Error in setting up SC_C %d\n\r" ,SC_C_TXCLK );sc_misc_get_control (ipc_handle,SC_R_ENET_1 ,SC_C_TXCLK , &test);debug ("TEST SC_C %d-->%d\n\r" ,SC_C_TXCLK , test); err =sc_misc_set_control (ipc_handle,SC_R_ENET_1 ,SC_C_CLKDIV ,0 ); -if (err !=SC_ERR_NONE ) +if (err)printf ("Error in setting up SC_C %d\n\r" ,SC_C_CLKDIV );sc_misc_get_control (ipc_handle,SC_R_ENET_1 ,SC_C_CLKDIV , &test);debug ("TEST SC_C %d-->%d\n\r" ,SC_C_CLKDIV , test); err =sc_misc_set_control (ipc_handle,SC_R_ENET_1 ,SC_C_DISABLE_50 ,0 ); -if (err !=SC_ERR_NONE ) +if (err)printf ("Error in setting up SC_C %d\n\r" ,SC_C_DISABLE_50 );sc_misc_get_control (ipc_handle,SC_R_ENET_1 ,SC_C_TXCLK , &test);debug ("TEST SC_C %d-->%d\n\r" ,SC_C_DISABLE_50 , test); err =sc_misc_set_control (ipc_handle,SC_R_ENET_1 ,SC_C_DISABLE_125 ,1 ); -if (err !=SC_ERR_NONE ) +if (err)printf ("Error in setting up SC_C %d\n\r" ,SC_C_DISABLE_125 );sc_misc_get_control (ipc_handle,SC_R_ENET_1 ,SC_C_TXCLK , &test);debug ("TEST SC_C %d-->%d\n\r" ,SC_C_DISABLE_125 , test); err =sc_misc_set_control (ipc_handle,SC_R_ENET_1 ,SC_C_SEL_125 ,1 ); -if (err !=SC_ERR_NONE ) +if (err)printf ("Error in setting up SC_C %d\n\r" ,SC_C_SEL_125 );sc_misc_get_control (ipc_handle,SC_R_ENET_1 ,SC_C_SEL_125 , &test);
Signature · 1 line
2.40.0
PATCH v2 4/30 imx: siemens/capricorn: correct SCU API usage
Quoted 3 lines
From: Peng Fan <[email protected]>
The return value is int type, notsc_err_t(u8), correct the usage.Signed-off-by Peng Fan <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected] =====================================================================
PATCH v2 5/30 imx: advantech: correct SCU API usage
In reply to Peng Fan (OSS)From: Peng Fan <[email protected]>
The return value is int type, not sc_err_t(u8), correct the usage.
--- board/advantech/imx8qm_dmsse20_a1/spl.c | 6 +++--- board/advantech/imx8qm_rom7720_a1/spl.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-)
board/advantech/imx8qm_dmsse20_a1/spl.c +3 -3
@@ -111,7 +111,7 @@ int board_mmc_init(struct bd_info *bis)switch (i) {case 0 : ret =sc_pm_set_resource_power_mode (-1 ,SC_R_SDHC_0 ,SC_PM_PW_MODE_ON ); -if (ret !=SC_ERR_NONE ) +if (ret)return ret;imx8_iomux_setup_multiple_pads (emmc0,ARRAY_SIZE (emmc0));
@@ -120,10 +120,10 @@ int board_mmc_init(struct bd_info *bis)break ;case 1 : ret =sc_pm_set_resource_power_mode (-1 ,SC_R_SDHC_2 ,SC_PM_PW_MODE_ON ); -if (ret !=SC_ERR_NONE ) +if (ret)return ret; ret =sc_pm_set_resource_power_mode (-1 ,SC_R_GPIO_4 ,SC_PM_PW_MODE_ON ); -if (ret !=SC_ERR_NONE ) +if (ret)return ret;imx8_iomux_setup_multiple_pads (usdhc2_sd,ARRAY_SIZE (usdhc2_sd));
board/advantech/imx8qm_rom7720_a1/spl.c +3 -3
@@ -112,7 +112,7 @@ int board_mmc_init(struct bd_info *bis)switch (i) {case 0 : ret =sc_pm_set_resource_power_mode (-1 ,SC_R_SDHC_0 ,SC_PM_PW_MODE_ON ); -if (ret !=SC_ERR_NONE ) +if (ret)return ret;imx8_iomux_setup_multiple_pads (emmc0,ARRAY_SIZE (emmc0));
@@ -121,10 +121,10 @@ int board_mmc_init(struct bd_info *bis)break ;case 1 : ret =sc_pm_set_resource_power_mode (-1 ,SC_R_SDHC_2 ,SC_PM_PW_MODE_ON ); -if (ret !=SC_ERR_NONE ) +if (ret)return ret; ret =sc_pm_set_resource_power_mode (-1 ,SC_R_GPIO_4 ,SC_PM_PW_MODE_ON ); -if (ret !=SC_ERR_NONE ) +if (ret)return ret;imx8_iomux_setup_multiple_pads (usdhc2_sd,ARRAY_SIZE (usdhc2_sd));
Signature · 1 line
2.40.0
PATCH v2 5/30 imx: advantech: correct SCU API usage
Quoted 5 lines
From: Peng Fan <[email protected]>
The return value is int type, notsc_err_t(u8), correct the usage.Signed-off-by Peng Fan <[email protected]>Tested-by Oliver Graute <[email protected]>Reviewed-by Oliver Graute <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected] =====================================================================
PATCH v2 6/30 imx: congatec/cgtqmx8: correct SCU API usage
In reply to Peng Fan (OSS)From: Peng Fan <[email protected]>
The return value is int type, not sc_err_t(u8), correct the usage.
--- board/congatec/cgtqmx8/cgtqmx8.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
board/congatec/cgtqmx8/cgtqmx8.c +4 -4
@@ -79,7 +79,7 @@ static void setup_iomux_uart(void)int board_early_init_f (void ) {/* sc_ipc_t ipcHndl = 0; */ -sc_err_t scierr =0 ; +int scierr;/* When start u-boot in XEN VM, directly return */ /* if (IS_ENABLED(CONFIG_XEN)) */
@@ -89,19 +89,19 @@ int board_early_init_f(void)/* Power up UART0, this is very early while power domain is not working */ scierr =sc_pm_set_resource_power_mode (-1 ,SC_R_UART_0 ,SC_PM_PW_MODE_ON ); -if (scierr !=SC_ERR_NONE ) +if (scierr)return 0 ;/* Set UART0 clock root to 80 MHz */ sc_pm_clock_rate_t rate =80000000 ; scierr =sc_pm_set_clock_rate (-1 ,SC_R_UART_0 ,2 , &rate); -if (scierr !=SC_ERR_NONE ) +if (scierr)return 0 ;/* Enable UART0 clock root */ scierr =sc_pm_clock_enable (-1 ,SC_R_UART_0 ,2 , true, false); -if (scierr !=SC_ERR_NONE ) +if (scierr)return 0 ;setup_iomux_uart ();
Signature · 1 line
2.40.0
PATCH v2 6/30 imx: congatec/cgtqmx8: correct SCU API usage
Quoted 5 lines
From: Peng Fan <[email protected]>
The return value is int type, notsc_err_t(u8), correct the usage.Signed-off-by Peng Fan <[email protected]>Tested-by Oliver Graute <[email protected]>Reviewed-by Oliver Graute <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected] =====================================================================
PATCH v2 7/30 imx: scu_api: update to version 1.16 and add more APIs
In reply to Peng Fan (OSS)From: Peng Fan <[email protected]>
Upgrade SCFW API to 1.16
Add more APIs:
sc_misc_get_button_status
sc_pm_reboot
sc_seco_v2x_build_info
--- drivers/misc/imx8/scu_api.c | 78 ++++++++++++++++++++ include/firmware/imx/sci/rpc.h | 27 ++++--- include/firmware/imx/sci/sci.h | 24 ++++++ include/firmware/imx/sci/svc/misc/api.h | 42 ++++++++--- include/firmware/imx/sci/svc/pm/api.h | 94 ++++++++++++++++++++++++ include/firmware/imx/sci/svc/rm/api.h | 14 ++-- include/firmware/imx/sci/svc/seco/api.h | 5 +- include/firmware/imx/sci/svc/timer/api.h | 33 +++++++++ 8 files changed, 287 insertions(+), 30 deletions(-) create mode 100644 include/firmware/imx/sci/svc/timer/api.h
drivers/misc/imx8/scu_api.c +78 -0
@@ -481,6 +481,22 @@ int sc_misc_get_temp(sc_ipc_t ipc, sc_rsrc_t resource, sc_misc_temp_t temp,return 0 ; } +void sc_misc_get_button_status (sc_ipc_t ipc,sc_bool_t *status) +{ +struct sc_rpc_msg_s msg; +struct udevice *dev = gd->arch.scu_dev; + +RPC_VER (&msg) =SC_RPC_VERSION ; +RPC_SIZE (&msg) =1U ; +RPC_SVC (&msg) = (u8)(SC_RPC_SVC_MISC ); +RPC_FUNC (&msg) = (u8)(MISC_FUNC_GET_BUTTON_STATUS ); + +misc_call (dev,SC_FALSE , &msg,1U , &msg,1U ); + +if (status) + *status = (sc_bool_t)(!!(RPC_U8 (&msg,0U ))); +} +/* RM */ sc_bool_t sc_rm_is_memreg_owned (sc_ipc_t ipc,sc_rm_mr_t mr) {
@@ -851,6 +867,21 @@ int sc_pm_cpu_start(sc_ipc_t ipc, sc_rsrc_t resource, sc_bool_t enable,return ret; } +void sc_pm_reboot (sc_ipc_t ipc,sc_pm_reset_type_t type) +{ +struct udevice *dev = gd->arch.scu_dev; +struct sc_rpc_msg_s msg; +int size =sizeof (struct sc_rpc_msg_s ); + +RPC_VER (&msg) =SC_RPC_VERSION ; +RPC_SVC (&msg) = (u8)(SC_RPC_SVC_PM ); +RPC_FUNC (&msg) = (u8)(PM_FUNC_REBOOT ); +RPC_U8 (&msg,0U ) = (u8)(type); +RPC_SIZE (&msg) =2U ; + +misc_call (dev,SC_TRUE , &msg, size, &msg, size); +} +int sc_pm_get_resource_power_mode (sc_ipc_t ipc,sc_rsrc_t resource,sc_pm_power_mode_t *mode) {
@@ -877,6 +908,28 @@ int sc_pm_get_resource_power_mode(sc_ipc_t ipc, sc_rsrc_t resource,return ret; } +int sc_timer_set_wdog_window (sc_ipc_t ipc,sc_timer_wdog_time_t window) +{ +struct udevice *dev = gd->arch.scu_dev; +struct sc_rpc_msg_s msg; +int size =sizeof (struct sc_rpc_msg_s ); +int ret; + +RPC_VER (&msg) =SC_RPC_VERSION ; +RPC_SIZE (&msg) =2U ; +RPC_SVC (&msg) = (u8)(SC_RPC_SVC_TIMER ); +RPC_FUNC (&msg) = (u8)(TIMER_FUNC_SET_WDOG_WINDOW ); + +RPC_U32 (&msg,0U ) = (u32)(window); + + ret =misc_call (dev,SC_FALSE , &msg, size, &msg, size); +if (ret) +printf ("%s: window:%u: res:%d\n" , + __func__, window,RPC_R8 (&msg)); + +return ret; +} +int sc_seco_authenticate (sc_ipc_t ipc,sc_seco_auth_cmd_t cmd,sc_faddr_t addr) {
@@ -974,6 +1027,31 @@ void sc_seco_build_info(sc_ipc_t ipc, u32 *version, u32 *commit) *commit =RPC_U32 (&msg,4U ); } +int sc_seco_v2x_build_info (sc_ipc_t ipc,u32 *version,u32 *commit) +{ +struct udevice *dev = gd->arch.scu_dev; +struct sc_rpc_msg_s msg; +int size =sizeof (struct sc_rpc_msg_s ); +int ret; + +RPC_VER (&msg) =SC_RPC_VERSION ; +RPC_SIZE (&msg) =1U ; +RPC_SVC (&msg) = (u8)(SC_RPC_SVC_SECO ); +RPC_FUNC (&msg) = (u8)(SECO_FUNC_V2X_BUILD_INFO ); + + ret =misc_call (dev,SC_FALSE , &msg, size, &msg, size); +if (ret) +printf ("%s: res:%d\n" , __func__,RPC_R8 (&msg)); + +if (version) + *version =RPC_U32 (&msg,0U ); + +if (commit) + *commit =RPC_U32 (&msg,4U ); + +return ret; +} +int sc_seco_get_event (sc_ipc_t ipc,u8 idx,u32 *event) {struct udevice *dev = gd->arch.scu_dev;
include/firmware/imx/sci/rpc.h +16 -11
@@ -23,12 +23,12 @@#define RPC_FUNC (MSG ) ((MSG)->func)#define RPC_R8 (MSG ) ((MSG)->func)#define RPC_I64 (MSG ,IDX ) ((s64)(RPC_U32((MSG), (IDX))) << 32ULL) | \ - (s64)(RPC_U32((MSG), (IDX) + 4U)) + (s64)(RPC_U32((MSG), (IDX) + 4U))#define RPC_I32 (MSG ,IDX ) ((MSG)->DATA.i32[(IDX) / 4U])#define RPC_I16 (MSG ,IDX ) ((MSG)->DATA.i16[(IDX) / 2U])#define RPC_I8 (MSG ,IDX ) ((MSG)->DATA.i8[(IDX)])#define RPC_U64 (MSG ,IDX ) ((u64)(RPC_U32((MSG), (IDX))) << 32ULL) | \ - (u64)(RPC_U32((MSG), (IDX) + 4U)) + (u64)(RPC_U32((MSG), (IDX) + 4U))#define RPC_U32 (MSG ,IDX ) ((MSG)->DATA.u32[(IDX) / 4U])#define RPC_U16 (MSG ,IDX ) ((MSG)->DATA.u16[(IDX) / 2U])#define RPC_U8 (MSG ,IDX ) ((MSG)->DATA.u8[(IDX)])
@@ -67,7 +67,9 @@ struct sc_rpc_msg_s {#define PM_FUNC_SET_SYS_POWER_MODE 19U#define PM_FUNC_SET_PARTITION_POWER_MODE 1U#define PM_FUNC_GET_SYS_POWER_MODE 2U +#define PM_FUNC_PARTITION_WAKE 28U#define PM_FUNC_SET_RESOURCE_POWER_MODE 3U +#define PM_FUNC_SET_RESOURCE_POWER_MODE_ALL 22U#define PM_FUNC_GET_RESOURCE_POWER_MODE 4U#define PM_FUNC_REQ_LOW_POWER_MODE 16U#define PM_FUNC_REQ_CPU_LOW_POWER_MODE 20U
@@ -81,13 +83,16 @@ struct sc_rpc_msg_s {#define PM_FUNC_GET_CLOCK_PARENT 15U#define PM_FUNC_RESET 13U#define PM_FUNC_RESET_REASON 10U +#define PM_FUNC_GET_RESET_PART 26U#define PM_FUNC_BOOT 8U +#define PM_FUNC_SET_BOOT_PARM 27U#define PM_FUNC_REBOOT 9U#define PM_FUNC_REBOOT_PARTITION 12U +#define PM_FUNC_REBOOT_CONTINUE 25U#define PM_FUNC_CPU_START 11U#define PM_FUNC_CPU_RESET 23U#define PM_FUNC_RESOURCE_RESET 29U -#define PM_FUNC_IS_PARTITION_STARTED 24U +#define PM_FUNC_IS_PARTITION_STARTED 24U/* MISC RPC */ #define MISC_FUNC_UNKNOWN 0
@@ -95,16 +100,10 @@ struct sc_rpc_msg_s {#define MISC_FUNC_GET_CONTROL 2U#define MISC_FUNC_SET_MAX_DMA_GROUP 4U#define MISC_FUNC_SET_DMA_GROUP 5U -#define MISC_FUNC_SECO_IMAGE_LOAD 8U -#define MISC_FUNC_SECO_AUTHENTICATE 9U -#define MISC_FUNC_SECO_FUSE_WRITE 20U -#define MISC_FUNC_SECO_ENABLE_DEBUG 21U -#define MISC_FUNC_SECO_FORWARD_LIFECYCLE 22U -#define MISC_FUNC_SECO_RETURN_LIFECYCLE 23U -#define MISC_FUNC_SECO_BUILD_INFO 24U#define MISC_FUNC_DEBUG_OUT 10U#define MISC_FUNC_WAVEFORM_CAPTURE 6U#define MISC_FUNC_BUILD_INFO 15U +#define MISC_FUNC_API_VER 35U#define MISC_FUNC_UNIQUE_ID 19U#define MISC_FUNC_SET_ARI 3U#define MISC_FUNC_BOOT_STATUS 7U
@@ -114,8 +113,11 @@ struct sc_rpc_msg_s {#define MISC_FUNC_SET_TEMP 12U#define MISC_FUNC_GET_TEMP 13U#define MISC_FUNC_GET_BOOT_DEV 16U +#define MISC_FUNC_GET_BOOT_TYPE 33U +#define MISC_FUNC_GET_BOOT_CONTAINER 36U#define MISC_FUNC_GET_BUTTON_STATUS 18U -#define MISC_FUNC_GET_BOOT_CONTAINER 36U +#define MISC_FUNC_ROMPATCH_CHECKSUM 26U +#define MISC_FUNC_BOARD_IOCTL 34U/* PAD RPC */ #define PAD_FUNC_UNKNOWN 0
@@ -160,6 +162,7 @@ struct sc_rpc_msg_s {#define RM_FUNC_GET_RESOURCE_INFO 16U#define RM_FUNC_MEMREG_ALLOC 17U#define RM_FUNC_MEMREG_SPLIT 29U +#define RM_FUNC_MEMREG_FRAG 32U#define RM_FUNC_MEMREG_FREE 18U#define RM_FUNC_FIND_MEMREG 30U#define RM_FUNC_ASSIGN_MEMREG 19U
@@ -190,6 +193,7 @@ struct sc_rpc_msg_s {#define SECO_FUNC_UPDATE_MPMR 14U/* Index for seco_update_mpmr() RPC call */ #define SECO_FUNC_GET_MP_SIGN 15U/* Index for seco_get_mp_sign() RPC call */ #define SECO_FUNC_BUILD_INFO 16U/* Index for seco_build_info() RPC call */ +#define SECO_FUNC_V2X_BUILD_INFO 30U/* Index for sc_seco_v2x_build_info() RPC call */ #define SECO_FUNC_CHIP_INFO 17U/* Index for seco_chip_info() RPC call */ #define SECO_FUNC_ENABLE_DEBUG 18U/* Index for seco_enable_debug() RPC call */ #define SECO_FUNC_GET_EVENT 19U/* Index for seco_get_event() RPC call */
@@ -210,6 +214,7 @@ struct sc_rpc_msg_s {#define TIMER_FUNC_UNKNOWN 0/* Unknown function */ #define TIMER_FUNC_SET_WDOG_TIMEOUT 1U/* Index for sc_timer_set_wdog_timeout() RPC call */ #define TIMER_FUNC_SET_WDOG_PRE_TIMEOUT 12U/* Index for sc_timer_set_wdog_pre_timeout() RPC call */ +#define TIMER_FUNC_SET_WDOG_WINDOW 19U/* Index for sc_timer_set_wdog_window() RPC call */ #define TIMER_FUNC_START_WDOG 2U/* Index for sc_timer_start_wdog() RPC call */ #define TIMER_FUNC_STOP_WDOG 3U/* Index for sc_timer_stop_wdog() RPC call */ #define TIMER_FUNC_PING_WDOG 4U/* Index for sc_timer_ping_wdog() RPC call */
include/firmware/imx/sci/sci.h +24 -0
@@ -13,6 +13,7 @@#include <firmware/imx/sci/svc/pm/api.h> #include <firmware/imx/sci/svc/rm/api.h> #include <firmware/imx/sci/svc/seco/api.h> +#include <firmware/imx/sci/svc/timer/api.h> #include <firmware/imx/sci/rpc.h> #include <dt-bindings/soc/imx_rsrc.h> #include <linux/errno.h>
@@ -73,6 +74,7 @@ int sc_pm_set_clock_parent(sc_ipc_t ipc, sc_rsrc_t resource, sc_pm_clk_t clk, sc_pm_clk_parent_t parent);int sc_pm_cpu_start (sc_ipc_t ipc,sc_rsrc_t resource,sc_bool_t enable,sc_faddr_t address); +void sc_pm_reboot (sc_ipc_t ipc,sc_pm_reset_type_t type);sc_bool_t sc_pm_is_partition_started (sc_ipc_t ipc,sc_rm_pt_t pt);int sc_pm_resource_reset (sc_ipc_t ipc,sc_rsrc_t resource);
@@ -88,6 +90,7 @@ void sc_misc_build_info(sc_ipc_t ipc, u32 *build, u32 *commit);int sc_misc_otp_fuse_read (sc_ipc_t ipc,u32 word,u32 *val);int sc_misc_get_temp (sc_ipc_t ipc,sc_rsrc_t resource,sc_misc_temp_t temp,s16 *celsius,s8 *tenths); +void sc_misc_get_button_status (sc_ipc_t ipc,sc_bool_t *status);/* RM API */ sc_bool_t sc_rm_is_memreg_owned (sc_ipc_t ipc,sc_rm_mr_t mr);
@@ -117,6 +120,9 @@ int sc_pad_get(sc_ipc_t ipc, sc_pad_t pad, uint32_t *val);/* SMMU API */ int sc_rm_set_master_sid (sc_ipc_t ipc,sc_rsrc_t resource,sc_rm_sid_t sid); +/* Timer API */ +int sc_timer_set_wdog_window (sc_ipc_t ipc,sc_timer_wdog_time_t window); +/* SECO API */ int sc_seco_authenticate (sc_ipc_t ipc,sc_seco_auth_cmd_t cmd,sc_faddr_t addr);
@@ -124,6 +130,7 @@ int sc_seco_forward_lifecycle(sc_ipc_t ipc, u32 change);int sc_seco_chip_info (sc_ipc_t ipc,u16 *lc,u16 *monotonic,u32 *uid_l,u32 *uid_h);void sc_seco_build_info (sc_ipc_t ipc,u32 *version,u32 *commit); +int sc_seco_v2x_build_info (sc_ipc_t ipc,u32 *version,u32 *commit);int sc_seco_get_event (sc_ipc_t ipc,u8 idx,u32 *event);int sc_seco_gen_key_blob (sc_ipc_t ipc,u32 id,sc_faddr_t load_addr,sc_faddr_t export_addr,u16 max_size);
@@ -374,6 +381,23 @@ static inline int sc_seco_secvio_config(sc_ipc_t ipc, u8 id, u8 access, u32 *datreturn -EOPNOTSUPP ; } +static inline void sc_pm_reboot (sc_ipc_t ipc,sc_pm_reset_type_t type) +{ +} + +static inline int sc_seco_v2x_build_info (sc_ipc_t ipc,u32 *version,u32 *commit) +{ +return -EOPNOTSUPP ; +} + +static inline void sc_misc_get_button_status (sc_ipc_t ipc,sc_bool_t *status) +{ +} + +static inline int sc_timer_set_wdog_window (sc_ipc_t ipc,sc_timer_wdog_time_t window) +{ +return -EOPNOTSUPP ; +}#endif #endif
include/firmware/imx/sci/svc/misc/api.h +30 -12
57 lines not on this page · raw message
include/firmware/imx/sci/svc/pm/api.h +94 -0
110 lines not on this page · raw message
include/firmware/imx/sci/svc/rm/api.h +9 -5
@@ -38,32 +38,36 @@/* Types */ -/*! +/* * This type is used to declare a resource partition. */ typedef u8 sc_rm_pt_t ; -/*! +/* * This type is used to declare a memory region. */ typedef u8 sc_rm_mr_t ; -/*! +/* * This type is used to declare a resource domain ID used by the * isolation HW. */ typedef u8 sc_rm_did_t ; -/*! +/* * This type is used to declare an SMMU StreamID. */ typedef u16 sc_rm_sid_t ; -/*! +/* * This type is a used to declare master transaction attributes. */ typedef u8 sc_rm_spa_t ; +/* +* This type is used to declare a resource/memory region access permission. +* Refer to the XRDC2 Block Guide for more information. +*/ typedef u8 sc_rm_perm_t ;#endif /* SC_RM_API_H */
include/firmware/imx/sci/svc/seco/api.h +3 -2
@@ -17,6 +17,7 @@#define SC_SECO_AUTH_SECO_FW 3U/* SECO Firmware */ #define SC_SECO_AUTH_HDMI_TX_FW 4U/* HDMI TX Firmware */ #define SC_SECO_AUTH_HDMI_RX_FW 5U/* HDMI RX Firmware */ +#define SC_SECO_EVERIFY_IMAGE 6U/* Enhanced verify image */ #define SC_SECO_RNG_STAT_UNAVAILABLE 0U/* Unable to initialize the RNG */ #define SC_SECO_RNG_STAT_INPROGRESS 1U/* Initialization is on-going */
@@ -24,12 +25,12 @@/* Types */ -/*! +/* * This type is used to issue SECO authenticate commands. */ typedef u8 sc_seco_auth_cmd_t ; -/*! +/* * This type is used to return the RNG initialization status. */ typedef u32 sc_seco_rng_stat_t ;
include/firmware/imx/sci/svc/timer/api.h new file +33 -0
@@ -0,0 +1,33 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright 2018-2019 NXP +*/ + +#ifndef SC_TIMER_API_H +#define SC_TIMER_API_H + +/* Defines */ + +/* Defines for type widths */ +#define SC_TIMER_ACTION_W 3U/* Width of sc_timer_wdog_action_t */ + +/* Defines for sc_timer_wdog_action_t */ +#define SC_TIMER_WDOG_ACTION_PARTITION 0U/* Reset partition */ +#define SC_TIMER_WDOG_ACTION_WARM 1U/* Warm reset system */ +#define SC_TIMER_WDOG_ACTION_COLD 2U/* Cold reset system */ +#define SC_TIMER_WDOG_ACTION_BOARD 3U/* Reset board */ +#define SC_TIMER_WDOG_ACTION_IRQ 4U/* Only generate IRQs */ + +/* Types */ + +/* +* This type is used to configure the watchdog action. +*/ +typedef u8 sc_timer_wdog_action_t ; + +/* +* This type is used to declare a watchdog time value in milliseconds. +*/ +typedef u32 sc_timer_wdog_time_t ; + +#endif /* SC_TIMER_API_H */
Signature · 1 line
2.40.0
PATCH v2 7/30 imx: scu_api: update to version 1.16 and add more APIs
Quoted 7 lines
From: Peng Fan <[email protected]>
Upgrade SCFW API to 1.16
Add more APIs:
sc_misc_get_button_status
sc_pm_reboot
sc_seco_v2x_build_infoSigned-off-by Peng Fan <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected] =====================================================================
PATCH v2 8/30 imx: use generic name ele(EdgeLockSecure Enclave)
In reply to Peng Fan (OSS)From: Peng Fan <[email protected]>
Per NXP requirement, we rename all the NXP EdgeLock Secure Enclave code including comment, folder and API name to ELE to align.
---
arch/arm/Kconfig | 4 +-
arch/arm/include/asm/arch-imx9/ccm_regs.h | 2 +-
arch/arm/include/asm/global_data.h | 4 +-
.../asm/mach-imx/{s400_api.h => ele_api.h} | 48 +++--
arch/arm/mach-imx/ele_ahab.c | 15 +-
arch/arm/mach-imx/imx8ulp/rdc.c | 18 +-
arch/arm/mach-imx/imx8ulp/soc.c | 16 +-
arch/arm/mach-imx/imx8ulp/upower/upower_hal.c | 6 +-
arch/arm/mach-imx/imx9/clock.c | 8 +-
arch/arm/mach-imx/imx9/clock_root.c | 2 +-
arch/arm/mach-imx/imx9/soc.c | 16 +-
arch/arm/mach-imx/imx9/trdc.c | 14 +-
board/freescale/imx8ulp_evk/spl.c | 10 +-
board/freescale/imx93_evk/spl.c | 1 -
drivers/misc/Kconfig | 4 +-
drivers/misc/Makefile | 2 +-
drivers/misc/{sentinel => imx_ele}/Makefile | 2 +-
.../s400_api.c => imx_ele/ele_api.c} | 200 +++++++++---------
.../{sentinel/s4mu.c => imx_ele/ele_mu.c} | 14 +-
drivers/misc/{sentinel => imx_ele}/fuse.c | 40 ++--
20 files changed, 213 insertions(+), 213 deletions(-)
rename arch/arm/include/asm/mach-imx/{s400_api.h => ele_api.h} (78%)
rename drivers/misc/{sentinel => imx_ele}/Makefile (71%)
rename drivers/misc/{sentinel/s400_api.c => imx_ele/ele_api.c} (63%)
rename drivers/misc/{sentinel/s4mu.c => imx_ele/ele_mu.c} (93%)
rename drivers/misc/{sentinel => imx_ele}/fuse.c (84%)arch/arm/Kconfig +2 -2
@@ -882,7 +882,7 @@ config ARCH_IMX8ULP select SUPPORT_SPL select GPIO_EXTRA_HEADER select MISC - select IMX_SENTINEL + select IMX_ELE imply CMD_DM config ARCH_IMX9
@@ -894,7 +894,7 @@ config ARCH_IMX9 select SUPPORT_SPL select GPIO_EXTRA_HEADER select MISC - select IMX_SENTINEL + select IMX_ELE imply CMD_DM config ARCH_IMXRT
arch/arm/include/asm/arch-imx9/ccm_regs.h +1 -1
@@ -12,7 +12,7 @@#define ARM_A55_MTR_BUS_CLK_ROOT 1#define ARM_A55_CLK_ROOT 2#define M33_CLK_ROOT 3 -#define SENTINEL_CLK_ROOT 4 +#define ELE_CLK_ROOT 4#define BUS_WAKEUP_CLK_ROOT 5#define BUS_AON_CLK_ROOT 6#define WAKEUP_AXI_CLK_ROOT 7
arch/arm/include/asm/global_data.h +2 -2
@@ -92,8 +92,8 @@ struct arch_global_data {struct udevice *scu_dev;#endif -#ifdef CONFIG_IMX_SENTINEL -struct udevice *s400_dev; +#ifdef CONFIG_IMX_ELE +struct udevice *ele_dev;u32 soc_rev;u32 lifecycle;u32 uid[4 ];
arch/arm/include/asm/mach-imx/ele_api.h renamed from arch/arm/include/asm/mach-imx/s400_api.h +25 -23
79 lines not on this page · raw message
arch/arm/mach-imx/ele_ahab.c +7 -8
@@ -7,14 +7,13 @@#include <command.h> #include <errno.h> #include <asm/io.h> -#include <asm/mach-imx/s400_api.h> +#include <asm/mach-imx/ele_api.h> #include <asm/mach-imx/sys_proto.h> #include <asm/arch-imx/cpu.h> #include <asm/arch/sys_proto.h> #include <asm/mach-imx/image.h> #include <console.h> #include <cpu_func.h> -#include <asm/mach-imx/ahab.h> #include <asm/global_data.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -267,7 +266,7 @@ int ahab_auth_cntr_hdr(struct container_hdr *container, u16 length)flush_dcache_range (IMG_CONTAINER_BASE ,IMG_CONTAINER_BASE +ALIGN (length,CONFIG_SYS_CACHELINE_SIZE ) -1 ); - err =ahab_auth_oem_ctnr (IMG_CONTAINER_BASE , &resp); + err =ele_auth_oem_ctnr (IMG_CONTAINER_BASE , &resp);if (err) {printf ("Authenticate container hdr failed, return %d, resp 0x%x\n" , err, resp);
@@ -282,7 +281,7 @@ int ahab_auth_release(void)int err;u32 resp; - err =ahab_release_container (&resp); + err =ele_release_container (&resp);if (err) {printf ("Error: release container failed, resp 0x%x!\n" , resp);display_ahab_auth_ind (resp);
@@ -296,7 +295,7 @@ int ahab_verify_cntr_image(struct boot_img_t *img, int image_index)int err;u32 resp; - err =ahab_verify_image (image_index, &resp); + err =ele_verify_image (image_index, &resp);if (err) {printf ("Authenticate img %d failed, return %d, resp 0x%x\n" , image_index, err, resp);
@@ -485,7 +484,7 @@ static int do_ahab_close(struct cmd_tbl *cmdtp, int flag, int argc,return -EPERM ; } - err =ahab_forward_lifecycle (8 , &resp); + err =ele_forward_lifecycle (8 , &resp);if (err !=0 ) {printf ("Error in forward lifecycle to OEM closed\n" );return -EIO ;
@@ -502,7 +501,7 @@ int ahab_dump(void)int ret, i =0 ; do { - ret = ahab_dump_buffer(buffer, 32); + ret = ele_dump_buffer(buffer, 32); if (ret < 0) { printf("Error in dump AHAB log\n"); return -EIO;
@@ -547,7 +546,7 @@ static int do_ahab_status(struct cmd_tbl *cmdtp, int flag, int argc, char *constdisplay_life_cycle (lc); - ret =ahab_get_events (events, &cnt,NULL ); + ret =ele_get_events (events, &cnt,NULL );if (ret) {printf ("Get ELE EVENTS error %d\n" , ret);return CMD_RET_FAILURE ;
arch/arm/mach-imx/imx8ulp/rdc.c +9 -9
@@ -9,7 +9,7 @@#include <asm/arch/imx-regs.h> #include <asm/arch/sys_proto.h> #include <asm/mach-imx/mu_hal.h> -#include <asm/mach-imx/s400_api.h> +#include <asm/mach-imx/ele_api.h> #include <asm/arch/rdc.h> #include <div64.h>
@@ -203,12 +203,12 @@ int xrdc_config_msc(u32 msc, u32 index, u32 dom, u32 perm)int release_rdc (enum rdc_type type) {ulong s_mu_base =0x27020000UL ; -struct sentinel_msg msg; +struct ele_msg msg;int ret;u32 rdc_id = (type ==RDC_XRDC ) ?0x78 :0x74 ; - msg.version =AHAB_VERSION ; - msg.tag =AHAB_CMD_TAG ; + msg.version =ELE_VERSION ; + msg.tag =ELE_CMD_TAG ; msg.size =2 ; msg.command =ELE_RELEASE_RDC_REQ ; msg.data[0 ] = (rdc_id <<8 ) |0x2 ;/* A35 XRDC */
@@ -266,7 +266,7 @@ void xrdc_mrc_region_set_access(int mrc_index, u32 addr, u32 access) mrgd[4 ] |= ((access &0xFFF ) <<16 ); } -/* not handle other cases, since S400 only set ACCESS1 and 2 */ +/* not handle other cases, since ELE only set ACCESS1 and 2 */ writel (mrgd[4 ], xrdc_base + off +0x10 );return ; }
@@ -295,7 +295,7 @@ void xrdc_init_mda(void)void xrdc_init_mrc (void ) { -/* Re-config MRC3 for SRAM0 in case protected by S400 */ +/* Re-config MRC3 for SRAM0 in case protected by ELE */ xrdc_config_mrc_w0_w1 (3 ,0 ,0x22010000 ,0x10000 );xrdc_config_mrc_dx_perm (3 ,0 ,0 ,1 );xrdc_config_mrc_dx_perm (3 ,0 ,1 ,1 );
@@ -320,7 +320,7 @@ void xrdc_init_mrc(void)xrdc_config_mrc_dx_perm (5 ,0 ,1 ,1 );xrdc_config_mrc_w3_w4 (5 ,0 ,0x0 ,0x80000FFF ); -/* Set MRC6 for DDR access from Sentinel */ +/* Set MRC6 for DDR access from ELE */ xrdc_config_mrc_w0_w1 (6 ,0 ,CFG_SYS_SDRAM_BASE ,PHYS_SDRAM_SIZE );xrdc_config_mrc_dx_perm (6 ,0 ,4 ,1 );xrdc_config_mrc_w3_w4 (6 ,0 ,0x0 ,0x80000FFF );
@@ -404,7 +404,7 @@ int trdc_mbc_set_access(u32 mbc_x, u32 dom_x, u32 mem_x, u32 blk_x, bool sec_acc val &= ~(0xFU << offset);/* MBC0-3 -* Global 0, 0x7777 secure pri/user read/write/execute, S400 has already set it. +* Global 0, 0x7777 secure pri/user read/write/execute, ELE has already set it. * So select MBC0_MEMN_GLBAC0 */ if (sec_access) {
@@ -445,7 +445,7 @@ int trdc_mrc_region_set_access(u32 mrc_x, u32 dom_x, u32 addr_start, u32 addr_encontinue ;/* MRC0,1 -* Global 0, 0x7777 secure pri/user read/write/execute, S400 has already set it. +* Global 0, 0x7777 secure pri/user read/write/execute, ELE has already set it. * So select MRCx_MEMN_GLBAC0 */ if (sec_access) {
arch/arm/mach-imx/imx8ulp/soc.c +8 -8
@@ -14,7 +14,7 @@#include <event.h> #include <spl.h> #include <asm/arch/rdc.h> -#include <asm/mach-imx/s400_api.h> +#include <asm/mach-imx/ele_api.h> #include <asm/mach-imx/mu_hal.h> #include <cpu_func.h> #include <asm/setup.h>
@@ -70,7 +70,7 @@ int mmc_get_env_dev(void) }#endif -static void set_cpu_info (struct sentinel_get_info_data *info) +static void set_cpu_info (struct ele_get_info_data *info) { gd->arch.soc_rev = info->soc; gd->arch.lifecycle = info->lc;
@@ -582,9 +582,9 @@ void get_board_serial(struct tag_serialnr *serialnr)u32 res;int ret; - ret =ahab_read_common_fuse (1 , uid,4 , &res); + ret =ele_read_common_fuse (1 , uid,4 , &res);if (ret) -printf ("ahab read fuse failed %d, 0x%x\n" , ret, res); +printf ("ele read fuse failed %d, 0x%x\n" , ret, res);else printf ("UID 0x%x,0x%x,0x%x,0x%x\n" , uid[0 ], uid[1 ], uid[2 ], uid[3 ]);
@@ -783,7 +783,7 @@ int imx8ulp_dm_post_init(void)struct udevice *devp;int ret;u32 res; -struct sentinel_get_info_data *info = (struct sentinel_get_info_data *)SRAM0_BASE ; +struct ele_get_info_data *info = (struct ele_get_info_data *)SRAM0_BASE ; ret =uclass_get_device_by_driver (UCLASS_MISC ,DM_DRIVER_GET (imx8ulp_mu), &devp);if (ret) {
@@ -791,11 +791,11 @@ int imx8ulp_dm_post_init(void)return ret; } - ret =ahab_get_info (info, &res); + ret =ele_get_info (info, &res);if (ret) { -printf ("ahab_get_info failed %d\n" , ret); +printf ("ele_get_info failed %d\n" , ret);/* fallback to A0.1 revision */ -memset ((void *)info,0 ,sizeof (struct sentinel_get_info_data )); +memset ((void *)info,0 ,sizeof (struct ele_get_info_data )); info->soc =0xa000084d ; }
arch/arm/mach-imx/imx8ulp/upower/upower_hal.c +3 -3
@@ -217,8 +217,8 @@ int upower_init(void)* CM33 Cache * PowerQuad RAM * ETF RAM -* Sentinel PKC, Data RAM1, Inst RAM0/1 -* Sentinel ROM +* ELE PKC, Data RAM1, Inst RAM0/1 +* ELE ROM * uPower IRAM/DRAM * uPower ROM * CM33 ROM
@@ -230,7 +230,7 @@ int upower_init(void)* SSRAM Partition 7_a(128KB) * SSRAM Partition 7_b(64KB) * SSRAM Partition 7_c(64KB) -* Sentinel Data RAM0, Inst RAM2 +* ELE Data RAM0, Inst RAM2 */ /* MIPI-CSI FIFO BIT28 not set */ memon =0x3FFFFFEFFFFFFCUL ;
arch/arm/mach-imx/imx9/clock.c +4 -4
@@ -709,8 +709,8 @@ struct imx_clk_setting imx_clk_settings[] = {/* Set A55 mtr bus to 133M */ {ARM_A55_MTR_BUS_CLK_ROOT, SYS_PLL_PFD1_DIV2, 3}, -/* Sentinel to 133M */ - {SENTINEL_CLK_ROOT, SYS_PLL_PFD1_DIV2, 3}, +/* ELE to 133M */ + {ELE_CLK_ROOT, SYS_PLL_PFD1_DIV2, 3},/* Bus_wakeup to 133M */ {BUS_WAKEUP_CLK_ROOT, SYS_PLL_PFD1_DIV2, 3},/* Bus_AON to 133M */
@@ -740,8 +740,8 @@ struct imx_clk_setting imx_clk_settings[] = { {ARM_A55_PERIPH_CLK_ROOT, SYS_PLL_PFD0, 3},/* Set A55 mtr bus to 133M */ {ARM_A55_MTR_BUS_CLK_ROOT, SYS_PLL_PFD1_DIV2, 3}, -/* Sentinel to 200M */ - {SENTINEL_CLK_ROOT, SYS_PLL_PFD1_DIV2, 2}, +/* ELE to 200M */ + {ELE_CLK_ROOT, SYS_PLL_PFD1_DIV2, 2},/* Bus_wakeup to 133M */ {BUS_WAKEUP_CLK_ROOT, SYS_PLL_PFD1_DIV2, 3}, /* Bus_AON to 133M */
arch/arm/mach-imx/imx9/clock_root.c +1 -1
@@ -34,7 +34,7 @@ static struct clk_root_map clk_root_array[] = { { ARM_A55_MTR_BUS_CLK_ROOT, 2 }, { ARM_A55_CLK_ROOT, 0 }, { M33_CLK_ROOT, 2 }, - { SENTINEL_CLK_ROOT, 2 }, + { ELE_CLK_ROOT, 2 }, { BUS_WAKEUP_CLK_ROOT, 2 }, { BUS_AON_CLK_ROOT, 2 }, { WAKEUP_AXI_CLK_ROOT, 0 },
arch/arm/mach-imx/imx9/soc.c +8 -8
@@ -34,7 +34,7 @@#include <asm/setup.h> #include <asm/bootm.h> #include <asm/arch-imx/cpu.h> -#include <asm/mach-imx/s400_api.h> +#include <asm/mach-imx/ele_api.h> #include <fuse.h> #include <asm/arch/ddr.h>
@@ -151,7 +151,7 @@ u32 get_cpu_temp_grade(int *minc, int *maxc)return val; } -static void set_cpu_info (struct sentinel_get_info_data *info) +static void set_cpu_info (struct ele_get_info_data *info) { gd->arch.soc_rev = info->soc; gd->arch.lifecycle = info->lc;
@@ -557,7 +557,7 @@ int imx9_probe_mu(void *ctx, struct event *event)struct udevice *devp;int node, ret;u32 res; -struct sentinel_get_info_data info; +struct ele_get_info_data info; node =fdt_node_offset_by_compatible (gd->fdt_blob,-1 ,"fsl,imx93-mu-s4" );
@@ -568,7 +568,7 @@ int imx9_probe_mu(void *ctx, struct event *event)if (gd->flags &GD_FLG_RELOC )return 0 ; - ret =ahab_get_info (&info, &res); + ret =ele_get_info (&info, &res);if (ret)return ret;
@@ -646,7 +646,7 @@ static int mix_power_init(enum mix_power_domain pd) mem_id =SRC_MEM_MEDIA ; scr =BIT (5 ); -/* Enable S400 handshake */ +/* Enable ELE handshake */ struct blk_ctrl_s_aonmix_regs *s_regs = (struct blk_ctrl_s_aonmix_regs *)BLK_CTRL_S_ANOMIX_BASE_ADDR ;
@@ -763,8 +763,8 @@ int m33_prepare(void)while (!(val &SRC_MIX_SLICE_FUNC_STAT_RST_STAT )) val =readl (&mix_regs->func_stat); -/* Release Sentinel TROUT */ -ahab_release_m33_trout (); +/* Release ELE TROUT */ +ele_release_m33_trout ();/* Mask WDOG1 IRQ from A55, we use it for M33 reset */ setbits_le32 (&s_regs->ca55_irq_mask[1 ],BIT (6 ));
@@ -772,7 +772,7 @@ int m33_prepare(void)/* Turn on WDOG1 clock */ ccm_lpcg_on (CCGR_WDG1 ,1 ); -/* Set sentinel LP handshake for M33 reset */ +/* Set ELE LP handshake for M33 reset */ setbits_le32 (&s_regs->lp_handshake[0 ],BIT (6 ));/* Clear M33 TCM for ECC */
arch/arm/mach-imx/imx9/trdc.c +7 -7
@@ -10,7 +10,7 @@#include <asm/arch/imx-regs.h> #include <asm/arch/sys_proto.h> #include <div64.h> -#include <asm/mach-imx/s400_api.h> +#include <asm/mach-imx/ele_api.h> #include <asm/mach-imx/mu_hal.h> #define DID_NUM 16
@@ -196,7 +196,7 @@ int trdc_mbc_blk_config(ulong trdc_reg, u32 mbc_x, u32 dom_x, u32 mem_x, val &= ~(0xFU << offset);/* MBC0-3 -* Global 0, 0x7777 secure pri/user read/write/execute, S400 has already set it. +* Global 0, 0x7777 secure pri/user read/write/execute, ELE has already set it. * So select MBC0_MEMN_GLBAC0 */ if (sec_access) {
@@ -266,7 +266,7 @@ int trdc_mrc_region_config(ulong trdc_reg, u32 mrc_x, u32 dom_x, u32 addr_start,continue ;/* MRC0,1 -* Global 0, 0x7777 secure pri/user read/write/execute, S400 has already set it. +* Global 0, 0x7777 secure pri/user read/write/execute, ELE has already set it. * So select MRCx_MEMN_GLBAC0 */ if (sec_access) {
@@ -315,7 +315,7 @@ bool trdc_mbc_enabled(ulong trdc_base)int release_rdc (u8 xrdc) {ulong s_mu_base =0x47520000UL ; -struct sentinel_msg msg; +struct ele_msg msg;int ret;u32 rdc_id;
@@ -336,8 +336,8 @@ int release_rdc(u8 xrdc)return -EINVAL ; } - msg.version =AHAB_VERSION ; - msg.tag =AHAB_CMD_TAG ; + msg.version =ELE_VERSION ; + msg.tag =ELE_CMD_TAG ; msg.size =2 ; msg.command =ELE_RELEASE_RDC_REQ ; msg.data[0 ] = (rdc_id <<8 ) |0x2 ;/* A55 */
@@ -394,7 +394,7 @@ void trdc_init(void)/* DDR */ trdc_mrc_set_control (0x49010000 ,0 ,0 ,0x7777 ); -/* S400*/ +/* ELE */ trdc_mrc_region_config (0x49010000 ,0 ,0 ,0x80000000 ,0xFFFFFFFF , false,0 );/* MTR */
board/freescale/imx8ulp_evk/spl.c +5 -5
@@ -19,7 +19,7 @@#include <asm/arch/ddr.h> #include <asm/arch/rdc.h> #include <asm/arch/upower.h> -#include <asm/mach-imx/s400_api.h> +#include <asm/mach-imx/ele_api.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -63,9 +63,9 @@ void display_ele_fw_version(void)u32 fw_version, sha1, res;int ret; - ret =ahab_get_fw_version (&fw_version, &sha1, &res); + ret =ele_get_fw_version (&fw_version, &sha1, &res);if (ret) { -printf ("ahab get firmware version failed %d, 0x%x\n" , ret, res); +printf ("ele get firmware version failed %d, 0x%x\n" , ret, res); }else { printf("ELE firmware version %u.%u.%u-%x", (fw_version & (0x00ff0000)) >> 16,
@@ -120,9 +120,9 @@ void spl_board_init(void)set_lpav_qos ();/* Enable A35 access to the CAAM */ - ret =ahab_release_caam (0x7 , &res); + ret =ele_release_caam (0x7 , &res);if (ret) -printf ("ahab release caam failed %d, 0x%x\n" , ret, res); +printf ("ele release caam failed %d, 0x%x\n" , ret, res); }void board_init_f (ulong dummy)
board/freescale/imx93_evk/spl.c +0 -1
@@ -20,7 +20,6 @@#include <asm/mach-imx/mxc_i2c.h> #include <asm/arch-mx7ulp/gpio.h> #include <asm/mach-imx/syscounter.h> -#include <asm/mach-imx/s400_api.h> #include <dm/uclass.h> #include <dm/device.h> #include <dm/uclass-internal.h>
drivers/misc/Kconfig +2 -2
@@ -364,8 +364,8 @@ config NPCM_OTP To compile this driver as a module, choose M here: the module will be called npcm_otp. -config IMX_SENTINEL - bool "Enable i.MX Sentinel MU driver and API" +config IMX_ELE + bool "Enable i.MX EdgeLock Enclave MU driver and API" depends on MISC && (ARCH_IMX9 || ARCH_IMX8ULP) help If you say Y here to enable Message Unit driver to work with
drivers/misc/Makefile +1 -1
@@ -47,7 +47,7 @@ obj-$(CONFIG_SANDBOX) += irq_sandbox.o irq_sandbox_test.o obj-$(CONFIG_$(SPL_)I2C_EEPROM) += i2c_eeprom.o obj-$(CONFIG_IHS_FPGA) += ihs_fpga.o obj-$(CONFIG_IMX8) += imx8/ -obj-$(CONFIG_IMX_SENTINEL) += sentinel/ +obj-$(CONFIG_IMX_ELE) += imx_ele/ obj-$(CONFIG_LED_STATUS) += status_led.o obj-$(CONFIG_LED_STATUS_GPIO) += gpio_led.o obj-$(CONFIG_MPC83XX_SERDES) += mpc83xx_serdes.o
drivers/misc/imx_ele/Makefile renamed from drivers/misc/sentinel/Makefile +1 -1
@@ -1,4 +1,4 @@ # SPDX-License-Identifier: GPL-2.0+ -obj-y += s400_api.o s4mu.o +obj-y += ele_api.o ele_mu.o obj-$(CONFIG_CMD_FUSE) += fuse.o
drivers/misc/imx_ele/ele_api.c renamed from drivers/misc/sentinel/s400_api.c +100 -100
400 lines not on this page · raw message
drivers/misc/imx_ele/ele_mu.c renamed from drivers/misc/sentinel/s4mu.c +7 -7
@@ -9,7 +9,7 @@#include <dm/lists.h> #include <dm/root.h> #include <dm/device-internal.h> -#include <asm/mach-imx/s400_api.h> +#include <asm/mach-imx/ele_api.h> #include <asm/arch/imx-regs.h> #include <linux/iopoll.h> #include <misc.h>
@@ -85,7 +85,7 @@ int mu_hal_receivemsg(ulong base, u32 reg_index, u32 *msg)static int imx8ulp_mu_read (struct mu_type *base,void *data) { -struct sentinel_msg *msg = (struct sentinel_msg *)data; +struct ele_msg *msg = (struct ele_msg *)data;int ret;u8 count =0 ;
@@ -99,7 +99,7 @@ static int imx8ulp_mu_read(struct mu_type *base, void *data) count++;/* Check size */ -if (msg->size >S400_MAX_MSG ) { +if (msg->size >ELE_MAX_MSG ) { *((u32 *)msg) =0 ;return -EINVAL ; }
@@ -118,7 +118,7 @@ static int imx8ulp_mu_read(struct mu_type *base, void *data)static int imx8ulp_mu_write (struct mu_type *base,void *data) { -struct sentinel_msg *msg = (struct sentinel_msg *)data; +struct ele_msg *msg = (struct ele_msg *)data;int ret;u8 count =0 ;
@@ -126,7 +126,7 @@ static int imx8ulp_mu_write(struct mu_type *base, void *data)return -EINVAL ;/* Check size */ -if (msg->size >S400_MAX_MSG ) +if (msg->size >ELE_MAX_MSG )return -EINVAL ;/* Write first word */
@@ -171,7 +171,7 @@ static int imx8ulp_mu_call(struct udevice *dev, int no_resp, void *tx_msg,return ret; } - result = ((struct sentinel_msg *)rx_msg)->data[0 ]; + result = ((struct ele_msg *)rx_msg)->data[0 ];if ((result &0xff ) ==0xd6 )return 0 ;
@@ -196,7 +196,7 @@ static int imx8ulp_mu_probe(struct udevice *dev)/* U-Boot not enable interrupts, so need to enable RX interrupts */ mu_hal_init ((ulong )priv->base); - gd->arch.s400_dev = dev; + gd->arch.ele_dev = dev;return 0 ; }
drivers/misc/imx_ele/fuse.c renamed from drivers/misc/sentinel/fuse.c +20 -20
@@ -10,7 +10,7 @@#include <asm/arch/sys_proto.h> #include <asm/arch/imx-regs.h> #include <env.h> -#include <asm/mach-imx/s400_api.h> +#include <asm/mach-imx/ele_api.h> #include <asm/global_data.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -24,11 +24,11 @@ struct fsb_map_entry {bool redundancy; }; -struct s400_map_entry { +struct ele_map_entry {s32 fuse_bank;u32 fuse_words;u32 fuse_offset; -u32 s400_index; +u32 ele_index; };#if defined(CONFIG_IMX8ULP )
@@ -65,7 +65,7 @@ u32 nonecc_fuse_banks[] = {0 ,1 ,8 ,12 ,16 ,22 ,24 ,25 ,26 ,27 ,36 ,41 ,51 ,56 }; -struct s400_map_entry s400_api_mapping_table[] = { +struct ele_map_entry ele_api_mapping_table[] = { {1 ,8 },/* LOCK */ {2 ,8 },/* ECID */ { 7, 4, 0, 1 }, /* OTP_UNIQ_ID */
@@ -122,7 +122,7 @@ struct fsb_map_entry fsb_mapping_table[] = { { 63, 8 }, }; -struct s400_map_entry s400_api_mapping_table[] = { +struct ele_map_entry ele_api_mapping_table[] = { {7 ,1 ,7 ,63 }, {16 ,8 , }, { 17, 8, },
@@ -159,18 +159,18 @@ static s32 map_fsb_fuse_index(u32 bank, u32 word, bool *redundancy)return word + word_pos; } -static s32 map_s400_fuse_index (u32 bank,u32 word) +static s32 map_ele_fuse_index (u32 bank,u32 word) { -s32 size =ARRAY_SIZE (s400_api_mapping_table); +s32 size =ARRAY_SIZE (ele_api_mapping_table);s32 i;/* map the fuse from ocotp fuse map to FSB*/ for (i =0 ; i < size; i++) { -if (s400_api_mapping_table[i].fuse_bank !=-1 && - s400_api_mapping_table[i].fuse_bank == bank) { -if (word >= s400_api_mapping_table[i].fuse_offset && - word < (s400_api_mapping_table[i].fuse_offset + - s400_api_mapping_table[i].fuse_words)) +if (ele_api_mapping_table[i].fuse_bank !=-1 && + ele_api_mapping_table[i].fuse_bank == bank) { +if (word >= ele_api_mapping_table[i].fuse_offset && + word < (ele_api_mapping_table[i].fuse_offset + + ele_api_mapping_table[i].fuse_words))break ; } }
@@ -178,10 +178,10 @@ static s32 map_s400_fuse_index(u32 bank, u32 word)if (i == size)return -1 ;/* Failed to find */ -if (s400_api_mapping_table[i].s400_index !=0 ) -return s400_api_mapping_table[i].s400_index; +if (ele_api_mapping_table[i].ele_index !=0 ) +return ele_api_mapping_table[i].ele_index; -return s400_api_mapping_table[i].fuse_bank *8 + word; +return ele_api_mapping_table[i].fuse_bank *8 + word; }#if defined(CONFIG_IMX8ULP )
@@ -202,7 +202,7 @@ int fuse_sense(u32 bank, u32 word, u32 *val)return 0 ; } - word_index =map_s400_fuse_index (bank, word); + word_index =map_ele_fuse_index (bank, word);if (word_index >=0 ) {u32 data[4 ];u32 res, size =4 ;
@@ -212,7 +212,7 @@ int fuse_sense(u32 bank, u32 word, u32 *val)if (word_index !=1 ) size =1 ; - ret =ahab_read_common_fuse (word_index, data, size, &res); + ret =ele_read_common_fuse (word_index, data, size, &res);if (ret) {printf ("ahab read fuse failed %d, 0x%x\n" , ret, res);return ret;
@@ -255,13 +255,13 @@ int fuse_sense(u32 bank, u32 word, u32 *val)return 0 ; } - word_index =map_s400_fuse_index (bank, word); + word_index =map_ele_fuse_index (bank, word);if (word_index >=0 ) {u32 data;u32 res, size =1 ;int ret; - ret =ahab_read_common_fuse (word_index, &data, size, &res); + ret =ele_read_common_fuse (word_index, &data, size, &res);if (ret) {printf ("ahab read fuse failed %d, 0x%x\n" , ret, res);return ret;
@@ -304,7 +304,7 @@ int fuse_prog(u32 bank, u32 word, u32 val) lock = true;#endif - ret =ahab_write_fuse ((bank *8 + word), val, lock, &res); + ret =ele_write_fuse ((bank *8 + word), val, lock, &res);if (ret) {printf ("ahab write fuse failed %d, 0x%x\n" , ret, res);return ret;
Signature · 1 line
2.40.0
PATCH v2 8/30 imx: use generic name ele(EdgeLockSecure Enclave)
Quoted 4 lines
From: Peng Fan <[email protected]>
Per NXP requirement, we rename all the NXP EdgeLock Secure Enclave code including comment, folder and API name to ELE to align.Signed-off-by Peng Fan <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected] =====================================================================
PATCH v2 9/30 imx: parse-container: fix build warning
In reply to Peng Fan (OSS)From: Peng Fan <[email protected]>
Fix build warning:
warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has type ‘u64’ {aka ‘long long unsigned int’} [-Wformat=]
printf("can't find memreg for image %d load address 0x%x, error %d\n",
warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but
argument 3 has type ‘sc_faddr_t’ {aka ‘long long unsigned int’} [-Wformat=]
debug("memreg %u 0x%lx -- 0x%lx\n", mr, start, end);--- arch/arm/mach-imx/parse-container.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-imx/parse-container.c +2 -2
@@ -35,14 +35,14 @@ static int authenticate_image(struct boot_img_t *img, int image_index) ALIGN(img->dst + img->size, CONFIG_SYS_CACHELINE_SIZE) - 1);if (err) { -printf ("can't find memreg for image %d load address 0x%x, error %d\n" , +printf ("can't find memreg for image %d load address 0x%llx, error %d\n" , image_index, img->dst & ~(CONFIG_SYS_CACHELINE_SIZE -1 ), err);return -ENOMEM ; } err =sc_rm_get_memreg_info (-1 , mr, &start, &end);if (!err) -debug ("memreg %u 0x%x -- 0x%x\n" , mr, start, end); +debug ("memreg %u 0x%llx -- 0x%llx\n" , mr, start, end); err =sc_rm_set_memreg_permissions (-1 , mr,SECO_PT ,SC_RM_PERM_FULL );
Signature · 1 line
2.40.0
PATCH v2 9/30 imx: parse-container: fix build warning
Quoted 9 lines
From: Peng Fan <[email protected]>
Fix build warning:
warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has type ‘u64’ {aka ‘long long unsigned int’} [-Wformat=]printf("can't find memreg for image %d load address 0x%x, error %d\n", warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘sc_faddr_t’ {aka ‘long long unsigned int’} [-Wformat=] debug("memreg %u 0x%lx -- 0x%lx\n", mr, start, end);Signed-off-by Peng Fan <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected] =====================================================================
PATCH v2 10/30 imx: ele_ahab: use hextoul
In reply to Peng Fan (OSS)From: Peng Fan <[email protected]>
Use hextoul which looks a bit simpler.
--- arch/arm/mach-imx/ele_ahab.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-imx/ele_ahab.c +1 -1
@@ -402,7 +402,7 @@ static int do_authenticate(struct cmd_tbl *cmdtp, int flag, int argc,if (argc <2 )return CMD_RET_USAGE ; - addr =simple_strtoul (argv[1 ],NULL ,16 ); + addr =hextoul (argv[1 ],NULL );printf ("Authenticate OS container at 0x%lx\n" , addr);
Signature · 1 line
2.40.0
PATCH v2 10/30 imx: ele_ahab: use hextoul
Quoted 3 lines
From: Peng Fan <[email protected]>
Use hextoul which looks a bit simpler.Signed-off-by Peng Fan <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected] =====================================================================
PATCH v2 11/30 imx: ele_api: support program secure fuse and return lifecycle
In reply to Peng Fan (OSS)From: Peng Fan <[email protected]>
Add two ELE API: ele_return_lifecycle_update and ele_write_secure_fuse Add two cmd: ahab_return_lifecycle and ahab_sec_fuse_prog
--- arch/arm/include/asm/mach-imx/ele_api.h | 2 + arch/arm/mach-imx/ele_ahab.c | 74 +++++++++++++++++++++++++ drivers/misc/imx_ele/ele_api.c | 64 ++++++++++++++++++++- 3 files changed, 139 insertions(+), 1 deletion(-)
arch/arm/include/asm/mach-imx/ele_api.h +2 -0
@@ -146,5 +146,7 @@ int ele_dump_buffer(u32 *buffer, u32 buffer_length);int ele_get_info (struct ele_get_info_data *info,u32 *response);int ele_get_fw_status (u32 *status,u32 *response);int ele_release_m33_trout (void ); +int ele_write_secure_fuse (ulong signed_msg_blk,u32 *response); +int ele_return_lifecycle_update (ulong signed_msg_blk,u32 *response);#endif
arch/arm/mach-imx/ele_ahab.c +74 -0
83 lines not on this page · raw message
drivers/misc/imx_ele/ele_api.c +63 -1
72 lines not on this page · raw message
Signature · 1 line
2.40.0
PATCH v2 11/30 imx: ele_api: support program secure fuse and return lifecycle
Quoted 4 lines
From: Peng Fan <[email protected]>
Add two ELE API:ele_return_lifecycle_updateandele_write_secure_fuseAdd two cmd:ahab_return_lifecycleandahab_sec_fuse_progSigned-off-by Peng Fan <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected] =====================================================================
PATCH v2 12/30 imx: ele_api: add DEK Blob generation
In reply to Peng Fan (OSS)From: Peng Fan <[email protected]>
- Add crc computation.
- Add ele_generate_dek_blob API for encrypted boot support.
--- arch/arm/include/asm/mach-imx/ele_api.h | 2 +- drivers/misc/imx_ele/ele_api.c | 44 +++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-)
arch/arm/include/asm/mach-imx/ele_api.h +1 -1
@@ -142,11 +142,11 @@ int ele_read_common_fuse(u16 fuse_id, u32 *fuse_words, u32 fuse_num, u32 *responint ele_release_caam (u32 core_did,u32 *response);int ele_get_fw_version (u32 *fw_version,u32 *sha1,u32 *response);int ele_get_events (u32 *events,u32 *events_cnt,u32 *response); +int ele_generate_dek_blob (u32 key_id,u32 src_paddr,u32 dst_paddr,u32 max_output_size);int ele_dump_buffer (u32 *buffer,u32 buffer_length);int ele_get_info (struct ele_get_info_data *info,u32 *response);int ele_get_fw_status (u32 *status,u32 *response);int ele_release_m33_trout (void );int ele_write_secure_fuse (ulong signed_msg_blk,u32 *response);int ele_return_lifecycle_update (ulong signed_msg_blk,u32 *response); -#endif
drivers/misc/imx_ele/ele_api.c +44 -0
53 lines not on this page · raw message
Signature · 1 line
2.40.0
PATCH v2 12/30 imx: ele_api: add DEK Blob generation
Quoted 5 lines
From: Peng Fan <[email protected]>
- Add crc computation.
- Addele_generate_dek_blobAPI for encrypted boot support.Signed-off-by Clement Faure <[email protected]>Signed-off-by Peng Fan <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected] =====================================================================
PATCH v2 13/30 imx: cmd_dek: Fix Uninitialized pointer read
In reply to Peng Fan (OSS)From: Ye Li <[email protected]>
Fix Coverity (CID 21143558).
When tee_shm_register returns failure, the shm_input pointer is invalid, should not free it. Same issue also exists on registering shm_output.
--- arch/arm/mach-imx/cmd_dek.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/mach-imx/cmd_dek.c +2 -1
@@ -101,6 +101,7 @@ static int blob_encap_dek(u32 src_addr, u32 dst_addr, u32 len) 0x0, &shm_output);if (ret <0 ) {printf ("Cannot register output shared memory 0x%X\n" , ret); +tee_shm_free (shm_input); goto error; }
@@ -122,11 +123,11 @@ static int blob_encap_dek(u32 src_addr, u32 dst_addr, u32 len)if (ret <0 )printf ("Cannot generate Blob with PTA DEK Blob 0x%X\n" , ret); -error:/* Free shared memory */ tee_shm_free (shm_input);tee_shm_free (shm_output); +error:/* Close session */ ret =tee_close_session (dev, arg.session);if (ret <0 )
Signature · 1 line
2.40.0
PATCH v2 13/30 imx: cmd_dek: Fix Uninitialized pointer read
Quoted 8 lines
From: Ye Li <[email protected]>
Fix Coverity (CID 21143558).
Whentee_shm_registerreturns failure, theshm_inputpointer is invalid, should not free it. Same issue also exists on registeringshm_output.Reviewed-by Peng Fan <[email protected]>Signed-off-by Ye Li <[email protected]>Signed-off-by Peng Fan <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected] =====================================================================
PATCH v2 14/30 imx: cmd_dek: add ELE DEK Blob generation support
In reply to Peng Fan (OSS)From: Clement Faure <[email protected]>
Add ELE DEK Blob generation for the cmd_dek command.
--- arch/arm/mach-imx/Kconfig | 7 ++++ arch/arm/mach-imx/cmd_dek.c | 84 +++++++++++++++++++++++++++++++++++++ 2 files changed, 91 insertions(+)
arch/arm/mach-imx/Kconfig +7 -0
@@ -86,6 +86,7 @@ config CMD_DEKBLOB select IMX_CAAM_DEK_ENCAP if ARCH_MX6 || ARCH_MX7 || ARCH_MX7ULP select IMX_OPTEE_DEK_ENCAP if ARCH_IMX8M select IMX_SECO_DEK_ENCAP if ARCH_IMX8 + select IMX_ELE_DEK_ENCAP if ARCH_IMX8ULP || ARCH_IMX9 help This enables the 'dek_blob' command which is used with the Freescale secure boot mechanism. This command encapsulates and
@@ -113,6 +114,12 @@ config IMX_SECO_DEK_ENCAP This enabled the DEK blob encapsulation with the SECO API. This option is only available on imx8. +config IMX_ELE_DEK_ENCAP + bool "Support the DEK blob encapsulation with ELE" + help + This enabled the DEK blob encapsulation with the ELE API. This option + is only available on imx8ulp and imx9. + config CMD_PRIBLOB bool "Support the set_priblob_bitfield command" depends on HAS_CAAM && IMX_HAB
arch/arm/mach-imx/cmd_dek.c +84 -0
102 lines not on this page · raw message
Signature · 1 line
2.40.0
PATCH v2 14/30 imx: cmd_dek: add ELE DEK Blob generation support
Quoted 4 lines
From: Clement Faure <[email protected]> Add ELE DEK Blob generation for the
cmd_dekcommand.Signed-off-by Clement Faure <[email protected]>Signed-off-by Peng Fan <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected] =====================================================================
PATCH v2 15/30 imx: misc: ele_mu: Update MU TR registers count
In reply to Peng Fan (OSS)From: Ye Li <[email protected]>
According to SRM, the Sentinel MU has 8 TR and 4 RR registers. All of them are used for ELE message. So update TR count to 8 and fix a typo in receive msg
--- drivers/misc/imx_ele/ele_mu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/misc/imx_ele/ele_mu.c +2 -2
@@ -22,7 +22,7 @@ struct imx8ulp_mu {#define MU_SR_TE0_MASK BIT(0)#define MU_SR_RF0_MASK BIT(0) -#define MU_TR_COUNT 4 +#define MU_TR_COUNT 8#define MU_RR_COUNT 4void mu_hal_init (ulong base)
@@ -65,7 +65,7 @@ int mu_hal_receivemsg(ulong base, u32 reg_index, u32 *msg)u32 val;int ret; -assert (reg_index <MU_TR_COUNT ); +assert (reg_index <MU_RR_COUNT );debug ("receivemsg sr 0x%x\n" ,readl (&mu_base->sr));
Signature · 1 line
2.40.0
PATCH v2 15/30 imx: misc: ele_mu: Update MU TR registers count
Quoted 7 lines
From: Ye Li <[email protected]>
According to SRM, the Sentinel MU has 8 TR and 4 RR registers. All of them are used for ELE message. So update TR count to 8 and fix a typo in receive msgReviewed-by Peng Fan <[email protected]>Signed-off-by Ye Li <[email protected]>Signed-off-by Peng Fan <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected] =====================================================================
PATCH v2 16/30 imx: misc: ele_mu: Update ELE MU driver
In reply to Peng Fan (OSS)From: Ye Li <[email protected]>
Extend the RX timeout value to 10s, because when authentication is failed the ELE needs long time (>2s for 28M image) to return the result. Print rx wait info per 1s.
Also correct TX and RX status registers in debug.
--- drivers/misc/imx_ele/ele_mu.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
drivers/misc/imx_ele/ele_mu.c +15 -5
@@ -42,7 +42,7 @@ int mu_hal_sendmsg(ulong base, u32 reg_index, u32 msg)assert (reg_index <MU_TR_COUNT ); -debug ("sendmsg sr 0x%x\n" ,readl (&mu_base->sr)); +debug ("sendmsg tsr 0x%x\n" ,readl (&mu_base->tsr));/* Wait TX register to be empty. */ ret =readl_poll_timeout (&mu_base->tsr, val, val & mask,10000 );
@@ -64,14 +64,24 @@ int mu_hal_receivemsg(ulong base, u32 reg_index, u32 *msg)u32 mask =MU_SR_RF0_MASK << reg_index;u32 val;int ret; +u32 count =10 ;assert (reg_index <MU_RR_COUNT ); -debug ("receivemsg sr 0x%x\n" ,readl (&mu_base->sr)); +debug ("receivemsg rsr 0x%x\n" ,readl (&mu_base->rsr)); -/* Wait RX register to be full. */ - ret =readl_poll_timeout (&mu_base->rsr, val, val & mask,10000 ); -if (ret <0 ) { +do { +/* Wait RX register to be full. */ + ret =readl_poll_timeout (&mu_base->rsr, val, val & mask,1000000 ); +if (ret <0 ) { + count--; +printf ("mu receive msg wait %us\n" ,10 - count); + }else { +break ; + } + }while (count >0 ); + +if (count ==0 ) {debug ("%s timeout\n" , __func__);return -ETIMEDOUT ; }
Signature · 1 line
2.40.0
PATCH v2 16/30 imx: misc: ele_mu: Update ELE MU driver
Quoted 7 lines
From: Ye Li <[email protected]>
Extend the RX timeout value to 10s, because when authentication is failed the ELE needs long time (>2s for 28M image) to return the result. Print rx wait info per 1s.
Also correct TX and RX status registers in debug.Signed-off-by Ye Li <[email protected]>Signed-off-by Peng Fan <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected] =====================================================================
PATCH v2 17/30 imx: imx8ulp: start the ELE RNG at boot
In reply to Peng Fan (OSS)From: Peng Fan <[email protected]>
On the imx8ulp A1 SoC, the ELE RNG needs to be manually started.
--- arch/arm/include/asm/mach-imx/ele_api.h | 1 + board/freescale/imx8ulp_evk/spl.c | 10 ++++++++++ drivers/misc/imx_ele/ele_api.c | 25 +++++++++++++++++++++++++ 3 files changed, 36 insertions(+)
arch/arm/include/asm/mach-imx/ele_api.h +1 -0
@@ -149,4 +149,5 @@ int ele_get_fw_status(u32 *status, u32 *response);int ele_release_m33_trout (void );int ele_write_secure_fuse (ulong signed_msg_blk,u32 *response);int ele_return_lifecycle_update (ulong signed_msg_blk,u32 *response); +int ele_start_rng (void );#endif
board/freescale/imx8ulp_evk/spl.c +10 -0
@@ -123,6 +123,16 @@ void spl_board_init(void) ret =ele_release_caam (0x7 , &res);if (ret)printf ("ele release caam failed %d, 0x%x\n" , ret, res); + +/* +* RNG start only available on the A1 soc revision. +* Check some JTAG register for the SoC revision. +*/ +if (!is_soc_rev (CHIP_REV_1_0 )) { + ret =ele_start_rng (); +if (ret) +printf ("Fail to start RNG: %d\n" , ret); + } }void board_init_f (ulong dummy)
drivers/misc/imx_ele/ele_api.c +25 -0
@@ -503,6 +503,31 @@ int ele_get_events(u32 *events, u32 *events_cnt, u32 *response)return ret; } +int ele_start_rng (void ) +{ +struct udevice *dev = gd->arch.ele_dev; +int size =sizeof (struct ele_msg ); +struct ele_msg msg; +int ret; + +if (!dev) { +printf ("ele dev is not initialized\n" ); +return -ENODEV ; + } + + msg.version =ELE_VERSION ; + msg.tag =ELE_CMD_TAG ; + msg.size =1 ; + msg.command =ELE_START_RNG ; + + ret =misc_call (dev, false, &msg, size, &msg, size); +if (ret) +printf ("Error: %s: ret %d, response 0x%x\n" , + __func__, ret, msg.data[0 ]); + +return ret; +} +int ele_write_secure_fuse (ulong signed_msg_blk,u32 *response) {struct udevice *dev = gd->arch.ele_dev;
Signature · 1 line
2.40.0
PATCH v2 17/30 imx: imx8ulp: start the ELE RNG at boot
Quoted 4 lines
From: Peng Fan <[email protected]>
On the imx8ulp A1 SoC, the ELE RNG needs to be manually started.Signed-off-by Clement Faure <[email protected]>Signed-off-by Peng Fan <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected] =====================================================================
PATCH v2 18/30 imx: hab: Fix coverity issue in HAB event decoding
In reply to Peng Fan (OSS)From: Ye Li <[email protected]>
Fix below coverity issues caused by get_idx function where "-1" is compared with uint8_t "element"
343336 Unsigned compared with neg
343337 Operands don't affect result
Additional, this function returns "-1" will cause overflow to event string array.
--- arch/arm/mach-imx/hab.c | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-)
arch/arm/mach-imx/hab.c +22 -19
@@ -289,9 +289,10 @@ static char *rsn_str[] = { };static char *sts_str[] = { -"STS = HAB_SUCCESS (0xF0)\n" , +"STS = HAB_STS_ANY (0x00)\n" ,"STS = HAB_FAILURE (0x33)\n" ,"STS = HAB_WARNING (0x69)\n" , +"STS = HAB_SUCCESS (0xF0)\n" ,"STS = INVALID\n" ,NULL };
@@ -336,8 +337,7 @@ static uint8_t hab_statuses[5] = {HAB_STS_ANY ,HAB_FAILURE ,HAB_WARNING , -HAB_SUCCESS , --1 +HAB_SUCCESS }; static uint8_t hab_reasons[26] = {
@@ -365,8 +365,7 @@ static uint8_t hab_reasons[26] = {HAB_UNS_ITEM ,HAB_UNS_KEY ,HAB_UNS_PROTOCOL , -HAB_UNS_STATE , --1 +HAB_UNS_STATE }; static uint8_t hab_contexts[12] = {
@@ -380,8 +379,7 @@ static uint8_t hab_contexts[12] = {HAB_CTX_COMMAND ,HAB_CTX_AUT_DAT ,HAB_CTX_ASSERT , -HAB_CTX_EXIT , --1 +HAB_CTX_EXIT }; static uint8_t hab_engines[16] = {
@@ -399,30 +397,35 @@ static uint8_t hab_engines[16] = {HAB_ENG_ROM ,HAB_ENG_HDCP ,HAB_ENG_RTL , -HAB_ENG_SW , --1 +HAB_ENG_SW }; -static inline uint8_t get_idx (uint8_t *list,uint8_t tgt) +static inline u32 get_idx (u8 *list,u8 tgt,u32 size) { -uint8_t idx =0 ; -uint8_t element = list[idx]; -while (element !=-1 ) { +u32 idx =0 ; +u8 element; + +while (idx < size) { + element = list[idx];if (element == tgt)return idx; - element = list[++idx]; + ++idx; } -return -1 ; +return idx; }static void process_event_record (uint8_t *event_data,size_t bytes) {struct record *rec = (struct record *)event_data; -printf ("\n\n%s" , sts_str[get_idx (hab_statuses, rec->contents[0 ])]); -printf ("%s" , rsn_str[get_idx (hab_reasons, rec->contents[1 ])]); -printf ("%s" , ctx_str[get_idx (hab_contexts, rec->contents[2 ])]); -printf ("%s" , eng_str[get_idx (hab_engines, rec->contents[3 ])]); +printf ("\n\n%s" , sts_str[get_idx (hab_statuses, rec->contents[0 ], +ARRAY_SIZE (hab_statuses))]); +printf ("%s" , rsn_str[get_idx (hab_reasons, rec->contents[1 ], +ARRAY_SIZE (hab_reasons))]); +printf ("%s" , ctx_str[get_idx (hab_contexts, rec->contents[2 ], +ARRAY_SIZE (hab_contexts))]); +printf ("%s" , eng_str[get_idx (hab_engines, rec->contents[3 ], +ARRAY_SIZE (hab_engines))]); }static void display_event (uint8_t *event_data,size_t bytes)
Signature · 1 line
2.40.0
PATCH v2 18/30 imx: hab: Fix coverity issue in HAB event decoding
Quoted 10 lines
From: Ye Li <[email protected]>
Fix below coverity issues caused byget_idxfunction where "-1" is compared withuint8_t"element"
343336 Unsigned compared with neg
343337 Operands don't affect result
Additional, this function returns "-1" will cause overflow to event string array.Reviewed-by Peng Fan <[email protected]>Signed-off-by Ye Li <[email protected]>Signed-off-by Peng Fan <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected] =====================================================================
PATCH v2 19/30 imx: image-container: Fix container header checking
In reply to Peng Fan (OSS)From: Ye Li <[email protected]>
Checking container header tag and version is wrong, it causes to fail to bypass invalid container
--- arch/arm/mach-imx/image-container.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-imx/image-container.c +1 -1
@@ -31,7 +31,7 @@ int get_container_size(ulong addr, u16 *header_length)u32 max_offset =0 , img_end; phdr = (struct container_hdr *)addr; -if (phdr->tag !=0x87 && phdr->version !=0x0 ) { +if (phdr->tag !=0x87 || phdr->version !=0x0 ) {debug ("Wrong container header\n" );return -EFAULT ; }
Signature · 1 line
2.40.0
PATCH v2 19/30 imx: image-container: Fix container header checking
Quoted 6 lines
From: Ye Li <[email protected]>
Checking container header tag and version is wrong, it causes to fail to bypass invalid containerReviewed-by Peng Fan <[email protected]>Signed-off-by Ye Li <[email protected]>Signed-off-by Peng Fan <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected] =====================================================================
PATCH v2 20/30 imx: iamge-container: support secondary container
In reply to Peng Fan (OSS)From: Peng Fan <[email protected]>
Add the support for loading image from secondary container set on iMX8QM B0, iMX8QXP C0.
Using the SCFW API to get container set index, if it is the secondary boot, get the offset from fuse and apply to offset of current container set beginning for loading.
Also override the emmc boot partition to check secondary boot and switch to the other boot part.
This patch is modified from NXP downstream:
imx8: Fix the fuse used by secondary container offset
imx: container: Skip container set check for ROM API
imx8: spl: Support booting from secondary container set
--- arch/arm/mach-imx/image-container.c | 94 ++++++++++++++++++++++++++--- 1 file changed, 87 insertions(+), 7 deletions(-)
arch/arm/mach-imx/image-container.c +87 -7
@@ -22,6 +22,25 @@#define QSPI_NOR_DEV 3#define ROM_API_DEV 4 +/* The unit of second image offset number which provision by the fuse bits */ +#define SND_IMG_OFF_UNIT (0x100000UL) + +/* +* If num = 0, off = (2 ^ 2) * 1MB +* else If num = 2, off = (2 ^ 0) * 1MB +* else off = (2 ^ num) * 1MB +*/ +#define SND_IMG_NUM_TO_OFF (num) \ + ((1UL << ((0 == (num)) ? 2 : (2 == (num)) ? 0 : (num))) * SND_IMG_OFF_UNIT) + +#define GET_SND_IMG_NUM (fuse) (((fuse) >> 24) & 0x1F) + +#if defined(CONFIG_IMX8QM ) +#define FUSE_IMG_SET_OFF_WORD 464 +#elif defined(CONFIG_IMX8QXP ) +#define FUSE_IMG_SET_OFF_WORD 720 +#endif +int get_container_size (ulong addr,u16 *header_length) {struct container_hdr *phdr;
@@ -136,15 +155,53 @@ static int get_dev_container_size(void *dev, int dev_type, unsigned long offset,return ret; } +static bool check_secondary_cnt_set (unsigned long *set_off) +{ +#if IS_ENABLED (CONFIG_ARCH_IMX8 ) +int ret; +u8 set_id =1 ; +u32 fuse_val =0 ; + +if (!(is_imx8qxp () &&is_soc_rev (CHIP_REV_B ))) { + ret =sc_misc_get_boot_container (-1 , &set_id); +if (ret) +return false; +/* Secondary boot */ +if (set_id ==2 ) { + ret =sc_misc_otp_fuse_read (-1 ,FUSE_IMG_SET_OFF_WORD , &fuse_val); +if (!ret) { +if (set_off) + *set_off =SND_IMG_NUM_TO_OFF (GET_SND_IMG_NUM (fuse_val)); +return true; + } + } + } +#endif + +return false; +} +static unsigned long get_boot_device_offset (void *dev,int dev_type) { -unsigned long offset =0 ; +unsigned long offset =0 , sec_set_off =0 ; +bool sec_boot = false; + +if (dev_type ==ROM_API_DEV ) { + offset = (unsigned long )dev; +return offset; + } + + sec_boot =check_secondary_cnt_set (&sec_set_off); +if (sec_boot) +printf ("Secondary set selected\n" ); +else +printf ("Primary set selected\n" );if (dev_type ==MMC_DEV ) {struct mmc *mmc = (struct mmc *)dev;if (IS_SD (mmc) || mmc->part_config ==MMCPART_NOAVAILABLE ) { - offset =CONTAINER_HDR_MMCSD_OFFSET ; + offset = sec_boot ? sec_set_off :CONTAINER_HDR_MMCSD_OFFSET ; }else {u8 part =EXT_CSD_EXTRACT_BOOT_PART (mmc->part_config);
@@ -154,19 +211,23 @@ static unsigned long get_boot_device_offset(void *dev, int dev_type)else offset =CONTAINER_HDR_EMMC_OFFSET ; }else { - offset =CONTAINER_HDR_MMCSD_OFFSET ; + offset = sec_boot ? sec_set_off :CONTAINER_HDR_MMCSD_OFFSET ; } } }else if (dev_type ==QSPI_DEV ) { - offset =CONTAINER_HDR_QSPI_OFFSET ; + offset = sec_boot ? (sec_set_off +CONTAINER_HDR_QSPI_OFFSET ) : +CONTAINER_HDR_QSPI_OFFSET ; }else if (dev_type ==NAND_DEV ) { - offset =CONTAINER_HDR_NAND_OFFSET ; + offset = sec_boot ? (sec_set_off +CONTAINER_HDR_NAND_OFFSET ) : +CONTAINER_HDR_NAND_OFFSET ; }else if (dev_type ==QSPI_NOR_DEV ) { offset =CONTAINER_HDR_QSPI_OFFSET +0x08000000 ; - }else if (dev_type ==ROM_API_DEV ) { - offset = (unsigned long )dev; + }else { +printf ("Not supported dev_type: %d\n" , dev_type); } +debug ("container set offset 0x%lx\n" , offset); +return offset; }
@@ -227,6 +288,25 @@ unsigned long spl_mmc_get_uboot_raw_sector(struct mmc *mmc, return end / mmc->read_bl_len; } + +int spl_mmc_emmc_boot_partition (struct mmc *mmc) +{ +int part; + + part =EXT_CSD_EXTRACT_BOOT_PART (mmc->part_config); +if (part ==1 || part ==2 ) { +unsigned long sec_set_off =0 ; +bool sec_boot = false; + + sec_boot =check_secondary_cnt_set (&sec_set_off); +if (sec_boot) + part = (part ==1 ) ?2 :1 ; + }else if (part ==7 ) { + part =0 ; + } + +return part; +}#endif #ifdef CONFIG_SPL_NAND_SUPPORT
Signature · 1 line
2.40.0
PATCH v2 20/30 imx: iamge-container: support secondary container
Quoted 12 lines
From: Peng Fan <[email protected]>
Add the support for loading image from secondary container set on iMX8QM B0, iMX8QXP C0.
Using the SCFW API to get container set index, if it is the secondary boot, get the offset from fuse and apply to offset of current container set beginning for loading.
Also override the emmc boot partition to check secondary boot and switch to the other boot part.
This patch is modified from NXP downstream:
imx8: Fix the fuse used by secondary container offset
imx: container: Skip container set check for ROM API
imx8: spl: Support booting from secondary container set
Quoted 2 lines
Signed-off-by Ye Li <[email protected]>Signed-off-by Peng Fan <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected] =====================================================================
PATCH v2 21/30 imx: bootaux: change names of MACROs used to boot MCU on iMX devices
In reply to Peng Fan (OSS)From: Peng Fan <[email protected]>
The current bootaux supports i.MX8M and i.MX93, but the name "_M4_" implies that the SoCs have Cortex-M4. Actually i.MX8MM/Q use Cortex-M4, i.MX8MN/P use Cortex-M7, i.MX93 use Cortex-M33, so use "_MCU_" in place of "_M4_" to simplify the naming.
--- arch/arm/include/asm/arch-imx8m/imx-regs.h | 2 +- arch/arm/include/asm/arch-mx6/imx-regs.h | 2 +- arch/arm/include/asm/arch-mx7/imx-regs.h | 2 +- arch/arm/mach-imx/imx9/imx_bootaux.c | 6 +++--- arch/arm/mach-imx/imx_bootaux.c | 24 +++++++++++----------- board/kontron/sl-mx8mm/sl-mx8mm.c | 2 +- board/kontron/sl-mx8mm/spl.c | 2 +- board/technexion/pico-imx8mq/pico-imx8mq.c | 2 +- board/technexion/pico-imx8mq/spl.c | 2 +- include/imx_sip.h | 6 +++--- 10 files changed, 25 insertions(+), 25 deletions(-)
arch/arm/include/asm/arch-imx8m/imx-regs.h +1 -1
@@ -13,7 +13,7 @@#define ROM_VERSION_A0 IS_ENABLED(CONFIG_IMX8MQ) ? 0x800 : 0x800#define ROM_VERSION_B0 IS_ENABLED(CONFIG_IMX8MQ) ? 0x83C : 0x800 -#define M4_BOOTROM_BASE_ADDR 0x007E0000 +#define MCU_BOOTROM_BASE_ADDR 0x007E0000#define GPIO1_BASE_ADDR 0X30200000#define GPIO2_BASE_ADDR 0x30210000
arch/arm/include/asm/arch-mx6/imx-regs.h +1 -1
@@ -23,7 +23,7 @@#define GPU_ARB_END_ADDR 0x01803FFF#define APBH_DMA_ARB_BASE_ADDR 0x01804000#define APBH_DMA_ARB_END_ADDR 0x0180BFFF -#define M4_BOOTROM_BASE_ADDR 0x007F8000 +#define MCU_BOOTROM_BASE_ADDR 0x007F8000#elif !defined(CONFIG_MX6SLL )#define CAAM_ARB_BASE_ADDR 0x00100000
arch/arm/include/asm/arch-mx7/imx-regs.h +1 -1
@@ -18,7 +18,7 @@#define GIC400_ARB_END_ADDR 0x31007FFF#define APBH_DMA_ARB_BASE_ADDR 0x33000000#define APBH_DMA_ARB_END_ADDR 0x33007FFF -#define M4_BOOTROM_BASE_ADDR 0x00180000 +#define MCU_BOOTROM_BASE_ADDR 0x00180000#define MXS_APBH_BASE APBH_DMA_ARB_BASE_ADDR#define MXS_GPMI_BASE (APBH_DMA_ARB_BASE_ADDR + 0x02000)
arch/arm/mach-imx/imx9/imx_bootaux.c +3 -3
@@ -13,7 +13,7 @@ int arch_auxiliary_core_check_up(u32 core_id) {struct arm_smccc_res res; -arm_smccc_smc (IMX_SIP_SRC ,IMX_SIP_SRC_M4_STARTED ,0 ,0 , +arm_smccc_smc (IMX_SIP_SRC ,IMX_SIP_SRC_MCU_STARTED ,0 ,0 ,0 ,0 ,0 ,0 , &res);return res.a0;
@@ -25,7 +25,7 @@ int arch_auxiliary_core_down(u32 core_id)printf ("## Stopping auxiliary core\n" ); -arm_smccc_smc (IMX_SIP_SRC ,IMX_SIP_SRC_M4_STOP ,0 ,0 , +arm_smccc_smc (IMX_SIP_SRC ,IMX_SIP_SRC_MCU_STOP ,0 ,0 ,0 ,0 ,0 ,0 , &res);return 0 ;
@@ -40,7 +40,7 @@ int arch_auxiliary_core_up(u32 core_id, ulong addr)printf ("## Starting auxiliary core addr = 0x%08lX...\n" , addr); -arm_smccc_smc (IMX_SIP_SRC ,IMX_SIP_SRC_M4_START , addr,0 , +arm_smccc_smc (IMX_SIP_SRC ,IMX_SIP_SRC_MCU_START , addr,0 ,0 ,0 ,0 ,0 , &res);return 0 ;
arch/arm/mach-imx/imx_bootaux.c +12 -12
@@ -124,15 +124,15 @@ int arch_auxiliary_core_up(u32 core_id, ulong addr)printf ("## Starting auxiliary core stack = 0x%08lX, pc = 0x%08lX...\n" , stack, pc); -/* Set the stack and pc to M4 bootROM */ -writel (stack,M4_BOOTROM_BASE_ADDR ); -writel (pc,M4_BOOTROM_BASE_ADDR +4 ); +/* Set the stack and pc to MCU bootROM */ +writel (stack,MCU_BOOTROM_BASE_ADDR ); +writel (pc,MCU_BOOTROM_BASE_ADDR +4 );flush_dcache_all (); -/* Enable M4 */ +/* Enable MCU */ if (IS_ENABLED (CONFIG_IMX8M )) { -arm_smccc_smc (IMX_SIP_SRC ,IMX_SIP_SRC_M4_START ,0 ,0 ,0 ,0 ,0 ,0 ,NULL ); +arm_smccc_smc (IMX_SIP_SRC ,IMX_SIP_SRC_MCU_START ,0 ,0 ,0 ,0 ,0 ,0 ,NULL ); }else {clrsetbits_le32 (SRC_BASE_ADDR +SRC_M4_REG_OFFSET ,SRC_M4C_NON_SCLR_RST_MASK ,SRC_M4_ENABLE_MASK );
@@ -147,7 +147,7 @@ int arch_auxiliary_core_check_up(u32 core_id)unsigned int val;if (IS_ENABLED (CONFIG_IMX8M )) { -arm_smccc_smc (IMX_SIP_SRC ,IMX_SIP_SRC_M4_STARTED ,0 ,0 ,0 ,0 ,0 ,0 , &res); +arm_smccc_smc (IMX_SIP_SRC ,IMX_SIP_SRC_MCU_STARTED ,0 ,0 ,0 ,0 ,0 ,0 , &res);return res.a0; }
@@ -164,13 +164,13 @@ int arch_auxiliary_core_check_up(u32 core_id)* the reset vector at the head for the image, with SP and PC * as the first two words. * -* Per the cortex-M reference manual, the reset vector of M4 needs -* to exist at 0x0 (TCMUL). The PC and SP are the first two addresses -* of that vector. So to boot M4, the A core must build the M4's reset +* Per the cortex-M reference manual, the reset vector of M4/M7 needs +* to exist at 0x0 (TCMUL/IDTCM). The PC and SP are the first two addresses +* of that vector. So to boot M4/M7, the A core must build the M4/M7's reset * vector with getting the PC and SP from image and filling them to -* TCMUL. When M4 is kicked, it will load the PC and SP by itself. -* The TCMUL is mapped to (M4_BOOTROM_BASE_ADDR) at A core side for -* accessing the M4 TCMUL. +* TCMUL/IDTCM. When M4/M7 is kicked, it will load the PC and SP by itself. +* The TCMUL/IDTCM is mapped to (MCU_BOOTROM_BASE_ADDR) at A core side for +* accessing the M4/M7 TCMUL/IDTCM. */ static int do_bootaux (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[])
board/kontron/sl-mx8mm/sl-mx8mm.c +1 -1
@@ -37,7 +37,7 @@ u8 num_image_type_guids = ARRAY_SIZE(fw_images);int board_phys_sdram_size (phys_size_t *size) { -u32 ddr_size =readl (M4_BOOTROM_BASE_ADDR ); +u32 ddr_size =readl (MCU_BOOTROM_BASE_ADDR );if (ddr_size ==4 ) { *size =0x100000000 ;
board/kontron/sl-mx8mm/spl.c +1 -1
@@ -106,7 +106,7 @@ static void spl_dram_init(void) } gd->ram_size = size; -writel (size,M4_BOOTROM_BASE_ADDR ); +writel (size,MCU_BOOTROM_BASE_ADDR ); }int do_board_detect (void )
board/technexion/pico-imx8mq/pico-imx8mq.c +1 -1
@@ -54,7 +54,7 @@ int board_early_init_f(void)int board_phys_sdram_size (phys_size_t *size) { -int ddr_size =readl (M4_BOOTROM_BASE_ADDR ); +int ddr_size =readl (MCU_BOOTROM_BASE_ADDR );if (ddr_size ==0x4 ) { *size =0x100000000 ;
board/technexion/pico-imx8mq/spl.c +1 -1
@@ -89,7 +89,7 @@ static void spl_dram_init(void)printf ("%s: LPDDR4 %d GiB\n" , __func__, size);ddr_init (dram_timing); -writel (size,M4_BOOTROM_BASE_ADDR ); +writel (size,MCU_BOOTROM_BASE_ADDR ); }#define USDHC2_CD_GPIO IMX_GPIO_NR(2, 12)
include/imx_sip.h +3 -3
@@ -13,8 +13,8 @@#define IMX_SIP_BUILDINFO_GET_COMMITHASH 0x00#define IMX_SIP_SRC 0xC2000005 -#define IMX_SIP_SRC_M4_START 0x00 -#define IMX_SIP_SRC_M4_STARTED 0x01 -#define IMX_SIP_SRC_M4_STOP 0x02 +#define IMX_SIP_SRC_MCU_START 0x00 +#define IMX_SIP_SRC_MCU_STARTED 0x01 +#define IMX_SIP_SRC_MCU_STOP 0x02#endif
Signature · 1 line
2.40.0
PATCH v2 21/30 imx: bootaux: change names of MACROs used to boot MCU on iMX devices
Quoted 7 lines
From: Peng Fan <[email protected]>
The current bootaux supports i.MX8M and i.MX93, but the name "_M4_" implies that the SoCs have Cortex-M4. Actually i.MX8MM/Q use Cortex-M4, i.MX8MN/P use Cortex-M7, i.MX93 use Cortex-M33, so use "_MCU_" in place of "_M4_" to simplify the naming.Signed-off-by faqiang.zhu <[email protected]>Signed-off-by Peng Fan <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected] =====================================================================
PATCH v2 22/30 imx: bootaux: Fix bootaux issue when running on ARM64
In reply to Peng Fan (OSS)From: Ye Li <[email protected]>
The bootaux uses ulong to read private data and write to M4 TCM, this cause problem on ARM64 platform where the ulong is 8bytes. Fix it by using u32 to replace ulong.
--- arch/arm/mach-imx/imx_bootaux.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/mach-imx/imx_bootaux.c +3 -3
@@ -45,7 +45,7 @@ static const struct rproc_att *get_host_mapping(unsigned long auxcore)* is valid, returns the entry point address. * Translates load addresses in the elf file to the U-Boot address space. */ -static unsigned long load_elf_image_m_core_phdr (unsigned long addr,ulong *stack) +static u32 load_elf_image_m_core_phdr (unsigned long addr,u32 *stack) {Elf32_Ehdr *ehdr;/* ELF header structure pointer */ Elf32_Phdr *phdr;/* Program header structure pointer */
@@ -95,7 +95,7 @@ static unsigned long load_elf_image_m_core_phdr(unsigned long addr, ulong *stackint arch_auxiliary_core_up (u32 core_id,ulong addr) { -ulong stack, pc; +u32 stack, pc;if (!addr)return -EINVAL ;
@@ -121,7 +121,7 @@ int arch_auxiliary_core_up(u32 core_id, ulong addr) pc = *(u32 *)(addr +4 ); } -printf ("## Starting auxiliary core stack = 0x%08lX, pc = 0x%08lX...\n" , +printf ("## Starting auxiliary core stack = 0x%08X, pc = 0x%08X...\n" , stack, pc);/* Set the stack and pc to MCU bootROM */
Signature · 1 line
2.40.0
PATCH v2 22/30 imx: bootaux: Fix bootaux issue when running on ARM64
Quoted 7 lines
From: Ye Li <[email protected]>
The bootaux uses ulong to read private data and write to M4 TCM, this cause problem on ARM64 platform where the ulong is 8bytes. Fix it by using u32 to replace ulong.Reviewed-by Peng Fan <[email protected]>Signed-off-by Ye Li <[email protected]>Signed-off-by Peng Fan <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected] =====================================================================
PATCH v2 23/30 imx: imx8: bootaux: Add i.MX8 M4 boot support
In reply to Peng Fan (OSS)From: Ye Li <[email protected]>
1. Implement bootaux for the M4 boot on i.MX8QM and QXP. Users need to download M4 image to any DDR address first. Then use the
"bootaux <M4 download DDR address> [M4 core id]" to boot CM4_0 or CM4_1, the default core id is 0 for CM4_0.
Since current M4 only supports running in TCM. The bootaux will copy the M4 image from DDR to its TCML.
2. Implment bootaux for HIFI on QXP
command: bootaux 0x81000000 1
--- arch/arm/include/asm/mach-imx/sys_proto.h | 1 + arch/arm/mach-imx/Kconfig | 2 +- arch/arm/mach-imx/Makefile | 5 + arch/arm/mach-imx/imx8/cpu.c | 174 ++++++++++++++++++++++ arch/arm/mach-imx/imx_bootaux.c | 15 +- 5 files changed, 192 insertions(+), 5 deletions(-)
arch/arm/include/asm/mach-imx/sys_proto.h +1 -0
@@ -236,6 +236,7 @@ void board_mem_get_layout(u64 *phys_sdram_1_start, u64 *phys_sdram_2_start, u64 *phys_sdram_2_size); +int arch_auxiliary_core_up (u32 core_id,ulong boot_private_data);int arch_auxiliary_core_check_up (u32 core_id);int board_mmc_get_env_dev (int devno);
arch/arm/mach-imx/Kconfig +1 -1
@@ -31,7 +31,7 @@ config IMX_RDC config IMX_BOOTAUX bool "Support boot auxiliary core" - depends on ARCH_MX7 || ARCH_MX6 || ARCH_VF610 || ARCH_IMX8M + depends on ARCH_MX7 || ARCH_MX6 || ARCH_VF610 || ARCH_IMX8 || ARCH_IMX8M help bootaux [addr] to boot auxiliary core.
arch/arm/mach-imx/Makefile +5 -0
@@ -66,6 +66,11 @@ ifeq ($(SOC),$(filter $(SOC),vf610)) obj-y += ddrmc-vf610.o obj-$(CONFIG_DDRMC_VF610_CALIBRATION) += ddrmc-vf610-calibration.o endif +ifeq ($(SOC),$(filter $(SOC),imx8)) +ifneq ($(CONFIG_SPL_BUILD),y) +obj-$(CONFIG_IMX_BOOTAUX) += imx_bootaux.o +endif +endif ifneq ($(CONFIG_SPL_BUILD),y) obj-$(CONFIG_CMD_BMODE) += cmd_bmode.o obj-$(CONFIG_CMD_HDMIDETECT) += cmd_hdmidet.o
arch/arm/mach-imx/imx8/cpu.c +174 -0
186 lines not on this page · raw message
arch/arm/mach-imx/imx_bootaux.c +11 -4
@@ -14,6 +14,7 @@#include <linux/compiler.h> #include <cpu_func.h> +#ifndef CONFIG_IMX8 /* Just to avoid build error */ #if IS_ENABLED (CONFIG_IMX8M )#define SRC_M4C_NON_SCLR_RST_MASK BIT(0)
@@ -158,7 +159,7 @@ int arch_auxiliary_core_check_up(u32 core_id) return 1; } - +#endif /* * To i.MX6SX and i.MX7D, the image supported by bootaux needs * the reset vector at the head for the image, with SP and PC
@@ -177,11 +178,15 @@ static int do_bootaux(struct cmd_tbl *cmdtp, int flag, int argc, {ulong addr;int ret, up; +u32 core =0 ;if (argc <2 )return CMD_RET_USAGE ; - up =arch_auxiliary_core_check_up (0 ); +if (argc >2 ) + core =simple_strtoul (argv[2 ],NULL ,10 ); + + up =arch_auxiliary_core_check_up (core);if (up) {printf ("## Auxiliary core is already up\n" );return CMD_RET_SUCCESS ;
@@ -192,7 +197,7 @@ static int do_bootaux(struct cmd_tbl *cmdtp, int flag, int argc,if (!addr)return CMD_RET_FAILURE ; - ret =arch_auxiliary_core_up (0 , addr); + ret =arch_auxiliary_core_up (core, addr);if (ret)return CMD_RET_FAILURE ;
@@ -202,5 +207,7 @@ static int do_bootaux(struct cmd_tbl *cmdtp, int flag, int argc,U_BOOT_CMD ( bootaux,CONFIG_SYS_MAXARGS ,1 , do_bootaux,"Start auxiliary core" , -"" +"<address> [<core>]\n" +" - start auxiliary core [<core>] (default 0),\n" +" at address <address>\n" );
Signature · 1 line
2.40.0
PATCH v2 23/30 imx: imx8: bootaux: Add i.MX8 M4 boot support
Quoted 11 lines
From: Ye Li <[email protected]>
1. Implement bootaux for the M4 boot on i.MX8QM and QXP. Users need to download M4 image to any DDR address first. Then use the
"bootaux <M4 download DDR address> [M4 core id]" to bootCM4_0orCM4_1, the default core id is 0 forCM4_0.
Since current M4 only supports running in TCM. The bootaux will copy the M4 image from DDR to its TCML.
2. Implment bootaux for HIFI on QXP
command: bootaux0x810000001Signed-off-by Ye Li <[email protected]>Signed-off-by Peng Fan <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected] =====================================================================
PATCH v2 24/30 imx: imx8m: clock: not configure reserved SRC register
In reply to Peng Fan (OSS)From: Peng Fan <[email protected]>
i.MX8M[M,N,P] SRC not has 0x1004 offset register, so drop it.
--- arch/arm/mach-imx/imx8m/clock_imx8mm.c | 1 - 1 file changed, 1 deletion(-)
arch/arm/mach-imx/imx8m/clock_imx8mm.c +0 -1
@@ -90,7 +90,6 @@ static int fracpll_configure(enum pll_clocks pll, u32 freq)case ANATOP_DRAM_PLL :setbits_le32 (GPC_BASE_ADDR +0xEC ,1 <<7 );setbits_le32 (GPC_BASE_ADDR +0xF8 ,1 <<5 ); -writel (SRC_DDR1_ENABLE_MASK ,SRC_BASE_ADDR +0x1004 ); pll_base = &ana_pll->dram_pll_gnrl_ctl;break ;
Signature · 1 line
2.40.0
PATCH v2 24/30 imx: imx8m: clock: not configure reserved SRC register
Quoted 4 lines
From: Peng Fan <[email protected]>
i.MX8M[M,N,P] SRC not has0x1004offset register, so drop it.Reviewed-by Ye Li <[email protected]>Signed-off-by Peng Fan <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected] =====================================================================
PATCH v2 25/30 imx: parse-container: Use malloc for container processing
In reply to Peng Fan (OSS)From: Nitin Garg <[email protected]>
If the container has image which conflicts with spl_get_load_buffer address, there are processing failures. Use malloc instead of spl_get_load_buffer.
--- arch/arm/mach-imx/parse-container.c | 38 ++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 11 deletions(-)
arch/arm/mach-imx/parse-container.c +27 -11
@@ -4,6 +4,7 @@*/ #include <common.h> +#include <stdlib.h> #include <errno.h> #include <log.h> #include <spl.h>
@@ -134,21 +135,27 @@ static int read_auth_container(struct spl_image_info *spl_image,* It will not override the ATF code, so safe to use it here, * no need malloc */ - container = (struct container_hdr *)spl_get_load_buffer (-size, size); + container =malloc (size); +if (!container) +return -ENOMEM ;debug ("%s: container: %p sector: %lu sectors: %u\n" , __func__, container, sector, sectors); -if (info->read (info, sector, sectors, container) != sectors) -return -EIO ; +if (info->read (info, sector, sectors, container) != sectors) { + ret = -EIO ; + goto end; + }if (container->tag !=0x87 && container->version !=0x0 ) { -printf ("Wrong container header\n" ); -return -ENOENT ; +printf ("Wrong container header" ); + ret = -ENOENT ; + goto end; }if (!container->num_images) { -printf ("Wrong container, no image found\n" ); -return -ENOENT ; +printf ("Wrong container, no image found" ); + ret = -ENOENT ; + goto end; } length = container->length_lsb + (container->length_msb <<8 );
@@ -158,13 +165,18 @@ static int read_auth_container(struct spl_image_info *spl_image, size =roundup (length, info->bl_len); sectors = size / info->bl_len; - container = (struct container_hdr *)spl_get_load_buffer (-size, size); +free (container); + container =malloc (size); +if (!container) +return -ENOMEM ;debug ("%s: container: %p sector: %lu sectors: %u\n" , __func__, container, sector, sectors);if (info->read (info, sector, sectors, container) != - sectors) -return -EIO ; + sectors) { + ret = -EIO ; + goto end; + } }#ifdef CONFIG_AHAB_BOOT
@@ -175,7 +187,7 @@ static int read_auth_container(struct spl_image_info *spl_image, SECO_LOCAL_SEC_SEC_SECURE_RAM_BASE);if (ret) {printf ("authenticate container hdr failed, return %d\n" , ret); -return ret; + goto end_auth; }#endif
@@ -200,6 +212,10 @@ end_auth:if (sc_seco_authenticate (-1 ,SC_SECO_REL_CONTAINER ,0 ))printf ("Error: release container failed!\n" );#endif + +end: +free (container); +return ret; }
Signature · 1 line
2.40.0
PATCH v2 25/30 imx: parse-container: Use malloc for container processing
Quoted 7 lines
From: Nitin Garg <[email protected]>
If the container has image which conflicts withspl_get_load_bufferaddress, there are processing failures. Use malloc instead ofspl_get_load_buffer.Reviewed-by Ye Li <[email protected]>Signed-off-by Nitin Garg <[email protected]>Signed-off-by Peng Fan <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected] =====================================================================
PATCH v2 26/30 imx: ahab: Update AHAB for iMX8 and iMX8ULP
In reply to Peng Fan (OSS)From: Ye Li <[email protected]>
Abstract common interfaces for AHAB authentication operations. Then share some common codes for AHAB and SPL container authentication
--- arch/arm/include/asm/mach-imx/ahab.h | 15 ++++ arch/arm/mach-imx/imx8/ahab.c | 129 +++++++++++++++++---------- arch/arm/mach-imx/imx8ulp/Makefile | 1 - arch/arm/mach-imx/parse-container.c | 81 ++--------------- 4 files changed, 103 insertions(+), 123 deletions(-) create mode 100644 arch/arm/include/asm/mach-imx/ahab.h
arch/arm/include/asm/mach-imx/ahab.h new file +15 -0
@@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Copyright 2020 NXP +*/ + +#ifndef __IMX_AHAB_H__ +#define __IMX_AHAB_H__ + +#include <asm/mach-imx/image.h> + +int ahab_auth_cntr_hdr (struct container_hdr *container,u16 length); +int ahab_auth_release (void ); +int ahab_verify_cntr_image (struct boot_img_t *img,int image_index); + +#endif
arch/arm/mach-imx/imx8/ahab.c +82 -47
166 lines not on this page · raw message
arch/arm/mach-imx/imx8ulp/Makefile +0 -1
@@ -5,7 +5,6 @@ obj-y += lowlevel_init.o obj-y += soc.o clock.o iomux.o pcc.o cgc.o rdc.o -obj-$(CONFIG_AHAB_BOOT) += ahab.o ifeq ($(CONFIG_SPL_BUILD),y) obj-y += upower/
arch/arm/mach-imx/parse-container.c +6 -75
112 lines not on this page · raw message
Signature · 1 line
2.40.0
PATCH v2 26/30 imx: ahab: Update AHAB for iMX8 and iMX8ULP
Quoted 5 lines
From: Ye Li <[email protected]>
Abstract common interfaces for AHAB authentication operations. Then share some common codes for AHAB and SPL container authenticationSigned-off-by Ye Li <[email protected]>Signed-off-by Peng Fan <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected] =====================================================================
PATCH v2 27/30 imx: imx8: ahab: sha256: enable image verification using ARMv8 crypto extension
In reply to Peng Fan (OSS)From: Gaurav Jain <[email protected]>
add support for SHA-256 secure hash algorithm using the ARM v8 SHA-256 instructions for verifying image hash.
--- arch/arm/mach-imx/imx8/ahab.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-)
arch/arm/mach-imx/imx8/ahab.c +24 -4
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0+ /* -* Copyright 2018-2019 NXP +* Copyright 2018-2019, 2022 NXP */ #include <common.h>
@@ -16,6 +16,7 @@#include <asm/mach-imx/image.h> #include <console.h> #include <cpu_func.h> +#include "u-boot/sha256.h" #include <asm/mach-imx/ahab.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -25,6 +26,8 @@ DECLARE_GLOBAL_DATA_PTR;#define SECO_LOCAL_SEC_SEC_SECURE_RAM_BASE (0x60000000UL)#define SECO_PT 2U +#define AHAB_HASH_TYPE_MASK 0x00000700 +#define AHAB_HASH_TYPE_SHA256 0int ahab_auth_cntr_hdr (struct container_hdr *container,u16 length) {
@@ -128,6 +131,9 @@ int authenticate_os_container(ulong addr)u16 length;struct boot_img_t *img;unsigned long s, e; +#ifdef CONFIG_ARMV8_CE_SHA256 +u8 hash_value[SHA256_SUM_LEN ]; +#endif if (addr %4 ) {puts ("Error: Image's address is not 4 byte aligned\n" );
@@ -177,9 +183,23 @@ int authenticate_os_container(ulong addr)flush_dcache_range (s, e); - ret =ahab_verify_cntr_image (img, i); -if (ret) - goto exit; +#ifdef CONFIG_ARMV8_CE_SHA256 +if (((img->hab_flags &AHAB_HASH_TYPE_MASK ) >>8 ) ==AHAB_HASH_TYPE_SHA256 ) { +sha256_csum_wd ((void *)img->dst, img->size, hash_value,CHUNKSZ_SHA256 ); + err =memcmp (&img->hash, &hash_value,SHA256_SUM_LEN ); +if (err) { +printf ("img %d hash comparison failed, error %d\n" , i, err); + ret = -EIO ; + goto exit; + } + }else { +#endif + ret =ahab_verify_cntr_image (img, i); +if (ret) + goto exit; +#ifdef CONFIG_ARMV8_CE_SHA256 + } +#endif } exit:
Signature · 1 line
2.40.0
PATCH v2 27/30 imx: imx8: ahab: sha256: enable image verification using ARMv8 crypto extension
Quoted 5 lines
From: Gaurav Jain <[email protected]>
add support for SHA-256 secure hash algorithm using the ARM v8 SHA-256 instructions for verifying image hash.Signed-off-by Gaurav Jain <[email protected]>Signed-off-by Peng Fan <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected] =====================================================================
PATCH v2 28/30 imx: imx8m: add CAAM_BASE_ADDR
In reply to Peng Fan (OSS)From: Peng Fan <[email protected]>
Add CAAM_BASE_ADDR which will be used by priblob.c
--- arch/arm/include/asm/arch-imx8m/imx-regs.h | 1 + 1 file changed, 1 insertion(+)
arch/arm/include/asm/arch-imx8m/imx-regs.h +1 -0
@@ -40,6 +40,7 @@#define UART1_BASE_ADDR 0x30860000#define UART3_BASE_ADDR 0x30880000#define UART2_BASE_ADDR 0x30890000 +#define CAAM_BASE_ADDR 0x30900000#define I2C1_BASE_ADDR 0x30A20000#define I2C2_BASE_ADDR 0x30A30000#define I2C3_BASE_ADDR 0x30A40000
Signature · 1 line
2.40.0
PATCH v2 28/30 imx: imx8m: add CAAM_BASE_ADDR
Quoted 3 lines
From: Peng Fan <[email protected]>
AddCAAM_BASE_ADDRwhich will be used bypriblob.cSigned-off-by Peng Fan <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected] =====================================================================
PATCH v2 29/30 imx: priblob: Update to use structure
In reply to Peng Fan (OSS)From: Maximus Sun <[email protected]>
Use structure to avoid define CAAM_SCFGR for each platform
--- arch/arm/mach-imx/priblob.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
arch/arm/mach-imx/priblob.c +7 -3
@@ -13,12 +13,16 @@#include <asm/io.h> #include <common.h> #include <command.h> -#include "../drivers/crypto/fsl_caam_internal.h" +#include <fsl_sec.h> int do_priblob_write (struct cmd_tbl *cmdtp,int flag,int argc,char *const argv[]) { -writel ((readl (CAAM_SCFGR ) &0xFFFFFFFC ) |3 ,CAAM_SCFGR ); -printf ("New priblob setting = 0x%x\n" ,readl (CAAM_SCFGR ) &0x3 ); +ccsr_sec_t *sec_regs = (ccsr_sec_t *)CAAM_BASE_ADDR ; +u32 scfgr =sec_in32 (&sec_regs->scfgr); + + scfgr |=0x3 ; +sec_out32 (&sec_regs->scfgr, scfgr); +printf ("New priblob setting = 0x%x\n" ,sec_in32 (&sec_regs->scfgr) &0x3 );return 0 ; }
Signature · 1 line
2.40.0
PATCH v2 29/30 imx: priblob: Update to use structure
Quoted 4 lines
From: Maximus Sun <[email protected]>
Use structure to avoid defineCAAM_SCFGRfor each platformSigned-off-by Maximus Sun <[email protected]>Signed-off-by Peng Fan <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected] =====================================================================
PATCH v2 30/30 imx: fsl_sec: preprocessor casting issue with addresses involving math
In reply to Peng Fan (OSS)From: Utkarsh Gupta <[email protected]>
The sec_in32 preprocessor is defined as follows in include/fsl_sec.h file:
When address "a" is calculated using math for ex: addition of base address and an offset, then casting is applied only to the first address which in this example is base address.
caam_ccbvid_reg = sec_in32(CONFIG_SYS_FSL_SEC_ADDR + CAAM_CCBVID_OFFSET) resolves to:caam_ccbvid_reg = in_le32((ulong *)(ulong)CONFIG_SYS_FSL_SEC_ADDR +
CAAM_CCBVID_OFFSET)
instead it should resolve to:caam_ccbvid_reg = in_le32((ulong *)(ulong)(CONFIG_SYS_FSL_SEC_ADDR +
CAAM_CCBVID_OFFSET))
Thus add parenthesis around the address "a" so that however the address is calculated, the casting is applied to the final calculated address.
--- include/fsl_sec.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/fsl_sec.h +2 -2
@@ -13,8 +13,8 @@#include <asm/io.h> #ifdef CONFIG_SYS_FSL_SEC_LE -#define sec_in32 (a) in_le32((ulong *)(ulong)a) -#define sec_out32 (a, v) out_le32((ulong *)(ulong)a, v) +#define sec_in32 (a) in_le32((ulong *)(ulong)(a)) +#define sec_out32 (a, v) out_le32((ulong *)(ulong)(a), v)#define sec_in16 (a) in_le16(a)#define sec_clrbits32 clrbits_le32#define sec_setbits32 setbits_le32
Signature · 1 line
2.40.0
PATCH v2 30/30 imx: fsl_sec: preprocessor casting issue with addresses involving math
Quoted 14 lines
From: Utkarsh Gupta <[email protected]>
Thesec_in32preprocessor is defined as follows ininclude/fsl_sec.hfile:
When address "a" is calculated using math for ex: addition of base address and an offset, then casting is applied only to the first address which in this example is base address.caam_ccbvid_reg=sec_in32(CONFIG_SYS_FSL_SEC_ADDR + CAAM_CCBVID_OFFSET)resolves to:caam_ccbvid_reg= in_le32((ulong *)(ulong)CONFIG_SYS_FSL_SEC_ADDR +
CAAM_CCBVID_OFFSET)
instead it should resolve to:caam_ccbvid_reg= in_le32((ulong *)(ulong)(CONFIG_SYS_FSL_SEC_ADDR +
CAAM_CCBVID_OFFSET))
Thus add parenthesis around the address "a" so that however the address is calculated, the casting is applied to the final calculated address.
Quoted 4 lines
Reviewed-by Horia Geanta <[email protected]>Reviewed-by Ye Li <[email protected]>Signed-off-by Utkarsh Gupta <[email protected]>Signed-off-by Peng Fan <[email protected]>
Applied to u-boot-imx, master, thanks !
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected] =====================================================================