From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexandru Gagniuc Date: Wed, 20 Jan 2021 10:46:49 -0600 Subject: [PATCH v4 1/8] spl: fit: Drop 'length' argument to board_spl_fit_post_load() In-Reply-To: <20210120164656.1396639-1-mr.nuke.me@gmail.com> References: <20210120164656.1396639-1-mr.nuke.me@gmail.com> Message-ID: <20210120164656.1396639-2-mr.nuke.me@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 --- arch/arm/mach-imx/spl.c | 7 ++++--- common/spl/spl_fit.c | 4 ++-- include/spl.h | 4 ++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c index aa2686bb92..f193be2e21 100644 --- a/arch/arm/mach-imx/spl.c +++ b/arch/arm/mach-imx/spl.c @@ -18,6 +18,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -318,11 +319,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 a6ad094e91..fc1b5f3e5e 100644 --- a/common/spl/spl_fit.c +++ b/common/spl/spl_fit.c @@ -26,7 +26,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) { } @@ -725,7 +725,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 a7648787b7..5e3e0406c2 100644 --- a/include/spl.h +++ b/include/spl.h @@ -638,9 +638,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 -- 2.26.2