[U-Boot] [PATCH 19/27] image: Account for CONFIG_SYS_SDRAM_BASE being physical

Paul Burton paul.burton at imgtec.com
Sat Oct 1 16:19:22 CEST 2016


README declares that CONFIG_SYS_SDRAM_BASE is meant to be the physical
address of SDRAM, but right now that is not the case on MIPS systems,
where it is instead a virtual address. In preparation for making it
physical, use phys_to_virt to translate CONFIG_SYS_SDRAM_BASE & the
associated bi_memstart field of struct bd_info to virtual addresses for
use.

Signed-off-by: Paul Burton <paul.burton at imgtec.com>
---

 common/image.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/image.c b/common/image.c
index a5d19ab..1581022 100644
--- a/common/image.c
+++ b/common/image.c
@@ -466,7 +466,7 @@ ulong getenv_bootm_low(void)
 	}
 
 #if defined(CONFIG_SYS_SDRAM_BASE)
-	return CONFIG_SYS_SDRAM_BASE;
+	return (ulong)phys_to_virt(CONFIG_SYS_SDRAM_BASE);
 #elif defined(CONFIG_ARM)
 	return gd->bd->bi_dram[0].start;
 #else
@@ -488,7 +488,7 @@ phys_size_t getenv_bootm_size(void)
 	start = gd->bd->bi_dram[0].start;
 	size = gd->bd->bi_dram[0].size;
 #else
-	start = gd->bd->bi_memstart;
+	start = (ulong)phys_to_virt(gd->bd->bi_memstart);
 	size = gd->bd->bi_memsize;
 #endif
 
-- 
2.10.0



More information about the U-Boot mailing list