Subject: Re: Limited success booting an A3020
To: Gavan Fantom <gavan@coolfactor.org>
From: Ben Harris <bjh21@netbsd.org>
List: port-arm26
Date: 12/03/2001 15:43:14
On Mon, 3 Dec 2001, Gavan Fantom wrote:

> On Mon, 3 Dec 2001, Ben Harris wrote:
>
> > On Mon, 3 Dec 2001, Gavan Fantom wrote:
> >
> > > * The EtherH driver chokes on startup thanks to a bug in the podloader
> > > stuff (see PR#14811)
> >
> > Thanks.  I've got a proper fix in my tree which I'll check in once it's
> > tested.
>
> What constitutes a "proper fix"? Is that changing which register
> int_restore etc uses to save the state, or maybe even changing them to
> macros (since IIRC they're only one/two instructions) with a register as a
> parameter?

In this case, actually moving from calling int_off() and int_restore()
from assembler to calling splhigh() and splx() from C.  It's not as if
this code has to be fast.  Here, have a patch:

Index: podloader_asm.S
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/arm26/podulebus/podloader_asm.S,v
retrieving revision 1.2
diff -u -r1.2 podloader_asm.S
--- podloader_asm.S	2001/08/20 23:28:05	1.2
+++ podloader_asm.S	2001/12/03 15:41:04
@@ -35,7 +35,7 @@
 #include <sys/errno.h>

 /*
- * register_t podloader_call(register_t r0, register_t r1, register_t r11,
+ * register_t _podloader_call(register_t r0, register_t r1, register_t r11,
  *     void *loader, int entry)
  *
  * Podule loader register assignments:
@@ -48,20 +48,16 @@
  * R12    Preserved
  * R13    Stack pointer, preserved
  */
-ENTRY(podloader_call)
+ENTRY(_podloader_call)
 	mov	ip, sp
 	stmfd	sp!, {r4, r5, fp, ip, lr, pc}
 	sub	fp, ip, #4
 	ldr	r4, [fp, #4]		/* fetch entry */
-	bl	_C_LABEL(int_off_save)
-	mov	r5, r0
 	stmfd	sp!, {fp}		/* Save FP, since that's R11 */
 	mov	r11, r2
 	mov	lr, pc
 	add	pc, r3, r4, lsl #2	/* Call loader */
 	ldmfd	sp!, {fp}
-	mov	r0, r5
-	bl	_C_LABEL(int_restore)
 	adrvs	r0, Lpodloader_panicmsg
 	blvs	_C_LABEL(panic)
 #ifdef __APCS_26__
Index: podulebus.c
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/arm26/podulebus/podulebus.c,v
retrieving revision 1.15
diff -u -r1.15 podulebus.c
--- podulebus.c	2001/08/20 23:09:12	1.15
+++ podulebus.c	2001/12/03 15:41:04
@@ -65,7 +65,7 @@
 #if NPODLOADER > 0
 void podloader_read_region(struct podulebus_attach_args *pa, u_int src,
     u_int8_t *dest, size_t length);
-extern register_t podloader_call(register_t, register_t, register_t,
+extern register_t _podloader_call(register_t, register_t, register_t,
     void *, int);
 #endif

@@ -267,6 +267,19 @@
 		FREE(pa->pa_descr, M_DEVBUF);
 	pa->pa_descr = podulebus_get_chunk(pa, CHUNK_DEV_DESCR);
 	return 0;
+}
+
+static register_t
+podloader_call(register_t r0, register_t r1, register_t r11, void *loader,
+    int entry)
+{
+	int s;
+	register_t result;
+
+	s = splhigh();
+	result = _podloader_call(r0, r1, r11, loader, entry);
+	splx(s);
+	return result;
 }

 int

> > > * NFS mounting anything complains with "Program version wrong" (ie a
> > > mismatch in the version of the NFS protocol between client and server),
> > > which seems odd given that the root filesystem is already nfs mounted, and
> > > I can do an nfs v2 loopback mount on the nfs server.
> >
> > This can also mean a mismatch between mount_nfs and the kernel -- i.e.
> > mount_nfs has asked for an NFSv3 mount, and the kernel doesn't support
> > that.  Try specifying -o -2.
>
> I did try specifying -2 in fstab, but that didn't appear to change
> anything.

Hmm.  That's odd, then.  My fstab has this, which works:

172.17.11.22:/opt/netbsd/src    /usr/src        nfs     rw,-2

-- 
Ben Harris                                                   <bjh21@netbsd.org>
Portmaster, NetBSD/arm26               <URL:http://www.netbsd.org/Ports/arm26/>