From: Alexandru Gagniuc Date: Wed, 20 Jan 2021 16:46:49 +0000 (-0600) Subject: spl: fit: Drop 'length' argument to board_spl_fit_post_load() X-Git-Url: http://git.dujemihanovic.xyz/img/static/git-favicon.png?a=commitdiff_plain;h=efc4ad0bc763f135f3437f51df693e83941a9928;p=u-boot.git spl: fit: Drop 'length' argument to board_spl_fit_post_load() 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 Reviewed-by: Peng Fan Reviewed-by: Simon Glass CC: Matt Porter --- diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c index be4da0f702..36033d611c 100644 --- a/arch/arm/mach-imx/spl.c +++ b/arch/arm/mach-imx/spl.c @@ -19,6 +19,7 @@ #include #include #include +#include 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"); diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index a2612b45a5..bf3731a627 100644 --- a/common/spl/spl_fit.c +++ b/common/spl/spl_fit.c @@ -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; diff --git a/include/spl.h b/include/spl.h index e172500b5f..0d134587de 100644 --- a/include/spl.h +++ b/include/spl.h @@ -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