public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Richard Danter <richard.danter@ntlworld.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] Global vars question -- Solved
Date: Fri, 15 Jul 2005 17:03:36 +0100	[thread overview]
Message-ID: <42D7DE58.3060005@ntlworld.com> (raw)
In-Reply-To: <42D7C858.2050104@ntlworld.com>

Richard Danter wrote:
> Richard Danter wrote:
> 
>> Hi all,
>>
>> Further progress on my port. I can now write to flash!
>>
>> I noticed in lib_ppc/board.c board_init_r() that on e500 CPU's the 
>> unlock_ram_in_cache() function is called. The 7xx/74xx also locks the 
>> init RAM in the dcache, but nowhere is it unlocked.
>>
>> I tried calling unlock_ram_in_cache() from my board's misc_init_r() 
>> function, but this crashes U-Boot.
>>
>> As an experiment, I left the cache locked, but then ran the "dcache 
>> off" command from the shell. If I do printenv before turning the 
>> dcache off it is all OK, if I do it after then it crashes.
>>
>> With my debugger I can see that the gd data structure is garbage when 
>> env_get_char_memory() is called. But I thought all data was copied to 
>> the main sys RAM.
>>
>> Is there something else I need to do before/after calling 
>> unlock_ram_in_cache() so I can use the D-Cache as normal?
> 
> 
> Since I now have system RAM initialised very early on, I tried using the 
> system RAM instead of the dcache for init RAM. That works fine. I do not 
> now need to call unlock_ram_in_cache() and I can turn the dcache off/on 
> without breaking printenv.
> 
> Just to check things out,I used "mw" to write a pattern over where the 
> init RAM is placed. After that, printenv fails again. So it seems 
> something is wrong within the relocation of global variables.
> 
> I have not changed the code to do the relocation, so am I just 
> misunderstanding what it does? Is there some #define I may have forgotten?

By default, the gd_t pointer (gd) remains pointing to init RAM, not to 
the relocated RAM on 7xx/74xx. I had to explicitly set gd to point to 
the relocated version in my after_reloc() function and ensure the 
correct value is passed to after_reloc() by start.S (relocate_code).

Seems odd this is not the default.

Rich

  reply	other threads:[~2005-07-15 16:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-15 14:03 [U-Boot-Users] 7xx/74xx cache question Richard Danter
2005-07-15 14:29 ` [U-Boot-Users] Global vars question (was 7xx/74xx cache question) Richard Danter
2005-07-15 16:03   ` Richard Danter [this message]
2005-07-15 16:52     ` [U-Boot-Users] Global vars question -- Solved Wolfgang Denk
2005-07-15 14:32 ` [U-Boot-Users] 7xx/74xx cache question Jerry Van Baren
2005-07-15 14:50   ` Richard Danter

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=42D7DE58.3060005@ntlworld.com \
    --to=richard.danter@ntlworld.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