Subject: port-i386/26895: i386 PS/2 MCA: toggle shared ram causes spurious resets of NIC on WD8013
To: None <>
From: at <,>
List: netbsd-bugs
Date: 09/09/2004 18:43:22
>Number:         26895
>Category:       port-i386
>Synopsis:       i386 PS/2 MCA: toggle shared ram causes spurious resets of NIC on WD8013
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-i386-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Sep 09 18:44:00 UTC 2004
>Originator:     Dave Barnes
>Release:        2.0_BETA
Consult Engr
PS/2 mod 50z with Reply PowerBoard upgrade
WE_MEM_ENABLE(wsc) and WE_MEM_DISABLE(wsc) are unnecessary with Microchannel versions of the WD8013 Ethernet Adapters.  Use of hese two macros with microchannel adapters can cause spurious resets to occur on the 83c690 NIC chip.

Copy a large >1MB file from a fast server to the PS/2.  Observe errors:

"rcp anchovy:/netbsd ."

causes poor performance plus these errors:

Sep  8 14:14:43 PS2 /netbsd: we0: length does not match next packet pointer
Sep  8 14:14:43 PS2 /netbsd: we0: len b088 nlen 1d88 start 0c first 39 curr 00 next 23 stop 40
Sep  8 14:14:43 PS2 /netbsd: we0: NIC memory corrupt - invalid packet length 7560
Sep  8 14:14:46 PS2 /netbsd: we0: device timeout


Notice that "curr" the current pointer in the 83c690 has been reset to 0.  Normally the current pointer goes from 0x0c to 0x40.  Further debugging showed that even the on chip ethernet address storage registers that had been written with the the card's MAC address were also cleared to all 0.
The following diff was applied and completely resolved the problem.  This diff, though, breaks non-microchannel cards.  A microchannel flag needs to be passed to we.c somehow.

OOPS:  The diff left something out.  Function we_recv_int() in we.c needs to be fixed so it compiles with the WE_MEM_DISABLE/WE_MEM_ENABLE stuff removed.

--- dev/ic/we.c.orig	2004-09-09 13:18:45.000000000 -0500
+++ dev/ic/we.c	2004-09-09 13:18:03.000000000 -0500
@@ -111,10 +111,15 @@
 #define	WE_DELAY(wsc) delay(3)
+#define DJB
+/* XXXX Disable the Shared Ram stuff for my Microchannel cards */
  * Enable card RAM, and 16-bit access.
-#define	WE_MEM_ENABLE(wsc) \
+#ifdef DJB
+  #define WE_MEM_ENABLE(wsc)
+  #define	WE_MEM_ENABLE(wsc) \
 do { \
 	if ((wsc)->sc_16bitp) \
 		bus_space_write_1((wsc)->sc_asict, (wsc)->sc_asich, \
@@ -123,11 +128,15 @@
 	    WE_MSR, wsc->sc_msr_proto | WE_MSR_MENB); \
 	WE_DELAY((wsc)); \
 } while (0)
  * Disable card RAM, and 16-bit access.
-#define	WE_MEM_DISABLE(wsc) \
+#ifdef DJB
+  #define WE_MEM_DISABLE(wsc)
+  #define	WE_MEM_DISABLE(wsc) \
 do { \
 	bus_space_write_1((wsc)->sc_asict, (wsc)->sc_asich, \
 	    WE_MSR, (wsc)->sc_msr_proto); \
@@ -136,6 +145,7 @@
 		    WE_LAAR, (wsc)->sc_laar_proto); \
 	WE_DELAY((wsc)); \
 } while (0)
 we_config(self, wsc, typestr)