All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hannes Schmelzer <hannes@schmelzer.or.at>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] image: fix getenv_bootm_size() function
Date: Mon, 08 Feb 2016 15:01:31 +0100	[thread overview]
Message-ID: <56B89FBB.6070403@schmelzer.or.at> (raw)
In-Reply-To: <1450415831-20347-1-git-send-email-yamada.masahiro@socionext.com>



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

  parent reply	other threads:[~2016-02-08 14:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Hannes Schmelzer [this message]
2016-02-08 14:11   ` [U-Boot] [PATCH] " Matthias Weißer
2016-02-08 14:16     ` Hannes Schmelzer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56B89FBB.6070403@schmelzer.or.at \
    --to=hannes@schmelzer.or.at \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.