From: Albert ARIBAUD <albert.u.boot@aribaud.net>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 3/5 v1] integrator: do not test first part of the memory
Date: Sat, 22 Oct 2011 01:47:31 +0200 [thread overview]
Message-ID: <4EA20493.3000800@aribaud.net> (raw)
In-Reply-To: <CACRpkdb+HDRHpSLBpnPXq6c5b7fKjSACp-0YJTguwEWVoir88A@mail.gmail.com>
Le 17/10/2011 13:57, Linus Walleij a ?crit :
> Hi Arnaud,
>
> On Sun, Oct 16, 2011 at 5:51 PM, Albert ARIBAUD
> <albert.u.boot@aribaud.net> wrote:
>> Le 18/09/2011 09:52, Linus Walleij a ?crit :
>>>
>>> When booting from Flash, the Integrator remaps its flash memory
>>> from 0x24000000 to 0x00000000, and starts executing it at
>>> 0x00000000. This ROM thus hides the RAM underneath and first
>>> 0x40000 bytes of the memory cannot be tested by get_ram_size().
>>> So let's test from 0x40000 to the end of detected memory
>>> instead.
>>
>> Is this masking of RAM by FLASH a hardware thing that cannot be avoided?
>> Can't the U-Boot startup code somehow remap the FLASH elsewhere, and then
>> proceed to really test the whole RAM?
>
> Well, it is unmapped in board_init() but that is post-RAM-test.
>
> The reason I cannot unmapp it in dram_init() is that at this point
> U-Boot is running from flash and has not relocated itself (it wants to test
> RAM before relocating of course) and the flash it is running from is
> exactly that which is in the way of the RAM test.
>
> So on integrator, the flash memory remaps itself to address 0x00000000
> when booting from flash, and U-Boot has text base 0x00000000 in
> this case, and is running in flash relative 0x00000000.
>
> If it would remap the flash at this point it would unmap itself,
> and crash.
>
> This way of having the flash containing U-Boot remap itself over the
> system RAM seems to be uncommon, but I'd share the problem with
> anyone else trying to do something similar I guess.
There is a technique for remapping running code memory, which relies on
the mapping controller being able to map the same device twice: usually
you start with one window already defined for the boot device, then you
create another window where you want the device to end up, then you jump
to that new address, then at that new address you can unmap the original
window. I sort of did that for orion5x, for a slightly different reason
-- see orion5x_config_adr_windows() in cpu.c.
Otherwise, I don't suppose there is static RAM that the FLASH code could
use as a pivot? If there was, you could boot from flash @ 'bad'
location, copy a flash-remapping routine into SRAM, jump to it, once
remapped, the routine jumps to flash@ 'good' location and then you can
test the whole RAM.
> Yours,
> Linus Walleij
Amicalement,
--
Albert.
prev parent reply other threads:[~2011-10-21 23:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-18 7:52 [U-Boot] [PATCH 3/5 v1] integrator: do not test first part of the memory Linus Walleij
2011-10-16 15:51 ` Albert ARIBAUD
2011-10-17 11:57 ` Linus Walleij
2011-10-21 23:47 ` Albert ARIBAUD [this message]
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=4EA20493.3000800@aribaud.net \
--to=albert.u.boot@aribaud.net \
--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