* [U-Boot-Users] MIPS cache management (and build) questions.
@ 2007-09-13 7:26 Paul Marciano
2007-09-13 7:38 ` Stefan Roese
2007-09-13 9:54 ` Shinya Kuribayashi
0 siblings, 2 replies; 3+ messages in thread
From: Paul Marciano @ 2007-09-13 7:26 UTC (permalink / raw)
To: u-boot
Hi,
I'm working on bringing U-Boot 1.2.0 up on a MIPS 24Kc
core (MIPS32R2). It has gone relatively smoothly -
with a couple of hiccups that I want to point out here
in case I'm missing something.
1. I needed to gdb through the code, so I turned off
-Os, and the build failed with strcmp and friends
missing. It seems that the MIPS port in-lines them
with -Os but omits them completely without it. Adding
'C' versions of the functions fixed that.
2. I'm using do_bootelf() to invoke my image. The
lines:
addr = load_elf_image(addr);
...
if (dcache_status())
dcache_disable();
...
(function call through addr)
The comment embedded in the code says the dcache is
flushed already, but in cpu/mips/cpu.c, the function
flush_cache() is empty so the dcache isn't flushed.
As it's not flushed, and dcache_disable() just turns
it off, if the run address is somewhere that hasn't
naturally spilled out of the dcache during the load,
the CPU will fetch garbage.
Also, as the 'addr' variable is now on the stack (in a
non-optimized compile), that variable pops out of
existence and jumping through it shoots the processor
off into the weeds.
Perhaps I'm just very green and am missing something
here. Does MIPS get no love, or am I missing
something fundamental?
Can someone please clue me in?
Thanks,
Paul.
____________________________________________________________________________________
Be a better Heartthrob. Get better relationship answers from someone who knows. Yahoo! Answers - Check it out.
http://answers.yahoo.com/dir/?link=list&sid=396545433
^ permalink raw reply [flat|nested] 3+ messages in thread* [U-Boot-Users] MIPS cache management (and build) questions.
2007-09-13 7:26 [U-Boot-Users] MIPS cache management (and build) questions Paul Marciano
@ 2007-09-13 7:38 ` Stefan Roese
2007-09-13 9:54 ` Shinya Kuribayashi
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Roese @ 2007-09-13 7:38 UTC (permalink / raw)
To: u-boot
Hi Paul,
On Thursday 13 September 2007, Paul Marciano wrote:
> 2. I'm using do_bootelf() to invoke my image. The
> lines:
> addr = load_elf_image(addr);
> ...
> if (dcache_status())
> dcache_disable();
> ...
> (function call through addr)
>
> The comment embedded in the code says the dcache is
> flushed already, but in cpu/mips/cpu.c, the function
> flush_cache() is empty so the dcache isn't flushed.
>
> As it's not flushed, and dcache_disable() just turns
> it off, if the run address is somewhere that hasn't
> naturally spilled out of the dcache during the load,
> the CPU will fetch garbage.
On PPC platforms, dcache_disable() first flushed the dcache and then disables
it. If this flushing is missing in your MIPS implementation you should
probably add this.
Best regards,
Stefan
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot-Users] MIPS cache management (and build) questions.
2007-09-13 7:26 [U-Boot-Users] MIPS cache management (and build) questions Paul Marciano
2007-09-13 7:38 ` Stefan Roese
@ 2007-09-13 9:54 ` Shinya Kuribayashi
1 sibling, 0 replies; 3+ messages in thread
From: Shinya Kuribayashi @ 2007-09-13 9:54 UTC (permalink / raw)
To: u-boot
Hi Paul,
Paul Marciano wrote:
> I'm working on bringing U-Boot 1.2.0 up on a MIPS 24Kc
> core (MIPS32R2). It has gone relatively smoothly -
> with a couple of hiccups that I want to point out here
> in case I'm missing something.
Nice. I'd like to see that.
> 1. I needed to gdb through the code, so I turned off
> -Os, and the build failed with strcmp and friends
> missing. It seems that the MIPS port in-lines them
> with -Os but omits them completely without it. Adding
> 'C' versions of the functions fixed that.
I've also fixed and the patch checked in. Please try 1.3.0-rc1.
> 2. I'm using do_bootelf() to invoke my image. The
> lines:
> addr = load_elf_image(addr);
> ...
> if (dcache_status())
> dcache_disable();
> ...
> (function call through addr)
>
> The comment embedded in the code says the dcache is
> flushed already, but in cpu/mips/cpu.c, the function
> flush_cache() is empty so the dcache isn't flushed.
>
> As it's not flushed, and dcache_disable() just turns
> it off, if the run address is somewhere that hasn't
> naturally spilled out of the dcache during the load,
> the CPU will fetch garbage.
>
> Also, as the 'addr' variable is now on the stack (in a
> non-optimized compile), that variable pops out of
> existence and jumping through it shoots the processor
> off into the weeds.
Hope this helps. Sorry for no description. I have to be add later...
Thanks,
Shinya Kuribayashi
---
common/cmd_elf.c | 2 ++
include/asm-mips/addrspace.h | 2 +-
2 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/common/cmd_elf.c b/common/cmd_elf.c
index 63a5593..f1057d4 100644
--- a/common/cmd_elf.c
+++ b/common/cmd_elf.c
@@ -55,12 +55,14 @@ int do_bootelf (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
printf ("## Starting application at 0x%08lx ...\n", addr);
+#if 0
/*
* QNX images require the data cache is disabled.
* Data cache is already flushed, so just turn it off.
*/
if (dcache_status ())
dcache_disable ();
+#endif
/*
* pass address parameter as argv[0] (aka command name),
diff --git a/include/asm-mips/addrspace.h b/include/asm-mips/addrspace.h
index 90e8840..bfdc06f 100644
--- a/include/asm-mips/addrspace.h
+++ b/include/asm-mips/addrspace.h
@@ -49,7 +49,7 @@
cannot access physical memory directly from core */
#define UNCACHED_SDRAM(a) (((unsigned long)(a)) | 0x20000000)
#else /* !CONFIG_AU1X00 */
-#define UNCACHED_SDRAM(a) PHYSADDR(a)
+#define UNCACHED_SDRAM(a) KSEG1ADDR(a)
#endif /* CONFIG_AU1X00 */
#endif /* __ASSEMBLY__ */
/*
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-09-13 9:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-13 7:26 [U-Boot-Users] MIPS cache management (and build) questions Paul Marciano
2007-09-13 7:38 ` Stefan Roese
2007-09-13 9:54 ` Shinya Kuribayashi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox