summaryrefslogtreecommitdiffstats
path: root/sys/dev/mii
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/mii
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/mii')
-rw-r--r--sys/dev/mii/acphy.c1
-rw-r--r--sys/dev/mii/amphy.c1
-rw-r--r--sys/dev/mii/atphy.c1
-rw-r--r--sys/dev/mii/axphy.c1
-rw-r--r--sys/dev/mii/bmtphy.c1
-rw-r--r--sys/dev/mii/brgphy.c1
-rw-r--r--sys/dev/mii/ciphy.c5
-rw-r--r--sys/dev/mii/e1000phy.c18
-rw-r--r--sys/dev/mii/exphy.c1
-rw-r--r--sys/dev/mii/gentbi.c1
-rw-r--r--sys/dev/mii/icsphy.c1
-rw-r--r--sys/dev/mii/inphy.c1
-rw-r--r--sys/dev/mii/ip1000phy.c22
-rw-r--r--sys/dev/mii/jmphy.c1
-rw-r--r--sys/dev/mii/lxtphy.c11
-rw-r--r--sys/dev/mii/mlphy.c1
-rw-r--r--sys/dev/mii/nsgphy.c1
-rw-r--r--sys/dev/mii/nsphy.c27
-rw-r--r--sys/dev/mii/nsphyter.c19
-rw-r--r--sys/dev/mii/pnaphy.c1
-rw-r--r--sys/dev/mii/qsphy.c1
-rw-r--r--sys/dev/mii/rgephy.c1
-rw-r--r--sys/dev/mii/rlphy.c1
-rw-r--r--sys/dev/mii/rlswitch.c1
-rw-r--r--sys/dev/mii/ruephy.c1
-rw-r--r--sys/dev/mii/smcphy.c1
-rw-r--r--sys/dev/mii/tdkphy.c1
-rw-r--r--sys/dev/mii/tlphy.c5
-rw-r--r--sys/dev/mii/truephy.c1
-rw-r--r--sys/dev/mii/ukphy.c1
-rw-r--r--sys/dev/mii/xmphy.c1
31 files changed, 57 insertions, 74 deletions
diff --git a/sys/dev/mii/acphy.c b/sys/dev/mii/acphy.c
index 661bc91..7013dbf 100644
--- a/sys/dev/mii/acphy.c
+++ b/sys/dev/mii/acphy.c
@@ -132,6 +132,7 @@ acphy_attach(device_t dev)
mii = ma->mii_data;
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
+ sc->mii_flags = miibus_get_flags(dev);
sc->mii_inst = mii->mii_instance++;
sc->mii_phy = ma->mii_phyno;
sc->mii_service = acphy_service;
diff --git a/sys/dev/mii/amphy.c b/sys/dev/mii/amphy.c
index a67c66c..010fe90 100644
--- a/sys/dev/mii/amphy.c
+++ b/sys/dev/mii/amphy.c
@@ -109,6 +109,7 @@ amphy_attach(device_t dev)
mii = ma->mii_data;
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
+ sc->mii_flags = miibus_get_flags(dev);
sc->mii_inst = mii->mii_instance++;
sc->mii_phy = ma->mii_phyno;
sc->mii_service = amphy_service;
diff --git a/sys/dev/mii/atphy.c b/sys/dev/mii/atphy.c
index fd531ad..41cd72c 100644
--- a/sys/dev/mii/atphy.c
+++ b/sys/dev/mii/atphy.c
@@ -113,6 +113,7 @@ atphy_attach(device_t dev)
mii = ma->mii_data;
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
+ sc->mii_flags = miibus_get_flags(dev);
sc->mii_inst = mii->mii_instance++;
sc->mii_phy = ma->mii_phyno;
sc->mii_service = atphy_service;
diff --git a/sys/dev/mii/axphy.c b/sys/dev/mii/axphy.c
index cdfa387..3349d3f 100644
--- a/sys/dev/mii/axphy.c
+++ b/sys/dev/mii/axphy.c
@@ -97,6 +97,7 @@ axphy_attach(device_t dev)
mii = ma->mii_data;
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
+ sc->mii_flags = miibus_get_flags(dev);
sc->mii_inst = mii->mii_instance++;
sc->mii_phy = ma->mii_phyno;
sc->mii_service = axphy_service;
diff --git a/sys/dev/mii/bmtphy.c b/sys/dev/mii/bmtphy.c
index af1fe11..63d1df1 100644
--- a/sys/dev/mii/bmtphy.c
+++ b/sys/dev/mii/bmtphy.c
@@ -147,6 +147,7 @@ bmtphy_attach(device_t dev)
mii = ma->mii_data;
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
+ sc->mii_flags = miibus_get_flags(dev);
sc->mii_inst = mii->mii_instance++;
sc->mii_phy = ma->mii_phyno;
sc->mii_service = bmtphy_service;
diff --git a/sys/dev/mii/brgphy.c b/sys/dev/mii/brgphy.c
index b995110..cf88d20 100644
--- a/sys/dev/mii/brgphy.c
+++ b/sys/dev/mii/brgphy.c
@@ -191,6 +191,7 @@ brgphy_attach(device_t dev)
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
/* Initialize mii_softc structure */
+ sc->mii_flags = miibus_get_flags(dev);
sc->mii_inst = mii->mii_instance++;
sc->mii_phy = ma->mii_phyno;
sc->mii_service = brgphy_service;
diff --git a/sys/dev/mii/ciphy.c b/sys/dev/mii/ciphy.c
index 31913ba..cb94f85 100644
--- a/sys/dev/mii/ciphy.c
+++ b/sys/dev/mii/ciphy.c
@@ -57,9 +57,7 @@ __FBSDID("$FreeBSD$");
#include "miibus_if.h"
#include <machine/bus.h>
-/*
-#include <dev/vge/if_vgereg.h>
-*/
+
static int ciphy_probe(device_t);
static int ciphy_attach(device_t);
@@ -118,6 +116,7 @@ ciphy_attach(device_t dev)
mii = ma->mii_data;
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
+ sc->mii_flags = miibus_get_flags(dev);
sc->mii_inst = mii->mii_instance++;
sc->mii_phy = ma->mii_phyno;
sc->mii_service = ciphy_service;
diff --git a/sys/dev/mii/e1000phy.c b/sys/dev/mii/e1000phy.c
index 8df7859..e763c21 100644
--- a/sys/dev/mii/e1000phy.c
+++ b/sys/dev/mii/e1000phy.c
@@ -59,9 +59,6 @@ __FBSDID("$FreeBSD$");
#include "miidevs.h"
#include <dev/mii/e1000phyreg.h>
-/* XXX */
-#include <machine/bus.h>
-#include <dev/msk/if_mskreg.h>
#include "miibus_if.h"
@@ -71,7 +68,6 @@ static int e1000phy_attach(device_t);
struct e1000phy_softc {
struct mii_softc mii_sc;
int mii_model;
- struct msk_mii_data *mmd;
};
static device_method_t e1000phy_methods[] = {
@@ -144,6 +140,7 @@ e1000phy_attach(device_t dev)
mii = ma->mii_data;
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
+ sc->mii_flags = miibus_get_flags(dev);
sc->mii_inst = mii->mii_instance++;
sc->mii_phy = ma->mii_phyno;
sc->mii_service = e1000phy_service;
@@ -151,14 +148,9 @@ e1000phy_attach(device_t dev)
esc->mii_model = MII_MODEL(ma->mii_id2);
ifp = sc->mii_pdata->mii_ifp;
- if (strcmp(ifp->if_dname, "msk") == 0) {
- /* XXX */
- esc->mmd = device_get_ivars(
- device_get_parent(device_get_parent(dev)));
- if (esc->mmd != NULL &&
- (esc->mmd->mii_flags & MIIF_HAVEFIBER) != 0)
- sc->mii_flags |= MIIF_HAVEFIBER;
- }
+ if (strcmp(ifp->if_dname, "msk") == 0 &&
+ (sc->mii_flags & MIIF_MACPRIV0) != 0)
+ sc->mii_flags |= MIIF_PHYPRIV0;
switch (esc->mii_model) {
case MII_MODEL_MARVELL_E1011:
@@ -214,7 +206,7 @@ e1000phy_reset(struct mii_softc *sc)
reg &= ~E1000_SCR_MODE_MASK;
reg |= E1000_SCR_MODE_1000BX;
PHY_WRITE(sc, E1000_SCR, reg);
- if (esc->mmd != NULL && esc->mmd->pmd == 'P') {
+ if ((sc->mii_flags & MIIF_MACPRIV0) != 0) {
/* Set SIGDET polarity low for SFP module. */
PHY_WRITE(sc, E1000_EADR, 1);
reg = PHY_READ(sc, E1000_SCR);
diff --git a/sys/dev/mii/exphy.c b/sys/dev/mii/exphy.c
index 02ed6442..a5b03dc 100644
--- a/sys/dev/mii/exphy.c
+++ b/sys/dev/mii/exphy.c
@@ -138,6 +138,7 @@ exphy_attach(device_t dev)
mii = ma->mii_data;
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
+ sc->mii_flags = miibus_get_flags(dev);
sc->mii_inst = mii->mii_instance++;
sc->mii_phy = ma->mii_phyno;
sc->mii_service = exphy_service;
diff --git a/sys/dev/mii/gentbi.c b/sys/dev/mii/gentbi.c
index 49cfc67..ee08efe 100644
--- a/sys/dev/mii/gentbi.c
+++ b/sys/dev/mii/gentbi.c
@@ -166,6 +166,7 @@ gentbi_attach(device_t dev)
MII_OUI(ma->mii_id1, ma->mii_id2),
MII_MODEL(ma->mii_id2), MII_REV(ma->mii_id2));
+ sc->mii_flags = miibus_get_flags(dev);
sc->mii_inst = mii->mii_instance++;
sc->mii_phy = ma->mii_phyno;
sc->mii_service = gentbi_service;
diff --git a/sys/dev/mii/icsphy.c b/sys/dev/mii/icsphy.c
index cac9af5..849a14b 100644
--- a/sys/dev/mii/icsphy.c
+++ b/sys/dev/mii/icsphy.c
@@ -141,6 +141,7 @@ icsphy_attach(device_t dev)
mii = ma->mii_data;
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
+ sc->mii_flags = miibus_get_flags(dev);
sc->mii_inst = mii->mii_instance++;
sc->mii_phy = ma->mii_phyno;
sc->mii_service = icsphy_service;
diff --git a/sys/dev/mii/inphy.c b/sys/dev/mii/inphy.c
index f6418f7..6830b5a 100644
--- a/sys/dev/mii/inphy.c
+++ b/sys/dev/mii/inphy.c
@@ -107,6 +107,7 @@ inphy_attach(device_t dev)
mii = ma->mii_data;
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
+ sc->mii_flags = miibus_get_flags(dev);
sc->mii_inst = mii->mii_instance++;
sc->mii_phy = ma->mii_phyno;
sc->mii_service = inphy_service;
diff --git a/sys/dev/mii/ip1000phy.c b/sys/dev/mii/ip1000phy.c
index 232e280..b60fab6 100644
--- a/sys/dev/mii/ip1000phy.c
+++ b/sys/dev/mii/ip1000phy.c
@@ -114,6 +114,7 @@ ip1000phy_attach(device_t dev)
mii = ma->mii_data;
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
+ sc->mii_flags = miibus_get_flags(dev);
sc->mii_inst = mii->mii_instance++;
sc->mii_phy = ma->mii_phyno;
sc->mii_service = ip1000phy_service;
@@ -123,6 +124,10 @@ ip1000phy_attach(device_t dev)
isc->model = MII_MODEL(ma->mii_id2);
isc->revision = MII_REV(ma->mii_id2);
+ if (isc->model == MII_MODEL_ICPLUS_IP1000A &&
+ strcmp(mii->mii_ifp->if_dname, "stge") == 0 &&
+ (sc->mii_flags & MIIF_MACPRIV0) != 0)
+ sc->mii_flags |= MIIF_PHYPRIV0;
sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask;
if (sc->mii_capabilities & BMSR_EXTSTAT)
@@ -412,12 +417,8 @@ ip1000phy_load_dspcode(struct mii_softc *sc)
static void
ip1000phy_reset(struct mii_softc *sc)
{
- struct ip1000phy_softc *isc;
- struct stge_softc *stge_sc;
- struct mii_data *mii;
uint32_t reg;
- isc = (struct ip1000phy_softc *)sc;
mii_phy_reset(sc);
/* clear autoneg/full-duplex as we don't want it after reset */
@@ -425,15 +426,6 @@ ip1000phy_reset(struct mii_softc *sc)
reg &= ~(IP1000PHY_BMCR_AUTOEN | IP1000PHY_BMCR_FDX);
PHY_WRITE(sc, MII_BMCR, reg);
- mii = sc->mii_pdata;
- /*
- * XXX There should be more general way to pass PHY specific
- * data via mii interface.
- */
- if (isc->model == MII_MODEL_ICPLUS_IP1000A &&
- strcmp(mii->mii_ifp->if_dname, "stge") == 0) {
- stge_sc = mii->mii_ifp->if_softc;
- if (stge_sc->sc_rev >= 0x40 && stge_sc->sc_rev <= 0x4e)
- ip1000phy_load_dspcode(sc);
- }
+ if ((sc->mii_flags & MIIF_PHYPRIV0) != 0)
+ ip1000phy_load_dspcode(sc);
}
diff --git a/sys/dev/mii/jmphy.c b/sys/dev/mii/jmphy.c
index ae066c5..0b04d80 100644
--- a/sys/dev/mii/jmphy.c
+++ b/sys/dev/mii/jmphy.c
@@ -112,6 +112,7 @@ jmphy_attach(device_t dev)
mii = ma->mii_data;
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
+ sc->mii_flags = miibus_get_flags(dev);
sc->mii_inst = mii->mii_instance++;
sc->mii_phy = ma->mii_phyno;
sc->mii_service = jmphy_service;
diff --git a/sys/dev/mii/lxtphy.c b/sys/dev/mii/lxtphy.c
index fc12ee6..44b40ff 100644
--- a/sys/dev/mii/lxtphy.c
+++ b/sys/dev/mii/lxtphy.c
@@ -127,7 +127,6 @@ lxtphy_attach(device_t dev)
struct mii_softc *sc;
struct mii_attach_args *ma;
struct mii_data *mii;
- const char *nic;
sc = device_get_softc(dev);
ma = device_get_ivars(dev);
@@ -135,6 +134,7 @@ lxtphy_attach(device_t dev)
mii = ma->mii_data;
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
+ sc->mii_flags = miibus_get_flags(dev);
sc->mii_inst = mii->mii_instance++;
sc->mii_phy = ma->mii_phyno;
sc->mii_service = lxtphy_service;
@@ -145,15 +145,6 @@ lxtphy_attach(device_t dev)
sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask;
device_printf(dev, " ");
- /*
- * On Apple BMAC controllers, we end up in a weird state
- * of partially-completed autonegotiation on boot. So
- * force autonegotation to try again.
- */
- nic = device_get_name(device_get_parent(sc->mii_dev));
- if (strcmp(nic, "bm") == 0)
- sc->mii_flags |= MIIF_FORCEANEG | MIIF_NOISOLATE;
-
#define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL)
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_FX, 0, sc->mii_inst),
MII_MEDIA_100_TX);
diff --git a/sys/dev/mii/mlphy.c b/sys/dev/mii/mlphy.c
index 5a2e42d..04e4b80 100644
--- a/sys/dev/mii/mlphy.c
+++ b/sys/dev/mii/mlphy.c
@@ -146,6 +146,7 @@ mlphy_attach(dev)
mii = ma->mii_data;
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
+ sc->mii_flags = miibus_get_flags(dev);
sc->mii_inst = mii->mii_instance++;
sc->mii_phy = ma->mii_phyno;
sc->mii_service = mlphy_service;
diff --git a/sys/dev/mii/nsgphy.c b/sys/dev/mii/nsgphy.c
index 6cfb40f..b3df8a2 100644
--- a/sys/dev/mii/nsgphy.c
+++ b/sys/dev/mii/nsgphy.c
@@ -129,6 +129,7 @@ nsgphy_attach(device_t dev)
mii = ma->mii_data;
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
+ sc->mii_flags = miibus_get_flags(dev);
sc->mii_inst = mii->mii_instance++;
sc->mii_phy = ma->mii_phyno;
sc->mii_service = nsgphy_service;
diff --git a/sys/dev/mii/nsphy.c b/sys/dev/mii/nsphy.c
index 21681f2..af805ca 100644
--- a/sys/dev/mii/nsphy.c
+++ b/sys/dev/mii/nsphy.c
@@ -133,6 +133,7 @@ nsphy_attach(device_t dev)
mii = ma->mii_data;
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
+ sc->mii_flags = miibus_get_flags(dev);
sc->mii_inst = mii->mii_instance++;
sc->mii_phy = ma->mii_phyno;
sc->mii_service = nsphy_service;
@@ -140,34 +141,23 @@ nsphy_attach(device_t dev)
nic = device_get_name(device_get_parent(sc->mii_dev));
/*
- * Am79C971 and i82557 wedge when isolating all of their
- * (external) PHYs.
+ * Am79C971 wedge when isolating all of their external PHYs.
*/
- if (strcmp(nic, "fxp") == 0 || strcmp(nic, "pcn") == 0)
+ if (strcmp(nic, "pcn") == 0)
sc->mii_flags |= MIIF_NOISOLATE;
- /*
- * DP83840A used with HME chips don't advertise their media
- * capabilities themselves properly so force writing the ANAR
- * according to the BMSR in mii_phy_setmedia().
- */
- if (strcmp(nic, "hme") == 0)
- sc->mii_flags |= MIIF_FORCEANEG;
+#if 1
#define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL)
/*
- * In order for MII loopback to work Am79C971 and greater PCnet
- * chips additionally need to be placed into external loopback
- * mode which pcn(4) doesn't do so far.
+ * XXX IFM_LOOP should be handled by mii_phy_add_media() based
+ * on MIIF_NOLOOP.
*/
- if (strcmp(nic, "pcn") != 0)
-#if 1
+ if ((sc->mii_flags & MIIF_NOLOOP) == 0)
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_LOOP,
sc->mii_inst), MII_MEDIA_100_TX);
-#else
- if (strcmp(nic, "pcn") == 0)
- sc->mii_flags |= MIIF_NOLOOP;
+
#endif
nsphy_reset(sc);
@@ -176,7 +166,6 @@ nsphy_attach(device_t dev)
device_printf(dev, " ");
mii_phy_add_media(sc);
printf("\n");
-#undef ADD
MIIBUS_MEDIAINIT(sc->mii_dev);
return (0);
diff --git a/sys/dev/mii/nsphyter.c b/sys/dev/mii/nsphyter.c
index 6317a52..5489504 100644
--- a/sys/dev/mii/nsphyter.c
+++ b/sys/dev/mii/nsphyter.c
@@ -130,7 +130,6 @@ nsphyter_attach(device_t dev)
struct mii_softc *sc;
struct mii_attach_args *ma;
struct mii_data *mii;
- const char *nic;
sc = device_get_softc(dev);
ma = device_get_ivars(dev);
@@ -138,26 +137,24 @@ nsphyter_attach(device_t dev)
mii = ma->mii_data;
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
+ sc->mii_flags = miibus_get_flags(dev);
sc->mii_inst = mii->mii_instance++;
sc->mii_phy = ma->mii_phyno;
sc->mii_service = nsphyter_service;
sc->mii_pdata = mii;
+#if 1
+
#define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL)
- nic = device_get_name(device_get_parent(sc->mii_dev));
/*
- * In order for MII loopback to work Am79C971 and greater PCnet
- * chips additionally need to be placed into external loopback
- * mode which pcn(4) doesn't do so far.
+ * XXX IFM_LOOP should be handled by mii_phy_add_media() based
+ * on MIIF_NOLOOP.
*/
- if (strcmp(nic, "pcn") != 0)
-#if 1
+ if ((sc->mii_flags & MIIF_NOLOOP) == 0)
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_LOOP,
sc->mii_inst), MII_MEDIA_100_TX);
-#else
- if (strcmp(nic, "pcn") == 0)
- sc->mii_flags |= MIIF_NOLOOP;
+
#endif
nsphyter_reset(sc);
@@ -167,8 +164,6 @@ nsphyter_attach(device_t dev)
mii_phy_add_media(sc);
printf("\n");
-#undef ADD
-
MIIBUS_MEDIAINIT(sc->mii_dev);
return (0);
}
diff --git a/sys/dev/mii/pnaphy.c b/sys/dev/mii/pnaphy.c
index 46e2eae..69c41d6 100644
--- a/sys/dev/mii/pnaphy.c
+++ b/sys/dev/mii/pnaphy.c
@@ -110,6 +110,7 @@ pnaphy_attach(device_t dev)
mii = ma->mii_data;
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
+ sc->mii_flags = miibus_get_flags(dev);
sc->mii_inst = mii->mii_instance++;
sc->mii_phy = ma->mii_phyno;
sc->mii_service = pnaphy_service;
diff --git a/sys/dev/mii/qsphy.c b/sys/dev/mii/qsphy.c
index f6cdd45..19fc77d 100644
--- a/sys/dev/mii/qsphy.c
+++ b/sys/dev/mii/qsphy.c
@@ -133,6 +133,7 @@ qsphy_attach(device_t dev)
mii = ma->mii_data;
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
+ sc->mii_flags = miibus_get_flags(dev);
sc->mii_inst = mii->mii_instance++;
sc->mii_phy = ma->mii_phyno;
sc->mii_service = qsphy_service;
diff --git a/sys/dev/mii/rgephy.c b/sys/dev/mii/rgephy.c
index c1d6703..d1e0e51 100644
--- a/sys/dev/mii/rgephy.c
+++ b/sys/dev/mii/rgephy.c
@@ -122,6 +122,7 @@ rgephy_attach(device_t dev)
mii = ma->mii_data;
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
+ sc->mii_flags = miibus_get_flags(dev);
sc->mii_inst = mii->mii_instance++;
sc->mii_phy = ma->mii_phyno;
sc->mii_service = rgephy_service;
diff --git a/sys/dev/mii/rlphy.c b/sys/dev/mii/rlphy.c
index 368b6ca..eeaaaab 100644
--- a/sys/dev/mii/rlphy.c
+++ b/sys/dev/mii/rlphy.c
@@ -141,6 +141,7 @@ rlphy_attach(device_t dev)
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
+ sc->mii_flags = miibus_get_flags(dev);
sc->mii_inst = mii->mii_instance++;
sc->mii_phy = ma->mii_phyno;
sc->mii_service = rlphy_service;
diff --git a/sys/dev/mii/rlswitch.c b/sys/dev/mii/rlswitch.c
index 1fda268..0c1b62f 100644
--- a/sys/dev/mii/rlswitch.c
+++ b/sys/dev/mii/rlswitch.c
@@ -120,6 +120,7 @@ rlswitch_attach(device_t dev)
mii = ma->mii_data;
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
+ sc->mii_flags = miibus_get_flags(dev);
sc->mii_inst = mii->mii_instance++;
sc->mii_phy = ma->mii_phyno;
sc->mii_service = rlswitch_service;
diff --git a/sys/dev/mii/ruephy.c b/sys/dev/mii/ruephy.c
index f793c61..fc2a6b94 100644
--- a/sys/dev/mii/ruephy.c
+++ b/sys/dev/mii/ruephy.c
@@ -111,6 +111,7 @@ ruephy_attach(device_t dev)
mii = ma->mii_data;
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
+ sc->mii_flags = miibus_get_flags(dev);
sc->mii_inst = mii->mii_instance++;
sc->mii_phy = ma->mii_phyno;
sc->mii_service = ruephy_service;
diff --git a/sys/dev/mii/smcphy.c b/sys/dev/mii/smcphy.c
index d893c31..f356fdb 100644
--- a/sys/dev/mii/smcphy.c
+++ b/sys/dev/mii/smcphy.c
@@ -105,6 +105,7 @@ smcphy_attach(device_t dev)
mii = ma->mii_data;
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
+ sc->mii_flags = miibus_get_flags(dev);
sc->mii_inst = mii->mii_instance++;
sc->mii_phy = ma->mii_phyno;
sc->mii_service = smcphy_service;
diff --git a/sys/dev/mii/tdkphy.c b/sys/dev/mii/tdkphy.c
index dc0feca..df08c5e 100644
--- a/sys/dev/mii/tdkphy.c
+++ b/sys/dev/mii/tdkphy.c
@@ -116,6 +116,7 @@ tdkphy_attach(device_t dev)
MII_OUI(ma->mii_id1, ma->mii_id2),
MII_MODEL(ma->mii_id2), MII_REV(ma->mii_id2));
+ sc->mii_flags = miibus_get_flags(dev);
sc->mii_inst = mii->mii_instance++;
sc->mii_phy = ma->mii_phyno;
sc->mii_service = tdkphy_service;
diff --git a/sys/dev/mii/tlphy.c b/sys/dev/mii/tlphy.c
index b425c76..e618611 100644
--- a/sys/dev/mii/tlphy.c
+++ b/sys/dev/mii/tlphy.c
@@ -144,12 +144,13 @@ tlphy_attach(device_t dev)
mii = device_get_softc(sc->sc_mii.mii_dev);
LIST_INSERT_HEAD(&mii->mii_phys, &sc->sc_mii, mii_list);
+ sc->sc_mii.mii_flags = miibus_get_flags(dev);
sc->sc_mii.mii_inst = mii->mii_instance;
sc->sc_mii.mii_phy = ma->mii_phyno;
sc->sc_mii.mii_service = tlphy_service;
sc->sc_mii.mii_pdata = mii;
- capmask = 0xFFFFFFFF;
+ capmask = BMSR_DEFCAPMASK;
if (mii->mii_instance &&
device_get_children(sc->sc_mii.mii_dev, &devlist, &devs) == 0) {
for (i = 0; i < devs; i++) {
@@ -174,7 +175,7 @@ tlphy_attach(device_t dev)
* the TLPHY_MEDIA_NO_10_T bit.
*/
sc->sc_mii.mii_capabilities =
- PHY_READ(&sc->sc_mii, MII_BMSR) & capmask /*ma->mii_capmask*/;
+ PHY_READ(&sc->sc_mii, MII_BMSR) & capmask;
#define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL)
diff --git a/sys/dev/mii/truephy.c b/sys/dev/mii/truephy.c
index c833983..bb99df2 100644
--- a/sys/dev/mii/truephy.c
+++ b/sys/dev/mii/truephy.c
@@ -151,6 +151,7 @@ truephy_attach(device_t dev)
mii = ma->mii_data;
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
+ sc->mii_flags = miibus_get_flags(dev);
sc->mii_inst = mii->mii_instance++;
sc->mii_phy = ma->mii_phyno;
sc->mii_service = truephy_service;
diff --git a/sys/dev/mii/ukphy.c b/sys/dev/mii/ukphy.c
index 75d6132..05b1b45 100644
--- a/sys/dev/mii/ukphy.c
+++ b/sys/dev/mii/ukphy.c
@@ -130,6 +130,7 @@ ukphy_attach(device_t dev)
MII_OUI(ma->mii_id1, ma->mii_id2),
MII_MODEL(ma->mii_id2), MII_REV(ma->mii_id2));
+ sc->mii_flags = miibus_get_flags(dev);
sc->mii_inst = mii->mii_instance++;
sc->mii_phy = ma->mii_phyno;
sc->mii_service = ukphy_service;
diff --git a/sys/dev/mii/xmphy.c b/sys/dev/mii/xmphy.c
index 582f864..745c7b3 100644
--- a/sys/dev/mii/xmphy.c
+++ b/sys/dev/mii/xmphy.c
@@ -110,6 +110,7 @@ xmphy_attach(device_t dev)
mii = ma->mii_data;
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
+ sc->mii_flags = miibus_get_flags(dev);
sc->mii_inst = mii->mii_instance++;
sc->mii_phy = ma->mii_phyno;
sc->mii_service = xmphy_service;
OpenPOWER on IntegriCloud