Make one generic mii_phy_detach() to replace 19 slightly different ones.

Rename mii_phy_auto_stop() mii_phy_down().

Introduce mii_down(), use it from nge.  Do not indirect it to 19 identical
case's in 19 switchstatements like NetBSD did.
This commit is contained in:
phk 2002-04-29 13:07:38 +00:00
parent 1f3afe6a56
commit 1239f6ec7e
25 changed files with 64 additions and 388 deletions

View File

@ -95,13 +95,12 @@ static const char rcsid[] =
static int dcphy_probe (device_t);
static int dcphy_attach (device_t);
static int dcphy_detach (device_t);
static device_method_t dcphy_methods[] = {
/* device interface */
DEVMETHOD(device_probe, dcphy_probe),
DEVMETHOD(device_attach, dcphy_attach),
DEVMETHOD(device_detach, dcphy_detach),
DEVMETHOD(device_detach, mii_phy_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
{ 0, 0 }
};
@ -204,20 +203,6 @@ static int dcphy_attach(dev)
return(0);
}
static int dcphy_detach(dev)
device_t dev;
{
struct mii_softc *sc;
struct mii_data *mii;
sc = device_get_softc(dev);
mii = device_get_softc(device_get_parent(dev));
sc->mii_dev = NULL;
LIST_REMOVE(sc, mii_list);
return(0);
}
static int
dcphy_service(sc, mii, cmd)
struct mii_softc *sc;

View File

@ -82,13 +82,12 @@ static const char rcsid[] =
static int pnphy_probe (device_t);
static int pnphy_attach (device_t);
static int pnphy_detach (device_t);
static device_method_t pnphy_methods[] = {
/* device interface */
DEVMETHOD(device_probe, pnphy_probe),
DEVMETHOD(device_attach, pnphy_attach),
DEVMETHOD(device_detach, pnphy_detach),
DEVMETHOD(device_detach, mii_phy_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
{ 0, 0 }
};
@ -167,20 +166,6 @@ static int pnphy_attach(dev)
return(0);
}
static int pnphy_detach(dev)
device_t dev;
{
struct mii_softc *sc;
struct mii_data *mii;
sc = device_get_softc(dev);
mii = device_get_softc(device_get_parent(dev));
sc->mii_dev = NULL;
LIST_REMOVE(sc, mii_list);
return(0);
}
static int
pnphy_service(sc, mii, cmd)
struct mii_softc *sc;

View File

@ -94,13 +94,12 @@ static const char rcsid[] =
static int acphy_probe (device_t);
static int acphy_attach (device_t);
static int acphy_detach (device_t);
static device_method_t acphy_methods[] = {
/* device interface */
DEVMETHOD(device_probe, acphy_probe),
DEVMETHOD(device_attach, acphy_attach),
DEVMETHOD(device_detach, acphy_detach),
DEVMETHOD(device_detach, mii_phy_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
{ 0, 0 }
};
@ -168,20 +167,6 @@ static int acphy_attach(dev)
return (0);
}
static int acphy_detach(dev)
device_t dev;
{
struct mii_softc *sc;
struct mii_data *mii;
sc = device_get_softc(dev);
mii = device_get_softc(device_get_parent(dev));
sc->mii_dev = NULL;
LIST_REMOVE(sc, mii_list);
return(0);
}
static int
acphy_service(sc, mii, cmd)
struct mii_softc *sc;

View File

@ -62,13 +62,12 @@ static const char rcsid[] =
static int amphy_probe (device_t);
static int amphy_attach (device_t);
static int amphy_detach (device_t);
static device_method_t amphy_methods[] = {
/* device interface */
DEVMETHOD(device_probe, amphy_probe),
DEVMETHOD(device_attach, amphy_attach),
DEVMETHOD(device_detach, amphy_detach),
DEVMETHOD(device_detach, mii_phy_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
{ 0, 0 }
};
@ -149,21 +148,6 @@ static int amphy_attach(dev)
return(0);
}
static int amphy_detach(dev)
device_t dev;
{
struct mii_softc *sc;
struct mii_data *mii;
sc = device_get_softc(dev);
mii = device_get_softc(device_get_parent(dev));
mii_phy_auto_stop(sc);
sc->mii_dev = NULL;
LIST_REMOVE(sc, mii_list);
return(0);
}
static int
amphy_service(sc, mii, cmd)
struct mii_softc *sc;

