Subject: Re: spontaneous reboot only once after power-up
To: None <port-dreamcast@netbsd.org, port-sh3@netbsd.org>
From: ITOH Yasufumi <itohy@netbsd.org>
List: port-sh3
Date: 11/03/2002 19:25:37
In article <200211030521.gA35LGt07808@mirage.ceres.dti.ne.jp>
tsutsui@ceres.dti.ne.jp writes:

> In article <200211030456.gA34u7h16089@pl374.nas911.nara.nttpc.ne.jp>
> itohy@netbsd.org wrote:
> 
> > > (1) it does not clear VPN
> > 
> > I don't think it is a problem.
> > The V (valid) and D (dirty) bits are cleared by either way,
> > and the VPN shall not make sense if an entry is not valid
> 
> Yeah, but I just think it is safe and is the difference
> between AA and DA1.
> 
> > Possibly, an errata or something?
> 
> AFAIK, there is no errata on the Hitachi's web site.

Hm, anyway, uninitialized "data array 1" seems problematic....
I'm going to commit this change to work around it.
-- 
ITOH Yasufumi

--- sys/arch/sh3/sh3/mmu_sh4.c.orig	Sat Jun 29 11:22:59 2002
+++ sys/arch/sh3/sh3/mmu_sh4.c	Sun Nov  3 18:49:27 2002
@@ -129,8 +129,14 @@ sh4_tlb_invalidate_all()
 	for (e = 0; e < eend; e++) {
 		a = SH4_UTLB_AA | (e << SH4_UTLB_E_SHIFT);
 		_reg_write_4(a, 0);
+		a = SH4_UTLB_DA1 | (e << SH4_UTLB_E_SHIFT);
+		_reg_write_4(a, 0);
 	}
 	__sh4_itlb_invalidate_all();
+	_reg_write_4(SH4_ITLB_DA1, 0);
+	_reg_write_4(SH4_ITLB_DA1 | (1 << SH4_ITLB_E_SHIFT), 0);
+	_reg_write_4(SH4_ITLB_DA1 | (2 << SH4_ITLB_E_SHIFT), 0);
+	_reg_write_4(SH4_ITLB_DA1 | (3 << SH4_ITLB_E_SHIFT), 0);
 	RUN_P1;
 }