[PATCH v3 15/30] boot: Use fit_image_get_data() to get data

Simon Glass sjg at chromium.org
Sat Jan 11 01:00:14 CET 2025


Use this function instead of fit_image_get_emb_data() data, since it
works will FITs that use external data.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

(no changes since v2)

Changes in v2:
- Fix unbalanced {}

 arch/arm/cpu/armv8/sec_firmware.c  |  4 ++--
 arch/arm/mach-k3/r5/sysfw-loader.c |  2 +-
 arch/x86/lib/bootm.c               |  6 +++---
 common/splash_source.c             | 19 ++++---------------
 common/update.c                    |  2 +-
 5 files changed, 11 insertions(+), 22 deletions(-)

diff --git a/arch/arm/cpu/armv8/sec_firmware.c b/arch/arm/cpu/armv8/sec_firmware.c
index b7c73f288bd..44372cbe4a1 100644
--- a/arch/arm/cpu/armv8/sec_firmware.c
+++ b/arch/arm/cpu/armv8/sec_firmware.c
@@ -128,8 +128,8 @@ static int sec_firmware_check_copy_loadable(const void *sec_firmware_img,
 			return -EINVAL;
 		}
 
-		if (fit_image_get_emb_data(sec_firmware_img, ld_node_off,
-					   &data, &size)) {
+		if (fit_image_get_data(sec_firmware_img, ld_node_off,
+				       &data, &size)) {
 			printf("SEC Loadable: Can't get subimage data/size");
 			return -ENOENT;
 		}
diff --git a/arch/arm/mach-k3/r5/sysfw-loader.c b/arch/arm/mach-k3/r5/sysfw-loader.c
index c323d2f78f8..188731e673d 100644
--- a/arch/arm/mach-k3/r5/sysfw-loader.c
+++ b/arch/arm/mach-k3/r5/sysfw-loader.c
@@ -115,7 +115,7 @@ static int fit_get_data_by_name(const void *fit, int images, const char *name,
 	if (node_offset < 0)
 		return -ENOENT;
 
-	return fit_image_get_emb_data(fit, node_offset, addr, size);
+	return fit_image_get_data(fit, node_offset, addr, size);
 }
 
 static void k3_start_system_controller(int rproc_id, bool rproc_loaded,
diff --git a/arch/x86/lib/bootm.c b/arch/x86/lib/bootm.c
index 3305560aa06..2a7933cdaf8 100644
--- a/arch/x86/lib/bootm.c
+++ b/arch/x86/lib/bootm.c
@@ -106,9 +106,9 @@ static int boot_prep_linux(struct bootm_headers *images)
 		is_zimage = 1;
 #if defined(CONFIG_FIT)
 	} else if (images->fit_uname_os && is_zimage) {
-		ret = fit_image_get_emb_data(images->fit_hdr_os,
-					     images->fit_noffset_os,
-					     (const void **)&data, &len);
+		ret = fit_image_get_data(images->fit_hdr_os,
+					 images->fit_noffset_os,
+					 (const void **)&data, &len);
 		if (ret) {
 			puts("Can't get image data/size!\n");
 			goto error;
diff --git a/common/splash_source.c b/common/splash_source.c
index 5ac32a2f995..2df78a4f2d7 100644
--- a/common/splash_source.c
+++ b/common/splash_source.c
@@ -395,21 +395,10 @@ static int splash_load_fit(struct splash_location *location, u32 bmp_load_addr)
 	}
 
 	/* Extract the splash data from FIT */
-	/* 1. Test if splash is in FIT internal data. */
-	if (!fit_image_get_emb_data(fit_header, node_offset,
-				    &internal_splash_data,
-				    &internal_splash_size))
-		memmove((void *)(uintptr_t)bmp_load_addr, internal_splash_data, internal_splash_size);
-	/* 2. Test if splash is in FIT external data with fixed position. */
-	else if (!fit_image_get_data_position(fit_header, node_offset, &external_splash_addr))
-		is_splash_external = true;
-	/* 3. Test if splash is in FIT external data with offset. */
-	else if (!fit_image_get_data_offset(fit_header, node_offset, &external_splash_addr)) {
-		/* Align data offset to 4-byte boundary */
-		fit_size = ALIGN(fdt_totalsize(fit_header), 4);
-		/* External splash offset means the offset by end of FIT header */
-		external_splash_addr += location->offset + fit_size;
-		is_splash_external = true;
+	if (!fit_image_get_data(fit_header, node_offset, &internal_splash_data,
+				&internal_splash_size)) {
+		memmove((void *)(uintptr_t)bmp_load_addr, internal_splash_data,
+			internal_splash_size);
 	} else {
 		printf("Failed to get splash image from FIT\n");
 		return -ENODATA;
diff --git a/common/update.c b/common/update.c
index d149ca18e78..6801b49479d 100644
--- a/common/update.c
+++ b/common/update.c
@@ -200,7 +200,7 @@ static int update_fit_getparams(const void *fit, int noffset, ulong *addr,
 {
 	const void *data;
 
-	if (fit_image_get_emb_data(fit, noffset, &data, (size_t *)size))
+	if (fit_image_get_data(fit, noffset, &data, (size_t *)size))
 		return 1;
 
 	if (fit_image_get_load(fit, noffset, (ulong *)fladdr))
-- 
2.34.1



More information about the U-Boot mailing list