Skip to contentSkip to conversation

image: fix getenv_bootm_size() function again

PATCH In review Masahiro Yamada 4 participants 4 messages Feb 5, 2016 – Feb 8, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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")

---

 common/image.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)
common/image.c +13 -8
index f4a1dc8..82ace38 100644
@@ -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)
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 image: fix getenv_bootm_size() function again

Hi Masahiro

2016-02-05 8:12 GMT+01:00 Masahiro Yamada <[email protected]>:

Quoted 7 lines

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")

This fixes the problem for me. Thanks a lot.

2016-02-05 8:12 GMT+01:00 Masahiro Yamada <[email protected]>:

Quoted 61 lines

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")

---

 common/image.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)
common/image.c +13 -9
index f4a1dc8..82ace38 100644
@@ -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)
--

1.9.1

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#2 lore raw

PATCH 1/1 image: fix getenv_bootm_size() function again

In reply to Masahiro Yamada
Quoted 44 lines · Masahiro Yamada

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")

---

  common/image.c | 21 +++++++++++++--------
  1 file changed, 13 insertions(+), 8 deletions(-)
common/image.c +12 -3
index f4a1dc8..82ace38 100644
@@ -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;

common/image.c ulong getenv_bootm_low(void) · line 486

Quoted 10 lines
common/image.c +1 -5
 
-#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)
#3 lore raw
In reply to Masahiro Yamada
Quoted 9 lines · Masahiro Yamada

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")

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160208/221d0587/attachment.sig>