summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2016-02-05 16:12:50 +0900
committerTom Rini <trini@konsulko.com>2016-02-08 10:22:40 -0500
commit0cb389dd1a3805db9639f70131e58f9bb602100e (patch)
treec673a17395894d80774ebe560de71abae638202f /common
parent89ab841088f5ccc78f0d501641fc99ea4d8c26f2 (diff)
downloadu-boot-imx-0cb389dd1a3805db9639f70131e58f9bb602100e.zip
u-boot-imx-0cb389dd1a3805db9639f70131e58f9bb602100e.tar.gz
u-boot-imx-0cb389dd1a3805db9639f70131e58f9bb602100e.tar.bz2
image: fix getenv_bootm_size() function again
Commit 9c11135ce053 ("image: fix getenv_bootm_size() function") fixed the case where "bootm_low" is defined, but "bootm_size" is not. Instead, it broke the case where neither "bootm_low" nor "bootm_size" is defined. Fix this function again. Fixes: 9c11135ce053 ("image: fix getenv_bootm_size() function") Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Tested-by: Matthias Weisser <m.weisser.m@gmail.com> Tested-by: Hannes Schmelzer <oe5hpm@oevsv.at>
Diffstat (limited to 'common')
-rw-r--r--common/image.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/common/image.c b/common/image.c
index 75b1104..1d7543d 100644
--- a/common/image.c
+++ b/common/image.c
@@ -458,24 +458,29 @@ ulong getenv_bootm_low(void)
phys_size_t getenv_bootm_size(void)
{
- phys_size_t tmp;
+ phys_size_t tmp, size;
+ phys_addr_t start;
char *s = getenv("bootm_size");
if (s) {
tmp = (phys_size_t)simple_strtoull(s, NULL, 16);
return tmp;
}
+
+#if defined(CONFIG_ARM) && defined(CONFIG_NR_DRAM_BANKS)
+ start = gd->bd->bi_dram[0].start;
+ size = gd->bd->bi_dram[0].size;
+#else
+ start = gd->bd->bi_memstart;
+ size = gd->bd->bi_memsize;
+#endif
+
s = getenv("bootm_low");
if (s)
tmp = (phys_size_t)simple_strtoull(s, NULL, 16);
else
- tmp = 0;
-
+ tmp = start;
-#if defined(CONFIG_ARM) && defined(CONFIG_NR_DRAM_BANKS)
- return gd->bd->bi_dram[0].size - (tmp - gd->bd->bi_dram[0].start);
-#else
- return gd->bd->bi_memsize - (tmp - gd->bd->bi_memstart);
-#endif
+ return size - (tmp - start);
}
phys_size_t getenv_bootm_mapsize(void)