All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] image: fix getenv_bootm_size() function
@ 2015-12-18  5:17 Masahiro Yamada
  2016-01-08  3:33 ` Simon Glass
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Masahiro Yamada @ 2015-12-18  5:17 UTC (permalink / raw)
  To: u-boot

Currently, this function returns wrong size if "bootm_low" is defined,
but "bootm_size" is not.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

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

diff --git a/common/image.c b/common/image.c
index d63d9e0..f4a1dc8 100644
--- a/common/image.c
+++ b/common/image.c
@@ -472,9 +472,9 @@ phys_size_t getenv_bootm_size(void)
 
 
 #if defined(CONFIG_ARM) && defined(CONFIG_NR_DRAM_BANKS)
-	return gd->bd->bi_dram[0].size - tmp;
+	return gd->bd->bi_dram[0].size - (tmp - gd->bd->bi_dram[0].start);
 #else
-	return gd->bd->bi_memsize - tmp;
+	return gd->bd->bi_memsize - (tmp - gd->bd->bi_memstart);
 #endif
 }
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH] image: fix getenv_bootm_size() function
  2015-12-18  5:17 [U-Boot] [PATCH] image: fix getenv_bootm_size() function Masahiro Yamada
@ 2016-01-08  3:33 ` Simon Glass
  2016-01-14  5:50   ` Masahiro Yamada
  2016-01-19 18:07 ` [U-Boot] " Tom Rini
  2016-02-08 14:01 ` [U-Boot] [PATCH] " Hannes Schmelzer
  2 siblings, 1 reply; 9+ messages in thread
From: Simon Glass @ 2016-01-08  3:33 UTC (permalink / raw)
  To: u-boot

Hi Masahiro,

On 17 December 2015 at 22:17, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
> Currently, this function returns wrong size if "bootm_low" is defined,
> but "bootm_size" is not.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
>
>  common/image.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/common/image.c b/common/image.c
> index d63d9e0..f4a1dc8 100644
> --- a/common/image.c
> +++ b/common/image.c
> @@ -472,9 +472,9 @@ phys_size_t getenv_bootm_size(void)
>
>
>  #if defined(CONFIG_ARM) && defined(CONFIG_NR_DRAM_BANKS)
> -       return gd->bd->bi_dram[0].size - tmp;
> +       return gd->bd->bi_dram[0].size - (tmp - gd->bd->bi_dram[0].start);
>  #else
> -       return gd->bd->bi_memsize - tmp;
> +       return gd->bd->bi_memsize - (tmp - gd->bd->bi_memstart);
>  #endif
>  }
>
> --
> 1.9.1
>

Reviewed-by: Simon Glass <sjg@chromium.org>

But can you please add a comment to the image.h header file as to what
this function is supposed to do?

Regards,
Simon

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH] image: fix getenv_bootm_size() function
  2016-01-08  3:33 ` Simon Glass
@ 2016-01-14  5:50   ` Masahiro Yamada
  2016-01-14 23:12     ` Simon Glass
  0 siblings, 1 reply; 9+ messages in thread
From: Masahiro Yamada @ 2016-01-14  5:50 UTC (permalink / raw)
  To: u-boot

Hi Simon,


2016-01-08 12:33 GMT+09:00 Simon Glass <sjg@chromium.org>:
> Hi Masahiro,
>
> On 17 December 2015 at 22:17, Masahiro Yamada
> <yamada.masahiro@socionext.com> wrote:
>> Currently, this function returns wrong size if "bootm_low" is defined,
>> but "bootm_size" is not.
>>
>> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
>> ---
>>
>>  common/image.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/common/image.c b/common/image.c
>> index d63d9e0..f4a1dc8 100644
>> --- a/common/image.c
>> +++ b/common/image.c
>> @@ -472,9 +472,9 @@ phys_size_t getenv_bootm_size(void)
>>
>>
>>  #if defined(CONFIG_ARM) && defined(CONFIG_NR_DRAM_BANKS)
>> -       return gd->bd->bi_dram[0].size - tmp;
>> +       return gd->bd->bi_dram[0].size - (tmp - gd->bd->bi_dram[0].start);
>>  #else
>> -       return gd->bd->bi_memsize - tmp;
>> +       return gd->bd->bi_memsize - (tmp - gd->bd->bi_memstart);
>>  #endif
>>  }
>>
>> --
>> 1.9.1
>>
>
> Reviewed-by: Simon Glass <sjg@chromium.org>
>
> But can you please add a comment to the image.h header file as to what
> this function is supposed to do?


This patch is a bug-fix and self-contained.


I assume you suggested the additional comment be a separate work.


