diff mbox

[U-Boot,01/16] image: Correct the OS location code to work on sandbox

Message ID 1455500220-1324-2-git-send-email-sjg@chromium.org
State Accepted
Commit 7a80de464167ec45fdb70f63d83d07f7c2c57b82
Delegated to: Simon Glass
Headers show

Commit Message

Simon Glass Feb. 15, 2016, 1:36 a.m. UTC
A recent change broke the 'bootm' command on sandbox. The root cause is
using a pointer as an address. Conversion from pointer to address needs to
use map_to_sysmem() so that sandbox can do the right thing. The problem was
pre-existing but uncovered by a recent commit.

Fix this. Also move fit_get_end() to the C file to avoid needing to include
mapmem.h (and thus asm/io.h) everywhere.

Fixes: 1fec3c5d (common/image.c: Make boot_get_ramdisk() perform a check for Android images)

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 common/bootm.c     | 2 +-
 common/image-fit.c | 5 +++++
 include/image.h    | 5 +----
 3 files changed, 7 insertions(+), 5 deletions(-)
diff mbox

Patch

diff --git a/common/bootm.c b/common/bootm.c
index 99d574d..df27089 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -201,7 +201,7 @@  static int bootm_find_os(cmd_tbl_t *cmdtp, int flag, int argc,
 		images.ep += images.os.load;
 	}
 
-	images.os.start = (ulong)os_hdr;
+	images.os.start = map_to_sysmem(os_hdr);
 
 	return 0;
 }
diff --git a/common/image-fit.c b/common/image-fit.c
index c531ee7..d3fad30 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -851,6 +851,11 @@  static int fit_image_hash_get_ignore(const void *fit, int noffset, int *ignore)
 	return 0;
 }
 
+ulong fit_get_end(const void *fit)
+{
+	return map_to_sysmem((void *)(fit + fdt_totalsize(fit)));
+}
+
 /**
  * fit_set_timestamp - set node timestamp property
  * @fit: pointer to the FIT format image header
diff --git a/include/image.h b/include/image.h
index 299d6d2..518a4f5 100644
--- a/include/image.h
+++ b/include/image.h
@@ -818,10 +818,7 @@  static inline ulong fit_get_size(const void *fit)
  * returns:
  *     end address of the FIT image (blob) in memory
  */
-static inline ulong fit_get_end(const void *fit)
-{
-	return (ulong)fit + fdt_totalsize(fit);
-}
+ulong fit_get_end(const void *fit);
 
 /**
  * fit_get_name - get FIT node name