View File

@ -64,13 +64,12 @@ static const char rcsid[] =
static int brgphy_probe (device_t);
static int brgphy_attach (device_t);
static int brgphy_detach (device_t);
static device_method_t brgphy_methods[] = {
/* device interface */
DEVMETHOD(device_probe, brgphy_probe),
DEVMETHOD(device_attach, brgphy_attach),
DEVMETHOD(device_detach, brgphy_detach),
DEVMETHOD(device_detach, mii_phy_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
{ 0, 0 }
};
@ -179,23 +178,6 @@ static int brgphy_attach(dev)
return(0);
}
static int brgphy_detach(dev)
device_t dev;
{
struct mii_softc *sc;
struct mii_data *mii;
sc = device_get_softc(dev);
mii = device_get_softc(device_get_parent(dev));
if (sc->mii_flags & MIIF_DOINGAUTO)
untimeout(mii_phy_auto_timeout, sc, sc->mii_auto_ch);
sc->mii_dev = NULL;
LIST_REMOVE(sc, mii_list);
return(0);
}
static int
brgphy_service(sc, mii, cmd)
struct mii_softc *sc;

View File

@ -95,13 +95,12 @@ static const char rcsid[] =
static int dcphy_probe (device_t);
static int dcphy_attach (device_t);
static int dcphy_detach (device_t);
static device_method_t dcphy_methods[] = {
/* device interface */
DEVMETHOD(device_probe, dcphy_probe),
DEVMETHOD(device_attach, dcphy_attach),
DEVMETHOD(device_detach, dcphy_detach),
DEVMETHOD(device_detach, mii_phy_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
{ 0, 0 }
};
@ -204,20 +203,6 @@ static int dcphy_attach(dev)
return(0);
}
static int dcphy_detach(dev)
device_t dev;
{
struct mii_softc *sc;
struct mii_data *mii;
sc = device_get_softc(dev);
mii = device_get_softc(device_get_parent(dev));
sc->mii_dev = NULL;
LIST_REMOVE(sc, mii_list);
return(0);
}
static int
dcphy_service(sc, mii, cmd)
struct mii_softc *sc;

View File

