summaryrefslogtreecommitdiffstats
path: root/sys/dev/ae
diff options
context:
space:
mode:
authormarius <marius@FreeBSD.org>2010-10-15 14:52:11 +0000
committermarius <marius@FreeBSD.org>2010-10-15 14:52:11 +0000
commit385153aa98ec9bc0cd0bde471d7b89b6f7304427 (patch)
tree6dd0ca5b178547c1f20c8ce1f607ac42d4afe2ae /sys/dev/ae
parent27659e5aa689e80a32d089f84ed2637bb3ce140d (diff)
downloadFreeBSD-src-385153aa98ec9bc0cd0bde471d7b89b6f7304427.zip
FreeBSD-src-385153aa98ec9bc0cd0bde471d7b89b6f7304427.tar.gz
Convert the PHY drivers to honor the mii_flags passed down and convert
the NIC drivers as well as the PHY drivers to take advantage of the mii_attach() introduced in r213878 to get rid of certain hacks. For the most part these were: - Artificially limiting miibus_{read,write}reg methods to certain PHY addresses; we now let mii_attach() only probe the PHY at the desired address(es) instead. - PHY drivers setting MIIF_* flags based on the NIC driver they hang off from, partly even based on grabbing and using the softc of the parent; we now pass these flags down from the NIC to the PHY drivers via mii_attach(). This got us rid of all such hacks except those of brgphy() in combination with bce(4) and bge(4), which is way beyond what can be expressed with simple flags. While at it, I took the opportunity to change the NIC drivers to pass up the error returned by mii_attach() (previously by mii_phy_probe()) and unify the error message used in this case where and as appropriate as mii_attach() actually can fail for a number of reasons, not just because of no PHY(s) being present at the expected address(es). Reviewed by: jhb, yongari
Diffstat (limited to 'sys/dev/ae')
-rw-r--r--sys/dev/ae/if_ae.c16
-rw-r--r--sys/dev/ae/if_aevar.h1
2 files changed, 4 insertions, 13 deletions
diff --git a/sys/dev/ae/if_ae.c b/sys/dev/ae/if_ae.c
index c47a03e..1a82516 100644
--- a/sys/dev/ae/if_ae.c
+++ b/sys/dev/ae/if_ae.c
@@ -360,9 +360,6 @@ ae_attach(device_t dev)
if (error != 0)
goto fail;
- /* Set default PHY address. */
- sc->phyaddr = AE_PHYADDR_DEFAULT;
-
ifp = sc->ifp = if_alloc(IFT_ETHER);
if (ifp == NULL) {
device_printf(dev, "could not allocate ifnet structure.\n");
@@ -390,10 +387,11 @@ ae_attach(device_t dev)
/*
* Configure and attach MII bus.
*/
- error = mii_phy_probe(dev, &sc->miibus, ae_mediachange,
- ae_mediastatus);
+ error = mii_attach(dev, &sc->miibus, ifp, ae_mediachange,
+ ae_mediastatus, BMSR_DEFCAPMASK, AE_PHYADDR_DEFAULT,
+ MII_OFFSET_ANY, 0);
if (error != 0) {
- device_printf(dev, "no PHY found.\n");
+ device_printf(dev, "attaching PHYs failed\n");
goto fail;
}
@@ -813,9 +811,6 @@ ae_miibus_readreg(device_t dev, int phy, int reg)
* Locking is done in upper layers.
*/
- if (phy != sc->phyaddr)
- return (0);
-
val = ((reg << AE_MDIO_REGADDR_SHIFT) & AE_MDIO_REGADDR_MASK) |
AE_MDIO_START | AE_MDIO_READ | AE_MDIO_SUP_PREAMBLE |
((AE_MDIO_CLK_25_4 << AE_MDIO_CLK_SHIFT) & AE_MDIO_CLK_MASK);
@@ -851,9 +846,6 @@ ae_miibus_writereg(device_t dev, int phy, int reg, int val)
* Locking is done in upper layers.
*/
- if (phy != sc->phyaddr)
- return (0);
-
aereg = ((reg << AE_MDIO_REGADDR_SHIFT) & AE_MDIO_REGADDR_MASK) |
AE_MDIO_START | AE_MDIO_SUP_PREAMBLE |
((AE_MDIO_CLK_25_4 << AE_MDIO_CLK_SHIFT) & AE_MDIO_CLK_MASK) |
diff --git a/sys/dev/ae/if_aevar.h b/sys/dev/ae/if_aevar.h
index eaef62e..8623401 100644
--- a/sys/dev/ae/if_aevar.h
+++ b/sys/dev/ae/if_aevar.h
@@ -111,7 +111,6 @@ typedef struct ae_softc {
struct mtx mtx;
- int phyaddr;
uint8_t eaddr[ETHER_ADDR_LEN];
uint8_t flags;
int if_flags;
OpenPOWER on IntegriCloud