]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
spl: fit: Drop 'length' argument to board_spl_fit_post_load()
authorAlexandru Gagniuc <mr.nuke.me@gmail.com>
Wed, 20 Jan 2021 16:46:49 +0000 (10:46 -0600)
committerTom Rini <trini@konsulko.com>
Wed, 17 Feb 2021 22:12:45 +0000 (17:12 -0500)
The size is derived from the FIT image itself. Any alignment
requirements are machine-specific and known by the board code. Thus
the total length can be derived from the FIT image and knowledge of
the platform. The 'length' argument is redundant. Remove it.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
CC: Matt Porter <mporter@konsulko.com>
arch/arm/mach-imx/spl.c
common/spl/spl_fit.c
include/spl.h

index be4da0f7023a164b45435aee0aecd41dc894bc73..36033d611c9f0c0dd7b3ca40e828055a40256ca3 100644 (file)
@@ -19,6 +19,7 @@
 #include <asm/mach-imx/hab.h>
 #include <asm/mach-imx/boot_mode.h>
 #include <g_dnl.h>
+#include <linux/libfdt.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -321,11 +322,11 @@ ulong board_spl_fit_size_align(ulong size)
        return size;
 }
 
-void board_spl_fit_post_load(ulong load_addr, size_t length)
+void board_spl_fit_post_load(const void *fit)
 {
-       u32 offset = length - CONFIG_CSF_SIZE;
+       u32 offset = ALIGN(fdt_totalsize(fit), 0x1000);
 
-       if (imx_hab_authenticate_image(load_addr,
+       if (imx_hab_authenticate_image((uintptr_t)fit,
                                       offset + IVT_SIZE + CSF_PAD_SIZE,
                                       offset)) {
                panic("spl: ERROR:  image authentication unsuccessful\n");
index a2612b45a59d5b14ac252d307ecea08ad85d18da..bf3731a6272d544944441cd8e79ee72ebfff26b7 100644 (file)
@@ -27,7 +27,7 @@ DECLARE_GLOBAL_DATA_PTR;
 #define CONFIG_SYS_BOOTM_LEN   (64 << 20)
 #endif
 
-__weak void board_spl_fit_post_load(ulong load_addr, size_t length)
+__weak void board_spl_fit_post_load(const void *fit)
 {
 }
 
@@ -726,7 +726,7 @@ int spl_load_simple_fit(struct spl_image_info *spl_image,
        spl_image->flags |= SPL_FIT_FOUND;
 
 #ifdef CONFIG_IMX_HAB
-       board_spl_fit_post_load((ulong)fit, size);
+       board_spl_fit_post_load(fit);
 #endif
 
        return 0;
index e172500b5f8dc42291b77c4647218d5c012a2b5e..0d134587de2a162a3746ecddda5d8a02391cef18 100644 (file)
@@ -701,9 +701,9 @@ int board_return_to_bootrom(struct spl_image_info *spl_image,
 
 /**
  * board_spl_fit_post_load - allow process images after loading finished
- *
+ * @fit: Pointer to a valid Flattened Image Tree blob
  */
-void board_spl_fit_post_load(ulong load_addr, size_t length);
+void board_spl_fit_post_load(const void *fit);
 
 /**
  * board_spl_fit_size_align - specific size align before processing payload