summaryrefslogtreecommitdiffstats
path: root/sys/dev/nfe
diff options
context:
space:
mode:
authoryongari <yongari@FreeBSD.org>2014-04-09 05:15:40 +0000
committeryongari <yongari@FreeBSD.org>2014-04-09 05:15:40 +0000
commit1fcaae4680e2e24bc3c25c2c1b4f3a5b45e2113b (patch)
tree1b4b7d29199f4d54660f1724fe73e99eaed293f9 /sys/dev/nfe
parent000dc57d15970de9f942fc38901af1191ae52ab2 (diff)
downloadFreeBSD-src-1fcaae4680e2e24bc3c25c2c1b4f3a5b45e2113b.zip
FreeBSD-src-1fcaae4680e2e24bc3c25c2c1b4f3a5b45e2113b.tar.gz
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. Tested by: Chris H
Diffstat (limited to 'sys/dev/nfe')
-rw-r--r--sys/dev/nfe/if_nfe.c38
1 files changed, 36 insertions, 2 deletions
diff --git a/sys/dev/nfe/if_nfe.c b/sys/dev/nfe/if_nfe.c
index e91f50a..d9814e3 100644
--- a/sys/dev/nfe/if_nfe.c
+++ b/sys/dev/nfe/if_nfe.c
@@ -79,6 +79,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);
@@ -334,13 +335,38 @@ nfe_alloc_msix(struct nfe_softc *sc, int count)
}
}
+
+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");
OpenPOWER on IntegriCloud