summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorPhilippe Reynes <philippe.reynes@softathome.com>2022-03-28 23:57:01 +0300
committerTom Rini <trini@konsulko.com>2022-03-31 21:12:01 +0300
commit2404a01544e5b4a70c2f5e07f0c915743995ffea (patch)
tree7f0c9c3ff852e23c6d3462dd8834496367c23437 /common
parent9d46e63d9771c789c2c934bb6f5f6af042f1bba0 (diff)
downloadu-boot-2404a01544e5b4a70c2f5e07f0c915743995ffea.tar.xz
common: spl: fit_ram: allow to use image pre load
Add the support of image pre load in spl or tpl when loading an image from ram. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
Diffstat (limited to 'common')
-rw-r--r--common/spl/spl_ram.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/common/spl/spl_ram.c b/common/spl/spl_ram.c
index 3f7f7accc1..8296459257 100644
--- a/common/spl/spl_ram.c
+++ b/common/spl/spl_ram.c
@@ -24,9 +24,17 @@
static ulong spl_ram_load_read(struct spl_load_info *load, ulong sector,
ulong count, void *buf)
{
+ ulong addr;
+
debug("%s: sector %lx, count %lx, buf %lx\n",
__func__, sector, count, (ulong)buf);
- memcpy(buf, (void *)(CONFIG_SPL_LOAD_FIT_ADDRESS + sector), count);
+
+ addr = (ulong)CONFIG_SPL_LOAD_FIT_ADDRESS + sector;
+ if (CONFIG_IS_ENABLED(IMAGE_PRE_LOAD))
+ addr += image_load_offset;
+
+ memcpy(buf, (void *)addr, count);
+
return count;
}
@@ -37,6 +45,17 @@ static int spl_ram_load_image(struct spl_image_info *spl_image,
header = (struct image_header *)CONFIG_SPL_LOAD_FIT_ADDRESS;
+ if (CONFIG_IS_ENABLED(IMAGE_PRE_LOAD)) {
+ unsigned long addr = (unsigned long)header;
+ int ret = image_pre_load(addr);
+
+ if (ret)
+ return ret;
+
+ addr += image_load_offset;
+ header = (struct image_header *)addr;
+ }
+
#if CONFIG_IS_ENABLED(DFU)
if (bootdev->boot_device == BOOT_DEVICE_DFU)
spl_dfu_cmd(0, "dfu_alt_info_ram", "ram", "0");