* [PATCH v2 1/5] pbl: fdt: fix fdt_fixup_mem error handling
@ 2026-01-14 12:00 Ahmad Fatoum
2026-01-14 12:00 ` [PATCH v2 2/5] pbl: compressed-dtb: add missing includes Ahmad Fatoum
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Ahmad Fatoum @ 2026-01-14 12:00 UTC (permalink / raw)
To: barebox; +Cc: Marco Felsch, Michael Tretter, Ahmad Fatoum
From: Marco Felsch <m.felsch@pengutronix.de>
fdt_find_or_add_memory() returns >= 0 on success, so the return must be
checked to be < 0. Also fix the following pr_warn() which used the wrong
variable.
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Fixes: ae175d4748b1 ("PBL: fdt: add fdt_fixup_mem to fixup memory nodes")
Cc: Michael Tretter <m.tretter@pengutronix.de>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
v1 - > v2:
- split off preparatory patch from
https://lore.barebox.org/barebox/20251110-v2025-09-0-topic-optee-of-handling-v1-0-8f0625ac5471@pengutronix.de/T/#t
- Add Fixes:
---
pbl/fdt.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pbl/fdt.c b/pbl/fdt.c
index c9820112c644..ac377446caea 100644
--- a/pbl/fdt.c
+++ b/pbl/fdt.c
@@ -128,9 +128,9 @@ int fdt_fixup_mem(void *fdt, unsigned long membase[], unsigned long memsize[],
snprintf(name, sizeof(name), "memory@%lx", base);
node = fdt_find_or_add_memory(fdt, root, name);
- if (!node) {
+ if (node < 0) {
pr_warn("%s: Failed to get node: %s\n",
- name, fdt_strerror(err));
+ name, fdt_strerror(node));
continue;
}
--
2.47.3
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH v2 2/5] pbl: compressed-dtb: add missing includes 2026-01-14 12:00 [PATCH v2 1/5] pbl: fdt: fix fdt_fixup_mem error handling Ahmad Fatoum @ 2026-01-14 12:00 ` Ahmad Fatoum 2026-01-14 12:00 ` [PATCH v2 3/5] ARM: atf: add missing includes in atf_common.h Ahmad Fatoum ` (2 subsequent siblings) 3 siblings, 0 replies; 5+ messages in thread From: Ahmad Fatoum @ 2026-01-14 12:00 UTC (permalink / raw) To: barebox; +Cc: Marco Felsch, Ahmad Fatoum From: Marco Felsch <m.felsch@pengutronix.de> Add missing includes else compressed-dtb.h depends on the include order. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> --- v1 - > v2: - split off preparatory patch from https://lore.barebox.org/barebox/20251110-v2025-09-0-topic-optee-of-handling-v1-0-8f0625ac5471@pengutronix.de/T/#t --- include/compressed-dtb.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/compressed-dtb.h b/include/compressed-dtb.h index cc5fbb276984..ff7c932f5b01 100644 --- a/include/compressed-dtb.h +++ b/include/compressed-dtb.h @@ -2,9 +2,11 @@ #ifndef COMPRESSED_DTB_H_ #define COMPRESSED_DTB_H_ +#include <linux/align.h> #include <linux/types.h> #include <linux/sizes.h> #include <asm/unaligned.h> +#include <fdt.h> struct barebox_boarddata_compressed_dtb { #define BAREBOX_BOARDDATA_COMPRESSED_DTB_MAGIC 0x7b66bcbd -- 2.47.3 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 3/5] ARM: atf: add missing includes in atf_common.h 2026-01-14 12:00 [PATCH v2 1/5] pbl: fdt: fix fdt_fixup_mem error handling Ahmad Fatoum 2026-01-14 12:00 ` [PATCH v2 2/5] pbl: compressed-dtb: add missing includes Ahmad Fatoum @ 2026-01-14 12:00 ` Ahmad Fatoum 2026-01-14 12:00 ` [PATCH v2 4/5] ARM: i.MX8M: cosmetic cleanup Ahmad Fatoum 2026-01-14 12:00 ` [PATCH v2 5/5] pbl: string: add strncmp Ahmad Fatoum 3 siblings, 0 replies; 5+ messages in thread From: Ahmad Fatoum @ 2026-01-14 12:00 UTC (permalink / raw) To: barebox; +Cc: Marco Felsch, Ahmad Fatoum From: Marco Felsch <m.felsch@pengutronix.de> Add missing includes else atf_common.h depends on the include order. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> --- v1 - > v2: - split off preparatory patch from https://lore.barebox.org/barebox/20251110-v2025-09-0-topic-optee-of-handling-v1-0-8f0625ac5471@pengutronix.de/T/#t --- arch/arm/include/asm/atf_common.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm/include/asm/atf_common.h b/arch/arm/include/asm/atf_common.h index ab99cd3ac142..11d3801da1cc 100644 --- a/arch/arm/include/asm/atf_common.h +++ b/arch/arm/include/asm/atf_common.h @@ -11,6 +11,9 @@ #ifndef __BL_COMMON_H__ #define __BL_COMMON_H__ +#include <linux/sizes.h> +#include <linux/types.h> + #define ATF_PARAM_EP 0x01 #define ATF_PARAM_IMAGE_BINARY 0x02 #define ATF_PARAM_BL31 0x03 -- 2.47.3 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 4/5] ARM: i.MX8M: cosmetic cleanup 2026-01-14 12:00 [PATCH v2 1/5] pbl: fdt: fix fdt_fixup_mem error handling Ahmad Fatoum 2026-01-14 12:00 ` [PATCH v2 2/5] pbl: compressed-dtb: add missing includes Ahmad Fatoum 2026-01-14 12:00 ` [PATCH v2 3/5] ARM: atf: add missing includes in atf_common.h Ahmad Fatoum @ 2026-01-14 12:00 ` Ahmad Fatoum 2026-01-14 12:00 ` [PATCH v2 5/5] pbl: string: add strncmp Ahmad Fatoum 3 siblings, 0 replies; 5+ messages in thread From: Ahmad Fatoum @ 2026-01-14 12:00 UTC (permalink / raw) To: barebox; +Cc: Marco Felsch From: Marco Felsch <m.felsch@pengutronix.de> Rename the local imx8m_atf_start_bl31() to imx8m_tfa_start_bl31() since the official naming is Trusted-Firmware A (TF-A) and not ARM Trusted Firmware which was the former name. While on it rename the parameters to make it clear what firmware component is passed and align the function documentation with the reality. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> --- v1 - > v2: - split off preparatory patch from https://lore.barebox.org/barebox/20251110-v2025-09-0-topic-optee-of-handling-v1-0-8f0625ac5471@pengutronix.de/T/#t --- arch/arm/mach-imx/atf.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/arch/arm/mach-imx/atf.c b/arch/arm/mach-imx/atf.c index 11fe0334059d..df2991f47827 100644 --- a/arch/arm/mach-imx/atf.c +++ b/arch/arm/mach-imx/atf.c @@ -19,11 +19,11 @@ #include <mach/imx/xload.h> /** - * imx8m_atf_load_bl31 - Load ATF BL31 blob and transfer control to it + * imx8m_tfa_start_bl31 - Load TF-A BL31 blob and transfer control to it * - * @fw: Pointer to the BL31 blob - * @fw_size: Size of the BL31 blob - * @atf_dest: Place where the BL31 is copied to and executed + * @tfa: Pointer to the BL31 blob + * @tfa_size: Size of the BL31 blob + * @tfa_dest: Place where the BL31 is copied to and executed * * This function: * @@ -37,12 +37,12 @@ * 3. Transfers control to BL31 */ -static __noreturn void imx8m_atf_start_bl31(const void *fw, size_t fw_size, void *atf_dest) +static __noreturn void imx8m_tfa_start_bl31(const void *tfa_bin, size_t tfa_size, void *tfa_dest) { - void __noreturn (*bl31)(void) = atf_dest; + void __noreturn (*bl31)(void) = tfa_dest; int ret; - BUG_ON(fw_size > MX8M_ATF_BL31_SIZE_LIMIT); + BUG_ON(tfa_size > MX8M_ATF_BL31_SIZE_LIMIT); if (IS_ENABLED(CONFIG_FSL_CAAM_RNG_PBL_INIT)) { ret = imx_early_caam_init(MX8M_CAAM_BASE_ADDR); @@ -52,10 +52,10 @@ static __noreturn void imx8m_atf_start_bl31(const void *fw, size_t fw_size, void pr_debug("CAAM early init successful\n"); } - memcpy(bl31, fw, fw_size); + memcpy(bl31, tfa_bin, tfa_size); asm volatile("msr sp_el2, %0" : : - "r" (atf_dest - 16) : + "r" (tfa_dest - 16) : "cc"); bl31(); __builtin_unreachable(); @@ -176,7 +176,7 @@ __noreturn void __imx8mm_load_and_start_image_via_tfa(void *bl33) get_builtin_firmware(imx8mm_bl31_bin, &bl31, &bl31_size); } - imx8m_atf_start_bl31(bl31, bl31_size, (void *)MX8MM_ATF_BL31_BASE_ADDR); + imx8m_tfa_start_bl31(bl31, bl31_size, (void *)MX8MM_ATF_BL31_BASE_ADDR); } void imx8mp_load_bl33(void *bl33) @@ -250,10 +250,9 @@ __noreturn void __imx8mp_load_and_start_image_via_tfa(void *bl33) get_builtin_firmware(imx8mp_bl31_bin, &bl31, &bl31_size); } - imx8m_atf_start_bl31(bl31, bl31_size, (void *)MX8MP_ATF_BL31_BASE_ADDR); + imx8m_tfa_start_bl31(bl31, bl31_size, (void *)MX8MP_ATF_BL31_BASE_ADDR); } - void imx8mn_load_bl33(void *bl33) { enum bootsource src; @@ -325,7 +324,7 @@ __noreturn void __imx8mn_load_and_start_image_via_tfa(void *bl33) get_builtin_firmware(imx8mn_bl31_bin, &bl31, &bl31_size); } - imx8m_atf_start_bl31(bl31, bl31_size, (void *)MX8MN_ATF_BL31_BASE_ADDR); + imx8m_tfa_start_bl31(bl31, bl31_size, (void *)MX8MN_ATF_BL31_BASE_ADDR); } void imx8mq_load_bl33(void *bl33) @@ -393,7 +392,7 @@ __noreturn void __imx8mq_load_and_start_image_via_tfa(void *bl33) get_builtin_firmware(imx8mq_bl31_bin, &bl31, &bl31_size); } - imx8m_atf_start_bl31(bl31, bl31_size, (void *)MX8MQ_ATF_BL31_BASE_ADDR); + imx8m_tfa_start_bl31(bl31, bl31_size, (void *)MX8MQ_ATF_BL31_BASE_ADDR); } void __noreturn imx93_load_and_start_image_via_tfa(void) -- 2.47.3 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 5/5] pbl: string: add strncmp 2026-01-14 12:00 [PATCH v2 1/5] pbl: fdt: fix fdt_fixup_mem error handling Ahmad Fatoum ` (2 preceding siblings ...) 2026-01-14 12:00 ` [PATCH v2 4/5] ARM: i.MX8M: cosmetic cleanup Ahmad Fatoum @ 2026-01-14 12:00 ` Ahmad Fatoum 3 siblings, 0 replies; 5+ messages in thread From: Ahmad Fatoum @ 2026-01-14 12:00 UTC (permalink / raw) To: barebox; +Cc: Marco Felsch, Ahmad Fatoum From: Marco Felsch <m.felsch@pengutronix.de> For use by PBL code, import the barebox proper definition of strncmp into pbl/string.c. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> --- v1 - > v2: - split off preparatory patch from https://lore.barebox.org/barebox/20251110-v2025-09-0-topic-optee-of-handling-v1-0-8f0625ac5471@pengutronix.de/T/#t - add a commit message body --- pbl/string.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pbl/string.c b/pbl/string.c index 528f62ef2055..89663fef3d6a 100644 --- a/pbl/string.c +++ b/pbl/string.c @@ -102,6 +102,21 @@ int strcmp(const char *cs, const char *ct) return res; } +int strncmp(const char *cs, const char *ct, size_t count) +{ + register signed char __res = 0; + + BUG_ON(!cs || !ct); + + while (count) { + if ((__res = *cs - *ct++) != 0 || !*cs++) + break; + count--; + } + + return __res; +} + int strcasecmp(const char *s1, const char *s2) { int c1, c2; -- 2.47.3 ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-01-14 12:03 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2026-01-14 12:00 [PATCH v2 1/5] pbl: fdt: fix fdt_fixup_mem error handling Ahmad Fatoum 2026-01-14 12:00 ` [PATCH v2 2/5] pbl: compressed-dtb: add missing includes Ahmad Fatoum 2026-01-14 12:00 ` [PATCH v2 3/5] ARM: atf: add missing includes in atf_common.h Ahmad Fatoum 2026-01-14 12:00 ` [PATCH v2 4/5] ARM: i.MX8M: cosmetic cleanup Ahmad Fatoum 2026-01-14 12:00 ` [PATCH v2 5/5] pbl: string: add strncmp Ahmad Fatoum
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox