* [PATCH 2/6] i.MX: HABv4: fix event status comparison
2023-07-05 14:42 [PATCH 1/6] kbuild: clean start*_*.{p,ps}imximg files Rouven Czerwinski
@ 2023-07-05 14:42 ` Rouven Czerwinski
2023-07-05 14:42 ` [PATCH 3/6] i.MX: HABv4: extend support to i.MX8M SoCs Rouven Czerwinski
` (5 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Rouven Czerwinski @ 2023-07-05 14:42 UTC (permalink / raw)
To: barebox; +Cc: Rouven Czerwinski
Instead of only printing events belonging to a certain level, print all
events that have a higher status than the current event. This fixes
event printing for i.MX8M based boards.
Fixes: 8b35facbb971 ("i.MX: HABv4: Improve HAB event printing")
Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
---
drivers/hab/habv4.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hab/habv4.c b/drivers/hab/habv4.c
index b6baa92c67..26463c8ce0 100644
--- a/drivers/hab/habv4.c
+++ b/drivers/hab/habv4.c
@@ -236,7 +236,7 @@ static enum hab_status imx8m_read_sram_events(enum hab_status status,
}
}
while (i < num_events) {
- if (events[i]->status == status) {
+ if (events[i]->status >= status) {
if (internal_index == index) {
*bytes = sizeof(struct hab_event_record) +
be16_to_cpu(events[i]->hdr.len);
--
2.41.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 3/6] i.MX: HABv4: extend support to i.MX8M SoCs
2023-07-05 14:42 [PATCH 1/6] kbuild: clean start*_*.{p,ps}imximg files Rouven Czerwinski
2023-07-05 14:42 ` [PATCH 2/6] i.MX: HABv4: fix event status comparison Rouven Czerwinski
@ 2023-07-05 14:42 ` Rouven Czerwinski
2023-07-26 6:31 ` [PATCH] fixup! " Ahmad Fatoum
2023-07-05 14:42 ` [PATCH 4/6] ARM: i.MX: allow HAB for i.MX8M family Rouven Czerwinski
` (4 subsequent siblings)
6 siblings, 1 reply; 10+ messages in thread
From: Rouven Czerwinski @ 2023-07-05 14:42 UTC (permalink / raw)
To: barebox; +Cc: Rouven Czerwinski
Instead of only supporting i.MX8MQ based boards, extend support to the
whole i.MX8M family. OCRAM address values were taken from AN12263 Rev1
06/2020. While at it turn the OCRAM adresses into defines as well.
Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
---
drivers/hab/habv4.c | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/drivers/hab/habv4.c b/drivers/hab/habv4.c
index 26463c8ce0..f558465618 100644
--- a/drivers/hab/habv4.c
+++ b/drivers/hab/habv4.c
@@ -205,18 +205,36 @@ static enum hab_status hab_sip_report_status(enum hab_config *config,
return (enum hab_status)res.a0;
}
+#define IMX8MQ_ROM_OCRAM_ADDRESS 0x9061C0
+#define IMX8MM_ROM_OCRAM_ADDRESS 0x908040
+#define IMX8MN_ROM_OCRAM_ADDRESS 0x908040
+#define IMX8MP_ROM_OCRAM_ADDRESS 0x90D040
+
static enum hab_status imx8m_read_sram_events(enum hab_status status,
uint32_t index, void *event,
uint32_t *bytes)
{
struct hab_event_record *events[10];
int num_events = 0;
- char *sram = (char *)0x9061c0;
+ char *sram;
int i = 0;
int internal_index = 0;
char *end = 0;
struct hab_event_record *search;
+ if (cpu_is_mx8mq()) {
+ sram = (char *)IMX8MQ_ROM_OCRAM_ADDRESS;
+ } else if (cpu_is_mx8mm()) {
+ sram = (char *)IMX8MM_ROM_OCRAM_ADDRESS;
+ } else if (cpu_is_mx8mn()) {
+ sram = (char *)IMX8MN_ROM_OCRAM_ADDRESS;
+ } else if (cpu_is_mx8mp()) {
+ sram = (char *)IMX8MP_ROM_OCRAM_ADDRESS;
+ } else {
+ /* No known i.MX8M variant */
+ return HAB_STATUS_FAILURE;
+ }
+
/*
* AN12263 HABv4 Guidelines and Recommendations
* recommends the address and size, however errors are usually contained
@@ -593,7 +611,7 @@ static int imx8m_hab_get_status(void)
static int init_imx8m_hab_get_status(void)
{
- if (!cpu_is_mx8mq())
+ if (!cpu_is_mx8m())
/* can happen in multi-image builds and is not an error */
return 0;
--
2.41.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] fixup! i.MX: HABv4: extend support to i.MX8M SoCs
2023-07-05 14:42 ` [PATCH 3/6] i.MX: HABv4: extend support to i.MX8M SoCs Rouven Czerwinski
@ 2023-07-26 6:31 ` Ahmad Fatoum
2023-07-26 7:51 ` Marco Felsch
0 siblings, 1 reply; 10+ messages in thread
From: Ahmad Fatoum @ 2023-07-26 6:31 UTC (permalink / raw)
To: barebox; +Cc: rcz, Ahmad Fatoum
CONFIG_HABV4 selects CONFIG_HAB and that file still has one imx8mq only
check that should be loosened to an imx8m check when extending the
symbol for these SoCs.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
drivers/hab/hab.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hab/hab.c b/drivers/hab/hab.c
index fad367f43dfb..c5d44ec921b0 100644
--- a/drivers/hab/hab.c
+++ b/drivers/hab/hab.c
@@ -208,7 +208,7 @@ static struct imx_hab_ops *imx_get_hab_ops(void)
if (IS_ENABLED(CONFIG_HABV3) && (cpu_is_mx25() || cpu_is_mx35()))
tmp = &imx_hab_ops_iim;
- else if (IS_ENABLED(CONFIG_HABV4) && (cpu_is_mx6() || cpu_is_mx8mq()))
+ else if (IS_ENABLED(CONFIG_HABV4) && (cpu_is_mx6() || cpu_is_mx8m()))
tmp = &imx_hab_ops_ocotp;
else
return NULL;
--
2.39.2
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] fixup! i.MX: HABv4: extend support to i.MX8M SoCs
2023-07-26 6:31 ` [PATCH] fixup! " Ahmad Fatoum
@ 2023-07-26 7:51 ` Marco Felsch
0 siblings, 0 replies; 10+ messages in thread
From: Marco Felsch @ 2023-07-26 7:51 UTC (permalink / raw)
To: Ahmad Fatoum; +Cc: barebox, rcz
On 23-07-26, Ahmad Fatoum wrote:
> CONFIG_HABV4 selects CONFIG_HAB and that file still has one imx8mq only
> check that should be loosened to an imx8m check when extending the
> symbol for these SoCs.
>
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>
> ---
> drivers/hab/hab.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/hab/hab.c b/drivers/hab/hab.c
> index fad367f43dfb..c5d44ec921b0 100644
> --- a/drivers/hab/hab.c
> +++ b/drivers/hab/hab.c
> @@ -208,7 +208,7 @@ static struct imx_hab_ops *imx_get_hab_ops(void)
>
> if (IS_ENABLED(CONFIG_HABV3) && (cpu_is_mx25() || cpu_is_mx35()))
> tmp = &imx_hab_ops_iim;
> - else if (IS_ENABLED(CONFIG_HABV4) && (cpu_is_mx6() || cpu_is_mx8mq()))
> + else if (IS_ENABLED(CONFIG_HABV4) && (cpu_is_mx6() || cpu_is_mx8m()))
> tmp = &imx_hab_ops_ocotp;
> else
> return NULL;
> --
> 2.39.2
>
>
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 4/6] ARM: i.MX: allow HAB for i.MX8M family
2023-07-05 14:42 [PATCH 1/6] kbuild: clean start*_*.{p,ps}imximg files Rouven Czerwinski
2023-07-05 14:42 ` [PATCH 2/6] i.MX: HABv4: fix event status comparison Rouven Czerwinski
2023-07-05 14:42 ` [PATCH 3/6] i.MX: HABv4: extend support to i.MX8M SoCs Rouven Czerwinski
@ 2023-07-05 14:42 ` Rouven Czerwinski
2023-07-05 14:42 ` [PATCH 5/6] ARM: i.MX: introduce build_imx8m_habv4img Rouven Czerwinski
` (3 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Rouven Czerwinski @ 2023-07-05 14:42 UTC (permalink / raw)
To: barebox; +Cc: Rouven Czerwinski
Since the HAB driver can now parse events for the complete family,
allow selection for the whole family.
Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
---
arch/arm/mach-imx/Kconfig | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index ef0e5fc561..349757d6bc 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -720,10 +720,10 @@ config HABV4
select HAB
select NVMEM
select IMX_OCOTP
- depends on ARCH_IMX6 || ARCH_IMX8MQ
+ depends on ARCH_IMX6 || ARCH_IMX8M
depends on OFDEVICE
help
- High Assurance Boot, as found on i.MX28/i.MX6/i.MX8MQ.
+ High Assurance Boot, as found on i.MX28/i.MX6/i.MX8M.
config HAB_CERTS_ENV
depends on HAB
--
2.41.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 5/6] ARM: i.MX: introduce build_imx8m_habv4img
2023-07-05 14:42 [PATCH 1/6] kbuild: clean start*_*.{p,ps}imximg files Rouven Czerwinski
` (2 preceding siblings ...)
2023-07-05 14:42 ` [PATCH 4/6] ARM: i.MX: allow HAB for i.MX8M family Rouven Czerwinski
@ 2023-07-05 14:42 ` Rouven Czerwinski
2023-07-05 14:42 ` [PATCH 6/6] ARM: i.MX: convert i.MX8MP/MM EVK to helper Rouven Czerwinski
` (2 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Rouven Czerwinski @ 2023-07-05 14:42 UTC (permalink / raw)
To: barebox; +Cc: Rouven Czerwinski
Similar to the helper for i.MX6, this allows us to build HAB enabled
images by selecting KConfig symbols. So far I have only tested signed
images, so there is no support for usb-signed or encrypted images yet.
Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
---
images/Makefile.imx | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/images/Makefile.imx b/images/Makefile.imx
index 65512e0e07..5691f2d70f 100644
--- a/images/Makefile.imx
+++ b/images/Makefile.imx
@@ -21,6 +21,19 @@ endif
)
endef
+define build_imx8m_habv4img =
+$(eval
+ifeq ($($(strip $(1))), y)
+ pblb-y += $(strip $(2))
+ CFG_$(strip $(2)).pblb.imximg = $(board)/$(strip $(3)).imxcfg
+ FILE_barebox-$(strip $(4)).img = $(strip $(2)).pblb.pimximg
+ FILE_barebox-$(strip $(4))-s.img = $(strip $(2)).pblb.psimximg
+ image-y += barebox-$(strip $(4)).img
+ image-$(CONFIG_HABV4_IMAGE_SIGNED) += barebox-$(strip $(4))-s.img
+endif
+)
+endef
+
# %.imximg - convert into i.MX image
# ----------------------------------------------------------------
--
2.41.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 6/6] ARM: i.MX: convert i.MX8MP/MM EVK to helper
2023-07-05 14:42 [PATCH 1/6] kbuild: clean start*_*.{p,ps}imximg files Rouven Czerwinski
` (3 preceding siblings ...)
2023-07-05 14:42 ` [PATCH 5/6] ARM: i.MX: introduce build_imx8m_habv4img Rouven Czerwinski
@ 2023-07-05 14:42 ` Rouven Czerwinski
2023-07-05 14:50 ` [PATCH 1/6] kbuild: clean start*_*.{p,ps}imximg files Ahmad Fatoum
2023-07-05 15:10 ` Rouven Czerwinski
6 siblings, 0 replies; 10+ messages in thread
From: Rouven Czerwinski @ 2023-07-05 14:42 UTC (permalink / raw)
To: barebox; +Cc: Rouven Czerwinski
Use the new helper for i.MX8MP/MM EVK boards. Also add the necessary
gencsf header to the imxcfg.
Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
---
| 1 +
| 1 +
images/Makefile.imx | 10 ++--------
3 files changed, 4 insertions(+), 8 deletions(-)
--git a/arch/arm/boards/nxp-imx8mm-evk/flash-header-imx8mm-evk.imxcfg b/arch/arm/boards/nxp-imx8mm-evk/flash-header-imx8mm-evk.imxcfg
index d6a536053e..a89243a78a 100644
--- a/arch/arm/boards/nxp-imx8mm-evk/flash-header-imx8mm-evk.imxcfg
+++ b/arch/arm/boards/nxp-imx8mm-evk/flash-header-imx8mm-evk.imxcfg
@@ -8,3 +8,4 @@ ivtofs 0x400
flexspi_ivtofs 0x1000
flexspi_fcfbofs 0x0
+#include <mach/imx/habv4-imx8-gencsf.h>
--git a/arch/arm/boards/nxp-imx8mp-evk/flash-header-imx8mp-evk.imxcfg b/arch/arm/boards/nxp-imx8mp-evk/flash-header-imx8mp-evk.imxcfg
index 3bb44d199c..6b05c2c38c 100644
--- a/arch/arm/boards/nxp-imx8mp-evk/flash-header-imx8mp-evk.imxcfg
+++ b/arch/arm/boards/nxp-imx8mp-evk/flash-header-imx8mp-evk.imxcfg
@@ -8,3 +8,4 @@ ivtofs 0x0
flexspi_ivtofs 0x0
flexspi_fcfbofs 0x400
+#include <mach/imx/habv4-imx8-gencsf.h>
diff --git a/images/Makefile.imx b/images/Makefile.imx
index 5691f2d70f..c988c68ded 100644
--- a/images/Makefile.imx
+++ b/images/Makefile.imx
@@ -444,10 +444,7 @@ FILE_barebox-kamstrup-mx7-concentrator.img = start_kamstrup_mx7_concentrator.pbl
image-$(CONFIG_MACH_KAMSTRUP_MX7_CONCENTRATOR) += barebox-kamstrup-mx7-concentrator.img
# ----------------------- i.MX8mm based boards --------------------------
-pblb-$(CONFIG_MACH_NXP_IMX8MM_EVK) += start_nxp_imx8mm_evk
-CFG_start_nxp_imx8mm_evk.pblb.imximg = $(board)/nxp-imx8mm-evk/flash-header-imx8mm-evk.imxcfg
-FILE_barebox-nxp-imx8mm-evk.img = start_nxp_imx8mm_evk.pblb.pimximg
-image-$(CONFIG_MACH_NXP_IMX8MM_EVK) += barebox-nxp-imx8mm-evk.img
+$(call build_imx8m_habv4img, CONFIG_MACH_NXP_IMX8MM_EVK, start_nxp_imx8mm_evk, nxp-imx8mm-evk/flash-header-imx8mm-evk, nxp-imx8mm-evk)
pblb-$(CONFIG_MACH_PROTONIC_IMX8M) += start_prt_prt8mm
CFG_start_prt_prt8mm.pblb.imximg = $(board)/protonic-imx8m/flash-header-prt8mm.imxcfg
@@ -466,10 +463,7 @@ FILE_barebox-nxp-imx8mn-evk.img = start_nxp_imx8mn_evk.pblb.pimximg
image-$(CONFIG_MACH_NXP_IMX8MN_EVK) += barebox-nxp-imx8mn-evk.img
# ----------------------- i.MX8mp based boards --------------------------
-pblb-$(CONFIG_MACH_NXP_IMX8MP_EVK) += start_nxp_imx8mp_evk
-CFG_start_nxp_imx8mp_evk.pblb.imximg = $(board)/nxp-imx8mp-evk/flash-header-imx8mp-evk.imxcfg
-FILE_barebox-nxp-imx8mp-evk.img = start_nxp_imx8mp_evk.pblb.pimximg
-image-$(CONFIG_MACH_NXP_IMX8MP_EVK) += barebox-nxp-imx8mp-evk.img
+$(call build_imx8m_habv4img, CONFIG_MACH_NXP_IMX8MP_EVK, start_nxp_imx8mp_evk, nxp-imx8mp-evk/flash-header-imx8mp-evk.imxcfg, nxp-imx8mp-evk)
pblb-$(CONFIG_MACH_TQ_MBA8MPXL) += start_tqma8mpxl
CFG_start_tqma8mpxl.pblb.imximg = $(board)/tqma8mpxl/flash-header-tqma8mpxl.imxcfg
--
2.41.0
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/6] kbuild: clean start*_*.{p,ps}imximg files
2023-07-05 14:42 [PATCH 1/6] kbuild: clean start*_*.{p,ps}imximg files Rouven Czerwinski
` (4 preceding siblings ...)
2023-07-05 14:42 ` [PATCH 6/6] ARM: i.MX: convert i.MX8MP/MM EVK to helper Rouven Czerwinski
@ 2023-07-05 14:50 ` Ahmad Fatoum
2023-07-05 15:10 ` Rouven Czerwinski
6 siblings, 0 replies; 10+ messages in thread
From: Ahmad Fatoum @ 2023-07-05 14:50 UTC (permalink / raw)
To: Rouven Czerwinski, barebox
On 05.07.23 16:42, Rouven Czerwinski wrote:
> Cleanup files build during i.MX8M image generation.
>
> Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
> ---
> images/Makefile | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/images/Makefile b/images/Makefile
> index c1cb56f5b1..85e5f0503c 100644
> --- a/images/Makefile
> +++ b/images/Makefile
> @@ -221,5 +221,6 @@ $(flash-list): $(image-y-path)
> clean-files := *.pbl *.pblb *.map start_*.imximg *.img barebox.z start_*.kwbimg \
> start_*.kwbuartimg *.socfpgaimg *.mlo *.t20img *.t20img.cfg *.t30img \
> *.t30img.cfg *.t124img *.t124img.cfg *.mlospi *.mlo *.mxsbs *.mxssd *.rkimg \
> - start_*.simximg start_*.usimximg *.zynqimg *.image *.swapped *.missing-firmware
> + start_*.simximg start_*.usimximg start_*.pimximg start_*.psimximg *.zynqimg \
> + *.image *.swapped *.missing-firmware
Nitpick: just glob start_*.*img and call it a day?
> clean-files += pbl.lds
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/6] kbuild: clean start*_*.{p,ps}imximg files
2023-07-05 14:42 [PATCH 1/6] kbuild: clean start*_*.{p,ps}imximg files Rouven Czerwinski
` (5 preceding siblings ...)
2023-07-05 14:50 ` [PATCH 1/6] kbuild: clean start*_*.{p,ps}imximg files Ahmad Fatoum
@ 2023-07-05 15:10 ` Rouven Czerwinski
6 siblings, 0 replies; 10+ messages in thread
From: Rouven Czerwinski @ 2023-07-05 15:10 UTC (permalink / raw)
To: barebox
Hi,
On Wed, 5 Jul 2023 16:42:14 +0200
Rouven Czerwinski <r.czerwinski@pengutronix.de> wrote:
> Cleanup files build during i.MX8M image generation.
>
> Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
> ---
> images/Makefile | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/images/Makefile b/images/Makefile
> index c1cb56f5b1..85e5f0503c 100644
> --- a/images/Makefile
> +++ b/images/Makefile
> @@ -221,5 +221,6 @@ $(flash-list): $(image-y-path)
> clean-files := *.pbl *.pblb *.map start_*.imximg *.img barebox.z
> start_*.kwbimg \ start_*.kwbuartimg *.socfpgaimg *.mlo *.t20img
> *.t20img.cfg *.t30img \ *.t30img.cfg *.t124img *.t124img.cfg *.mlospi
> *.mlo *.mxsbs *.mxssd *.rkimg \
> - start_*.simximg start_*.usimximg *.zynqimg *.image *.swapped
> *.missing-firmware
> + start_*.simximg start_*.usimximg start_*.pimximg
> start_*.psimximg *.zynqimg \
> + *.image *.swapped *.missing-firmware
> clean-files += pbl.lds
Please disregard this series for now. There still seem to be bugs which
only revealed themselves after the send.
Best regards,
Rouven
^ permalink raw reply [flat|nested] 10+ messages in thread