@ -56,13 +56,12 @@
static int e1000phy_probe(device_t);
static int e1000phy_attach(device_t);
static int e1000phy_detach(device_t);
static device_method_t e1000phy_methods[] = {
/* device interface */
DEVMETHOD(device_probe, e1000phy_probe),
DEVMETHOD(device_attach, e1000phy_attach),
DEVMETHOD(device_detach, e1000phy_detach),
DEVMETHOD(device_detach, mii_phy_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
{ 0, 0 }
};
@ -159,24 +158,6 @@ e1000phy_attach(device_t dev)
return(0);
}
static int
e1000phy_detach(device_t dev)
{
struct mii_softc *sc;
struct mii_data *mii;
sc = device_get_softc(dev);
mii = device_get_softc(device_get_parent(dev));
if (sc->mii_flags & MIIF_DOINGAUTO)
untimeout(mii_phy_auto_timeout, sc, sc->mii_auto_ch);
sc->mii_dev = NULL;
LIST_REMOVE(sc, mii_list);
return 0;
}
static void
e1000phy_reset(struct mii_softc *sc)
{

View File

@ -93,13 +93,12 @@ static const char rcsid[] =
static int exphy_probe (device_t);
static int exphy_attach (device_t);
static int exphy_detach (device_t);
static device_method_t exphy_methods[] = {
/* device interface */
DEVMETHOD(device_probe, exphy_probe),
DEVMETHOD(device_attach, exphy_attach),
DEVMETHOD(device_detach, exphy_detach),
DEVMETHOD(device_detach, mii_phy_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
{ 0, 0 }
};
@ -202,21 +201,6 @@ static int exphy_attach(dev)
return(0);
}
static int exphy_detach(dev)
device_t dev;
{
struct mii_softc *sc;
struct mii_data *mii;
sc = device_get_softc(dev);
mii = device_get_softc(device_get_parent(dev));
mii_phy_auto_stop(sc);
sc->mii_dev = NULL;
LIST_REMOVE(sc, mii_list);
return(0);
}
static int
exphy_service(sc, mii, cmd)
struct mii_softc *sc;

View File

@ -53,13 +53,12 @@
static int inphy_probe(device_t dev);
static int inphy_attach(device_t dev);
static int inphy_detach(device_t dev);
static device_method_t inphy_methods[] = {
/* device interface */
DEVMETHOD(device_probe, inphy_probe),
DEVMETHOD(device_attach, inphy_attach),
DEVMETHOD(device_detach, inphy_detach),
DEVMETHOD(device_detach, mii_phy_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
{ 0, 0 }
};
@ -152,21 +151,6 @@ inphy_attach(device_t dev)
return (0);
}
static int
inphy_detach(device_t dev)
{
struct mii_softc *sc;
struct mii_data *mii;
sc = device_get_softc(dev);
mii = device_get_softc(device_get_softc(dev));
mii_phy_auto_stop(sc);
sc->mii_dev = NULL;
LIST_REMOVE(sc, mii_list);
return (0);
}
static int
inphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
{

View File

@ -98,13 +98,12 @@ static const char rcsid[] =
static int lxtphy_probe (device_t);
static int lxtphy_attach (device_t);
static int lxtphy_detach (device_t);
static device_method_t lxtphy_methods[] = {
/* device interface */
DEVMETHOD(device_probe, lxtphy_probe),
DEVMETHOD(device_attach, lxtphy_attach),
DEVMETHOD(device_detach, lxtphy_detach),
DEVMETHOD(device_detach, mii_phy_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
{ 0, 0 }
};
@ -185,21 +184,6 @@ static int lxtphy_attach(dev)
return(0);
}
static int lxtphy_detach(dev)
device_t dev;
{
struct mii_softc *sc;
struct mii_data *mii;
sc = device_get_softc(dev);
mii = device_get_softc(device_get_parent(dev));
sc->mii_dev = NULL;
LIST_REMOVE(sc, mii_list);
return(0);
}
static int
lxtphy_service(sc, mii, cmd)
struct mii_softc *sc;

View File

@ -363,3 +363,15 @@ mii_pollstat(mii)
LIST_FOREACH(child, &mii->mii_phys, mii_list)
(void) (*child->mii_service)(child, mii, MII_POLLSTAT);
}
/*
* Inform the PHYs that the interface is down.
*/
void
mii_down(struct mii_data *mii)
{
struct mii_softc *child;
LIST_FOREACH(child, &mii->mii_phys, mii_list)
mii_phy_down(child);
}

View File

@ -229,16 +229,6 @@ mii_phy_auto(struct mii_softc *sc, int waitfor)
return (EJUSTRETURN);
}
void
mii_phy_auto_stop(sc)
struct mii_softc *sc;
{
if (sc->mii_flags & MIIF_DOINGAUTO) {
sc->mii_flags &= ~MIIF_DOINGAUTO;
untimeout(mii_phy_auto_timeout, sc, sc->mii_auto_ch);
}
}
void
mii_phy_auto_timeout(void *arg)
{
@ -332,13 +322,22 @@ mii_phy_reset(struct mii_softc *sc)
}
void
mii_phy_update(sc, cmd)
struct mii_softc *sc;
int cmd;
mii_phy_down(struct mii_softc *sc)
{
if (sc->mii_flags & MIIF_DOINGAUTO) {
sc->mii_flags &= ~MIIF_DOINGAUTO;
untimeout(mii_phy_auto_timeout, sc, sc->mii_auto_ch);
}
}
void
mii_phy_update(struct mii_softc *sc, int cmd)
{
struct mii_data *mii = sc->mii_pdata;
if (sc->mii_media_active != mii->mii_media_active || cmd == MII_MEDIACHG) {
if (sc->mii_media_active != mii->mii_media_active ||
cmd == MII_MEDIACHG) {
MIIBUS_STATCHG(sc->mii_dev);
sc->mii_media_active = mii->mii_media_active;
}
@ -580,3 +579,17 @@ mii_phy_add_media(struct mii_softc *sc)
#undef PRINT
}
int
mii_phy_detach(device_t dev)
{
struct mii_softc *sc;
struct mii_data *mii;
sc = device_get_softc(dev);
mii = device_get_softc(device_get_parent(dev));
mii_phy_down(sc);
sc->mii_dev = NULL;
LIST_REMOVE(sc, mii_list);
return(0);
}

View File

@ -192,6 +192,7 @@ int miibus_attach(device_t);
int miibus_detach(device_t);
int mii_anar(int);
void mii_down(struct mii_data *);
int mii_mediachg(struct mii_data *);
void mii_tick(struct mii_data *);
void mii_pollstat(struct mii_data *);
@ -202,7 +203,8 @@ void mii_phy_add_media(struct mii_softc *);
int mii_media_from_bmcr(int);
int mii_phy_auto(struct mii_softc *, int);
void mii_phy_auto_stop(struct mii_softc *);
int mii_phy_detach(device_t dev);
void mii_phy_down(struct mii_softc *);
void mii_phy_reset(struct mii_softc *);
void mii_phy_setmedia(struct mii_softc *sc);
void mii_phy_update(struct mii_softc *, int);

View File

@ -74,13 +74,12 @@ struct mlphy_softc {
static int mlphy_probe (device_t);
static int mlphy_attach (device_t);
static int mlphy_detach (device_t);
static device_method_t mlphy_methods[] = {
/* device interface */
DEVMETHOD(device_probe, mlphy_probe),
DEVMETHOD(device_attach, mlphy_attach),
DEVMETHOD(device_detach, mlphy_detach),
DEVMETHOD(device_detach, mii_phy_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
{ 0, 0 }
};
@ -174,21 +173,6 @@ static int mlphy_attach(dev)
return(0);
}
static int mlphy_detach(dev)
device_t dev;
{
struct mlphy_softc *sc;
struct mii_data *mii;
sc = device_get_softc(dev);
mii = device_get_softc(device_get_parent(dev));
mii_phy_auto_stop(&sc->ml_mii);
sc->ml_mii.mii_dev = NULL;
LIST_REMOVE(&sc->ml_mii, mii_list);
return(0);
}
static int
mlphy_service(xsc, mii, cmd)
struct mii_softc *xsc;

View File

@ -80,13 +80,12 @@ static const char rcsid[] =
static int nsgphy_probe (device_t);
static int nsgphy_attach (device_t);
static int nsgphy_detach (device_t);
static device_method_t nsgphy_methods[] = {
/* device interface */
DEVMETHOD(device_probe, nsgphy_probe),
DEVMETHOD(device_attach, nsgphy_attach),
DEVMETHOD(device_detach, nsgphy_detach),
DEVMETHOD(device_detach, mii_phy_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
{ 0, 0 }
};
@ -159,22 +158,6 @@ nsgphy_attach(device_t dev)
return(0);
}
static int
nsgphy_detach(device_t dev)
{
struct mii_softc *sc;
struct mii_data *mii;
sc = device_get_softc(dev);
mii = device_get_softc(device_get_parent(dev));
if (sc->mii_flags & MIIF_DOINGAUTO)
untimeout(mii_phy_auto_timeout, sc, sc->mii_auto_ch);
sc->mii_dev = NULL;
LIST_REMOVE(sc, mii_list);
return(0);
}
static int
nsgphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
{

View File

@ -97,13 +97,12 @@ static const char rcsid[] =
static int nsphy_probe (device_t);
static int nsphy_attach (device_t);
static int nsphy_detach (device_t);
static device_method_t nsphy_methods[] = {
/* device interface */
DEVMETHOD(device_probe, nsphy_probe),
DEVMETHOD(device_attach, nsphy_attach),
DEVMETHOD(device_detach, nsphy_detach),
DEVMETHOD(device_detach, mii_phy_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
{ 0, 0 }
};
@ -189,21 +188,6 @@ static int nsphy_attach(dev)
return(0);
}
static int nsphy_detach(dev)
device_t dev;
{
struct mii_softc *sc;
struct mii_data *mii;
sc = device_get_softc(dev);
mii = device_get_softc(device_get_parent(dev));
mii_phy_auto_stop(sc);
sc->mii_dev = NULL;
LIST_REMOVE(sc, mii_list);
return(0);
}
static int
nsphy_service(sc, mii, cmd)
struct mii_softc *sc;

View File

@ -68,13 +68,12 @@ static const char rcsid[] =
static int pnaphy_probe (device_t);
static int pnaphy_attach (device_t);
static int pnaphy_detach (device_t);
static device_method_t pnaphy_methods[] = {
/* device interface */
DEVMETHOD(device_probe, pnaphy_probe),
DEVMETHOD(device_attach, pnaphy_attach),
DEVMETHOD(device_detach, pnaphy_detach),
DEVMETHOD(device_detach, mii_phy_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
{ 0, 0 }
};
@ -160,21 +159,6 @@ pnaphy_attach(dev)
return(0);
}
static int pnaphy_detach(dev)
device_t dev;
{
struct mii_softc *sc;
struct mii_data *mii;
sc = device_get_softc(dev);
mii = device_get_softc(device_get_parent(dev));
mii_phy_auto_stop(sc);
sc->mii_dev = NULL;
LIST_REMOVE(sc, mii_list);
return(0);
}
int
pnaphy_service(sc, mii, cmd)
struct mii_softc *sc;

View File

@ -82,13 +82,12 @@ static const char rcsid[] =
static int pnphy_probe (device_t);
static int pnphy_attach (device_t);
static int pnphy_detach (device_t);
static device_method_t pnphy_methods[] = {
/* device interface */
DEVMETHOD(device_probe, pnphy_probe),
DEVMETHOD(device_attach, pnphy_attach),
DEVMETHOD(device_detach, pnphy_detach),
DEVMETHOD(device_detach, mii_phy_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
{ 0, 0 }
};
@ -167,20 +166,6 @@ static int pnphy_attach(dev)
return(0);
}
static int pnphy_detach(dev)
device_t dev;
{
struct mii_softc *sc;
struct mii_data *mii;
sc = device_get_softc(dev);
mii = device_get_softc(device_get_parent(dev));
sc->mii_dev = NULL;
LIST_REMOVE(sc, mii_list);
return(0);
}
static int
pnphy_service(sc, mii, cmd)
struct mii_softc *sc;

View File

@ -98,13 +98,12 @@ static const char rcsid[] =
static int qsphy_probe (device_t);
static int qsphy_attach (device_t);
static int qsphy_detach (device_t);
static device_method_t qsphy_methods[] = {
/* device interface */
DEVMETHOD(device_probe, qsphy_probe),
DEVMETHOD(device_attach, qsphy_attach),
DEVMETHOD(device_detach, qsphy_detach),
DEVMETHOD(device_detach, mii_phy_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
{ 0, 0 }
};
@ -172,20 +171,6 @@ static int qsphy_attach(dev)
return (0);
}
static int qsphy_detach(dev)
device_t dev;
{
struct mii_softc *sc;
struct mii_data *mii;
sc = device_get_softc(dev);
mii = device_get_softc(device_get_parent(dev));
sc->mii_dev = NULL;
LIST_REMOVE(sc, mii_list);
return(0);
}
static int
qsphy_service(sc, mii, cmd)
struct mii_softc *sc;

View File

@ -62,13 +62,12 @@ static const char rcsid[] =
static int rlphy_probe (device_t);
static int rlphy_attach (device_t);
static int rlphy_detach (device_t);
static device_method_t rlphy_methods[] = {
/* device interface */
DEVMETHOD(device_probe, rlphy_probe),
DEVMETHOD(device_attach, rlphy_attach),
DEVMETHOD(device_detach, rlphy_detach),
DEVMETHOD(device_detach, mii_phy_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
{ 0, 0 }
};
@ -174,21 +173,6 @@ static int rlphy_attach(dev)
return(0);
}
static int rlphy_detach(dev)
device_t dev;
{
struct mii_softc *sc;
struct mii_data *mii;
sc = device_get_softc(dev);
mii = device_get_softc(device_get_softc(dev));
mii_phy_auto_stop(sc);
sc->mii_dev = NULL;
LIST_REMOVE(sc, mii_list);
return(0);
}
static int
rlphy_service(sc, mii, cmd)
struct mii_softc *sc;

View File

@ -71,13 +71,12 @@ static const char rcsid[] =
static int tdkphy_probe (device_t);
static int tdkphy_attach (device_t);
static int tdkphy_detach (device_t);
static device_method_t tdkphy_methods[] = {
/* device interface */
DEVMETHOD(device_probe, tdkphy_probe),
DEVMETHOD(device_attach, tdkphy_attach),
DEVMETHOD(device_detach, tdkphy_detach),
DEVMETHOD(device_detach, mii_phy_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
{ 0, 0 }
};
@ -157,20 +156,6 @@ tdkphy_attach(device_t dev)
return(0);
}
static int tdkphy_detach(device_t dev)
{
struct mii_softc *sc;
struct mii_data *mii;
sc = device_get_softc(dev);
mii = device_get_softc(device_get_parent(dev));
mii_phy_auto_stop(sc);
sc->mii_dev = NULL;
LIST_REMOVE(sc, mii_list);
return(0);
}
static int
tdkphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd)
{

View File

@ -104,13 +104,12 @@ struct tlphy_softc {
static int tlphy_probe (device_t);
static int tlphy_attach (device_t);
static int tlphy_detach (device_t);
static device_method_t tlphy_methods[] = {
/* device interface */
DEVMETHOD(device_probe, tlphy_probe),
DEVMETHOD(device_attach, tlphy_attach),
DEVMETHOD(device_detach, tlphy_detach),
DEVMETHOD(device_detach, mii_phy_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
{ 0, 0 }
};
@ -226,20 +225,6 @@ static int tlphy_attach(dev)
return(0);
}
static int tlphy_detach(dev)
device_t dev;
{
struct tlphy_softc *sc;
struct mii_data *mii;
sc = device_get_softc(dev);
mii = device_get_softc(device_get_parent(dev));
sc->sc_mii.mii_dev = NULL;
LIST_REMOVE(&sc->sc_mii, mii_list);
return(0);
}
static int
tlphy_service(self, mii, cmd)
struct mii_softc *self;

View File

@ -94,13 +94,12 @@ static const char rcsid[] =
static int ukphy_probe (device_t);
static int ukphy_attach (device_t);
static int ukphy_detach (device_t);
static device_method_t ukphy_methods[] = {
/* device interface */
DEVMETHOD(device_probe, ukphy_probe),
DEVMETHOD(device_attach, ukphy_attach),
DEVMETHOD(device_detach, ukphy_detach),
DEVMETHOD(device_detach, mii_phy_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
{ 0, 0 }
};
@ -180,21 +179,6 @@ ukphy_attach(dev)
return(0);
}
static int ukphy_detach(dev)
device_t dev;
{
struct mii_softc *sc;
struct mii_data *mii;
sc = device_get_softc(dev);
mii = device_get_softc(device_get_parent(dev));
mii_phy_auto_stop(sc);
sc->mii_dev = NULL;
LIST_REMOVE(sc, mii_list);
return(0);
}
static int
ukphy_service(sc, mii, cmd)
struct mii_softc *sc;

View File

@ -64,13 +64,12 @@ static const char rcsid[] =
static int xmphy_probe (device_t);
static int xmphy_attach (device_t);
static int xmphy_detach (device_t);
static device_method_t xmphy_methods[] = {
/* device interface */
DEVMETHOD(device_probe, xmphy_probe),
DEVMETHOD(device_attach, xmphy_attach),
DEVMETHOD(device_detach, xmphy_detach),
DEVMETHOD(device_detach, mii_phy_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown),
{ 0, 0 }
};
@ -163,22 +162,6 @@ static int xmphy_attach(dev)
return(0);
}
static int xmphy_detach(dev)
device_t dev;
{
struct mii_softc *sc;
struct mii_data *mii;
sc = device_get_softc(dev);
mii = device_get_softc(device_get_parent(dev));
if (sc->mii_flags & MIIF_DOINGAUTO)
untimeout(mii_phy_auto_timeout, sc, sc->mii_auto_ch);
sc->mii_dev = NULL;
LIST_REMOVE(sc, mii_list);
return(0);
}
static int
xmphy_service(sc, mii, cmd)
struct mii_softc *sc;

View File

@ -1955,9 +1955,7 @@ static void nge_stop(sc)
{
register int i;
struct ifnet *ifp;
struct ifmedia_entry *ifm;
struct mii_data *mii;
int mtmp, itmp;
ifp = &sc->arpcom.ac_if;
ifp->if_timer = 0;
@ -1971,21 +1969,7 @@ static void nge_stop(sc)
CSR_WRITE_4(sc, NGE_TX_LISTPTR, 0);
CSR_WRITE_4(sc, NGE_RX_LISTPTR, 0);
/*
* Isolate/power down the PHY, but leave the media selection
* unchanged so that things will be put back to normal when
* we bring the interface back up.
*/
itmp = ifp->if_flags;
ifp->if_flags |= IFF_UP;
ifm = mii->mii_media.ifm_cur;
mtmp = ifm->ifm_media;
#if 0
ifm->ifm_media = IFM_ETHER|IFM_AUTO;
mii_mediachg(mii);
ifm->ifm_media = mtmp;
ifp->if_flags = itmp;
#endif
mii_down(mii);
sc->nge_link = 0;