-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH] image: fix getenv_bootm_size() function
  2016-01-14  5:50   ` Masahiro Yamada
@ 2016-01-14 23:12     ` Simon Glass
  2016-01-17  1:07       ` Masahiro Yamada
  0 siblings, 1 reply; 9+ messages in thread
From: Simon Glass @ 2016-01-14 23:12 UTC (permalink / raw)
  To: u-boot

Hi Masahiro,

On 13 January 2016 at 22:50, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
> Hi Simon,
>
>
> 2016-01-08 12:33 GMT+09:00 Simon Glass <sjg@chromium.org>:
>> Hi Masahiro,
>>
>> On 17 December 2015 at 22:17, Masahiro Yamada
>> <yamada.masahiro@socionext.com> wrote:
>>> Currently, this function returns wrong size if "bootm_low" is defined,
>>> but "bootm_size" is not.
>>>
>>> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
>>> ---
>>>
>>>  common/image.c | 4 ++--
>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/common/image.c b/common/image.c
>>> index d63d9e0..f4a1dc8 100644
>>> --- a/common/image.c
>>> +++ b/common/image.c
>>> @@ -472,9 +472,9 @@ phys_size_t getenv_bootm_size(void)
>>>
>>>
>>>  #if defined(CONFIG_ARM) && defined(CONFIG_NR_DRAM_BANKS)
>>> -       return gd->bd->bi_dram[0].size - tmp;
>>> +       return gd->bd->bi_dram[0].size - (tmp - gd->bd->bi_dram[0].start);
>>>  #else
>>> -       return gd->bd->bi_memsize - tmp;
>>> +       return gd->bd->bi_memsize - (tmp - gd->bd->bi_memstart);
>>>  #endif
>>>  }
>>>
>>> --
>>> 1.9.1
>>>
>>
>> Reviewed-by: Simon Glass <sjg@chromium.org>
>>
>> But can you please add a comment to the image.h header file as to what
>> this function is supposed to do?
>
>
> This patch is a bug-fix and self-contained.
>
>
> I assume you suggested the additional comment be a separate work.

That's OK with me. It takes ages to understand what the function does
so a comment would really help.

Regards,
Simon

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH] image: fix getenv_bootm_size() function
  2016-01-14 23:12     ` Simon Glass
@ 2016-01-17  1:07       ` Masahiro Yamada
  0 siblings, 0 replies; 9+ messages in thread
From: Masahiro Yamada @ 2016-01-17  1:07 UTC (permalink / raw)
  To: u-boot

Tom,

This patch is a bug-fix
and still keeping me from using bootm_low on my boards.

Please apply!

-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] image: fix getenv_bootm_size() function
  2015-12-18  5:17 [U-Boot] [PATCH] image: fix getenv_bootm_size() function Masahiro Yamada
  2016-01-08  3:33 ` Simon Glass
@ 2016-01-19 18:07 ` Tom Rini
  2016-02-08 14:01 ` [U-Boot] [PATCH] " Hannes Schmelzer
  2 siblings, 0 replies; 9+ messages in thread
From: Tom Rini @ 2016-01-19 18:07 UTC (permalink / raw)
  To: u-boot

On Fri, Dec 18, 2015 at 02:17:10PM +0900, Masahiro Yamada wrote:

> Currently, this function returns wrong size if "bootm_low" is defined,
> but "bootm_size" is not.
> 
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!

-- 
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/20160119/8c919c5a/attachment.sig>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH] image: fix getenv_bootm_size() function
  2015-12-18  5:17 [U-Boot] [PATCH] image: fix getenv_bootm_size() function Masahiro Yamada
  2016-01-08  3:33 ` Simon Glass
  2016-01-19 18:07 ` [U-Boot] " Tom Rini
@ 2016-02-08 14:01 ` Hannes Schmelzer
  2016-02-08 14:11   ` Matthias Weißer
  2 siblings, 1 reply; 9+ messages in thread
From: Hannes Schmelzer @ 2016-02-08 14:01 UTC (permalink / raw)
  To: u-boot



On 18.12.2015 06:17, Masahiro Yamada wrote:
> Currently, this function returns wrong size if "bootm_low" is defined,
> but "bootm_size" is not.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
>
>   common/image.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/common/image.c b/common/image.c
> index d63d9e0..f4a1dc8 100644
> --- a/common/image.c
> +++ b/common/image.c
> @@ -472,9 +472,9 @@ phys_size_t getenv_bootm_size(void)
>   
>   
>   #if defined(CONFIG_ARM) && defined(CONFIG_NR_DRAM_BANKS)
> -	return gd->bd->bi_dram[0].size - tmp;
> +	return gd->bd->bi_dram[0].size - (tmp - gd->bd->bi_dram[0].start);
>   #else
> -	return gd->bd->bi_memsize - tmp;
> +	return gd->bd->bi_memsize - (tmp - gd->bd->bi_memstart);
>   #endif
>   }
Hi Masahiro,

