Re: [U-Boot] [PATCH] image: fix getenv_bootm_size() function again

2016-02-08 Thread Hannes Schmelzer



On 05.02.2016 08:12, Masahiro Yamada wrote:

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

  common/image.c | 21 +
  1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/common/image.c b/common/image.c
index f4a1dc8..82ace38 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)

Tested-by: Hannes Schmelzer 

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


Re: [U-Boot] [PATCH] image: fix getenv_bootm_size() function again

2016-02-05 Thread Matthias Weißer
Hi Masahiro

2016-02-05 8:12 GMT+01:00 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")
> Signed-off-by: Masahiro Yamada 

This fixes the problem for me. Thanks a lot.

Tested-by: Matthias Weisser 

2016-02-05 8:12 GMT+01:00 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")
> Signed-off-by: Masahiro Yamada 
> ---
>
>  common/image.c | 21 +
>  1 file changed, 13 insertions(+), 8 deletions(-)
>
> diff --git a/common/image.c b/common/image.c
> index f4a1dc8..82ace38 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)
> --
> 1.9.1
>
> ___
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] image: fix getenv_bootm_size() function again

2016-02-04 Thread 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")
Signed-off-by: Masahiro Yamada 
---

 common/image.c | 21 +
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/common/image.c b/common/image.c
index f4a1dc8..82ace38 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)
-- 
1.9.1

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