[PATCH v3 1/8] spl: fit: Drop 'length' argument to board_spl_fit_post_load()

Tom Rini
2021-01-16T02:33:04Z

On Wed, Dec 23, 2020 at 08:44:05AM -0600, Alexandru Gagniuc wrote:

> 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>
> ---
> arch/arm/mach-imx/spl.c | 5 +++--
> common/spl/spl_fit.c | 4 ++--
> include/spl.h | 4 ++--
> 3 files changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c
> index aa2686bb92..11255798d3 100644
> --- a/arch/arm/mach-imx/spl.c
> +++ b/arch/arm/mach-imx/spl.c
> @@ -18,6 +18,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;
>
> @@ -318,9 +319,9 @@ 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,
> offset + IVT_SIZE + CSF_PAD_SIZE,

OK, this is a problem right here. First, the code no longer compiles as
we don't pass in "load_addr", which is what
imx_hab_authenticate_image() takes to know where in DDR the image is to
validate. While I could probably work out that value from what we use
now for offset, I would rather someone that can test the code do so.
Thanks!

--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210115/79b4a3f8/attachment.sig>