[U-Boot-Users] Mips_cache_lock () function
amdyer at gmail.com
Fri May 26 19:59:33 CEST 2006
On 26 May 2006 09:08:15 -0000, ilGimmy <ilgimmy at supereva.it> wrote:
> So, finally the question: how the mips_cache_lock () works?
> It takes the address to lock from a0 (stored in start.S before calling), but instead of passing it to the (overcomplicated) icacheop, it performs some math on that address.
> To me, it seems that it locks the last DCACHE_SIZE bytes of the stack.
> Also, in a0 we store not an address, but the CFG_INIT_SP_OFFSET, so at least the mips_cache_lock comment is wrong.
I believe what it's supposed to do is lock the entire d-cache to
provide some usable
ram for a stack for C code. I don't think it works correctly, but I
also think it doesn't
matter for the boards I know about (Au1x00 stuff). I know nothing
about the mysterious
purple, tb0229, and inca_ip boards.
The code takes an offset from K0BASE for a stack pointer (not a
physical address as
you pointed out) and subtracts the size (grow down stack) of the
d-cache or 1/2 for the purple board and then tries to run a single
lock d-cache op.
The trouble on the Au1550 is that cache lock is a per line operation,
so it should
to iterate across the addresses it wants to lock, starting at a
and using a cache-line sized stride. It doesn't matter because on
Au1550 the dram
is already initialized by the lowlevel_init.S assembly code, so the
one's that aren't
locked are passed to the ram that's already there. I also noticed
that on the Au1x00
stuff it looks like the dcache line never gets unlocked (I did a very
cursory scan - I
could have missed it).
In a general case MIPS requires the ram to be up and running before
the cache because
some variants require the ram behind the cache to be zeroed to do a
proper cache parity init.
For a more general handling of different types of caches for mips you
can look at the
linux or netbsd cache stuff - it get's hairy very quickly because of
all the variations.
The parts of a computer system that can be kicked.
More information about the U-Boot