public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Luca Ellero <lroluk@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] arm: fix bug on relocation address
Date: Fri, 01 Feb 2013 09:50:32 +0100	[thread overview]
Message-ID: <510B81D8.20700@gmail.com> (raw)
In-Reply-To: <510AC112.2090409@myspectrum.nl>

Hi Jeroen,
Hi Heiko,

On 31/01/2013 20.08, Jeroen Hofstee wrote:
> Hello Luca,
>
> On 01/31/2013 03:29 PM, Luca Ellero wrote:
>> If (N. SDRAM banks > 1) and they are not contiguous, don't relocate
>> u-boot at (CONFIG_SYS_SDRAM_BASE + gd->ram_size), which is a bug.
>> Instead use the end of 2nd bank (even if there are more than 2 banks)
>>
>> Signed-off-by: Luca Ellero <lroluk@gmail.com>
>> Cc: Albert Aribaud <albert.u.boot@aribaud.net>
>> Cc: Heiko Schocher <hs@denx.de>
>> ---
>>
>> On ARM architectures there is a bug getting top of SDRAM (where u-boot
>> will be relocated). Top of SDRAM will always be:
>>
>> CONFIG_SYS_SDRAM_BASE + gd->ram_size
>>
>> anyway this can be wrong since SDRAM can be composed by more that one
>> bank in not-contiguous address space.
> I don't think this is a valid use case since the README says:
>
> "The available memory is mapped to fixed addresses using the memory
> controller. In this process, a contiguous block is formed for each
> memory type (Flash, SDRAM, SRAM), even when it consists of several
> physical memory banks."
>

Thank for your comments.
You are saying more or less the same thing but I'm afraid I didn't 
really catch what you mean.
I know how is the U-Boot memory map and I summarize it here  (more or 
less, depending on board configuration):

TOP of RAM ------------------------
              Kernel Log Buffer
            ---------------------------
              Protected RAM
            ---------------------------
              TLB Table (32kB to 64 kB)
            ---------------------------
              LCD Frame Buffer
            ---------------------------
              Relocated U-Boot Code
            ---------------------------
              malloc area
            ---------------------------
              Board Info (struct bd_t)
            ---------------------------
              Global Data (struct gd_t)
            ---------------------------
              IRQ Stack
            ---------------------------
              Abort Stack
            ---------------------------
	     ...


Now, I have a Freescale iMX53 LOCO board which have 2 banks of 512 MB 
SDRAM, for total of 1GB. One bank is at phys 0x70000000-0x8fffffff, the 
other is at 0xb0000000-0xcfffffff.
If I stop U-Boot execution after relocation (with a JTAG debugger) I see 
that it is running at physical address 0xaff6D000 (more or less).
As far as I can see this address is not existent. And the dangerous part 
is that I can see the same data (U-Boot code) at address 0x8ff6D000. 
This clearly states that U-Boot is relocated at 0xAff6D000
but in reality it is at 0x8ff6D000 an the relocation can potentially 
override data already existing there.
Don't you think this is a wrong behaviour?
Thanks
Regards
Luca

  reply	other threads:[~2013-02-01  8:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-31 14:29 [U-Boot] [PATCH] arm: fix bug on relocation address Luca Ellero
2013-01-31 19:08 ` Jeroen Hofstee
2013-02-01  8:50   ` Luca Ellero [this message]
2013-02-01 10:07     ` Heiko Schocher
2013-02-01  9:49       ` Luca Ellero
2013-02-07  9:07         ` Luca Ellero
2013-02-01  8:17 ` Heiko Schocher

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=510B81D8.20700@gmail.com \
    --to=lroluk@gmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox