X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=common%2Fimage.c;h=1d7543dd185c331fc21c81add59b97a829d85c01;hb=6febd8ca5aef84de67a2d7da9450d9385352bd04;hp=75b1104bf3ab2ad476549dfb6a3e4de8f3cb01af;hpb=57dc53a72460e8e301fa1cc7951b41db8e731485;p=u-boot diff --git a/common/image.c b/common/image.c index 75b1104bf3..1d7543dd18 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)