summaryrefslogtreecommitdiff
path: root/arch/arm/mach-imx/spl.c
diff options
context:
space:
mode:
authorHeiko Schocher <hs@denx.de>2021-08-06 06:44:27 +0200
committerStefano Babic <sbabic@denx.de>2021-10-07 16:53:50 +0200
commit9de35448580020b526b6e5a8b538a59a64c72f0e (patch)
treeb1d4f38fa87c4e8a3645a76d67891b08d656303c /arch/arm/mach-imx/spl.c
parent884ba50a078f57df5bf18a1bbc8aa337f5ce404d (diff)
imx: spl: implement spl_load_simple_fit_fix_load
read the address where the IVT header must sit from IVT image header, loaded from SPL into an malloced buffer and copy the IVT header to this address May make this dependend on SoC ? Signed-off-by: Heiko Schocher <hs@denx.de>
Diffstat (limited to 'arch/arm/mach-imx/spl.c')
-rw-r--r--arch/arm/mach-imx/spl.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c
index c2845241d9..01f6f0a1de 100644
--- a/arch/arm/mach-imx/spl.c
+++ b/arch/arm/mach-imx/spl.c
@@ -345,3 +345,36 @@ int dram_init_banksize(void)
return 0;
}
#endif
+
+/*
+ * read the address where the IVT header must sit
+ * from IVT image header, loaded from SPL into
+ * an malloced buffer and copy the IVT header
+ * to this address
+ */
+void *spl_load_simple_fit_fix_load(const void *fit)
+{
+ struct ivt *ivt;
+ unsigned long new;
+ unsigned long offset;
+ unsigned long size;
+ u8 *tmp = (u8 *)fit;
+
+ offset = ALIGN(fdt_totalsize(fit), 0x1000);
+ size = ALIGN(fdt_totalsize(fit), 4);
+ size = board_spl_fit_size_align(size);
+ tmp += offset;
+ ivt = (struct ivt *)tmp;
+ if (ivt->hdr.magic != IVT_HEADER_MAGIC) {
+ debug("no IVT header found\n");
+ return (void *)fit;
+ }
+ debug("%s: ivt: %p offset: %lx size: %lx\n", __func__, ivt, offset, size);
+ debug("%s: ivt self: %x\n", __func__, ivt->self);
+ new = ivt->self;
+ new -= offset;
+ debug("%s: new %lx\n", __func__, new);
+ memcpy((void *)new, fit, size);
+
+ return (void *)new;
+}