summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authormarius <marius@FreeBSD.org>2010-10-15 15:00:30 +0000
committermarius <marius@FreeBSD.org>2010-10-15 15:00:30 +0000
commitac757f20ddc830f07633b578212e7bed65957067 (patch)
treedebadee7b9221daaf40bb137a65e66c245f99886 /sys/dev
parent385153aa98ec9bc0cd0bde471d7b89b6f7304427 (diff)
downloadFreeBSD-src-ac757f20ddc830f07633b578212e7bed65957067.zip
FreeBSD-src-ac757f20ddc830f07633b578212e7bed65957067.tar.gz
Converted the remainder of the NIC drivers to use the mii_attach()
introduced in r213878 instead of mii_phy_probe(). Unlike r213893 these are only straight forward conversions though. Reviewed by: yongari
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/bce/if_bce.c13
-rw-r--r--sys/dev/ed/if_ed_pccard.c26
-rw-r--r--sys/dev/et/if_et.c8
-rw-r--r--sys/dev/lge/if_lge.c8
-rw-r--r--sys/dev/nfe/if_nfe.c8
-rw-r--r--sys/dev/nge/if_nge.c6
-rw-r--r--sys/dev/nve/if_nve.c15
-rw-r--r--sys/dev/sf/if_sf.c8
-rw-r--r--sys/dev/sge/if_sge.c8
-rw-r--r--sys/dev/sis/if_sis.c8
-rw-r--r--sys/dev/smc/if_smc.c5
-rw-r--r--sys/dev/tl/if_tl.c6
-rw-r--r--sys/dev/tx/if_tx.c8
-rw-r--r--sys/dev/usb/net/usb_ethernet.c7
-rw-r--r--sys/dev/wb/if_wb.c7
15 files changed, 72 insertions, 69 deletions
diff --git a/sys/dev/bce/if_bce.c b/sys/dev/bce/if_bce.c
index 9d098cc..2d38b8e 100644
--- a/sys/dev/bce/if_bce.c
+++ b/sys/dev/bce/if_bce.c
@@ -1140,12 +1140,13 @@ bce_attach(device_t dev)
/* Handle any special PHY initialization for SerDes PHYs. */
bce_init_media(sc);
- /* MII child bus by probing the PHY. */
- if (mii_phy_probe(dev, &sc->bce_miibus, bce_ifmedia_upd,
- bce_ifmedia_sts)) {
- BCE_PRINTF("%s(%d): No PHY found on child MII bus!\n",
- __FILE__, __LINE__);
- rc = ENXIO;
+ /* MII child bus by attaching the PHY. */
+ rc = mii_attach(dev, &sc->bce_miibus, ifp, bce_ifmedia_upd,
+ bce_ifmedia_sts, BMSR_DEFCAPMASK, sc->bce_phy_addr,
+ MII_OFFSET_ANY, 0);
+ if (rc != 0) {
+ BCE_PRINTF("%s(%d): attaching PHYs failed\n", __FILE__,
+ __LINE__);
goto bce_attach_fail;
}
diff --git a/sys/dev/ed/if_ed_pccard.c b/sys/dev/ed/if_ed_pccard.c
index b9c1cad..ed8704b 100644
--- a/sys/dev/ed/if_ed_pccard.c
+++ b/sys/dev/ed/if_ed_pccard.c
@@ -578,25 +578,21 @@ ed_pccard_attach(device_t dev)
goto bad;
if (sc->chip_type == ED_CHIP_TYPE_DL10019 ||
sc->chip_type == ED_CHIP_TYPE_DL10022) {
- /* Probe for an MII bus, but ignore errors. */
+ /* Try to attach an MII bus, but ignore errors. */
ed_pccard_dl100xx_mii_reset(sc);
- (void)mii_phy_probe(dev, &sc->miibus, ed_ifmedia_upd,
- ed_ifmedia_sts);
+ (void)mii_attach(dev, &sc->miibus, sc->ifp, ed_ifmedia_upd,
+ ed_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY,
+ MII_OFFSET_ANY, 0);
} else if (sc->chip_type == ED_CHIP_TYPE_AX88190 ||
- sc->chip_type == ED_CHIP_TYPE_AX88790) {
- if ((error = mii_phy_probe(dev, &sc->miibus, ed_ifmedia_upd,
- ed_ifmedia_sts)) != 0) {
- device_printf(dev, "Missing mii %d!\n", error);
+ sc->chip_type == ED_CHIP_TYPE_AX88790 ||
+ sc->chip_type == ED_CHIP_TYPE_TC5299J) {
+ error = mii_attach(dev, &sc->miibus, sc->ifp, ed_ifmedia_upd,
+ ed_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY,
+ MII_OFFSET_ANY, 0);
+ if (error != 0) {
+ device_printf(dev, "attaching PHYs failed\n");
goto bad;
}
-
- } else if (sc->chip_type == ED_CHIP_TYPE_TC5299J) {
- if ((error = mii_phy_probe(dev, &sc->miibus, ed_ifmedia_upd,
- ed_ifmedia_sts)) != 0) {
- device_printf(dev, "Missing mii!\n");
- goto bad;
- }
-
}
if (sc->miibus != NULL) {
sc->sc_tick = ed_pccard_tick;
diff --git a/sys/dev/et/if_et.c b/sys/dev/et/if_et.c
index 0d0ed56..326309e 100644
--- a/sys/dev/et/if_et.c
+++ b/sys/dev/et/if_et.c
@@ -63,8 +63,8 @@ __FBSDID("$FreeBSD$");
#include <machine/bus.h>
+#include <dev/mii/mii.h>
#include <dev/mii/miivar.h>
-#include <dev/mii/truephyreg.h>
#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
@@ -343,10 +343,10 @@ et_attach(device_t dev)
et_chip_attach(sc);
- error = mii_phy_probe(dev, &sc->sc_miibus,
- et_ifmedia_upd, et_ifmedia_sts);
+ error = mii_attach(dev, &sc->sc_miibus, ifp, et_ifmedia_upd,
+ et_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0);
if (error) {
- device_printf(dev, "can't probe any PHY\n");
+ device_printf(dev, "attaching PHYs failed\n");
goto fail;
}
diff --git a/sys/dev/lge/if_lge.c b/sys/dev/lge/if_lge.c
index b870bf0..ab488df 100644
--- a/sys/dev/lge/if_lge.c
+++ b/sys/dev/lge/if_lge.c
@@ -557,10 +557,10 @@ lge_attach(dev)
/*
* Do MII setup.
*/
- if (mii_phy_probe(dev, &sc->lge_miibus,
- lge_ifmedia_upd, lge_ifmedia_sts)) {
- device_printf(dev, "MII without any PHY!\n");
- error = ENXIO;
+ error = mii_attach(dev, &sc->lge_miibus, ifp, lge_ifmedia_upd,
+ lge_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0);
+ if (error != 0) {
+ device_printf(dev, "attaching PHYs failed\n");
goto fail;
}
diff --git a/sys/dev/nfe/if_nfe.c b/sys/dev/nfe/if_nfe.c
index 7d77754..bb4f3bc 100644
--- a/sys/dev/nfe/if_nfe.c
+++ b/sys/dev/nfe/if_nfe.c
@@ -600,10 +600,10 @@ nfe_attach(device_t dev)
#endif
/* Do MII setup */
- if (mii_phy_probe(dev, &sc->nfe_miibus, nfe_ifmedia_upd,
- nfe_ifmedia_sts)) {
- device_printf(dev, "MII without any phy!\n");
- error = ENXIO;
+ error = mii_attach(dev, &sc->nfe_miibus, ifp, nfe_ifmedia_upd,
+ nfe_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0);
+ if (error != 0) {
+ device_printf(dev, "attaching PHYs failed\n");
goto fail;
}
ether_ifattach(ifp, sc->eaddr);
diff --git a/sys/dev/nge/if_nge.c b/sys/dev/nge/if_nge.c
index 1b346dd..aef2269 100644
--- a/sys/dev/nge/if_nge.c
+++ b/sys/dev/nge/if_nge.c
@@ -1079,10 +1079,10 @@ nge_attach(device_t dev)
/*
* Do MII setup.
*/
- error = mii_phy_probe(dev, &sc->nge_miibus, nge_mediachange,
- nge_mediastatus);
+ error = mii_attach(dev, &sc->nge_miibus, ifp, nge_mediachange,
+ nge_mediastatus, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0);
if (error != 0) {
- device_printf(dev, "no PHY found!\n");
+ device_printf(dev, "attaching PHYs failed\n");
goto fail;
}
diff --git a/sys/dev/nve/if_nve.c b/sys/dev/nve/if_nve.c
index 6179869..b04ac19 100644
--- a/sys/dev/nve/if_nve.c
+++ b/sys/dev/nve/if_nve.c
@@ -541,11 +541,12 @@ nve_attach(device_t dev)
ifp->if_capabilities |= IFCAP_VLAN_MTU;
ifp->if_capenable |= IFCAP_VLAN_MTU;
- /* Probe device for MII interface to PHY */
- DEBUGOUT(NVE_DEBUG_INIT, "nve: do mii_phy_probe\n");
- if (mii_phy_probe(dev, &sc->miibus, nve_ifmedia_upd, nve_ifmedia_sts)) {
- device_printf(dev, "MII without any phy!\n");
- error = ENXIO;
+ /* Attach device for MII interface to PHY */
+ DEBUGOUT(NVE_DEBUG_INIT, "nve: do mii_attach\n");
+ error = mii_attach(dev, &sc->miibus, ifp, nve_ifmedia_upd,
+ nve_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0);
+ if (error != 0) {
+ device_printf(dev, "attaching PHYs failed\n");
goto fail;
}
@@ -553,10 +554,10 @@ nve_attach(device_t dev)
ether_ifattach(ifp, eaddr);
/* Activate our interrupt handler. - attach last to avoid lock */
- error = bus_setup_intr(sc->dev, sc->irq, INTR_TYPE_NET | INTR_MPSAFE,
+ error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET | INTR_MPSAFE,
NULL, nve_intr, sc, &sc->sc_ih);
if (error) {
- device_printf(sc->dev, "couldn't set up interrupt handler\n");
+ device_printf(dev, "couldn't set up interrupt handler\n");
goto fail;
}
DEBUGOUT(NVE_DEBUG_INIT, "nve: nve_attach - exit\n");
diff --git a/sys/dev/sf/if_sf.c b/sys/dev/sf/if_sf.c
index 043e255..7edb976 100644
--- a/sys/dev/sf/if_sf.c
+++ b/sys/dev/sf/if_sf.c
@@ -866,10 +866,10 @@ sf_attach(device_t dev)
}
/* Do MII setup. */
- if (mii_phy_probe(dev, &sc->sf_miibus, sf_ifmedia_upd,
- sf_ifmedia_sts)) {
- device_printf(dev, "MII without any phy!\n");
- error = ENXIO;
+ error = mii_attach(dev, &sc->sf_miibus, ifp, sf_ifmedia_upd,
+ sf_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0);
+ if (error != 0) {
+ device_printf(dev, "attaching PHYs failed\n");
goto fail;
}
diff --git a/sys/dev/sge/if_sge.c b/sys/dev/sge/if_sge.c
index e727d05..f379590 100644
--- a/sys/dev/sge/if_sge.c
+++ b/sys/dev/sge/if_sge.c
@@ -627,10 +627,10 @@ sge_attach(device_t dev)
/*
* Do MII setup.
*/
- if (mii_phy_probe(dev, &sc->sge_miibus, sge_ifmedia_upd,
- sge_ifmedia_sts)) {
- device_printf(dev, "no PHY found!\n");
- error = ENXIO;
+ error = mii_attach(dev, &sc->sge_miibus, ifp, sge_ifmedia_upd,
+ sge_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0);
+ if (error != 0) {
+ device_printf(dev, "attaching PHYs failed\n");
goto fail;
}
diff --git a/sys/dev/sis/if_sis.c b/sys/dev/sis/if_sis.c
index 33eb920..93246d3 100644
--- a/sys/dev/sis/if_sis.c
+++ b/sys/dev/sis/if_sis.c
@@ -1164,10 +1164,10 @@ sis_attach(device_t dev)
/*
* Do MII setup.
*/
- if (mii_phy_probe(dev, &sc->sis_miibus,
- sis_ifmedia_upd, sis_ifmedia_sts)) {
- device_printf(dev, "MII without any PHY!\n");
- error = ENXIO;
+ error = mii_attach(dev, &sc->sis_miibus, ifp, sis_ifmedia_upd,
+ sis_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0);
+ if (error != 0) {
+ device_printf(dev, "attaching PHYs failed\n");
goto fail;
}
diff --git a/sys/dev/smc/if_smc.c b/sys/dev/smc/if_smc.c
index 6d9ba59..22f8bab 100644
--- a/sys/dev/smc/if_smc.c
+++ b/sys/dev/smc/if_smc.c
@@ -324,8 +324,9 @@ smc_attach(device_t dev)
callout_init_mtx(&sc->smc_mii_tick_ch, &sc->smc_mtx,
CALLOUT_RETURNUNLOCKED);
if (sc->smc_chip >= REV_CHIP_91110FD) {
- mii_phy_probe(dev, &sc->smc_miibus, smc_mii_ifmedia_upd,
- smc_mii_ifmedia_sts);
+ (void)mii_attach(dev, &sc->smc_miibus, ifp,
+ smc_mii_ifmedia_upd, smc_mii_ifmedia_sts, BMSR_DEFCAPMASK,
+ MII_PHY_ANY, MII_OFFSET_ANY, 0);
if (sc->smc_miibus != NULL) {
sc->smc_mii_tick = smc_mii_tick;
sc->smc_mii_mediachg = smc_mii_mediachg;
diff --git a/sys/dev/tl/if_tl.c b/sys/dev/tl/if_tl.c
index d18d21a..56f51df 100644
--- a/sys/dev/tl/if_tl.c
+++ b/sys/dev/tl/if_tl.c
@@ -1276,9 +1276,11 @@ tl_attach(dev)
* Do MII setup. If no PHYs are found, then this is a
* bitrate ThunderLAN chip that only supports 10baseT
* and AUI/BNC.
+ * XXX mii_attach() can fail for reason different than
+ * no PHYs found!
*/
- if (mii_phy_probe(dev, &sc->tl_miibus,
- tl_ifmedia_upd, tl_ifmedia_sts)) {
+ if (mii_attach(dev, &sc->tl_miibus, ifp, tl_ifmedia_upd,
+ tl_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0)) {
struct ifmedia *ifm;
sc->tl_bitrate = 1;
ifmedia_init(&sc->ifmedia, 0, tl_ifmedia_upd, tl_ifmedia_sts);
diff --git a/sys/dev/tx/if_tx.c b/sys/dev/tx/if_tx.c
index 3750e7b..12843ac 100644
--- a/sys/dev/tx/if_tx.c
+++ b/sys/dev/tx/if_tx.c
@@ -379,10 +379,10 @@ epic_attach(device_t dev)
device_printf(dev, "unknown card vendor %04xh\n", sc->cardvend);
/* Do ifmedia setup. */
- if (mii_phy_probe(dev, &sc->miibus,
- epic_ifmedia_upd, epic_ifmedia_sts)) {
- device_printf(dev, "ERROR! MII without any PHY!?\n");
- error = ENXIO;
+ error = mii_attach(dev, &sc->miibus, ifp, epic_ifmedia_upd,
+ epic_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0);
+ if (error != 0) {
+ device_printf(dev, "attaching PHYs failed\n");
goto fail;
}
diff --git a/sys/dev/usb/net/usb_ethernet.c b/sys/dev/usb/net/usb_ethernet.c
index 4a4526f..de702f6 100644
--- a/sys/dev/usb/net/usb_ethernet.c
+++ b/sys/dev/usb/net/usb_ethernet.c
@@ -222,11 +222,12 @@ ue_attach_post_task(struct usb_proc_msg *_task)
if (ue->ue_methods->ue_mii_upd != NULL &&
ue->ue_methods->ue_mii_sts != NULL) {
mtx_lock(&Giant); /* device_xxx() depends on this */
- error = mii_phy_probe(ue->ue_dev, &ue->ue_miibus,
- ue_ifmedia_upd, ue->ue_methods->ue_mii_sts);
+ error = mii_attach(ue->ue_dev, &ue->ue_miibus, ifp,
+ ue_ifmedia_upd, ue->ue_methods->ue_mii_sts,
+ BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0);
mtx_unlock(&Giant);
if (error) {
- device_printf(ue->ue_dev, "MII without any PHY\n");
+ device_printf(ue->ue_dev, "attaching PHYs failed\n");
goto error;
}
}
diff --git a/sys/dev/wb/if_wb.c b/sys/dev/wb/if_wb.c
index cb4f3bb..1169cb7 100644
--- a/sys/dev/wb/if_wb.c
+++ b/sys/dev/wb/if_wb.c
@@ -855,9 +855,10 @@ wb_attach(dev)
/*
* Do MII setup.
*/
- if (mii_phy_probe(dev, &sc->wb_miibus,
- wb_ifmedia_upd, wb_ifmedia_sts)) {
- error = ENXIO;
+ error = mii_attach(dev, &sc->wb_miibus, ifp, wb_ifmedia_upd,
+ wb_ifmedia_sts, BMSR_DEFCAPMASK, MII_PHY_ANY, MII_OFFSET_ANY, 0);
+ if (error != 0) {
+ device_printf(dev, "attaching PHYs failed\n");
goto fail;
}
OpenPOWER on IntegriCloud