Subject: Re: Problems w/ NetBSD-current & SUN 4/300
To: Ralf Sauther <rhs@inka.de>
From: Charles M. Hannum <mycroft@gnu.ai.mit.edu>
List: port-sparc
Date: 04/23/1997 05:31:43
Ralf Sauther <rhs@inka.de> writes:

> 
> On Mon, 14 Apr 1997, Paul Kranenburg wrote:
> 
> > > i tested the latest release of NetBSD on a SUN 4/300 and at boot-stage,
> > > the kernel reports after the boot-code:
> > > 
> > > panic: Unknown CPU type: cpu: impl 1, vers 1; mmu: impl -1, vers -1
> > 
> > The CY7C601 processor was missing in the SUN4 section of the cpu table.
> > Diff (cpu.c):
> > 953d952
> > <       { CPU_SUN4, 1, 1, ANY, ANY, "CY7C601", &module_sun4 },
> Thanks, that fixed the boot-Problem, but now it crashes just before the
> assigning of the root-fs
> 
> [...]
> vmel0 at mainbus0
> vmes0 at mainbus0
> data fault: pc=f80e2f3c addr=fe000004 ser=8080<WRITE,INVAL>

That VA is the Sun 4m locations for the microsecond counter.  This is
almost certainly due to a bug in the recent changes to locore, which I
checked in a fix for a couple of days ago, that caused a SUN4 or SUN4C
kernel without SUN4M to attempt to read the counter from the wrong
location.  (On Sun 4c models, the effect was to cause microtime() to
fail to interpolate between ticks -- which I didn't notice until I
started xntpd on one machine and it failed to sync.)

Hopefully this change fixes the last of your problems!

Index: locore.s
===================================================================
RCS file: /cvsroot/src/sys/arch/sparc/sparc/locore.s,v
retrieving revision 1.67
retrieving revision 1.69
diff -c -2 -r1.67 -r1.69
*** locore.s	1997/04/02 20:56:28	1.67
--- locore.s	1997/04/21 18:20:14	1.69
***************
*** 3678,3682 ****
  
  1:
! 	MUNGE(NOP_ON_4_1)
  
  2:
--- 3677,3681 ----
  
  1:
! 	MUNGE(NOP_ON_4_4C_1)
  
  2:
***************
*** 5713,5722 ****
  #endif
  	sethi	%hi(_time), %g2
  	sethi	%hi(TIMERREG_VA), %g3
  	or	%g3, %lo(TIMERREG_VA), %g3
! 
! 	/* sun4m has microsecond counter at a different location */
! NOP_ON_4_1:
  	 add	%g3, 4, %g3
  
  2:
--- 5712,5728 ----
  #endif
  	sethi	%hi(_time), %g2
+ 
+ #if defined(SUN4M) && !(defined(SUN4C) || defined(SUN4))
+ 	sethi	%hi(TIMERREG_VA+4), %g3
+ 	or	%g3, %lo(TIMERREG_VA+4), %g3
+ #elif (defined(SUN4C) || defined(SUN4)) && !defined(SUN4M)
  	sethi	%hi(TIMERREG_VA), %g3
  	or	%g3, %lo(TIMERREG_VA), %g3
! #else
! 	sethi	%hi(TIMERREG_VA), %g3
! 	or	%g3, %lo(TIMERREG_VA), %g3
! NOP_ON_4_4C_1:
  	 add	%g3, 4, %g3
+ #endif
  
  2: