Subject: kern/34812: VIA Rhine III (VT6105) fails to get valid station address
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: Christopher SEKIYA <sekiya@netbsd.org>
List: netbsd-bugs
Date: 10/14/2006 09:25:04
>Number:         34812
>Category:       kern
>Synopsis:       VIA Rhine III (VT6105) fails to get valid station address
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Oct 14 09:25:04 +0000 2006
>Originator:     Christopher SEKIYA
>Release:        NetBSD 4.0_BETA
>Organization:
        
>Environment:
        
        
System: NetBSD firewall 4.0_BETA NetBSD 4.0_BETA (FW2) #1: Sat Oct 14 16:17:02 JST 2006 wileyc@inasa.siberia.rezrov.net:/usr/local/src/40-src/src/sys/arch/i386/compile/FW2 i386
Architecture: i386
Machine: i386
>Description:

sys/dev/pci/if_vr.c special-cases the VT6105 and VT6102 when it tries to read
the station address from EEPROM by *not* reloading the EEPROM.  The comment
surrounding the code indicates that it's intentional because it's redundant.

Unfortunately, on my EPIA-PD's VT6105, the chip does not read its EEPROM at
powerup.  This results in the MAC address being set to 00:00:00:00:00:00, which
is definitely incorrect behavior.

The FreeBSD driver doesn't special-case either chip, and it works.  Removing
the special-case logic results in a proper station address being read/set.

(I'm send-pr'ing this rather than just committing the fix because the cvs log
indicates that this special-casing addressed an issue found by scw@)
        
>How-To-Repeat:
        
>Fix:

Index: if_vr.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/if_vr.c,v
retrieving revision 1.76
diff -u -r1.76 if_vr.c
--- if_vr.c	17 Jun 2006 23:34:27 -0000	1.76
+++ if_vr.c	14 Oct 2006 07:52:26 -0000
@@ -1581,12 +1581,22 @@
 	 *         (and the lack of anyone else noticing the problems this
 	 *         causes) I'm going to retain the old behaviour for the
 	 *         other parts.
+	 *
+	 * XXXsekiya: not all VT6105s load the EEPROM at powerup, resulting in
+	 *         a completely null station address.  The FreeBSD driver
+	 *         doesn't treat these chip variants differently; disable.
 	 */
+#if 0
 	if (PCI_PRODUCT(pa->pa_id) != PCI_PRODUCT_VIATECH_VT6105 &&
 	    PCI_PRODUCT(pa->pa_id) != PCI_PRODUCT_VIATECH_VT6102) {
 		VR_SETBIT(sc, VR_EECSR, VR_EECSR_LOAD);
 		DELAY(200);
 	}
+#else
+	VR_SETBIT(sc, VR_EECSR, VR_EECSR_LOAD);
+	DELAY(200);
+#endif
+
 	for (i = 0; i < ETHER_ADDR_LEN; i++)
 		eaddr[i] = CSR_READ_1(sc, VR_PAR0 + i);
 

>Unformatted: