i386/142974: [patch][net][if_re] Teach the if_re driver to properly recognize hardware revisions with non-zero MAC rev. bits

Shteryana Shopova syrinx at FreeBSD.org
Tue Jan 19 18:00:20 UTC 2010


>Number:         142974
>Category:       i386
>Synopsis:       [patch][net][if_re] Teach the if_re driver to properly recognize hardware revisions with non-zero MAC rev. bits
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-i386
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jan 19 18:00:19 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Shteryana Shopova
>Release:        FreeBSD 9.0-CURRENT r202292
>Organization:
>Environment:
>Description:
Attached patch fixed a problem with the if_re driver properly recognizing my Realtek 8102E chip (and possibly others), which have any of the three MAC TX config register bits set to a non-zero value. Before patch driver reported

Chip rev. 0x34800000
MAC rev. 0x00400000
Unknown H/W revision: 0x:34c00000

After patch is applied, driver attaches fine, interface works correctly.
>How-To-Repeat:

>Fix:
Make sure the MAC rev. bits are zeroed when comparing the hardware revision read from the chip and each entry in the list of known chip hardware revisions.

Patch attached with submission follows:

Index: pci/if_rlreg.h
===================================================================
--- pci/if_rlreg.h	(revision 202292)
+++ pci/if_rlreg.h	(working copy)
@@ -146,6 +146,7 @@
 #define RL_TXCFG_IFG2		0x00080000	/* 8169 only */
 #define RL_TXCFG_IFG		0x03000000	/* interframe gap */
 #define RL_TXCFG_HWREV		0x7CC00000
+#define	RL_TXCFG_MACMODE	0x00700000
 
 #define RL_LOOPTEST_OFF		0x00000000
 #define RL_LOOPTEST_ON		0x00020000
Index: dev/re/if_re.c
===================================================================
--- dev/re/if_re.c	(revision 202292)
+++ dev/re/if_re.c	(working copy)
@@ -1236,9 +1236,9 @@
 		hwrev &= RL_TXCFG_HWREV;
 		break;
 	}
-	device_printf(dev, "MAC rev. 0x%08x\n", hwrev & 0x00700000);
+	device_printf(dev, "MAC rev. 0x%08x\n", hwrev & RL_TXCFG_MACMODE);
 	while (hw_rev->rl_desc != NULL) {
-		if (hw_rev->rl_rev == hwrev) {
+		if (hw_rev->rl_rev == (hwrev & ~RL_TXCFG_MACMODE)) {
 			sc->rl_type = hw_rev->rl_type;
 			sc->rl_hwrev = hw_rev->rl_rev;
 			break;
@@ -1279,7 +1279,7 @@
 		sc->rl_flags |= RL_FLAG_MACSLEEP;
 		/* FALLTHROUGH */
 	case RL_HWREV_8168C:
-		if ((hwrev & 0x00700000) == 0x00200000)
+		if ((hwrev & RL_TXCFG_MACMODE) == 0x00200000)
 			sc->rl_flags |= RL_FLAG_MACSLEEP;
 		/* FALLTHROUGH */
 	case RL_HWREV_8168CP:


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


More information about the freebsd-i386 mailing list