svn commit: r264748 - stable/9/sys/dev/nfe

Pyun YongHyeon yongari at FreeBSD.org
Tue Apr 22 04:36:54 UTC 2014


Author: yongari
Date: Tue Apr 22 04:36:53 2014
New Revision: 264748
URL: http://svnweb.freebsd.org/changeset/base/264748

Log:
  MFC r264293:
    Add workaround for MCP61 Ethernet controller found on MSI K9
    motherboard.  PHY hardware used for the controller responded at
    all possible addresses which in turn resulted in having 32 PHYs
    for the controller.  If driver detects "MSI K9N6PGM2-V2 (MS-7309)"
    motherboard, tell miibus(4) PHY is located at 0.

Modified:
  stable/9/sys/dev/nfe/if_nfe.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/nfe/if_nfe.c
==============================================================================
--- stable/9/sys/dev/nfe/if_nfe.c	Tue Apr 22 04:35:07 2014	(r264747)
+++ stable/9/sys/dev/nfe/if_nfe.c	Tue Apr 22 04:36:53 2014	(r264748)
@@ -78,6 +78,7 @@ static int  nfe_suspend(device_t);
 static int  nfe_resume(device_t);
 static int nfe_shutdown(device_t);
 static int  nfe_can_use_msix(struct nfe_softc *);
+static int  nfe_detect_msik9(struct nfe_softc *);
 static void nfe_power(struct nfe_softc *);
 static int  nfe_miibus_readreg(device_t, int, int);
 static int  nfe_miibus_writereg(device_t, int, int, int);
@@ -333,13 +334,38 @@ nfe_alloc_msix(struct nfe_softc *sc, int
 	}
 }
 
+
+static int
+nfe_detect_msik9(struct nfe_softc *sc)
+{
+	static const char *maker = "MSI";
+	static const char *product = "K9N6PGM2-V2 (MS-7309)";
+	char *m, *p;
+	int found;
+
+	found = 0;
+	m = getenv("smbios.planar.maker");
+	p = getenv("smbios.planar.product");
+	if (m != NULL && p != NULL) {
+		if (strcmp(m, maker) == 0 && strcmp(p, product) == 0)
+			found = 1;
+	}
+	if (m != NULL)
+		freeenv(m);
+	if (p != NULL)
+		freeenv(p);
+
+	return (found);
+}
+
+
 static int
 nfe_attach(device_t dev)
 {
 	struct nfe_softc *sc;
 	struct ifnet *ifp;
 	bus_addr_t dma_addr_max;
-	int error = 0, i, msic, reg, rid;
+	int error = 0, i, msic, phyloc, reg, rid;
 
 	sc = device_get_softc(dev);
 	sc->nfe_dev = dev;
@@ -608,8 +634,16 @@ nfe_attach(device_t dev)
 #endif
 
 	/* Do MII setup */
+	phyloc = MII_PHY_ANY;
+	if (sc->nfe_devid == PCI_PRODUCT_NVIDIA_MCP61_LAN1 ||
+	    sc->nfe_devid == PCI_PRODUCT_NVIDIA_MCP61_LAN2 ||
+	    sc->nfe_devid == PCI_PRODUCT_NVIDIA_MCP61_LAN3 ||
+	    sc->nfe_devid == PCI_PRODUCT_NVIDIA_MCP61_LAN4) {
+		if (nfe_detect_msik9(sc) != 0)
+			phyloc = 0;
+	}
 	error = mii_attach(dev, &sc->nfe_miibus, ifp, nfe_ifmedia_upd,
-	    nfe_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY,
+	    nfe_ifmedia_sts, BMSR_DEFCAPMASK, phyloc, MII_OFFSET_ANY,
 	    MIIF_DOPAUSE);
 	if (error != 0) {
 		device_printf(dev, "attaching PHYs failed\n");


More information about the svn-src-stable-9 mailing list