Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 2 Mar 2002 08:39:45 -0800 (PST)
From:      Ted Stockwell <tstockwell@visi.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   kern/35482: dc driver uses wrong case to read MAC from eeprom.  fix included
Message-ID:  <200203021639.g22Gdjr25609@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         35482
>Category:       kern
>Synopsis:       dc driver uses wrong case to read MAC from eeprom.  fix included
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Mar 02 08:40:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Ted Stockwell
>Release:        RELENG_4 tag, late feb 2002
>Organization:
self
>Environment:
FreeBSD test.mesabi-tech.com 4.5-STABLE FreeBSD 4.5-STABLE #11: Thu Feb 28 16:03:27 CST 2002     ted@dev.mesabi-tech.com:/usr/users/ted/mip/sys/compile/MIP_144  i386
>Description:
The Siemens SpeedStream SS1020 is recognized by the dc driver as an
Accton EN2242.  The vendor and device ids match that of the EN2242,
but the part is actually an EN5251B and it does not work quite
correctly.  Most notably, the MAC address is wrong.

The Accton EN2242 is handled by the driver as being of type
DC_TYPE_AN985.  This seems to be mostly correct, however, the code
assumes that AN985 implies that the EEPROM is a 93c66.  The part on
the SS1020 board is a 93LC46.  My diffs create a new type that follows
the AN985, except for the EEPROM type.

I do not have access to the Accton EN2242, and so I cannot confirm
that my fix did not break support for that board.  Because their device
and vendor IDs match, I had to _assume_ that the revision numbers
differed. 

The Siemens board uses a chip labeled Accton EN5251B.  The Siemens
board appears to be identical to this Accton board:

  http://www.acctontech.com/pdf/EN1207FTX_WOL.pdf

The Siemes board is here:
  http://www.efficient.com/pdf/products/1012_1020.pdf


One resource I found on the net suggested that the EN5251 was really a
clone of the ADMtek 983.  I do not know how the 983 differs from the
the 985 or 981 which are explicitly supported in by the dc driver.

One point about this code that merits review is the use of the
DC_IS_CENTAUR() macro.  Should the DC_IS_CENTAUR be used in
dc_eeprom_putbyte(), in which case the EN5251B is not a CENTAUR.  Or,
should the test in dc_eeprom_putbyte() test explicitly for the 985, in
which case the new DC_TYPE_EN5152B type should be added to
DC_IS_CENTAUR.

>How-To-Repeat:
run ifconfig with a Siemens SpeedStream SS1020, 
and look at the value of the MAC address
>Fix:
Index: if_dcreg.h
===================================================================
RCS file: /home/ncvs/src/sys/pci/if_dcreg.h,v
retrieving revision 1.4.2.16
diff -u -r1.4.2.16 if_dcreg.h
--- if_dcreg.h	2002/02/26 04:21:30	1.4.2.16
+++ if_dcreg.h	2002/03/01 04:21:40
@@ -76,6 +76,7 @@
 #define DC_TYPE_PNICII		0x9	/* 82c115 PNIC II */
 #define DC_TYPE_PNIC		0xA	/* 82c168/82c169 PNIC I */
 #define DC_TYPE_CONEXANT        0xC     /* Conexant LANfinity RS7112 */
+#define DC_TYPE_EN5152B		0xD	/* Accton EN5251B. Clone of ADMtek 983B? */
 
 #define DC_IS_MACRONIX(x)			\
 	(x->dc_type == DC_TYPE_98713 ||		\
@@ -84,6 +85,7 @@
 
 #define DC_IS_ADMTEK(x)				\
 	(x->dc_type == DC_TYPE_AL981 ||		\
+	 x->dc_type == DC_TYPE_EN5152B ||	\
 	 x->dc_type == DC_TYPE_AN985)
 
 #define DC_IS_INTEL(x)		(x->dc_type == DC_TYPE_21143)
@@ -855,6 +857,13 @@
  */
 #define DC_DEVICEID_EN1217	0x1217
 #define DC_DEVICEID_EN2242	0x1216
+#define DC_DEVICEID_EN5251B	0x1216
+
+/*
+ * The Accton EN5251B is sold as the Siemens Speedstream SS1020.
+ * The EN5251B seems to be a clone of the ADMtek 983 or 983B
+ */
+#define DC_REVISION_EN5251B	0x11  /* ASSUMING that EN2242's revision differs */
 
 /*
  * Conexant vendor ID.
Index: if_dc.c
===================================================================
RCS file: /home/ncvs/src/sys/pci/if_dc.c,v
retrieving revision 1.9.2.33
diff -u -r1.9.2.33 if_dc.c
--- if_dc.c	2002/02/26 04:21:30	1.9.2.33
+++ if_dc.c	2002/03/01 04:21:42
@@ -183,6 +183,8 @@
 		"Accton EN1217 10/100BaseTX" },
 	{ DC_VENDORID_ACCTON, DC_DEVICEID_EN2242,
 		"Accton EN2242 MiniPCI 10/100BaseTX" },
+	{ DC_VENDORID_ACCTON, DC_DEVICEID_EN5251B,
+		"Siemens SpeedStream SS1020 10/100BaseTX" },
 	{ DC_VENDORID_CONEXANT, DC_DEVICEID_RS7112,
 		"Conexant LANfinity MiniPCI 10/100BaseTX" },
 	{ 0, 0, NULL }
@@ -1438,6 +1440,9 @@
 			if (t->dc_did == DC_DEVICEID_DM9102 &&
 			    rev >= DC_REVISION_DM9102A)
 				t++;
+			if (t->dc_did == DC_DEVICEID_EN2242 &&
+			    rev >= DC_REVISION_EN5251B)
+				t++;
 			return(t);
 		}
 		t++;
@@ -1773,8 +1778,17 @@
 		sc->dc_flags |= DC_TX_ADMTEK_WAR;
 		sc->dc_pmode = DC_PMODE_MII;
 		break;
+	case DC_DEVICEID_EN2242:     /* and  DC_DEVICEID_EN5251B:  */
+		if (revision < DC_REVISION_EN5251B) {
+			sc->dc_type = DC_TYPE_AN985;
+		}  else {
+			sc->dc_type = DC_TYPE_EN5152B;
+		}
+		sc->dc_flags |= DC_TX_USE_TX_INTR;
+		sc->dc_flags |= DC_TX_ADMTEK_WAR;
+		sc->dc_pmode = DC_PMODE_MII;
+		break;
 	case DC_DEVICEID_AN985:
-	case DC_DEVICEID_EN2242:
 		sc->dc_type = DC_TYPE_AN985;
 		sc->dc_flags |= DC_TX_USE_TX_INTR;
 		sc->dc_flags |= DC_TX_ADMTEK_WAR;
@@ -1901,6 +1915,7 @@
 		break;
 	case DC_TYPE_AL981:
 	case DC_TYPE_AN985:
+	case DC_TYPE_EN5152B:
 		dc_read_eeprom(sc, (caddr_t)&eaddr, DC_AL_EE_NODEADDR, 3, 0);
 		break;
 	case DC_TYPE_CONEXANT:


>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200203021639.g22Gdjr25609>