your commit has been merged on 19.1. this year.
Today i ran a test on my tseries board with most current u-boot/master.

I ran into trouble booting my linux kernel:

---
Kernel image @ 0x80200000 [ 0x000000 - 0x222720 ]
## Loading init Ramdisk from Legacy Image at 80a00000 ...
    Image Name:
    Image Type:   ARM Linux RAMDisk Image (uncompressed)
    Data Size:    12452646 Bytes = 11.9 MiB
    Load Address: 00000000
    Entry Point:  00000000
## Flattened Device Tree blob at 80100000
    Booting using the fdt blob at 0x80100000
ERROR: Failed to allocate 0xbe0326 bytes below 0x10000000.
ramdisk - allocation error
FDT creation failed! hanging...### ERROR ### Please RESET the board ###
---

I debugged  bit am came to the conclusio, that the line

+	return gd->bd->bi_dram[0].size - (tmp - gd->bd->bi_dram[0].start);

brings me into trouble.

On my board DRAM is configured as follows:
U-Boot (BuR V2.0)# bdinfo
arch_number = 0xFFFFFFFF
boot_params = 0x80000100
DRAM bank   = 0x00000000
*-> start    = 0x80000000**
**-> size     = 0x10000000**
*
so size minus start would give a negative number.
I tried local revert of this commit and everything works as before.

more correct would be

+	return gd->bd->bi_dram[0].start - (tmp - gd->bd->bi_dram[0].size);


whats your thinking about?

best regards,
Hannes

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH] image: fix getenv_bootm_size() function
  2016-02-08 14:01 ` [U-Boot] [PATCH] " Hannes Schmelzer
@ 2016-02-08 14:11   ` Matthias Weißer
  2016-02-08 14:16     ` Hannes Schmelzer
  0 siblings, 1 reply; 9+ messages in thread
From: Matthias Weißer @ 2016-02-08 14:11 UTC (permalink / raw)
  To: u-boot

Hi Hannes

I had the same problem. http://patchwork.ozlabs.org/patch/579391/ fixed it.

Regards,
Matthias


2016-02-08 15:01 GMT+01:00 Hannes Schmelzer <hannes@schmelzer.or.at>:
>
>
> On 18.12.2015 06:17, Masahiro Yamada wrote:
>>
>> Currently, this function returns wrong size if "bootm_low" is defined,
>> but "bootm_size" is not.
>>
>> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
>> ---
>>
>>   common/image.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/common/image.c b/common/image.c
>> index d63d9e0..f4a1dc8 100644
>> --- a/common/image.c
>> +++ b/common/image.c
>> @@ -472,9 +472,9 @@ phys_size_t getenv_bootm_size(void)
>>       #if defined(CONFIG_ARM) && defined(CONFIG_NR_DRAM_BANKS)
>> -       return gd->bd->bi_dram[0].size - tmp;
>> +       return gd->bd->bi_dram[0].size - (tmp - gd->bd->bi_dram[0].start);
>>   #else
>> -       return gd->bd->bi_memsize - tmp;
>> +       return gd->bd->bi_memsize - (tmp - gd->bd->bi_memstart);
>>   #endif
>>   }
>
> Hi Masahiro,
>
> your commit has been merged on 19.1. this year.
> Today i ran a test on my tseries board with most current u-boot/master.
>
> I ran into trouble booting my linux kernel:
>
> ---
> Kernel image @ 0x80200000 [ 0x000000 - 0x222720 ]
> ## Loading init Ramdisk from Legacy Image at 80a00000 ...
>    Image Name:
>    Image Type:   ARM Linux RAMDisk Image (uncompressed)
>    Data Size:    12452646 Bytes = 11.9 MiB
>    Load Address: 00000000
>    Entry Point:  00000000
> ## Flattened Device Tree blob at 80100000
>    Booting using the fdt blob at 0x80100000
> ERROR: Failed to allocate 0xbe0326 bytes below 0x10000000.
> ramdisk - allocation error
> FDT creation failed! hanging...### ERROR ### Please RESET the board ###
> ---
>
> I debugged  bit am came to the conclusio, that the line
>
> +       return gd->bd->bi_dram[0].size - (tmp - gd->bd->bi_dram[0].start);
>
> brings me into trouble.
>
> On my board DRAM is configured as follows:
> U-Boot (BuR V2.0)# bdinfo
> arch_number = 0xFFFFFFFF
> boot_params = 0x80000100
> DRAM bank   = 0x00000000
> *-> start    = 0x80000000**
> **-> size     = 0x10000000**
> *
> so size minus start would give a negative number.
> I tried local revert of this commit and everything works as before.
>
> more correct would be
>
> +       return gd->bd->bi_dram[0].start - (tmp - gd->bd->bi_dram[0].size);
>
>
> whats your thinking about?
>
> best regards,
> Hannes
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH] image: fix getenv_bootm_size() function
  2016-02-08 14:11   ` Matthias Weißer
