Subject: Re: RaQ1 / Stock NetBSD Recovery ISO
To: None <jjhartley@gmail.com>
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
List: port-cobalt
Date: 07/24/2007 18:18:19
I wrote:
> I get base.tgz and kern-GENERIC.tgz from the same directory,
> then now I see that it works on RaQ1 with 64MB RAM but
> not on RaQ2 with 256MB:
:
> I suspect that there is some memory corruption in bootloader
> around bootinfo, but I'll check what actually happens there.
Adding cacheflush code at the beginning of the bootloader
seems to fix this problem.
(though I haven't tracked how the problem is caused)
Could you try this one? (rename it appropriately)
http://www.ceres.dti.ne.jp/~tsutsui/netbsd/boot-cobalt-20070724.gz
Index: start.S
===================================================================
RCS file: /cvsroot/src/sys/arch/cobalt/stand/boot/start.S,v
retrieving revision 1.3
diff -u -r1.3 start.S
--- start.S 11 Dec 2005 12:17:06 -0000 1.3
+++ start.S 24 Jul 2007 09:09:35 -0000
@@ -37,9 +37,11 @@
*/
#include <mips/asm.h>
+#include <mips/cache_r4k.h>
LEAF(start)
.set noreorder
+ .set mips3
#ifdef __GP_SUPPORT__
la gp, _C_LABEL (_gp)
#endif
@@ -49,6 +51,9 @@
move s0, a0 # save argc
move s1, a1 # save argv
+ jal _C_LABEL(flushcache)
+ nop
+
la a0, _C_LABEL (edata) # clear BSS
move a1, zero
la a2, _C_LABEL (end)
@@ -63,3 +68,36 @@
jal _C_LABEL(cpu_reboot) # failed, reboot
nop
END(start)
+
+LEAF(flushcache)
+ li t0, 0x80000000
+ addu t1, t0, 32*1024 /* flush 32KB */
+ subu t1, t1, 0x100 /* per 256 bytes */
+
+1:
+ /* flush I-cache */
+ cache CACHE_R4K_I | CACHEOP_R4K_INDEX_INV, 0x000(t0)
+ cache CACHE_R4K_I | CACHEOP_R4K_INDEX_INV, 0x020(t0)
+ cache CACHE_R4K_I | CACHEOP_R4K_INDEX_INV, 0x040(t0)
+ cache CACHE_R4K_I | CACHEOP_R4K_INDEX_INV, 0x060(t0)
+ cache CACHE_R4K_I | CACHEOP_R4K_INDEX_INV, 0x080(t0)
+ cache CACHE_R4K_I | CACHEOP_R4K_INDEX_INV, 0x0a0(t0)
+ cache CACHE_R4K_I | CACHEOP_R4K_INDEX_INV, 0x0c0(t0)
+ cache CACHE_R4K_I | CACHEOP_R4K_INDEX_INV, 0x0e0(t0)
+
+ /* flush D-cache */
+ cache CACHE_R4K_D | CACHEOP_R4K_INDEX_WB_INV, 0x000(t0)
+ cache CACHE_R4K_D | CACHEOP_R4K_INDEX_WB_INV, 0x020(t0)
+ cache CACHE_R4K_D | CACHEOP_R4K_INDEX_WB_INV, 0x040(t0)
+ cache CACHE_R4K_D | CACHEOP_R4K_INDEX_WB_INV, 0x060(t0)
+ cache CACHE_R4K_D | CACHEOP_R4K_INDEX_WB_INV, 0x080(t0)
+ cache CACHE_R4K_D | CACHEOP_R4K_INDEX_WB_INV, 0x0a0(t0)
+ cache CACHE_R4K_D | CACHEOP_R4K_INDEX_WB_INV, 0x0c0(t0)
+ cache CACHE_R4K_D | CACHEOP_R4K_INDEX_WB_INV, 0x0e0(t0)
+
+ bne t0, t1, 1b
+ addu t0, t0, 0x100
+
+ j ra
+ nop
+END(flushcache)
Index: version
===================================================================
RCS file: /cvsroot/src/sys/arch/cobalt/stand/boot/version,v
retrieving revision 1.1
diff -u -r1.1 version
--- version 25 Jun 2003 17:25:05 -0000 1.1
+++ version 24 Jul 2007 09:09:35 -0000
@@ -5,3 +5,4 @@
is taken as the current.
0.1: Initial revision, only booting from the harddrive is supported
+0.2: Flush all cache data in start.S
---
Izumi Tsutsui