aboutsummaryrefslogtreecommitdiffstats
path: root/common/spl/spl_nor.c
diff options
context:
space:
mode:
authorSean Anderson <seanga2@gmail.com>2023-10-14 16:47:55 -0400
committerTom Rini <trini@konsulko.com>2023-10-17 20:50:52 -0400
commitb02c4e941c7fed520f05cc956b9263bc934a9828 (patch)
tree8e37dab03b30112d99d4fe17f76ae6a313688154 /common/spl/spl_nor.c
parent93caa3efe25bb9d3e6265aa467dc5b6a2201819b (diff)
downloadu-boot-b02c4e941c7fed520f05cc956b9263bc934a9828.tar.gz
spl: Use map_sysmem where appropriate
All "physical" addresses in SPL must be converted to virtual addresses before access in order for sandbox to work. Add some calls to map_sysmem in appropriate places. We do not generally call unmap_sysmem, since we need the image memory to still be mapped when we jump to the image. This doesn't matter at the moment since unmap_sysmem is a no-op. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common/spl/spl_nor.c')
-rw-r--r--common/spl/spl_nor.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/common/spl/spl_nor.c b/common/spl/spl_nor.c
index dd447982071..236b0718283 100644
--- a/common/spl/spl_nor.c
+++ b/common/spl/spl_nor.c
@@ -7,6 +7,7 @@
#include <image.h>
#include <imx_container.h>
#include <log.h>
+#include <mapmem.h>
#include <spl.h>
static ulong spl_nor_load_read(struct spl_load_info *load, ulong sector,
@@ -14,7 +15,7 @@ static ulong spl_nor_load_read(struct spl_load_info *load, ulong sector,
{
debug("%s: sector %lx, count %lx, buf %p\n",
__func__, sector, count, buf);
- memcpy(buf, (void *)sector, count);
+ memcpy(buf, map_sysmem(sector, count), count);
return count;
}
@@ -92,7 +93,7 @@ static int spl_nor_load_image(struct spl_image_info *spl_image,
* Load real U-Boot from its location in NOR flash to its
* defined location in SDRAM
*/
- header = (const struct legacy_img_hdr *)spl_nor_get_uboot_base();
+ header = map_sysmem(spl_nor_get_uboot_base(), sizeof(*header));
#ifdef CONFIG_SPL_LOAD_FIT
if (image_get_magic(header) == FDT_MAGIC) {
debug("Found FIT format U-Boot\n");