@ 2016-02-08 14:16     ` Hannes Schmelzer
  0 siblings, 0 replies; 9+ messages in thread
From: Hannes Schmelzer @ 2016-02-08 14:16 UTC (permalink / raw)
  To: u-boot



On 08.02.2016 15:11, Matthias Wei?er wrote:
> Hi Hannes
>
> I had the same problem. http://patchwork.ozlabs.org/patch/579391/ fixed it.
>
> Regards,
> Matthias
>
>
> 2016-02-08 15:01 GMT+01:00 Hannes Schmelzer <hannes@schmelzer.or.at>:
>>
>> On 18.12.2015 06:17, Masahiro Yamada wrote:
>>> Currently, this function returns wrong size if "bootm_low" is defined,
>>> but "bootm_size" is not.
>>>
>>> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
>>> ---
>>>
>>>    common/image.c | 4 ++--
>>>    1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/common/image.c b/common/image.c
>>> index d63d9e0..f4a1dc8 100644
>>> --- a/common/image.c
>>> +++ b/common/image.c
>>> @@ -472,9 +472,9 @@ phys_size_t getenv_bootm_size(void)
>>>        #if defined(CONFIG_ARM) && defined(CONFIG_NR_DRAM_BANKS)
>>> -       return gd->bd->bi_dram[0].size - tmp;
>>> +       return gd->bd->bi_dram[0].size - (tmp - gd->bd->bi_dram[0].start);
>>>    #else
>>> -       return gd->bd->bi_memsize - tmp;
>>> +       return gd->bd->bi_memsize - (tmp - gd->bd->bi_memstart);
>>>    #endif
>>>    }
>> Hi Masahiro,
>>
>> your commit has been merged on 19.1. this year.
>> Today i ran a test on my tseries board with most current u-boot/master.
>>
>> I ran into trouble booting my linux kernel:
>>
>> ---
>> Kernel image @ 0x80200000 [ 0x000000 - 0x222720 ]
>> ## Loading init Ramdisk from Legacy Image at 80a00000 ...
>>     Image Name:
>>     Image Type:   ARM Linux RAMDisk Image (uncompressed)
>>     Data Size:    12452646 Bytes = 11.9 MiB
>>     Load Address: 00000000
>>     Entry Point:  00000000
>> ## Flattened Device Tree blob at 80100000
>>     Booting using the fdt blob at 0x80100000
>> ERROR: Failed to allocate 0xbe0326 bytes below 0x10000000.
>> ramdisk - allocation error
>> FDT creation failed! hanging...### ERROR ### Please RESET the board ###
>> ---
>>
>> I debugged  bit am came to the conclusio, that the line
>>
>> +       return gd->bd->bi_dram[0].size - (tmp - gd->bd->bi_dram[0].start);
>>
>> brings me into trouble.
>>
>> On my board DRAM is configured as follows:
>> U-Boot (BuR V2.0)# bdinfo
>> arch_number = 0xFFFFFFFF
>> boot_params = 0x80000100
>> DRAM bank   = 0x00000000
>> *-> start    = 0x80000000**
>> **-> size     = 0x10000000**
>> *
>> so size minus start would give a negative number.
>> I tried local revert of this commit and everything works as before.
>>
>> more correct would be
>>
>> +       return gd->bd->bi_dram[0].start - (tmp - gd->bd->bi_dram[0].size);
>>
>>
>> whats your thinking about?
>>
>> best regards,
>> Hannes
>>
>> _______________________________________________
>> U-Boot mailing list
>> U-Boot at lists.denx.de
>> http://lists.denx.de/mailman/listinfo/u-boot
Hi Matthias,

this also fixes my problem.

many thanks!

best regards,
Hannes

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-02-08 14:16 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-18  5:17 [U-Boot] [PATCH] image: fix getenv_bootm_size() function Masahiro Yamada
2016-01-08  3:33 ` Simon Glass
2016-01-14  5:50   ` Masahiro Yamada
2016-01-14 23:12     ` Simon Glass
2016-01-17  1:07       ` Masahiro Yamada
2016-01-19 18:07 ` [U-Boot] " Tom Rini
2016-02-08 14:01 ` [U-Boot] [PATCH] " Hannes Schmelzer
2016-02-08 14:11   ` Matthias Weißer
2016-02-08 14:16     ` Hannes Schmelzer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.