summaryrefslogtreecommitdiff
path: root/common/spl/spl_legacy.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_legacy.c
parent93caa3efe25bb9d3e6265aa467dc5b6a2201819b (diff)
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_legacy.c')
-rw-r--r--common/spl/spl_legacy.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/common/spl/spl_legacy.c b/common/spl/spl_legacy.c
index e9564e5c2a5..51656fb9617 100644
--- a/common/spl/spl_legacy.c
+++ b/common/spl/spl_legacy.c
@@ -7,6 +7,7 @@
#include <image.h>
#include <log.h>
#include <malloc.h>
+#include <mapmem.h>
#include <asm/sections.h>
#include <spl.h>
@@ -129,7 +130,7 @@ int spl_load_legacy_img(struct spl_image_info *spl_image,
dataptr += sizeof(*hdr);
load->read(load, dataptr, spl_image->size,
- (void *)(unsigned long)spl_image->load_addr);
+ map_sysmem(spl_image->load_addr, spl_image->size));
break;
case IH_COMP_LZMA:
@@ -148,7 +149,8 @@ int spl_load_legacy_img(struct spl_image_info *spl_image,
}
load->read(load, dataptr, spl_image->size, src);
- ret = lzmaBuffToBuffDecompress((void *)spl_image->load_addr,
+ ret = lzmaBuffToBuffDecompress(map_sysmem(spl_image->load_addr,
+ spl_image->size),
&lzma_len, src, spl_image->size);
if (ret) {
printf("LZMA decompression error: %d\n", ret);