Module Name:    src
Committed By:   riz
Date:           Sun Apr 19 06:50:22 UTC 2015

Modified Files:
        src/sys/dev/pci [netbsd-7]: if_wm.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #698):
        sys/dev/pci/if_wm.c: revision 1.316
  Fix a bug that newer revision of I218-{LM,V} use wrong PHY access functions.
The problem only occured on devices that the PCI device ID was 0x15a[0123].


To generate a diff of this commit:
cvs rdiff -u -r1.289.2.5 -r1.289.2.6 src/sys/dev/pci/if_wm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.289.2.5 src/sys/dev/pci/if_wm.c:1.289.2.6
--- src/sys/dev/pci/if_wm.c:1.289.2.5	Thu Apr 16 06:10:43 2015
+++ src/sys/dev/pci/if_wm.c	Sun Apr 19 06:50:22 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.289.2.5 2015/04/16 06:10:43 snj Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.289.2.6 2015/04/19 06:50:22 riz Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -81,7 +81,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.289.2.5 2015/04/16 06:10:43 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.289.2.6 2015/04/19 06:50:22 riz Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -6397,8 +6397,9 @@ wm_gmii_mediainit(struct wm_softc *sc, p
 	 *  For some devices, we can determine the PHY access method
 	 * from sc_type.
 	 *
-	 *  For ICH8 variants, it's difficult to determine the PHY access
-	 * method by sc_type, so use the PCI product ID for some devices.
+	 *  For ICH and PCH variants, it's difficult to determine the PHY
+	 * access  method by sc_type, so use the PCI product ID for some
+	 * devices.
 	 * For other ICH8 variants, try to use igp's method. If the PHY
 	 * can't detect, then use bm's method.
 	 */
@@ -6407,30 +6408,16 @@ wm_gmii_mediainit(struct wm_softc *sc, p
 	case PCI_PRODUCT_INTEL_PCH_M_LC:
 		/* 82577 */
 		sc->sc_phytype = WMPHY_82577;
-		mii->mii_readreg = wm_gmii_hv_readreg;
-		mii->mii_writereg = wm_gmii_hv_writereg;
 		break;
 	case PCI_PRODUCT_INTEL_PCH_D_DM:
 	case PCI_PRODUCT_INTEL_PCH_D_DC:
 		/* 82578 */
 		sc->sc_phytype = WMPHY_82578;
-		mii->mii_readreg = wm_gmii_hv_readreg;
-		mii->mii_writereg = wm_gmii_hv_writereg;
 		break;
 	case PCI_PRODUCT_INTEL_PCH2_LV_LM:
 	case PCI_PRODUCT_INTEL_PCH2_LV_V:
 		/* 82579 */
 		sc->sc_phytype = WMPHY_82579;
-		mii->mii_readreg = wm_gmii_hv_readreg;
-		mii->mii_writereg = wm_gmii_hv_writereg;
-		break;
-	case PCI_PRODUCT_INTEL_I217_LM:
-	case PCI_PRODUCT_INTEL_I217_V:
-	case PCI_PRODUCT_INTEL_I218_LM:
-	case PCI_PRODUCT_INTEL_I218_V:
-		/* I21[78] */
-		mii->mii_readreg = wm_gmii_hv_readreg;
-		mii->mii_writereg = wm_gmii_hv_writereg;
 		break;
 	case PCI_PRODUCT_INTEL_82801I_BM:
 	case PCI_PRODUCT_INTEL_82801J_R_BM_LM:
@@ -6467,6 +6454,11 @@ wm_gmii_mediainit(struct wm_softc *sc, p
 		}
 		break;
 	}
+	if ((sc->sc_type >= WM_T_PCH) && (sc->sc_type <= WM_T_PCH_LPT)) {
+		/* All PCH* use _hv_ */
+		mii->mii_readreg = wm_gmii_hv_readreg;
+		mii->mii_writereg = wm_gmii_hv_writereg;
+	}
 	mii->mii_statchg = wm_gmii_statchg;
 
 	wm_gmii_reset(sc);

Reply via email to