Subject: Re: JavaStation w/ OBP3 - some progress
To: None <port-sparc@netbsd.org>
From: Valeriy E. Ushakov <uwe@ptc.spbu.ru>
List: port-sparc
Date: 04/05/2001 04:54:46
--gKMricLos+KVdGMg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Wed, Apr 04, 2001 at 17:49:03 +0200, Paul Kranenburg wrote:

> I've fixed the problems you mentioned above. Hopefully the other
> issues will be resolved soon too.

This also requires a coordinated change to srt0.S

Attached are my current changes.

sys/lib/libsa/rarp.c
    Fix format mismatch in debug build

sys/arch/sparc/stand/common/promdev.c
    Missing OF bits - your rev 1.10

sys/arch/sparc/stand/common/srt0.S
    Get rid of unused opf_romp. Store to romp either %o0 (romvec) or
    %o3 (OFW entry) - that's what promlib.c and openfirm.c expect.

sys/arch/sparc/sparc/locore.s
    Be smarter when telling OBP from OFW.  NOT TESTED YET - my SS1 is
    not a speed daemon :-), kernel is still being compiled.


This test in prom_init: obpvec->pv_magic == OBP_MAGIC on OF machine
(where obpvec is actually a OFW entry point) seems benign in secondary
boot and is probably benign as well in kernel.

So far it loads the kernel ok and then kernel (GENERIC) freezes:

JavaStation
OpenBoot 3.11.2, 64 MB memory installed, Serial #8893604.
Ethernet address 8:0:20:87:b4:a4, Host ID: 8087b4a4.

Rebooting with command: boot                                          
Boot device: net  File and args: 
14000 
Server  IP address: 192.168.77.1
Client  IP address: 192.168.77.2
>> NetBSD/sparc Secondary Boot, Revision 1.9
>> (toor@felix.sparc.spb.su, Thu Apr  5 03:47:53 MSD 2001)
Booting netbsd
Using BOOTPARAMS protocol: ip address: 192.168.77.2, hostname: brick
root addr=192.168.77.1 path=/export/netbsd/brick
2381409+115748+235184 [68+153296+111862]=0x2ebf0c


I'm compiling modified kernel now.

SY, Uwe
-- 
uwe@ptc.spbu.ru                         |       Zu Grunde kommen
http://www.ptc.spbu.ru/~uwe/            |       Ist zu Grunde gehen

--gKMricLos+KVdGMg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="promlib.diff"

Index: promdev.c
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/sparc/stand/common/promdev.c,v
retrieving revision 1.8
diff -u -r1.8 promdev.c
--- promdev.c	1999/04/28 13:20:55	1.8
+++ promdev.c	2001/04/05 00:27:33
@@ -479,6 +479,7 @@
 		(void)(*obpvec->pv_enaddr)(fd, (char *)ea);
 		break;
 	case PROM_OBP_V3:
+	case PROM_OPENFIRM:
 		sprintf(buf, "%lx mac-address drop swap 6 cmove", (u_long)ea);
 		prom_interpret(buf);
 		break;
@@ -524,7 +525,8 @@
 
 	case PROM_OBP_V2:
 	case PROM_OBP_V3:
-		node = (*obpvec->pv_v2devops.v2_fd_phandle)(fd);
+	case PROM_OPENFIRM:
+		node = prom_instance_to_package(fd);
 		cp = mygetpropstring(node, "device_type");
 		if (strcmp(cp, "block") == 0)
 			return (DT_BLOCK);

--gKMricLos+KVdGMg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="srt0.diff"

Index: srt0.S
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/sparc/stand/common/srt0.S,v
retrieving revision 1.4
diff -u -r1.4 srt0.S
--- srt0.S	1999/03/05 11:12:16	1.4
+++ srt0.S	2001/04/05 00:27:33
@@ -47,7 +47,6 @@
 	.file	"str0.s"
 
 	.comm	_C_LABEL(romp), 4
-	.comm	_C_LABEL(opf_romp), 4
 	.comm	_C_LABEL(cputyp), 4
 	.comm	_C_LABEL(nbpg), 4
 	.comm	_C_LABEL(pgofset), 4
@@ -138,14 +137,24 @@
 	mov	SUN4CM_PGSHIFT, %g5
 
 	/*
+	 * OpenProm machines pass PROM vector in %o0 (%i0 after save)
+	 * OpenFirm machines pass OF entry in %o3 (%i3 after save)
+	 */
+	cmp	%i0, 0
+	be	is_openfirm
+	 nop
+
+	/*
 	 * Save address of PROM vector (passed in %i0).
 	 */
 	sethi	%hi(_C_LABEL(romp)), %o1
 	st	%i0, [%o1 + %lo(_C_LABEL(romp))]
+	b,a	is_sun4cm
 
-	/* Also save %i3, which is the Openfirmware entry, if any */
-	sethi	%hi(_C_LABEL(opf_romp)), %o1
-	st	%i3, [%o1 + %lo(_C_LABEL(opf_romp))]
+is_openfirm:
+	/* Save %i3, which is the OpenFirmware entry */
+	sethi	%hi(_C_LABEL(romp)), %o1
+	st	%i3, [%o1 + %lo(_C_LABEL(romp))]
 	b,a	is_sun4cm
 
 is_sun4:

--gKMricLos+KVdGMg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="locore.diff"

Index: locore.s
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/sparc/sparc/locore.s,v
retrieving revision 1.132.2.1
diff -u -r1.132.2.1 locore.s
--- locore.s	2000/07/26 22:46:37	1.132.2.1
+++ locore.s	2001/04/05 00:28:11
@@ -3435,12 +3435,17 @@
 	 nop
 
 #if defined(SUN4C) || defined(SUN4M)
+	cmp	%o0, 0			! this obsoletes jump to is_openfirm
+	be	is_openfirm		!  below, should halt instead
+	 nop
+
 	mov	%o0, %g7		! save prom vector pointer
 
 	/* First, check `romp->pv_magic' */
 	ld	[%g7 + PV_MAGIC], %o0	! v = pv->pv_magic
 	set	OBP_MAGIC, %o1
 	cmp	%o0, %o1		! if ( v != OBP_MAGIC) {
+					! XXX: should halt instead
 	bne	is_openfirm		!    assume this is an OPENFIRM machine
 	 nop				! }
 

--gKMricLos+KVdGMg
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="rarp.diff"

Index: rarp.c
===================================================================
RCS file: /cvsroot/syssrc/sys/lib/libsa/rarp.c,v
retrieving revision 1.20
diff -u -r1.20 rarp.c
--- rarp.c	2000/03/30 12:19:48	1.20
+++ rarp.c	2001/04/05 00:30:04
@@ -197,7 +197,7 @@
 	if (n == -1 || n < sizeof(struct ether_arp)) {
 #ifdef RARP_DEBUG
 		if (debug)
-			printf("bad len=%d\n", n);
+			printf("bad len=%ld\n", n);
 #endif
 		return (-1);
 	}

--gKMricLos+KVdGMg--