Subject: Re: 2.0 doesn't boot on 4/300
To: NetBSD port-sparc mailing list <port-sparc@netbsd.org>
From: Julian Coleman <jdc@coris.org.uk>
List: port-sparc
Date: 01/22/2005 21:55:45
> I tried to put 2.0 on a 4/330.  A couple of problems.  The bootloader doesn't
> load the kernel:
> 
>   >> NetBSD/sparc Secondary Boot, Revision 1.14
>   >> (root@sparky.coris.org.uk, Tue Nov 30 12:12:07 GMT 2004)
>   Booting netbsd
>   -
>   Bus Error at Virtual address 0xF0000000 (Physical address 0x00100000)
>   with PC 0x0038BDF8.  A SIZE error was detected.  Type 0.

Thanks to mrg for the hint.  Having tracked it down to failing at:

  #define	setsegmap(va, pmeg)	stba(va, ASI_SEGMAP, pmeg)

  	setsegmap((va & -NBPSG), ++scookie);

in common/mmu.c: pmap_map4(), he pointed out that previous code used stha()
on sun4 and stba() on sun4c.  The attached patch works for me.

Thanks,

J

  - - 8< - - - - - - - - - - - - - Cut here - - - - - - - - - - - - - >8 - -
--- src/sys/arch/sparc/stand/common/mmu.c.dist	Fri Oct 24 10:48:08 2003
+++ src/sys/arch/sparc/stand/common/mmu.c	Sat Jan 22 21:40:51 2005
@@ -97,7 +97,8 @@
  * Limited functionality wrt. MMU resource management.
  */
 #define	setregmap(va, smeg)	stha((va)+2, ASI_REGMAP, (smeg << 8))
-#define	setsegmap(va, pmeg)	stba(va, ASI_SEGMAP, pmeg)
+#define	setsegmap4(va, pmeg)	stha(va, ASI_SEGMAP, pmeg)
+#define	setsegmap4c(va, pmeg)	stba(va, ASI_SEGMAP, pmeg)
 
 int pmap_map4(vaddr_t va, paddr_t pa, psize_t size)
 {
@@ -109,7 +110,10 @@
 
 	if (boothowto & AB_VERBOSE)
 		printf("Mapping %lx -> %lx (%d pages)\n", va, pa, n);
-	setsegmap((va & -NBPSG), ++scookie);
+	if (CPU_ISSUN4)
+		setsegmap4((va & -NBPSG), ++scookie);
+	else /* CPU_ISSUN4C */
+		setsegmap4c((va & -NBPSG), ++scookie);
 	while (n--) {
 		pte = PG_S | PG_V | PG_W | PG_NC | ((pa >> PGSHIFT) & PG_PFNUM);
 		setpte4(va, pte);
@@ -118,7 +122,10 @@
 		if ((va & (NBPSG - 1)) == 0) {
 			if (boothowto & AB_VERBOSE)
 				printf("%d ", scookie);
-			setsegmap(va, ++scookie);
+			if (CPU_ISSUN4)
+				setsegmap4(va, ++scookie);
+			else /* CPU_ISSUN4C */
+				setsegmap4c(va, ++scookie);
 		}
 	}
 	if (boothowto & AB_VERBOSE)
  - - 8< - - - - - - - - - - - - - Cut here - - - - - - - - - - - - - >8 - -

-- 
  My other computer also runs NetBSD    /        Sailing at Newbiggin
        http://www.netbsd.org/        /   http://www.newbigginsailingclub.org/