Make many ethernet drivers share the common code for MII media
handling, ether_mediastatus() and ether_mediachange(). Check for a non-ENXIO error return from mii_mediachg(). (ENXIO indicates that a PHY is suspended.) This patch shrinks the source code size by 979 lines. There was a 5100-byte savings on the NetBSD/i386 kernel configuration, ALL. I have made a few miscellaneous changes, too: gem(4): use LIST_EMPTY(), LIST_FOREACH(). mtd(4): handle media ioctls, for a change! axe(4): do not track link status in sc->axe_link any longer nfe(4), aue(4), axe(4), udav(4), url(4): do not reset all PHYs on a change of media Except for the change to mtd(4), no functional changes are intended. XXX This patch affects more architectures than I can feasibly XXX compile and run. I have compiled macppc, sparc64, i386. I XXX have run the patches on i386 boxen with bnx(4) and sip(4). XXX Compiling and running on evbmips (MERAKI, ADM5120) is in XXX progress.
This commit is contained in:
parent
f7455b20d9
commit
b480b62270
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: epe.c,v 1.14 2008/01/19 13:11:09 chris Exp $ */
|
||||
/* $NetBSD: epe.c,v 1.15 2008/01/19 22:10:14 dyoung Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2004 Jesse Off
|
||||
@ -34,7 +34,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: epe.c,v 1.14 2008/01/19 13:11:09 chris Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: epe.c,v 1.15 2008/01/19 22:10:14 dyoung Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
@ -114,7 +114,6 @@ static void epe_init(struct epe_softc *);
|
||||
static int epe_intr(void* arg);
|
||||
static int epe_gctx(struct epe_softc *);
|
||||
static int epe_mediachange(struct ifnet *);
|
||||
static void epe_mediastatus(struct ifnet *, struct ifmediareq *);
|
||||
int epe_mii_readreg (struct device *, int, int);
|
||||
void epe_mii_writereg (struct device *, int, int, int);
|
||||
void epe_statchg (struct device *);
|
||||
@ -424,8 +423,9 @@ epe_init(struct epe_softc *sc)
|
||||
sc->sc_mii.mii_readreg = epe_mii_readreg;
|
||||
sc->sc_mii.mii_writereg = epe_mii_writereg;
|
||||
sc->sc_mii.mii_statchg = epe_statchg;
|
||||
sc->sc_ec.ec_mii = &sc->sc_mii;
|
||||
ifmedia_init(&sc->sc_mii.mii_media, IFM_IMASK, epe_mediachange,
|
||||
epe_mediastatus);
|
||||
ether_mediastatus);
|
||||
mii_attach((struct device *)sc, &sc->sc_mii, 0xffffffff, MII_PHY_ANY,
|
||||
MII_OFFSET_ANY, 0);
|
||||
ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER|IFM_AUTO);
|
||||
@ -470,19 +470,6 @@ epe_mediachange(ifp)
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void
|
||||
epe_mediastatus(ifp, ifmr)
|
||||
struct ifnet *ifp;
|
||||
struct ifmediareq *ifmr;
|
||||
{
|
||||
struct epe_softc *sc = ifp->if_softc;
|
||||
|
||||
mii_pollstat(&sc->sc_mii);
|
||||
ifmr->ifm_active = sc->sc_mii.mii_media_active;
|
||||
ifmr->ifm_status = sc->sc_mii.mii_media_status;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
epe_mii_readreg(self, phy, reg)
|
||||
struct device *self;
|
||||
@ -575,18 +562,11 @@ epe_ifioctl(ifp, cmd, data)
|
||||
int s, error;
|
||||
|
||||
s = splnet();
|
||||
switch(cmd) {
|
||||
case SIOCSIFMEDIA:
|
||||
case SIOCGIFMEDIA:
|
||||
error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, cmd);
|
||||
break;
|
||||
default:
|
||||
error = ether_ioctl(ifp, cmd, data);
|
||||
if (error == ENETRESET) {
|
||||
if (ifp->if_flags & IFF_RUNNING)
|
||||
epe_setaddr(ifp);
|
||||
error = 0;
|
||||
}
|
||||
error = ether_ioctl(ifp, cmd, data);
|
||||
if (error == ENETRESET) {
|
||||
if (ifp->if_flags & IFF_RUNNING)
|
||||
epe_setaddr(ifp);
|
||||
error = 0;
|
||||
}
|
||||
splx(s);
|
||||
return error;
|
||||
@ -724,15 +704,21 @@ epe_ifinit(ifp)
|
||||
struct ifnet *ifp;
|
||||
{
|
||||
struct epe_softc *sc = ifp->if_softc;
|
||||
int s = splnet();
|
||||
int rc, s = splnet();
|
||||
|
||||
callout_stop(&sc->epe_tick_ch);
|
||||
EPE_WRITE(RXCtl, RXCtl_IA0|RXCtl_BA|RXCtl_RCRCA|RXCtl_SRxON);
|
||||
EPE_WRITE(TXCtl, TXCtl_STxON);
|
||||
EPE_WRITE(GIIntMsk, GIIntMsk_INT); /* start interrupting */
|
||||
mii_mediachg(&sc->sc_mii);
|
||||
|
||||
if ((rc = mii_mediachg(&sc->sc_mii)) == ENXIO)
|
||||
rc = 0;
|
||||
else if (rc != 0)
|
||||
goto out;
|
||||
|
||||
callout_reset(&sc->epe_tick_ch, hz, epe_tick, sc);
|
||||
ifp->if_flags |= IFF_RUNNING;
|
||||
out:
|
||||
splx(s);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ixp425_if_npe.c,v 1.6 2008/01/08 02:07:52 matt Exp $ */
|
||||
/* $NetBSD: ixp425_if_npe.c,v 1.7 2008/01/19 22:10:14 dyoung Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2006 Sam Leffler. All rights reserved.
|
||||
@ -28,7 +28,7 @@
|
||||
#if 0
|
||||
__FBSDID("$FreeBSD: src/sys/arm/xscale/ixp425/if_npe.c,v 1.1 2006/11/19 23:55:23 sam Exp $");
|
||||
#endif
|
||||
__KERNEL_RCSID(0, "$NetBSD: ixp425_if_npe.c,v 1.6 2008/01/08 02:07:52 matt Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ixp425_if_npe.c,v 1.7 2008/01/19 22:10:14 dyoung Exp $");
|
||||
|
||||
/*
|
||||
* Intel XScale NPE Ethernet driver.
|
||||
@ -296,6 +296,7 @@ npe_attach(struct device *parent, struct device *self, void *arg)
|
||||
sc->sc_mii.mii_readreg = npe_miibus_readreg;
|
||||
sc->sc_mii.mii_writereg = npe_miibus_writereg;
|
||||
sc->sc_mii.mii_statchg = npe_miibus_statchg;
|
||||
sc->sc_ethercom.ec_mii = &sc->sc_mii;
|
||||
|
||||
mii_attach(&sc->sc_dev, &sc->sc_mii, 0xffffffff,
|
||||
(sc->sc_phy > IXPNPECF_PHY_DEFAULT) ?
|
||||
@ -660,9 +661,9 @@ npe_ifmedia_change(struct ifnet *ifp)
|
||||
{
|
||||
struct npe_softc *sc = ifp->if_softc;
|
||||
|
||||
if (sc->sc_phy > IXPNPECF_PHY_DEFAULT && ifp->if_flags & IFF_UP)
|
||||
mii_mediachg(&sc->sc_mii);
|
||||
return (0);
|
||||
if (sc->sc_phy > IXPNPECF_PHY_DEFAULT)
|
||||
return ether_mediachange(ifp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1266,26 +1267,17 @@ npeioctl(struct ifnet *ifp, u_long cmd, void *data)
|
||||
|
||||
s = splnet();
|
||||
|
||||
switch (cmd) {
|
||||
case SIOCSIFMEDIA:
|
||||
case SIOCGIFMEDIA:
|
||||
error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, cmd);
|
||||
break;
|
||||
|
||||
default:
|
||||
error = ether_ioctl(ifp, cmd, data);
|
||||
if (error == ENETRESET) {
|
||||
if ((ifp->if_flags & IFF_UP) == 0 &&
|
||||
ifp->if_flags & IFF_RUNNING) {
|
||||
ifp->if_flags &= ~IFF_RUNNING;
|
||||
npestop(&sc->sc_ethercom.ec_if, 0);
|
||||
} else {
|
||||
/* reinitialize card on any parameter change */
|
||||
npeinit_locked(sc);
|
||||
}
|
||||
error = 0;
|
||||
error = ether_ioctl(ifp, cmd, data);
|
||||
if (error == ENETRESET) {
|
||||
if ((ifp->if_flags & IFF_UP) == 0 &&
|
||||
ifp->if_flags & IFF_RUNNING) {
|
||||
ifp->if_flags &= ~IFF_RUNNING;
|
||||
npestop(&sc->sc_ethercom.ec_if, 0);
|
||||
} else {
|
||||
/* reinitialize card on any parameter change */
|
||||
npeinit_locked(sc);
|
||||
}
|
||||
break;
|
||||
error = 0;
|
||||
}
|
||||
|
||||
npestart(ifp);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_temac.c,v 1.2 2007/03/04 05:59:46 christos Exp $ */
|
||||
/* $NetBSD: if_temac.c,v 1.3 2008/01/19 22:10:14 dyoung Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006 Jachym Holecek
|
||||
@ -40,7 +40,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_temac.c,v 1.2 2007/03/04 05:59:46 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_temac.c,v 1.3 2008/01/19 22:10:14 dyoung Exp $");
|
||||
|
||||
#include "bpfilter.h"
|
||||
|
||||
@ -205,8 +205,6 @@ static void temac_start(struct ifnet *);
|
||||
static void temac_stop(struct ifnet *, int);
|
||||
|
||||
/* Media management. */
|
||||
static int temac_mediachange(struct ifnet *);
|
||||
static void temac_mediastatus(struct ifnet *, struct ifmediareq *);
|
||||
static int temac_mii_readreg(struct device *, int, int);
|
||||
static void temac_mii_statchg(struct device *);
|
||||
static void temac_mii_tick(void *);
|
||||
@ -500,8 +498,8 @@ temac_attach(struct device *parent, struct device *self, void *aux)
|
||||
mii->mii_readreg = temac_mii_readreg;
|
||||
mii->mii_writereg = temac_mii_writereg;
|
||||
mii->mii_statchg = temac_mii_statchg;
|
||||
ifmedia_init(&mii->mii_media, 0, temac_mediachange,
|
||||
temac_mediastatus);
|
||||
sc->sc_ec.ec_mii = mii;
|
||||
ifmedia_init(&mii->mii_media, 0, ether_mediachange, ether_mediastatus);
|
||||
|
||||
mii_attach(&sc->sc_dev, mii, 0xffffffff, MII_PHY_ANY,
|
||||
MII_OFFSET_ANY, 0);
|
||||
@ -593,7 +591,9 @@ temac_init(struct ifnet *ifp)
|
||||
cdmac_rx_reset(sc);
|
||||
|
||||
/* Set current media. */
|
||||
mii_mediachg(&sc->sc_mii);
|
||||
if ((error = ether_mediachange(ifp)) != 0)
|
||||
return error;
|
||||
|
||||
callout_schedule(&sc->sc_mii_tick, hz);
|
||||
|
||||
/* Enable EMAC engine. */
|
||||
@ -653,21 +653,10 @@ temac_ioctl(struct ifnet *ifp, u_long cmd, void *data)
|
||||
int s, ret;
|
||||
|
||||
s = splnet();
|
||||
if (sc->sc_dead) {
|
||||
if (sc->sc_dead)
|
||||
ret = EIO;
|
||||
} else
|
||||
switch (cmd) {
|
||||
case SIOCSIFMEDIA:
|
||||
case SIOCGIFMEDIA:
|
||||
ret = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media,
|
||||
cmd);
|
||||
break;
|
||||
|
||||
default:
|
||||
ret = ether_ioctl(ifp, cmd, data);
|
||||
break;
|
||||
}
|
||||
|
||||
else
|
||||
ret = ether_ioctl(ifp, cmd, data);
|
||||
splx(s);
|
||||
return (ret);
|
||||
}
|
||||
@ -839,30 +828,6 @@ temac_stop(struct ifnet *ifp, int disable)
|
||||
ifp->if_flags &= ~(IFF_RUNNING|IFF_OACTIVE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Media management.
|
||||
*/
|
||||
static int
|
||||
temac_mediachange(struct ifnet *ifp)
|
||||
{
|
||||
struct temac_softc *sc = (struct temac_softc *)ifp->if_softc;
|
||||
|
||||
if (ifp->if_flags & IFF_UP)
|
||||
mii_mediachg(&sc->sc_mii);
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void
|
||||
temac_mediastatus(struct ifnet *ifp, struct ifmediareq *imr)
|
||||
{
|
||||
struct temac_softc *sc = (struct temac_softc *)ifp->if_softc;
|
||||
|
||||
mii_pollstat(&sc->sc_mii);
|
||||
|
||||
imr->ifm_status = sc->sc_mii.mii_media_status;
|
||||
imr->ifm_active = sc->sc_mii.mii_media_active;
|
||||
}
|
||||
|
||||
static int
|
||||
temac_mii_readreg(struct device *self, int phy, int reg)
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_bm.c,v 1.35 2007/12/29 23:12:38 dyoung Exp $ */
|
||||
/* $NetBSD: if_bm.c,v 1.36 2008/01/19 22:10:15 dyoung Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1998, 1999, 2000 Tsubai Masanari. All rights reserved.
|
||||
@ -27,7 +27,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_bm.c,v 1.35 2007/12/29 23:12:38 dyoung Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_bm.c,v 1.36 2008/01/19 22:10:15 dyoung Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
#include "bpfilter.h"
|
||||
@ -115,8 +115,6 @@ int bmac_put(struct bmac_softc *, void *, struct mbuf *);
|
||||
struct mbuf *bmac_get(struct bmac_softc *, void *, int);
|
||||
void bmac_watchdog(struct ifnet *);
|
||||
int bmac_ioctl(struct ifnet *, u_long, void *);
|
||||
int bmac_mediachange(struct ifnet *);
|
||||
void bmac_mediastatus(struct ifnet *, struct ifmediareq *);
|
||||
void bmac_setladrf(struct bmac_softc *);
|
||||
|
||||
int bmac_mii_readreg(struct device *, int, int);
|
||||
@ -248,7 +246,8 @@ bmac_attach(struct device *parent, struct device *self, void *aux)
|
||||
mii->mii_writereg = bmac_mii_writereg;
|
||||
mii->mii_statchg = bmac_mii_statchg;
|
||||
|
||||
ifmedia_init(&mii->mii_media, 0, bmac_mediachange, bmac_mediastatus);
|
||||
sc->sc_ethercom.ec_mii = mii;
|
||||
ifmedia_init(&mii->mii_media, 0, ether_mediachange, ether_mediastatus);
|
||||
mii_attach(&sc->sc_dev, mii, 0xffffffff, MII_PHY_ANY,
|
||||
MII_OFFSET_ANY, 0);
|
||||
|
||||
@ -524,7 +523,7 @@ next:
|
||||
cmd->d_resid = 0;
|
||||
sc->sc_rxlast = i + 1;
|
||||
}
|
||||
bmac_mediachange(ifp);
|
||||
ether_mediachange(ifp);
|
||||
|
||||
dbdma_continue(sc->sc_rxdma);
|
||||
|
||||
@ -728,7 +727,6 @@ bmac_ioctl(ifp, cmd, data)
|
||||
{
|
||||
struct bmac_softc *sc = ifp->if_softc;
|
||||
struct ifaddr *ifa = (struct ifaddr *)data;
|
||||
struct ifreq *ifr = (struct ifreq *)data;
|
||||
int s, error = 0;
|
||||
|
||||
s = splnet();
|
||||
@ -783,6 +781,8 @@ bmac_ioctl(ifp, cmd, data)
|
||||
|
||||
case SIOCADDMULTI:
|
||||
case SIOCDELMULTI:
|
||||
case SIOCGIFMEDIA:
|
||||
case SIOCSIFMEDIA:
|
||||
if ((error = ether_ioctl(ifp, cmd, data)) == ENETRESET) {
|
||||
/*
|
||||
* Multicast list has changed; set the hardware filter
|
||||
@ -795,12 +795,6 @@ bmac_ioctl(ifp, cmd, data)
|
||||
error = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case SIOCGIFMEDIA:
|
||||
case SIOCSIFMEDIA:
|
||||
error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, cmd);
|
||||
break;
|
||||
|
||||
default:
|
||||
error = EINVAL;
|
||||
}
|
||||
@ -809,28 +803,6 @@ bmac_ioctl(ifp, cmd, data)
|
||||
return error;
|
||||
}
|
||||
|
||||
int
|
||||
bmac_mediachange(ifp)
|
||||
struct ifnet *ifp;
|
||||
{
|
||||
struct bmac_softc *sc = ifp->if_softc;
|
||||
|
||||
return mii_mediachg(&sc->sc_mii);
|
||||
}
|
||||
|
||||
void
|
||||
bmac_mediastatus(ifp, ifmr)
|
||||
struct ifnet *ifp;
|
||||
struct ifmediareq *ifmr;
|
||||
{
|
||||
struct bmac_softc *sc = ifp->if_softc;
|
||||
|
||||
mii_pollstat(&sc->sc_mii);
|
||||
|
||||
ifmr->ifm_status = sc->sc_mii.mii_media_status;
|
||||
ifmr->ifm_active = sc->sc_mii.mii_media_active;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set up the logical address filter.
|
||||
*/
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_gm.c,v 1.32 2007/12/29 23:14:06 dyoung Exp $ */
|
||||
/* $NetBSD: if_gm.c,v 1.33 2008/01/19 22:10:15 dyoung Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000 Tsubai Masanari. All rights reserved.
|
||||
@ -27,7 +27,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_gm.c,v 1.32 2007/12/29 23:14:06 dyoung Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_gm.c,v 1.33 2008/01/19 22:10:15 dyoung Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
#include "rnd.h"
|
||||
@ -123,8 +123,6 @@ void gmac_setladrf(struct gmac_softc *);
|
||||
int gmac_ioctl(struct ifnet *, u_long, void *);
|
||||
void gmac_watchdog(struct ifnet *);
|
||||
|
||||
int gmac_mediachange(struct ifnet *);
|
||||
void gmac_mediastatus(struct ifnet *, struct ifmediareq *);
|
||||
int gmac_mii_readreg(struct device *, int, int);
|
||||
void gmac_mii_writereg(struct device *, int, int, int);
|
||||
void gmac_mii_statchg(struct device *);
|
||||
@ -246,7 +244,8 @@ gmac_attach(parent, self, aux)
|
||||
mii->mii_writereg = gmac_mii_writereg;
|
||||
mii->mii_statchg = gmac_mii_statchg;
|
||||
|
||||
ifmedia_init(&mii->mii_media, 0, gmac_mediachange, gmac_mediastatus);
|
||||
sc->sc_ethercom.ec_mii = mii;
|
||||
ifmedia_init(&mii->mii_media, 0, ether_mediachange, ether_mediastatus);
|
||||
mii_attach(self, mii, 0xffffffff, MII_PHY_ANY, MII_OFFSET_ANY, 0);
|
||||
|
||||
/* Choose a default media. */
|
||||
@ -854,6 +853,8 @@ gmac_ioctl(ifp, cmd, data)
|
||||
|
||||
case SIOCADDMULTI:
|
||||
case SIOCDELMULTI:
|
||||
case SIOCGIFMEDIA:
|
||||
case SIOCSIFMEDIA:
|
||||
if ((error = ether_ioctl(ifp, cmd, data)) == ENETRESET) {
|
||||
/*
|
||||
* Multicast list has changed; set the hardware filter
|
||||
@ -866,12 +867,6 @@ gmac_ioctl(ifp, cmd, data)
|
||||
error = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case SIOCGIFMEDIA:
|
||||
case SIOCSIFMEDIA:
|
||||
error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, cmd);
|
||||
break;
|
||||
|
||||
default:
|
||||
error = EINVAL;
|
||||
}
|
||||
@ -893,28 +888,6 @@ gmac_watchdog(ifp)
|
||||
gmac_init(sc);
|
||||
}
|
||||
|
||||
int
|
||||
gmac_mediachange(ifp)
|
||||
struct ifnet *ifp;
|
||||
{
|
||||
struct gmac_softc *sc = ifp->if_softc;
|
||||
|
||||
return mii_mediachg(&sc->sc_mii);
|
||||
}
|
||||
|
||||
void
|
||||
gmac_mediastatus(ifp, ifmr)
|
||||
struct ifnet *ifp;
|
||||
struct ifmediareq *ifmr;
|
||||
{
|
||||
struct gmac_softc *sc = ifp->if_softc;
|
||||
|
||||
mii_pollstat(&sc->sc_mii);
|
||||
|
||||
ifmr->ifm_status = sc->sc_mii.mii_media_status;
|
||||
ifmr->ifm_active = sc->sc_mii.mii_media_active;
|
||||
}
|
||||
|
||||
int
|
||||
gmac_mii_readreg(dev, phy, reg)
|
||||
struct device *dev;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_aumac.c,v 1.23 2007/10/17 19:55:35 garbled Exp $ */
|
||||
/* $NetBSD: if_aumac.c,v 1.24 2008/01/19 22:10:15 dyoung Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001 Wasabi Systems, Inc.
|
||||
@ -46,7 +46,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_aumac.c,v 1.23 2007/10/17 19:55:35 garbled Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_aumac.c,v 1.24 2008/01/19 22:10:15 dyoung Exp $");
|
||||
|
||||
#include "bpfilter.h"
|
||||
#include "rnd.h"
|
||||
@ -202,9 +202,6 @@ static void aumac_mii_writereg(struct device *, int, int, int);
|
||||
static void aumac_mii_statchg(struct device *);
|
||||
static int aumac_mii_wait(struct aumac_softc *, const char *);
|
||||
|
||||
static int aumac_mediachange(struct ifnet *);
|
||||
static void aumac_mediastatus(struct ifnet *, struct ifmediareq *);
|
||||
|
||||
static int aumac_match(struct device *, struct cfdata *, void *);
|
||||
static void aumac_attach(struct device *, struct device *, void *);
|
||||
|
||||
@ -326,8 +323,9 @@ aumac_attach(struct device *parent, struct device *self, void *aux)
|
||||
sc->sc_mii.mii_readreg = aumac_mii_readreg;
|
||||
sc->sc_mii.mii_writereg = aumac_mii_writereg;
|
||||
sc->sc_mii.mii_statchg = aumac_mii_statchg;
|
||||
ifmedia_init(&sc->sc_mii.mii_media, 0, aumac_mediachange,
|
||||
aumac_mediastatus);
|
||||
sc->sc_ethercom.ec_mii = &sc->sc_mii;
|
||||
ifmedia_init(&sc->sc_mii.mii_media, 0, ether_mediachange,
|
||||
ether_mediastatus);
|
||||
|
||||
mii_attach(&sc->sc_dev, &sc->sc_mii, 0xffffffff, MII_PHY_ANY,
|
||||
MII_OFFSET_ANY, 0);
|
||||
@ -507,23 +505,14 @@ aumac_ioctl(struct ifnet *ifp, u_long cmd, void *data)
|
||||
|
||||
s = splnet();
|
||||
|
||||
switch (cmd) {
|
||||
case SIOCSIFMEDIA:
|
||||
case SIOCGIFMEDIA:
|
||||
error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, cmd);
|
||||
break;
|
||||
|
||||
default:
|
||||
error = ether_ioctl(ifp, cmd, data);
|
||||
if (error == ENETRESET) {
|
||||
/*
|
||||
* Multicast list has changed; set the hardware filter
|
||||
* accordingly.
|
||||
*/
|
||||
if (ifp->if_flags & IFF_RUNNING)
|
||||
aumac_set_filter(sc);
|
||||
}
|
||||
break;
|
||||
error = ether_ioctl(ifp, cmd, data);
|
||||
if (error == ENETRESET) {
|
||||
/*
|
||||
* Multicast list has changed; set the hardware filter
|
||||
* accordingly.
|
||||
*/
|
||||
if (ifp->if_flags & IFF_RUNNING)
|
||||
aumac_set_filter(sc);
|
||||
}
|
||||
|
||||
/* Try to get more packets going. */
|
||||
@ -828,7 +817,8 @@ aumac_init(struct ifnet *ifp)
|
||||
#endif
|
||||
|
||||
/* Set the media. */
|
||||
aumac_mediachange(ifp);
|
||||
if ((error = ether_mediachange(ifp)) != 0)
|
||||
goto out;
|
||||
|
||||
/*
|
||||
* Set the receive filter. This will actually start the transmit
|
||||
@ -843,6 +833,7 @@ aumac_init(struct ifnet *ifp)
|
||||
ifp->if_flags |= IFF_RUNNING;
|
||||
ifp->if_flags &= ~IFF_OACTIVE;
|
||||
|
||||
out:
|
||||
if (error)
|
||||
printf("%s: interface not running\n", sc->sc_dev.dv_xname);
|
||||
return (error);
|
||||
@ -995,36 +986,6 @@ aumac_set_filter(struct aumac_softc *sc)
|
||||
sc->sc_control);
|
||||
}
|
||||
|
||||
/*
|
||||
* aumac_mediastatus: [ifmedia interface function]
|
||||
*
|
||||
* Get the current interface media status.
|
||||
*/
|
||||
static void
|
||||
aumac_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr)
|
||||
{
|
||||
struct aumac_softc *sc = ifp->if_softc;
|
||||
|
||||
mii_pollstat(&sc->sc_mii);
|
||||
ifmr->ifm_status = sc->sc_mii.mii_media_status;
|
||||
ifmr->ifm_active = sc->sc_mii.mii_media_active;
|
||||
}
|
||||
|
||||
/*
|
||||
* aumac_mediachange: [ifmedia interface function]
|
||||
*
|
||||
* Set hardware to newly selected media.
|
||||
*/
|
||||
static int
|
||||
aumac_mediachange(struct ifnet *ifp)
|
||||
{
|
||||
struct aumac_softc *sc = ifp->if_softc;
|
||||
|
||||
if (ifp->if_flags & IFF_UP)
|
||||
mii_mediachg(&sc->sc_mii);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* aumac_mii_wait:
|
||||
*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: if_ae.c,v 1.9 2007/10/17 19:55:35 garbled Exp $ */
|
||||
/* $Id: if_ae.c,v 1.10 2008/01/19 22:10:15 dyoung Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 2006 Urbana-Champaign Independent Media Center.
|
||||
* Copyright (c) 2006 Garrett D'Amore.
|
||||
@ -105,7 +105,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_ae.c,v 1.9 2007/10/17 19:55:35 garbled Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_ae.c,v 1.10 2008/01/19 22:10:15 dyoung Exp $");
|
||||
|
||||
#include "bpfilter.h"
|
||||
|
||||
@ -164,9 +164,6 @@ static int ae_activate(struct device *, enum devact);
|
||||
static void ae_reset(struct ae_softc *);
|
||||
static void ae_idle(struct ae_softc *, u_int32_t);
|
||||
|
||||
static int ae_mediachange(struct ifnet *);
|
||||
static void ae_mediastatus(struct ifnet *, struct ifmediareq *);
|
||||
|
||||
static void ae_start(struct ifnet *);
|
||||
static void ae_watchdog(struct ifnet *);
|
||||
static int ae_ioctl(struct ifnet *, u_long, void *);
|
||||
@ -362,8 +359,9 @@ ae_attach(struct device *parent, struct device *self, void *aux)
|
||||
sc->sc_mii.mii_readreg = ae_mii_readreg;
|
||||
sc->sc_mii.mii_writereg = ae_mii_writereg;
|
||||
sc->sc_mii.mii_statchg = ae_mii_statchg;
|
||||
ifmedia_init(&sc->sc_mii.mii_media, 0, ae_mediachange,
|
||||
ae_mediastatus);
|
||||
sc->sc_ethercom.ec_mii = &sc->sc_mii;
|
||||
ifmedia_init(&sc->sc_mii.mii_media, 0, ether_mediachange,
|
||||
ether_mediastatus);
|
||||
mii_attach(&sc->sc_dev, &sc->sc_mii, 0xffffffff, MII_PHY_ANY,
|
||||
MII_OFFSET_ANY, 0);
|
||||
|
||||
@ -837,10 +835,6 @@ ae_ioctl(struct ifnet *ifp, u_long cmd, void *data)
|
||||
s = splnet();
|
||||
|
||||
switch (cmd) {
|
||||
case SIOCSIFMEDIA:
|
||||
case SIOCGIFMEDIA:
|
||||
error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, cmd);
|
||||
break;
|
||||
case SIOCSIFFLAGS:
|
||||
/* If the interface is up and running, only modify the receive
|
||||
* filter when setting promiscuous or debug mode. Otherwise
|
||||
@ -1465,7 +1459,8 @@ ae_init(struct ifnet *ifp)
|
||||
/*
|
||||
* Set the current media.
|
||||
*/
|
||||
ae_mediachange(ifp);
|
||||
if ((error = ether_mediachange(ifp)) != 0)
|
||||
goto out;
|
||||
|
||||
/*
|
||||
* Start the mac.
|
||||
@ -1847,48 +1842,6 @@ ae_idle(struct ae_softc *sc, u_int32_t bits)
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* Generic media support functions.
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* ae_mediastatus: [ifmedia interface function]
|
||||
*
|
||||
* Query the current media.
|
||||
*/
|
||||
void
|
||||
ae_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr)
|
||||
{
|
||||
struct ae_softc *sc = ifp->if_softc;
|
||||
|
||||
if (AE_IS_ENABLED(sc) == 0) {
|
||||
ifmr->ifm_active = IFM_ETHER | IFM_NONE;
|
||||
ifmr->ifm_status = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
mii_pollstat(&sc->sc_mii);
|
||||
ifmr->ifm_status = sc->sc_mii.mii_media_status;
|
||||
ifmr->ifm_active = sc->sc_mii.mii_media_active;
|
||||
}
|
||||
|
||||
/*
|
||||
* ae_mediachange: [ifmedia interface function]
|
||||
*
|
||||
* Update the current media.
|
||||
*/
|
||||
int
|
||||
ae_mediachange(struct ifnet *ifp)
|
||||
{
|
||||
struct ae_softc *sc = ifp->if_softc;
|
||||
|
||||
if ((ifp->if_flags & IFF_UP) == 0)
|
||||
return (0);
|
||||
|
||||
mii_mediachg(&sc->sc_mii);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* Support functions for MII-attached media.
|
||||
*****************************************************************************/
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: sbmac.c,v 1.26 2007/10/17 19:55:40 garbled Exp $ */
|
||||
/* $NetBSD: sbmac.c,v 1.27 2008/01/19 22:10:15 dyoung Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 2000, 2001, 2004
|
||||
@ -33,7 +33,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: sbmac.c,v 1.26 2007/10/17 19:55:40 garbled Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: sbmac.c,v 1.27 2008/01/19 22:10:15 dyoung Exp $");
|
||||
|
||||
#include "bpfilter.h"
|
||||
#include "opt_inet.h"
|
||||
@ -257,8 +257,6 @@ static void sbmac_start(struct ifnet *ifp);
|
||||
static void sbmac_setmulti(struct sbmac_softc *sc);
|
||||
static int sbmac_ether_ioctl(struct ifnet *ifp, u_long cmd, void *data);
|
||||
static int sbmac_ioctl(struct ifnet *ifp, u_long command, void *data);
|
||||
static int sbmac_mediachange(struct ifnet *ifp);
|
||||
static void sbmac_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr);
|
||||
static void sbmac_watchdog(struct ifnet *ifp);
|
||||
static int sbmac_match(struct device *parent, struct cfdata *match, void *aux);
|
||||
static void sbmac_attach(struct device *parent, struct device *self, void *aux);
|
||||
@ -2063,14 +2061,13 @@ sbmac_ioctl(struct ifnet *ifp, u_long command, void *data)
|
||||
|
||||
case SIOCADDMULTI:
|
||||
case SIOCDELMULTI:
|
||||
if (ifp->if_flags & IFF_RUNNING) {
|
||||
sbmac_setmulti(sc);
|
||||
error = 0;
|
||||
}
|
||||
break;
|
||||
case SIOCSIFMEDIA:
|
||||
case SIOCGIFMEDIA:
|
||||
error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, command);
|
||||
if ((error = ether_ioctl(ifp, command, data)) == ENETRESET) {
|
||||
error = 0;
|
||||
if (ifp->if_flags & IFF_RUNNING)
|
||||
sbmac_setmulti(sc);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
error = EINVAL;
|
||||
@ -2096,16 +2093,6 @@ sbmac_ioctl(struct ifnet *ifp, u_long command, void *data)
|
||||
* else error code
|
||||
*/
|
||||
|
||||
static int
|
||||
sbmac_mediachange(struct ifnet *ifp)
|
||||
{
|
||||
struct sbmac_softc *sc = ifp->if_softc;
|
||||
|
||||
if (ifp->if_flags & IFF_UP)
|
||||
mii_mediachg(&sc->sc_mii);
|
||||
return(0);
|
||||
}
|
||||
|
||||
/*
|
||||
* SBMAC_IFMEDIA_STS(ifp, ifmr)
|
||||
*
|
||||
@ -2119,16 +2106,6 @@ sbmac_mediachange(struct ifnet *ifp)
|
||||
* nothing
|
||||
*/
|
||||
|
||||
static void
|
||||
sbmac_mediastatus(struct ifnet *ifp, struct ifmediareq *req)
|
||||
{
|
||||
struct sbmac_softc *sc = ifp->if_softc;
|
||||
|
||||
mii_pollstat(&sc->sc_mii);
|
||||
req->ifm_status = sc->sc_mii.mii_media_status;
|
||||
req->ifm_active = sc->sc_mii.mii_media_active;
|
||||
}
|
||||
|
||||
/*
|
||||
* SBMAC_WATCHDOG(ifp)
|
||||
*
|
||||
@ -2387,8 +2364,9 @@ sbmac_attach(struct device *parent, struct device *self, void *aux)
|
||||
sc->sc_mii.mii_readreg = sbmac_mii_readreg;
|
||||
sc->sc_mii.mii_writereg = sbmac_mii_writereg;
|
||||
sc->sc_mii.mii_statchg = sbmac_mii_statchg;
|
||||
ifmedia_init(&sc->sc_mii.mii_media, 0, sbmac_mediachange,
|
||||
sbmac_mediastatus);
|
||||
sc->sc_ethercom.ec_mii = &sc->sc_mii;
|
||||
ifmedia_init(&sc->sc_mii.mii_media, 0, ether_mediachange,
|
||||
ether_mediastatus);
|
||||
mii_attach(&sc->sc_dev, &sc->sc_mii, 0xffffffff, MII_PHY_ANY,
|
||||
MII_OFFSET_ANY, 0);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: emac3.c,v 1.5 2007/12/15 00:39:21 perry Exp $ */
|
||||
/* $NetBSD: emac3.c,v 1.6 2008/01/19 22:10:15 dyoung Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
@ -41,7 +41,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: emac3.c,v 1.5 2007/12/15 00:39:21 perry Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: emac3.c,v 1.6 2008/01/19 22:10:15 dyoung Exp $");
|
||||
|
||||
#include "debug_playstation2.h"
|
||||
|
||||
@ -313,28 +313,6 @@ emac3_config(const u_int8_t *eaddr)
|
||||
/*
|
||||
* PHY/MII
|
||||
*/
|
||||
int
|
||||
emac3_ifmedia_upd(struct ifnet *ifp)
|
||||
{
|
||||
struct emac3_softc *sc;
|
||||
|
||||
sc = ifp->if_softc;
|
||||
|
||||
return (mii_mediachg(&sc->mii));
|
||||
}
|
||||
|
||||
void
|
||||
emac3_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
|
||||
{
|
||||
struct emac3_softc *sc;
|
||||
|
||||
sc = ifp->if_softc;
|
||||
|
||||
mii_pollstat(&sc->mii);
|
||||
ifmr->ifm_status = sc->mii.mii_media_status;
|
||||
ifmr->ifm_active = sc->mii.mii_media_active;
|
||||
}
|
||||
|
||||
void
|
||||
emac3_phy_writereg(struct device *self, int phy, int reg, int data)
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: emac3var.h,v 1.1 2001/10/16 15:38:33 uch Exp $ */
|
||||
/* $NetBSD: emac3var.h,v 1.2 2008/01/19 22:10:15 dyoung Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
@ -60,8 +60,6 @@ int emac3_tx_done(void);
|
||||
|
||||
void emac3_setmulti(struct emac3_softc *, struct ethercom *);
|
||||
|
||||
int emac3_ifmedia_upd(struct ifnet *);
|
||||
void emac3_ifmedia_sts(struct ifnet *, struct ifmediareq *);
|
||||
int emac3_phy_readreg(struct device *, int, int);
|
||||
void emac3_phy_writereg(struct device *, int, int, int);
|
||||
void emac3_phy_statchg(struct device *);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_smap.c,v 1.10 2007/12/15 00:39:21 perry Exp $ */
|
||||
/* $NetBSD: if_smap.c,v 1.11 2008/01/19 22:10:15 dyoung Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
@ -37,7 +37,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_smap.c,v 1.10 2007/12/15 00:39:21 perry Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_smap.c,v 1.11 2008/01/19 22:10:15 dyoung Exp $");
|
||||
|
||||
#include "debug_playstation2.h"
|
||||
|
||||
@ -250,7 +250,8 @@ smap_attach(struct device *parent, struct device *self, void *aux)
|
||||
mii->mii_readreg = emac3_phy_readreg;
|
||||
mii->mii_writereg = emac3_phy_writereg;
|
||||
mii->mii_statchg = emac3_phy_statchg;
|
||||
ifmedia_init(&mii->mii_media, 0, emac3_ifmedia_upd, emac3_ifmedia_sts);
|
||||
sc->ethercom.ec_mii = mii;
|
||||
ifmedia_init(&mii->mii_media, 0, ether_mediachange, ether_mediastatus);
|
||||
mii_attach(&emac3->dev, mii, 0xffffffff, MII_PHY_ANY,
|
||||
MII_OFFSET_ANY, 0);
|
||||
|
||||
@ -282,22 +283,12 @@ smap_ioctl(struct ifnet *ifp, u_long command, void *data)
|
||||
|
||||
s = splnet();
|
||||
|
||||
switch (command) {
|
||||
case SIOCGIFMEDIA:
|
||||
case SIOCSIFMEDIA:
|
||||
error = ifmedia_ioctl(ifp, ifr, &sc->emac3.mii.mii_media,
|
||||
command);
|
||||
break;
|
||||
error = ether_ioctl(ifp, command, data);
|
||||
|
||||
default:
|
||||
error = ether_ioctl(ifp, command, data);
|
||||
|
||||
if (error == ENETRESET) {
|
||||
if (ifp->if_flags & IFF_RUNNING)
|
||||
emac3_setmulti(&sc->emac3, &sc->ethercom);
|
||||
error = 0;
|
||||
}
|
||||
break;
|
||||
if (error == ENETRESET) {
|
||||
if (ifp->if_flags & IFF_RUNNING)
|
||||
emac3_setmulti(&sc->emac3, &sc->ethercom);
|
||||
error = 0;
|
||||
}
|
||||
|
||||
splx(s);
|
||||
@ -615,6 +606,7 @@ smap_init(struct ifnet *ifp)
|
||||
{
|
||||
struct smap_softc *sc = ifp->if_softc;
|
||||
u_int16_t r16;
|
||||
int rc;
|
||||
|
||||
smap_fifo_init(sc);
|
||||
emac3_reset(&sc->emac3);
|
||||
@ -636,7 +628,10 @@ smap_init(struct ifnet *ifp)
|
||||
emac3_setmulti(&sc->emac3, &sc->ethercom);
|
||||
|
||||
/* Set current media. */
|
||||
mii_mediachg(&sc->emac3.mii);
|
||||
if ((rc = mii_mediachg(&sc->emac3.mii)) == ENXIO)
|
||||
rc = 0;
|
||||
else if (rc != 0)
|
||||
return rc;
|
||||
|
||||
ifp->if_flags |= IFF_RUNNING;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_emac.c,v 1.30 2007/10/17 19:56:39 garbled Exp $ */
|
||||
/* $NetBSD: if_emac.c,v 1.31 2008/01/19 22:10:16 dyoung Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 2001, 2002 Wasabi Systems, Inc.
|
||||
@ -36,7 +36,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_emac.c,v 1.30 2007/10/17 19:56:39 garbled Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_emac.c,v 1.31 2008/01/19 22:10:16 dyoung Exp $");
|
||||
|
||||
#include "bpfilter.h"
|
||||
|
||||
@ -270,8 +270,6 @@ static int emac_txde_intr(void *);
|
||||
static int emac_rxde_intr(void *);
|
||||
static int emac_intr(void *);
|
||||
|
||||
static int emac_mediachange(struct ifnet *);
|
||||
static void emac_mediastatus(struct ifnet *, struct ifmediareq *);
|
||||
static int emac_mii_readreg(struct device *, int, int);
|
||||
static void emac_mii_statchg(struct device *);
|
||||
static void emac_mii_tick(void *);
|
||||
@ -419,8 +417,8 @@ emac_attach(struct device *parent, struct device *self, void *aux)
|
||||
mii->mii_writereg = emac_mii_writereg;
|
||||
mii->mii_statchg = emac_mii_statchg;
|
||||
|
||||
ifmedia_init(&mii->mii_media, 0, emac_mediachange,
|
||||
emac_mediastatus);
|
||||
sc->sc_ethercom.ec_mii = mii;
|
||||
ifmedia_init(&mii->mii_media, 0, ether_mediachange, ether_mediastatus);
|
||||
mii_attach(&sc->sc_dev, mii, 0xffffffff,
|
||||
MII_PHY_ANY, MII_OFFSET_ANY, 0);
|
||||
if (LIST_FIRST(&mii->mii_phys) == NULL) {
|
||||
@ -778,7 +776,8 @@ emac_init(struct ifnet *ifp)
|
||||
/*
|
||||
* Set the current media.
|
||||
*/
|
||||
mii_mediachg(&sc->sc_mii);
|
||||
if ((error = ether_mediachange(ifp)) != 0)
|
||||
goto out;
|
||||
|
||||
/*
|
||||
* Give the transmit and receive rings to the MAL.
|
||||
@ -1018,25 +1017,16 @@ emac_ioctl(struct ifnet *ifp, u_long cmd, void *data)
|
||||
|
||||
s = splnet();
|
||||
|
||||
switch (cmd) {
|
||||
case SIOCSIFMEDIA:
|
||||
case SIOCGIFMEDIA:
|
||||
error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, cmd);
|
||||
break;
|
||||
|
||||
default:
|
||||
error = ether_ioctl(ifp, cmd, data);
|
||||
if (error == ENETRESET) {
|
||||
/*
|
||||
* Multicast list has changed; set the hardware filter
|
||||
* accordingly.
|
||||
*/
|
||||
if (ifp->if_flags & IFF_RUNNING)
|
||||
error = emac_set_filter(sc);
|
||||
else
|
||||
error = 0;
|
||||
}
|
||||
break;
|
||||
error = ether_ioctl(ifp, cmd, data);
|
||||
if (error == ENETRESET) {
|
||||
/*
|
||||
* Multicast list has changed; set the hardware filter
|
||||
* accordingly.
|
||||
*/
|
||||
if (ifp->if_flags & IFF_RUNNING)
|
||||
error = emac_set_filter(sc);
|
||||
else
|
||||
error = 0;
|
||||
}
|
||||
|
||||
/* try to get more packets going */
|
||||
@ -1564,26 +1554,3 @@ emac_mii_tick(void *arg)
|
||||
|
||||
callout_reset(&sc->sc_callout, hz, emac_mii_tick, sc);
|
||||
}
|
||||
|
||||
/* ifmedia interface function */
|
||||
static void
|
||||
emac_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr)
|
||||
{
|
||||
struct emac_softc *sc = ifp->if_softc;
|
||||
|
||||
mii_pollstat(&sc->sc_mii);
|
||||
|
||||
ifmr->ifm_status = sc->sc_mii.mii_media_status;
|
||||
ifmr->ifm_active = sc->sc_mii.mii_media_active;
|
||||
}
|
||||
|
||||
/* ifmedia interface function */
|
||||
static int
|
||||
emac_mediachange(struct ifnet *ifp)
|
||||
{
|
||||
struct emac_softc *sc = ifp->if_softc;
|
||||
|
||||
if (ifp->if_flags & IFF_UP)
|
||||
mii_mediachg(&sc->sc_mii);
|
||||
return (0);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_mec.c,v 1.14 2007/12/29 17:53:23 tsutsui Exp $ */
|
||||
/* $NetBSD: if_mec.c,v 1.15 2008/01/19 22:10:16 dyoung Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2004 Izumi Tsutsui.
|
||||
@ -64,7 +64,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_mec.c,v 1.14 2007/12/29 17:53:23 tsutsui Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_mec.c,v 1.15 2008/01/19 22:10:16 dyoung Exp $");
|
||||
|
||||
#include "opt_ddb.h"
|
||||
#include "bpfilter.h"
|
||||
@ -338,8 +338,6 @@ STATIC int mec_mii_readreg(struct device *, int, int);
|
||||
STATIC void mec_mii_writereg(struct device *, int, int, int);
|
||||
STATIC int mec_mii_wait(struct mec_softc *);
|
||||
STATIC void mec_statchg(struct device *);
|
||||
STATIC void mec_mediastatus(struct ifnet *, struct ifmediareq *);
|
||||
STATIC int mec_mediachange(struct ifnet *);
|
||||
|
||||
static void enaddr_aton(const char *, uint8_t *);
|
||||
|
||||
@ -475,8 +473,9 @@ mec_attach(struct device *parent, struct device *self, void *aux)
|
||||
sc->sc_mii.mii_statchg = mec_statchg;
|
||||
|
||||
/* Set up PHY properties */
|
||||
ifmedia_init(&sc->sc_mii.mii_media, 0, mec_mediachange,
|
||||
mec_mediastatus);
|
||||
sc->sc_ethercom.ec_mii = &sc->sc_mii;
|
||||
ifmedia_init(&sc->sc_mii.mii_media, 0, ether_mediachange,
|
||||
ether_mediastatus);
|
||||
mii_attach(&sc->sc_dev, &sc->sc_mii, 0xffffffff, MII_PHY_ANY,
|
||||
MII_OFFSET_ANY, 0);
|
||||
|
||||
@ -642,30 +641,6 @@ mec_statchg(struct device *self)
|
||||
bus_space_write_8(st, sh, MEC_MAC_CONTROL, control);
|
||||
}
|
||||
|
||||
STATIC void
|
||||
mec_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr)
|
||||
{
|
||||
struct mec_softc *sc = ifp->if_softc;
|
||||
|
||||
if ((ifp->if_flags & IFF_UP) == 0)
|
||||
return;
|
||||
|
||||
mii_pollstat(&sc->sc_mii);
|
||||
ifmr->ifm_status = sc->sc_mii.mii_media_status;
|
||||
ifmr->ifm_active = sc->sc_mii.mii_media_active;
|
||||
}
|
||||
|
||||
STATIC int
|
||||
mec_mediachange(struct ifnet *ifp)
|
||||
{
|
||||
struct mec_softc *sc = ifp->if_softc;
|
||||
|
||||
if ((ifp->if_flags & IFF_UP) == 0)
|
||||
return 0;
|
||||
|
||||
return mii_mediachg(&sc->sc_mii);
|
||||
}
|
||||
|
||||
/*
|
||||
* XXX
|
||||
* maybe this function should be moved to common part
|
||||
@ -703,7 +678,7 @@ mec_init(struct ifnet *ifp)
|
||||
bus_space_tag_t st = sc->sc_st;
|
||||
bus_space_handle_t sh = sc->sc_sh;
|
||||
struct mec_rxdesc *rxd;
|
||||
int i;
|
||||
int i, rc;
|
||||
|
||||
/* cancel any pending I/O */
|
||||
mec_stop(ifp, 0);
|
||||
@ -747,12 +722,13 @@ mec_init(struct ifnet *ifp)
|
||||
|
||||
callout_reset(&sc->sc_tick_ch, hz, mec_tick, sc);
|
||||
|
||||
if ((rc = ether_mediachange(ifp)) != 0)
|
||||
return rc;
|
||||
|
||||
ifp->if_flags |= IFF_RUNNING;
|
||||
ifp->if_flags &= ~IFF_OACTIVE;
|
||||
mec_start(ifp);
|
||||
|
||||
mii_mediachg(&sc->sc_mii);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1107,25 +1083,16 @@ mec_ioctl(struct ifnet *ifp, u_long cmd, void *data)
|
||||
|
||||
s = splnet();
|
||||
|
||||
switch (cmd) {
|
||||
case SIOCSIFMEDIA:
|
||||
case SIOCGIFMEDIA:
|
||||
error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, cmd);
|
||||
break;
|
||||
|
||||
default:
|
||||
error = ether_ioctl(ifp, cmd, data);
|
||||
if (error == ENETRESET) {
|
||||
/*
|
||||
* Multicast list has changed; set the hardware filter
|
||||
* accordingly.
|
||||
*/
|
||||
if (ifp->if_flags & IFF_RUNNING)
|
||||
error = mec_init(ifp);
|
||||
else
|
||||
error = 0;
|
||||
}
|
||||
break;
|
||||
error = ether_ioctl(ifp, cmd, data);
|
||||
if (error == ENETRESET) {
|
||||
/*
|
||||
* Multicast list has changed; set the hardware filter
|
||||
* accordingly.
|
||||
*/
|
||||
if (ifp->if_flags & IFF_RUNNING)
|
||||
error = mec_init(ifp);
|
||||
else
|
||||
error = 0;
|
||||
}
|
||||
|
||||
/* Try to get more packets going. */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: aic6915.c,v 1.19 2007/10/19 11:59:46 ad Exp $ */
|
||||
/* $NetBSD: aic6915.c,v 1.20 2008/01/19 22:10:16 dyoung Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
@ -42,7 +42,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: aic6915.c,v 1.19 2007/10/19 11:59:46 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: aic6915.c,v 1.20 2008/01/19 22:10:16 dyoung Exp $");
|
||||
|
||||
#include "bpfilter.h"
|
||||
|
||||
@ -101,9 +101,6 @@ static void sf_mii_statchg(struct device *);
|
||||
|
||||
static void sf_tick(void *);
|
||||
|
||||
static int sf_mediachange(struct ifnet *);
|
||||
static void sf_mediastatus(struct ifnet *, struct ifmediareq *);
|
||||
|
||||
#define sf_funcreg_read(sc, reg) \
|
||||
bus_space_read_4((sc)->sc_st, (sc)->sc_sh_func, (reg))
|
||||
#define sf_funcreg_write(sc, reg, val) \
|
||||
@ -271,8 +268,9 @@ sf_attach(struct sf_softc *sc)
|
||||
sc->sc_mii.mii_readreg = sf_mii_read;
|
||||
sc->sc_mii.mii_writereg = sf_mii_write;
|
||||
sc->sc_mii.mii_statchg = sf_mii_statchg;
|
||||
ifmedia_init(&sc->sc_mii.mii_media, IFM_IMASK, sf_mediachange,
|
||||
sf_mediastatus);
|
||||
sc->sc_ethercom.ec_mii = &sc->sc_mii;
|
||||
ifmedia_init(&sc->sc_mii.mii_media, IFM_IMASK, ether_mediachange,
|
||||
ether_mediastatus);
|
||||
mii_attach(&sc->sc_dev, &sc->sc_mii, 0xffffffff, MII_PHY_ANY,
|
||||
MII_OFFSET_ANY, 0);
|
||||
if (LIST_FIRST(&sc->sc_mii.mii_phys) == NULL) {
|
||||
@ -527,29 +525,19 @@ static int
|
||||
sf_ioctl(struct ifnet *ifp, u_long cmd, void *data)
|
||||
{
|
||||
struct sf_softc *sc = ifp->if_softc;
|
||||
struct ifreq *ifr = (struct ifreq *) data;
|
||||
int s, error;
|
||||
|
||||
s = splnet();
|
||||
|
||||
switch (cmd) {
|
||||
case SIOCSIFMEDIA:
|
||||
case SIOCGIFMEDIA:
|
||||
error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, cmd);
|
||||
break;
|
||||
|
||||
default:
|
||||
error = ether_ioctl(ifp, cmd, data);
|
||||
if (error == ENETRESET) {
|
||||
/*
|
||||
* Multicast list has changed; set the hardware filter
|
||||
* accordingly.
|
||||
*/
|
||||
if (ifp->if_flags & IFF_RUNNING)
|
||||
sf_set_filter(sc);
|
||||
error = 0;
|
||||
}
|
||||
break;
|
||||
error = ether_ioctl(ifp, cmd, data);
|
||||
if (error == ENETRESET) {
|
||||
/*
|
||||
* Multicast list has changed; set the hardware filter
|
||||
* accordingly.
|
||||
*/
|
||||
if (ifp->if_flags & IFF_RUNNING)
|
||||
sf_set_filter(sc);
|
||||
error = 0;
|
||||
}
|
||||
|
||||
/* Try to get more packets going. */
|
||||
@ -1088,7 +1076,8 @@ sf_init(struct ifnet *ifp)
|
||||
/*
|
||||
* Set the media.
|
||||
*/
|
||||
mii_mediachg(&sc->sc_mii);
|
||||
if ((error = ether_mediachange(ifp)) != 0)
|
||||
goto out;
|
||||
|
||||
/*
|
||||
* Initialize the interrupt register.
|
||||
@ -1443,33 +1432,3 @@ sf_mii_statchg(struct device *self)
|
||||
|
||||
sf_genreg_write(sc, SF_BkToBkIPG, ipg);
|
||||
}
|
||||
|
||||
/*
|
||||
* sf_mediastatus: [ifmedia interface function]
|
||||
*
|
||||
* Callback from ifmedia to request current media status.
|
||||
*/
|
||||
static void
|
||||
sf_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr)
|
||||
{
|
||||
struct sf_softc *sc = ifp->if_softc;
|
||||
|
||||
mii_pollstat(&sc->sc_mii);
|
||||
ifmr->ifm_status = sc->sc_mii.mii_media_status;
|
||||
ifmr->ifm_active = sc->sc_mii.mii_media_active;
|
||||
}
|
||||
|
||||
/*
|
||||
* sf_mediachange: [ifmedia interface function]
|
||||
*
|
||||
* Callback from ifmedia to request new media setting.
|
||||
*/
|
||||
static int
|
||||
sf_mediachange(struct ifnet *ifp)
|
||||
{
|
||||
struct sf_softc *sc = ifp->if_softc;
|
||||
|
||||
if (ifp->if_flags & IFF_UP)
|
||||
mii_mediachg(&sc->sc_mii);
|
||||
return (0);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ax88190.c,v 1.8 2007/10/19 11:59:48 ad Exp $ */
|
||||
/* $NetBSD: ax88190.c,v 1.9 2008/01/19 22:10:16 dyoung Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
@ -37,7 +37,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ax88190.c,v 1.8 2007/10/19 11:59:48 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ax88190.c,v 1.9 2008/01/19 22:10:16 dyoung Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -120,9 +120,11 @@ ax88190_media_fini(struct dp8390_softc *sc)
|
||||
int
|
||||
ax88190_mediachange(struct dp8390_softc *sc)
|
||||
{
|
||||
int rc;
|
||||
|
||||
mii_mediachg(&sc->sc_mii);
|
||||
return (0);
|
||||
if ((rc = mii_mediachg(&sc->sc_mii)) == ENXIO)
|
||||
return 0;
|
||||
return rc;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: dl10019.c,v 1.8 2007/10/19 11:59:50 ad Exp $ */
|
||||
/* $NetBSD: dl10019.c,v 1.9 2008/01/19 22:10:16 dyoung Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
@ -37,7 +37,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: dl10019.c,v 1.8 2007/10/19 11:59:50 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: dl10019.c,v 1.9 2008/01/19 22:10:16 dyoung Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -154,9 +154,11 @@ dl10019_media_fini(struct dp8390_softc *sc)
|
||||
int
|
||||
dl10019_mediachange(struct dp8390_softc *sc)
|
||||
{
|
||||
int rc;
|
||||
|
||||
mii_mediachg(&sc->sc_mii);
|
||||
return (0);
|
||||
if ((rc = mii_mediachg(&sc->sc_mii)) == ENXIO)
|
||||
return 0;
|
||||
return rc;
|
||||
}
|
||||
|
||||
void
|
||||
|
116
sys/dev/ic/gem.c
116
sys/dev/ic/gem.c
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: gem.c,v 1.68 2008/01/05 20:27:44 jdc Exp $ */
|
||||
/* $NetBSD: gem.c,v 1.69 2008/01/19 22:10:16 dyoung Exp $ */
|
||||
|
||||
/*
|
||||
*
|
||||
@ -37,7 +37,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: gem.c,v 1.68 2008/01/05 20:27:44 jdc Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: gem.c,v 1.69 2008/01/19 22:10:16 dyoung Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
#include "bpfilter.h"
|
||||
@ -121,8 +121,8 @@ static void gem_mii_statchg(struct device *);
|
||||
|
||||
void gem_statuschange(struct gem_softc *);
|
||||
|
||||
int gem_mediachange(struct ifnet *);
|
||||
void gem_mediastatus(struct ifnet *, struct ifmediareq *);
|
||||
int gem_ser_mediachange(struct ifnet *);
|
||||
void gem_ser_mediastatus(struct ifnet *, struct ifmediareq *);
|
||||
|
||||
struct mbuf *gem_get(struct gem_softc *, int, int);
|
||||
int gem_put(struct gem_softc *, int, struct mbuf *);
|
||||
@ -158,7 +158,6 @@ gem_attach(sc, enaddr)
|
||||
struct mii_data *mii = &sc->sc_mii;
|
||||
bus_space_tag_t t = sc->sc_bustag;
|
||||
bus_space_handle_t h = sc->sc_h1;
|
||||
struct mii_softc *child;
|
||||
struct ifmedia_entry *ifm;
|
||||
int i, error;
|
||||
u_int32_t v;
|
||||
@ -274,7 +273,7 @@ gem_attach(sc, enaddr)
|
||||
mii->mii_writereg = gem_mii_writereg;
|
||||
mii->mii_statchg = gem_mii_statchg;
|
||||
|
||||
ifmedia_init(&mii->mii_media, IFM_IMASK, gem_mediachange, gem_mediastatus);
|
||||
sc->sc_ethercom.ec_mii = mii;
|
||||
|
||||
/*
|
||||
* Initialization based on `GEM Gigabit Ethernet ASIC Specification'
|
||||
@ -287,22 +286,24 @@ gem_attach(sc, enaddr)
|
||||
gem_mifinit(sc);
|
||||
|
||||
if ((sc->sc_flags & (GEM_SERDES | GEM_SERIAL)) == 0) {
|
||||
ifmedia_init(&mii->mii_media, IFM_IMASK, ether_mediachange,
|
||||
ether_mediastatus);
|
||||
mii_attach(&sc->sc_dev, mii, 0xffffffff,
|
||||
MII_PHY_ANY, MII_OFFSET_ANY, MIIF_FORCEANEG);
|
||||
child = LIST_FIRST(&mii->mii_phys);
|
||||
if (child == NULL) {
|
||||
if (LIST_EMPTY(&mii->mii_phys)) {
|
||||
/* No PHY attached */
|
||||
aprint_error("%s: PHY probe failed\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
goto fail_7;
|
||||
} else {
|
||||
struct mii_softc *child;
|
||||
|
||||
/*
|
||||
* Walk along the list of attached MII devices and
|
||||
* establish an `MII instance' to `PHY number'
|
||||
* mapping.
|
||||
*/
|
||||
for (; child != NULL;
|
||||
child = LIST_NEXT(child, mii_list)) {
|
||||
LIST_FOREACH(child, &mii->mii_phys, mii_list) {
|
||||
/*
|
||||
* Note: we support just one PHY: the internal
|
||||
* or external MII is already selected for us
|
||||
@ -339,9 +340,11 @@ gem_attach(sc, enaddr)
|
||||
* XXX - we can really do the following ONLY if the
|
||||
* PHY indeed has the auto negotiation capability!!
|
||||
*/
|
||||
ifmedia_set(&sc->sc_media, IFM_ETHER|IFM_AUTO);
|
||||
ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER|IFM_AUTO);
|
||||
}
|
||||
} else {
|
||||
ifmedia_init(&mii->mii_media, IFM_IMASK, gem_ser_mediachange,
|
||||
gem_ser_mediastatus);
|
||||
/* SERDES or Serialink */
|
||||
if (sc->sc_flags & GEM_SERDES) {
|
||||
bus_space_write_4(t, h, GEM_MII_DATAPATH_MODE,
|
||||
@ -356,20 +359,20 @@ gem_attach(sc, enaddr)
|
||||
sc->sc_dev.dv_xname,
|
||||
sc->sc_flags & GEM_SERDES ? "SERDES" : "Serialink");
|
||||
|
||||
ifmedia_add(&sc->sc_media, IFM_ETHER|IFM_AUTO, 0, NULL);
|
||||
ifmedia_add(&sc->sc_mii.mii_media, IFM_ETHER|IFM_AUTO, 0, NULL);
|
||||
/* Check for FDX and HDX capabilities */
|
||||
sc->sc_mii_anar = bus_space_read_4(t, h, GEM_MII_ANAR);
|
||||
if (sc->sc_mii_anar & GEM_MII_ANEG_FUL_DUPLX) {
|
||||
ifmedia_add(&sc->sc_media,
|
||||
ifmedia_add(&sc->sc_mii.mii_media,
|
||||
IFM_ETHER|IFM_1000_SX|IFM_MANUAL|IFM_FDX, 0, NULL);
|
||||
aprint_normal("1000baseSX-FDX, ");
|
||||
}
|
||||
if (sc->sc_mii_anar & GEM_MII_ANEG_HLF_DUPLX) {
|
||||
ifmedia_add(&sc->sc_media,
|
||||
ifmedia_add(&sc->sc_mii.mii_media,
|
||||
IFM_ETHER|IFM_1000_SX|IFM_MANUAL|IFM_HDX, 0, NULL);
|
||||
aprint_normal("1000baseSX-HDX, ");
|
||||
}
|
||||
ifmedia_set(&sc->sc_media, IFM_ETHER|IFM_AUTO);
|
||||
ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER|IFM_AUTO);
|
||||
sc->sc_mii_media = IFM_AUTO;
|
||||
aprint_normal("auto\n");
|
||||
|
||||
@ -415,7 +418,7 @@ gem_attach(sc, enaddr)
|
||||
* If we support GigE media, we support jumbo frames too.
|
||||
* Unless we are Apple.
|
||||
*/
|
||||
TAILQ_FOREACH(ifm, &sc->sc_media.ifm_list, ifm_list) {
|
||||
TAILQ_FOREACH(ifm, &sc->sc_mii.mii_media.ifm_list, ifm_list) {
|
||||
if (IFM_SUBTYPE(ifm->ifm_media) == IFM_1000_T ||
|
||||
IFM_SUBTYPE(ifm->ifm_media) == IFM_1000_SX ||
|
||||
IFM_SUBTYPE(ifm->ifm_media) == IFM_1000_LX ||
|
||||
@ -1022,7 +1025,7 @@ gem_init(struct ifnet *ifp)
|
||||
struct gem_softc *sc = (struct gem_softc *)ifp->if_softc;
|
||||
bus_space_tag_t t = sc->sc_bustag;
|
||||
bus_space_handle_t h = sc->sc_h1;
|
||||
int s;
|
||||
int rc = 0, s;
|
||||
u_int max_frame_size;
|
||||
u_int32_t v;
|
||||
|
||||
@ -1109,8 +1112,9 @@ gem_init(struct ifnet *ifp)
|
||||
gem_rx_common(sc);
|
||||
|
||||
/* step 11. Configure Media */
|
||||
if ((sc->sc_flags & (GEM_SERDES | GEM_SERIAL)) == 0)
|
||||
mii_mediachg(&sc->sc_mii);
|
||||
if ((sc->sc_flags & (GEM_SERDES | GEM_SERIAL)) == 0 &&
|
||||
(rc = mii_ifmedia_change(&sc->sc_mii)) != 0)
|
||||
goto out;
|
||||
|
||||
/* step 12. RX_MAC Configuration Register */
|
||||
v = bus_space_read_4(t, h, GEM_MAC_RX_CONFIG);
|
||||
@ -1139,7 +1143,7 @@ gem_init(struct ifnet *ifp)
|
||||
ifp->if_flags &= ~IFF_OACTIVE;
|
||||
ifp->if_timer = 0;
|
||||
sc->sc_if_flags = ifp->if_flags;
|
||||
|
||||
out:
|
||||
splx(s);
|
||||
|
||||
return (0);
|
||||
@ -2384,24 +2388,40 @@ gem_statuschange(struct gem_softc* sc)
|
||||
}
|
||||
|
||||
int
|
||||
gem_mediachange(ifp)
|
||||
struct ifnet *ifp;
|
||||
gem_ser_mediachange(struct ifnet *ifp)
|
||||
{
|
||||
struct gem_softc *sc = ifp->if_softc;
|
||||
u_int s, t;
|
||||
|
||||
if (IFM_TYPE(sc->sc_media.ifm_media) != IFM_ETHER)
|
||||
if (IFM_TYPE(sc->sc_mii.mii_media.ifm_media) != IFM_ETHER)
|
||||
return EINVAL;
|
||||
|
||||
if ((sc->sc_flags & (GEM_SERDES | GEM_SERIAL)) != 0) {
|
||||
s = IFM_SUBTYPE(sc->sc_media.ifm_media);
|
||||
if (s == IFM_AUTO) {
|
||||
if (sc->sc_mii_media != s) {
|
||||
s = IFM_SUBTYPE(sc->sc_mii.mii_media.ifm_media);
|
||||
if (s == IFM_AUTO) {
|
||||
if (sc->sc_mii_media != s) {
|
||||
#ifdef GEM_DEBUG
|
||||
aprint_debug("%s: setting media to auto\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
aprint_debug("%s: setting media to auto\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
#endif
|
||||
sc->sc_mii_media = s;
|
||||
if (ifp->if_flags & IFF_UP) {
|
||||
gem_pcs_stop(sc, 0);
|
||||
gem_pcs_start(sc);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if (s == IFM_1000_SX) {
|
||||
t = IFM_OPTIONS(sc->sc_mii.mii_media.ifm_media);
|
||||
if (t == IFM_FDX || t == IFM_HDX) {
|
||||
if (sc->sc_mii_media != t) {
|
||||
sc->sc_mii_media = t;
|
||||
#ifdef GEM_DEBUG
|
||||
aprint_debug("%s:"
|
||||
" setting media to 1000baseSX-%s\n",
|
||||
sc->sc_dev.dv_xname,
|
||||
t == IFM_FDX ? "FDX" : "HDX");
|
||||
#endif
|
||||
sc->sc_mii_media = s;
|
||||
if (ifp->if_flags & IFF_UP) {
|
||||
gem_pcs_stop(sc, 0);
|
||||
gem_pcs_start(sc);
|
||||
@ -2409,42 +2429,17 @@ gem_mediachange(ifp)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if (s == IFM_1000_SX) {
|
||||
t = IFM_OPTIONS(sc->sc_media.ifm_media);
|
||||
if (t == IFM_FDX || t == IFM_HDX) {
|
||||
if (sc->sc_mii_media != t) {
|
||||
sc->sc_mii_media = t;
|
||||
#ifdef GEM_DEBUG
|
||||
aprint_debug("%s:"
|
||||
" setting media to 1000baseSX-%s\n",
|
||||
sc->sc_dev.dv_xname,
|
||||
t == IFM_FDX ? "FDX" : "HDX");
|
||||
#endif
|
||||
if (ifp->if_flags & IFF_UP) {
|
||||
gem_pcs_stop(sc, 0);
|
||||
gem_pcs_start(sc);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return EINVAL;
|
||||
} else
|
||||
return (mii_mediachg(&sc->sc_mii));
|
||||
}
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
void
|
||||
gem_mediastatus(ifp, ifmr)
|
||||
struct ifnet *ifp;
|
||||
struct ifmediareq *ifmr;
|
||||
gem_ser_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr)
|
||||
{
|
||||
struct gem_softc *sc = ifp->if_softc;
|
||||
|
||||
if ((ifp->if_flags & IFF_UP) == 0)
|
||||
return;
|
||||
|
||||
if ((sc->sc_flags & (GEM_SERDES | GEM_SERIAL)) == 0)
|
||||
mii_pollstat(&sc->sc_mii);
|
||||
ifmr->ifm_active = sc->sc_mii.mii_media_active;
|
||||
ifmr->ifm_status = sc->sc_mii.mii_media_status;
|
||||
}
|
||||
@ -2459,16 +2454,11 @@ gem_ioctl(ifp, cmd, data)
|
||||
void *data;
|
||||
{
|
||||
struct gem_softc *sc = ifp->if_softc;
|
||||
struct ifreq *ifr = (struct ifreq *)data;
|
||||
int s, error = 0;
|
||||
|
||||
s = splnet();
|
||||
|
||||
switch (cmd) {
|
||||
case SIOCGIFMEDIA:
|
||||
case SIOCSIFMEDIA:
|
||||
error = ifmedia_ioctl(ifp, ifr, &sc->sc_media, cmd);
|
||||
break;
|
||||
case SIOCSIFFLAGS:
|
||||
#define RESETIGN (IFF_CANTCHANGE|IFF_DEBUG)
|
||||
if (((ifp->if_flags & (IFF_UP|IFF_RUNNING))
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: hme.c,v 1.60 2007/10/19 11:59:52 ad Exp $ */
|
||||
/* $NetBSD: hme.c,v 1.61 2008/01/19 22:10:16 dyoung Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
||||
@ -41,7 +41,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: hme.c,v 1.60 2007/10/19 11:59:52 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: hme.c,v 1.61 2008/01/19 22:10:16 dyoung Exp $");
|
||||
|
||||
/* #define HMEDEBUG */
|
||||
|
||||
@ -98,7 +98,7 @@ int hme_ioctl(struct ifnet *, u_long, void *);
|
||||
void hme_tick(void *);
|
||||
void hme_watchdog(struct ifnet *);
|
||||
void hme_shutdown(void *);
|
||||
void hme_init(struct hme_softc *);
|
||||
int hme_init(struct hme_softc *);
|
||||
void hme_meminit(struct hme_softc *);
|
||||
void hme_mifinit(struct hme_softc *);
|
||||
void hme_reset(struct hme_softc *);
|
||||
@ -110,7 +110,6 @@ static void hme_mii_writereg(struct device *, int, int, int);
|
||||
static void hme_mii_statchg(struct device *);
|
||||
|
||||
int hme_mediachange(struct ifnet *);
|
||||
void hme_mediastatus(struct ifnet *, struct ifmediareq *);
|
||||
|
||||
struct mbuf *hme_get(struct hme_softc *, int, uint32_t);
|
||||
int hme_put(struct hme_softc *, int, struct mbuf *);
|
||||
@ -263,7 +262,8 @@ hme_config(sc)
|
||||
mii->mii_writereg = hme_mii_writereg;
|
||||
mii->mii_statchg = hme_mii_statchg;
|
||||
|
||||
ifmedia_init(&mii->mii_media, 0, hme_mediachange, hme_mediastatus);
|
||||
sc->sc_ethercom.ec_mii = mii;
|
||||
ifmedia_init(&mii->mii_media, 0, hme_mediachange, ether_mediastatus);
|
||||
|
||||
hme_mifinit(sc);
|
||||
|
||||
@ -273,8 +273,8 @@ hme_config(sc)
|
||||
child = LIST_FIRST(&mii->mii_phys);
|
||||
if (child == NULL) {
|
||||
/* No PHY attached */
|
||||
ifmedia_add(&sc->sc_media, IFM_ETHER|IFM_MANUAL, 0, NULL);
|
||||
ifmedia_set(&sc->sc_media, IFM_ETHER|IFM_MANUAL);
|
||||
ifmedia_add(&sc->sc_mii.mii_media, IFM_ETHER|IFM_MANUAL, 0, NULL);
|
||||
ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER|IFM_MANUAL);
|
||||
} else {
|
||||
/*
|
||||
* Walk along the list of attached MII devices and
|
||||
@ -305,7 +305,7 @@ hme_config(sc)
|
||||
* XXX - we can really do the following ONLY if the
|
||||
* phy indeed has the auto negotiation capability!!
|
||||
*/
|
||||
ifmedia_set(&sc->sc_media, IFM_ETHER|IFM_AUTO);
|
||||
ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER|IFM_AUTO);
|
||||
}
|
||||
|
||||
/* claim 802.1q capability */
|
||||
@ -348,7 +348,7 @@ hme_reset(sc)
|
||||
int s;
|
||||
|
||||
s = splnet();
|
||||
hme_init(sc);
|
||||
(void)hme_init(sc);
|
||||
splx(s);
|
||||
}
|
||||
|
||||
@ -462,7 +462,7 @@ hme_meminit(sc)
|
||||
* Initialization of interface; set up initialization block
|
||||
* and transmit/receive descriptor rings.
|
||||
*/
|
||||
void
|
||||
int
|
||||
hme_init(sc)
|
||||
struct hme_softc *sc;
|
||||
{
|
||||
@ -474,6 +474,7 @@ hme_init(sc)
|
||||
bus_space_handle_t mac = sc->sc_mac;
|
||||
u_int8_t *ea;
|
||||
u_int32_t v;
|
||||
int rc;
|
||||
|
||||
/*
|
||||
* Initialization sequence. The numbered steps below correspond
|
||||
@ -634,7 +635,8 @@ hme_init(sc)
|
||||
(*sc->sc_hwinit)(sc);
|
||||
|
||||
/* Set the current media. */
|
||||
mii_mediachg(&sc->sc_mii);
|
||||
if ((rc = hme_mediachange(ifp)) != 0)
|
||||
return rc;
|
||||
|
||||
/* Start the one second timer. */
|
||||
callout_reset(&sc->sc_tick_ch, hz, hme_tick, sc);
|
||||
@ -644,6 +646,7 @@ hme_init(sc)
|
||||
sc->sc_if_flags = ifp->if_flags;
|
||||
ifp->if_timer = 0;
|
||||
hme_start(ifp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1169,8 +1172,8 @@ hme_mifinit(sc)
|
||||
int instance, phy;
|
||||
u_int32_t v;
|
||||
|
||||
if (sc->sc_media.ifm_cur != NULL) {
|
||||
instance = IFM_INST(sc->sc_media.ifm_cur->ifm_media);
|
||||
if (sc->sc_mii.mii_media.ifm_cur != NULL) {
|
||||
instance = IFM_INST(sc->sc_mii.mii_media.ifm_cur->ifm_media);
|
||||
phy = sc->sc_phys[instance];
|
||||
} else
|
||||
/* No media set yet, pick phy arbitrarily.. */
|
||||
@ -1374,13 +1377,14 @@ hme_mediachange(ifp)
|
||||
bus_space_handle_t mac = sc->sc_mac;
|
||||
int instance = IFM_INST(sc->sc_mii.mii_media.ifm_cur->ifm_media);
|
||||
int phy = sc->sc_phys[instance];
|
||||
int rc;
|
||||
u_int32_t v;
|
||||
|
||||
#ifdef HMEDEBUG
|
||||
if (sc->sc_debug)
|
||||
printf("hme_mediachange: phy = %d\n", phy);
|
||||
#endif
|
||||
if (IFM_TYPE(sc->sc_media.ifm_media) != IFM_ETHER)
|
||||
if (IFM_TYPE(sc->sc_mii.mii_media.ifm_media) != IFM_ETHER)
|
||||
return (EINVAL);
|
||||
|
||||
/* Select the current PHY in the MIF configuration register */
|
||||
@ -1397,22 +1401,9 @@ hme_mediachange(ifp)
|
||||
v |= HME_MAC_XIF_MIIENABLE;
|
||||
bus_space_write_4(t, mac, HME_MACI_XIF, v);
|
||||
|
||||
return (mii_mediachg(&sc->sc_mii));
|
||||
}
|
||||
|
||||
void
|
||||
hme_mediastatus(ifp, ifmr)
|
||||
struct ifnet *ifp;
|
||||
struct ifmediareq *ifmr;
|
||||
{
|
||||
struct hme_softc *sc = ifp->if_softc;
|
||||
|
||||
if ((ifp->if_flags & IFF_UP) == 0)
|
||||
return;
|
||||
|
||||
mii_pollstat(&sc->sc_mii);
|
||||
ifmr->ifm_active = sc->sc_mii.mii_media_active;
|
||||
ifmr->ifm_status = sc->sc_mii.mii_media_status;
|
||||
if ((rc = mii_mediachg(&sc->sc_mii)) == ENXIO)
|
||||
return 0;
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1426,7 +1417,6 @@ hme_ioctl(ifp, cmd, data)
|
||||
{
|
||||
struct hme_softc *sc = ifp->if_softc;
|
||||
struct ifaddr *ifa = (struct ifaddr *)data;
|
||||
struct ifreq *ifr = (struct ifreq *)data;
|
||||
int s, error = 0;
|
||||
|
||||
s = splnet();
|
||||
@ -1441,14 +1431,14 @@ hme_ioctl(ifp, cmd, data)
|
||||
hme_setladrf(sc);
|
||||
else {
|
||||
ifp->if_flags |= IFF_UP;
|
||||
hme_init(sc);
|
||||
error = hme_init(sc);
|
||||
}
|
||||
arp_ifinit(ifp, ifa);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
ifp->if_flags |= IFF_UP;
|
||||
hme_init(sc);
|
||||
error = hme_init(sc);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@ -1472,7 +1462,7 @@ hme_ioctl(ifp, cmd, data)
|
||||
* If interface is marked up and it is stopped, then
|
||||
* start it.
|
||||
*/
|
||||
hme_init(sc);
|
||||
error = hme_init(sc);
|
||||
} else if ((ifp->if_flags & IFF_UP) != 0) {
|
||||
/*
|
||||
* If setting debug or promiscuous mode, do not reset
|
||||
@ -1485,18 +1475,20 @@ hme_ioctl(ifp, cmd, data)
|
||||
== (sc->sc_if_flags & (~RESETIGN)))
|
||||
hme_setladrf(sc);
|
||||
else
|
||||
hme_init(sc);
|
||||
error = hme_init(sc);
|
||||
}
|
||||
#undef RESETIGN
|
||||
}
|
||||
|
||||
if (sc->sc_ec_capenable != sc->sc_ethercom.ec_capenable)
|
||||
hme_init(sc);
|
||||
error = hme_init(sc);
|
||||
|
||||
break;
|
||||
|
||||
case SIOCADDMULTI:
|
||||
case SIOCDELMULTI:
|
||||
case SIOCGIFMEDIA:
|
||||
case SIOCSIFMEDIA:
|
||||
if ((error = ether_ioctl(ifp, cmd, data)) == ENETRESET) {
|
||||
/*
|
||||
* Multicast list has changed; set the hardware filter
|
||||
@ -1507,12 +1499,6 @@ hme_ioctl(ifp, cmd, data)
|
||||
error = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case SIOCGIFMEDIA:
|
||||
case SIOCSIFMEDIA:
|
||||
error = ifmedia_ioctl(ifp, ifr, &sc->sc_media, cmd);
|
||||
break;
|
||||
|
||||
default:
|
||||
error = EINVAL;
|
||||
break;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: i82557.c,v 1.109 2007/12/29 17:59:20 tsutsui Exp $ */
|
||||
/* $NetBSD: i82557.c,v 1.110 2008/01/19 22:10:17 dyoung Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997, 1998, 1999, 2001, 2002 The NetBSD Foundation, Inc.
|
||||
@ -73,7 +73,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: i82557.c,v 1.109 2007/12/29 17:59:20 tsutsui Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: i82557.c,v 1.110 2008/01/19 22:10:17 dyoung Exp $");
|
||||
|
||||
#include "bpfilter.h"
|
||||
#include "rnd.h"
|
||||
@ -175,7 +175,6 @@ const u_int8_t fxp_cb_config_template[] = {
|
||||
};
|
||||
|
||||
void fxp_mii_initmedia(struct fxp_softc *);
|
||||
int fxp_mii_mediachange(struct ifnet *);
|
||||
void fxp_mii_mediastatus(struct ifnet *, struct ifmediareq *);
|
||||
|
||||
void fxp_80c24_initmedia(struct fxp_softc *);
|
||||
@ -478,7 +477,9 @@ fxp_mii_initmedia(struct fxp_softc *sc)
|
||||
sc->sc_mii.mii_readreg = fxp_mdi_read;
|
||||
sc->sc_mii.mii_writereg = fxp_mdi_write;
|
||||
sc->sc_mii.mii_statchg = fxp_statchg;
|
||||
ifmedia_init(&sc->sc_mii.mii_media, IFM_IMASK, fxp_mii_mediachange,
|
||||
|
||||
sc->sc_ethercom.ec_mii = &sc->sc_mii;
|
||||
ifmedia_init(&sc->sc_mii.mii_media, IFM_IMASK, ether_mediachange,
|
||||
fxp_mii_mediastatus);
|
||||
|
||||
flags = MIIF_NOISOLATE;
|
||||
@ -489,7 +490,7 @@ fxp_mii_initmedia(struct fxp_softc *sc)
|
||||
*/
|
||||
mii_attach(&sc->sc_dev, &sc->sc_mii, 0xffffffff, MII_PHY_ANY,
|
||||
MII_OFFSET_ANY, flags);
|
||||
if (LIST_FIRST(&sc->sc_mii.mii_phys) == NULL) {
|
||||
if (LIST_EMPTY(&sc->sc_mii.mii_phys)) {
|
||||
ifmedia_add(&sc->sc_mii.mii_media, IFM_ETHER|IFM_NONE, 0, NULL);
|
||||
ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER|IFM_NONE);
|
||||
} else
|
||||
@ -1895,7 +1896,8 @@ fxp_init(struct ifnet *ifp)
|
||||
/*
|
||||
* Set current media.
|
||||
*/
|
||||
mii_mediachg(&sc->sc_mii);
|
||||
if ((error = mii_ifmedia_change(&sc->sc_mii)) != 0)
|
||||
goto out;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1934,19 +1936,6 @@ fxp_init(struct ifnet *ifp)
|
||||
return (error);
|
||||
}
|
||||
|
||||
/*
|
||||
* Change media according to request.
|
||||
*/
|
||||
int
|
||||
fxp_mii_mediachange(struct ifnet *ifp)
|
||||
{
|
||||
struct fxp_softc *sc = ifp->if_softc;
|
||||
|
||||
if (ifp->if_flags & IFF_UP)
|
||||
mii_mediachg(&sc->sc_mii);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Notify the world which media we're using.
|
||||
*/
|
||||
@ -1961,9 +1950,7 @@ fxp_mii_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr)
|
||||
return;
|
||||
}
|
||||
|
||||
mii_pollstat(&sc->sc_mii);
|
||||
ifmr->ifm_status = sc->sc_mii.mii_media_status;
|
||||
ifmr->ifm_active = sc->sc_mii.mii_media_active;
|
||||
ether_mediastatus(ifp, ifmr);
|
||||
|
||||
/*
|
||||
* XXX Flow control is always turned on if the chip supports
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mtd803.c,v 1.16 2007/12/05 07:58:30 ad Exp $ */
|
||||
/* $NetBSD: mtd803.c,v 1.17 2008/01/19 22:10:17 dyoung Exp $ */
|
||||
|
||||
/*-
|
||||
*
|
||||
@ -51,7 +51,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mtd803.c,v 1.16 2007/12/05 07:58:30 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mtd803.c,v 1.17 2008/01/19 22:10:17 dyoung Exp $");
|
||||
|
||||
#include "bpfilter.h"
|
||||
|
||||
@ -125,8 +125,6 @@ void mtd_stop(struct ifnet *, int);
|
||||
int mtd_ioctl(struct ifnet *, u_long, void *);
|
||||
void mtd_setmulti(struct mtd_softc *);
|
||||
void mtd_watchdog(struct ifnet *);
|
||||
int mtd_mediachange(struct ifnet *);
|
||||
void mtd_mediastatus(struct ifnet *, struct ifmediareq *);
|
||||
|
||||
int mtd_init(struct ifnet *);
|
||||
void mtd_reset(struct mtd_softc *);
|
||||
@ -168,7 +166,9 @@ mtd_config(sc)
|
||||
sc->mii.mii_writereg = mtd_mii_writereg;
|
||||
sc->mii.mii_statchg = mtd_mii_statchg;
|
||||
|
||||
ifmedia_init(&sc->mii.mii_media, 0, mtd_mediachange, mtd_mediastatus);
|
||||
sc->ethercom.ec_mii = &sc->mii;
|
||||
ifmedia_init(&sc->mii.mii_media, 0, ether_mediachange,
|
||||
ether_mediastatus);
|
||||
|
||||
mii_attach(&sc->dev, &sc->mii, 0xffffffff, MII_PHY_ANY, 0, 0);
|
||||
|
||||
@ -587,24 +587,14 @@ mtd_ioctl(ifp, cmd, data)
|
||||
|
||||
s = splnet();
|
||||
|
||||
/* Don't do anything special */
|
||||
switch(cmd) {
|
||||
case SIOCADDMULTI:
|
||||
case SIOCDELMULTI:
|
||||
if ((error = ether_ioctl(ifp, cmd, data)) == ENETRESET) {
|
||||
/*
|
||||
* Multicast list has changed; set the hardware
|
||||
* filter accordingly.
|
||||
*/
|
||||
if (ifp->if_flags & IFF_RUNNING)
|
||||
mtd_setmulti(sc);
|
||||
error = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
error = ether_ioctl(ifp, cmd, data);
|
||||
break;
|
||||
if ((error = ether_ioctl(ifp, cmd, data)) == ENETRESET) {
|
||||
/*
|
||||
* Multicast list has changed; set the hardware
|
||||
* filter accordingly.
|
||||
*/
|
||||
if (ifp->if_flags & IFF_RUNNING)
|
||||
mtd_setmulti(sc);
|
||||
error = 0;
|
||||
}
|
||||
|
||||
splx(s);
|
||||
@ -946,35 +936,6 @@ mtd_reset(sc)
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
mtd_mediachange(ifp)
|
||||
struct ifnet *ifp;
|
||||
{
|
||||
struct mtd_softc *sc = ifp->if_softc;
|
||||
|
||||
if (IFM_TYPE(sc->mii.mii_media.ifm_media) != IFM_ETHER)
|
||||
return EINVAL;
|
||||
|
||||
return mii_mediachg(&sc->mii);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
mtd_mediastatus(ifp, ifmr)
|
||||
struct ifnet *ifp;
|
||||
struct ifmediareq *ifmr;
|
||||
{
|
||||
struct mtd_softc *sc = ifp->if_softc;
|
||||
|
||||
if ((ifp->if_flags & IFF_UP) == 0)
|
||||
return;
|
||||
|
||||
mii_pollstat(&sc->mii);
|
||||
ifmr->ifm_active = sc->mii.mii_media_active;
|
||||
ifmr->ifm_status = sc->mii.mii_media_status;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
mtd_shutdown (arg)
|
||||
void *arg;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: rtl8169.c,v 1.92 2008/01/08 15:50:35 joerg Exp $ */
|
||||
/* $NetBSD: rtl8169.c,v 1.93 2008/01/19 22:10:17 dyoung Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997, 1998-2003
|
||||
@ -33,7 +33,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: rtl8169.c,v 1.92 2008/01/08 15:50:35 joerg Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: rtl8169.c,v 1.93 2008/01/19 22:10:17 dyoung Exp $");
|
||||
/* $FreeBSD: /repoman/r/ncvs/src/sys/dev/re/if_re.c,v 1.20 2004/04/11 20:34:08 ru Exp $ */
|
||||
|
||||
/*
|
||||
@ -166,9 +166,6 @@ static void re_watchdog(struct ifnet *);
|
||||
static int re_enable(struct rtk_softc *);
|
||||
static void re_disable(struct rtk_softc *);
|
||||
|
||||
static int re_ifmedia_upd(struct ifnet *);
|
||||
static void re_ifmedia_sts(struct ifnet *, struct ifmediareq *);
|
||||
|
||||
static int re_gmii_readreg(struct device *, int, int);
|
||||
static void re_gmii_writereg(struct device *, int, int, int);
|
||||
|
||||
@ -781,8 +778,9 @@ re_attach(struct rtk_softc *sc)
|
||||
sc->mii.mii_readreg = re_miibus_readreg;
|
||||
sc->mii.mii_writereg = re_miibus_writereg;
|
||||
sc->mii.mii_statchg = re_miibus_statchg;
|
||||
ifmedia_init(&sc->mii.mii_media, IFM_IMASK, re_ifmedia_upd,
|
||||
re_ifmedia_sts);
|
||||
sc->ethercom.ec_mii = &sc->mii;
|
||||
ifmedia_init(&sc->mii.mii_media, IFM_IMASK, ether_mediachange,
|
||||
ether_mediastatus);
|
||||
mii_attach(&sc->sc_dev, &sc->mii, 0xffffffff, MII_PHY_ANY,
|
||||
MII_OFFSET_ANY, 0);
|
||||
ifmedia_set(&sc->mii.mii_media, IFM_ETHER | IFM_AUTO);
|
||||
@ -1891,34 +1889,6 @@ re_init(struct ifnet *ifp)
|
||||
return error;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set media options.
|
||||
*/
|
||||
static int
|
||||
re_ifmedia_upd(struct ifnet *ifp)
|
||||
{
|
||||
struct rtk_softc *sc;
|
||||
|
||||
sc = ifp->if_softc;
|
||||
|
||||
return mii_mediachg(&sc->mii);
|
||||
}
|
||||
|
||||
/*
|
||||
* Report current media status.
|
||||
*/
|
||||
static void
|
||||
re_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
|
||||
{
|
||||
struct rtk_softc *sc;
|
||||
|
||||
sc = ifp->if_softc;
|
||||
|
||||
mii_pollstat(&sc->mii);
|
||||
ifmr->ifm_active = sc->mii.mii_media_active;
|
||||
ifmr->ifm_status = sc->mii.mii_media_status;
|
||||
}
|
||||
|
||||
static int
|
||||
re_ioctl(struct ifnet *ifp, u_long command, void *data)
|
||||
{
|
||||
@ -1934,10 +1904,6 @@ re_ioctl(struct ifnet *ifp, u_long command, void *data)
|
||||
error = EINVAL;
|
||||
ifp->if_mtu = ifr->ifr_mtu;
|
||||
break;
|
||||
case SIOCGIFMEDIA:
|
||||
case SIOCSIFMEDIA:
|
||||
error = ifmedia_ioctl(ifp, ifr, &sc->mii.mii_media, command);
|
||||
break;
|
||||
default:
|
||||
error = ether_ioctl(ifp, command, data);
|
||||
if (error == ENETRESET) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: rtl81x9.c,v 1.80 2008/01/08 15:50:36 joerg Exp $ */
|
||||
/* $NetBSD: rtl81x9.c,v 1.81 2008/01/19 22:10:17 dyoung Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997, 1998
|
||||
@ -86,7 +86,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: rtl81x9.c,v 1.80 2008/01/08 15:50:36 joerg Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: rtl81x9.c,v 1.81 2008/01/19 22:10:17 dyoung Exp $");
|
||||
|
||||
#include "bpfilter.h"
|
||||
#include "rnd.h"
|
||||
@ -140,8 +140,6 @@ STATIC int rtk_init(struct ifnet *);
|
||||
STATIC void rtk_stop(struct ifnet *, int);
|
||||
|
||||
STATIC void rtk_watchdog(struct ifnet *);
|
||||
STATIC int rtk_ifmedia_upd(struct ifnet *);
|
||||
STATIC void rtk_ifmedia_sts(struct ifnet *, struct ifmediareq *);
|
||||
|
||||
STATIC void rtk_eeprom_putbyte(struct rtk_softc *, int, int);
|
||||
STATIC void rtk_mii_sync(struct rtk_softc *);
|
||||
@ -734,8 +732,9 @@ rtk_attach(struct rtk_softc *sc)
|
||||
sc->mii.mii_readreg = rtk_phy_readreg;
|
||||
sc->mii.mii_writereg = rtk_phy_writereg;
|
||||
sc->mii.mii_statchg = rtk_phy_statchg;
|
||||
ifmedia_init(&sc->mii.mii_media, IFM_IMASK, rtk_ifmedia_upd,
|
||||
rtk_ifmedia_sts);
|
||||
sc->ethercom.ec_mii = &sc->mii;
|
||||
ifmedia_init(&sc->mii.mii_media, IFM_IMASK, ether_mediachange,
|
||||
ether_mediastatus);
|
||||
mii_attach(self, &sc->mii, 0xffffffff,
|
||||
MII_PHY_ANY, MII_OFFSET_ANY, 0);
|
||||
|
||||
@ -1437,7 +1436,8 @@ rtk_init(struct ifnet *ifp)
|
||||
/*
|
||||
* Set current media.
|
||||
*/
|
||||
mii_mediachg(&sc->mii);
|
||||
if ((error = ether_mediachange(ifp)) != 0)
|
||||
goto out;
|
||||
|
||||
ifp->if_flags |= IFF_RUNNING;
|
||||
ifp->if_flags &= ~IFF_OACTIVE;
|
||||
@ -1453,64 +1453,24 @@ rtk_init(struct ifnet *ifp)
|
||||
return error;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set media options.
|
||||
*/
|
||||
STATIC int
|
||||
rtk_ifmedia_upd(struct ifnet *ifp)
|
||||
{
|
||||
struct rtk_softc *sc;
|
||||
|
||||
sc = ifp->if_softc;
|
||||
|
||||
return mii_mediachg(&sc->mii);
|
||||
}
|
||||
|
||||
/*
|
||||
* Report current media status.
|
||||
*/
|
||||
STATIC void
|
||||
rtk_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
|
||||
{
|
||||
struct rtk_softc *sc;
|
||||
|
||||
sc = ifp->if_softc;
|
||||
|
||||
mii_pollstat(&sc->mii);
|
||||
ifmr->ifm_status = sc->mii.mii_media_status;
|
||||
ifmr->ifm_active = sc->mii.mii_media_active;
|
||||
}
|
||||
|
||||
STATIC int
|
||||
rtk_ioctl(struct ifnet *ifp, u_long command, void *data)
|
||||
{
|
||||
struct rtk_softc *sc = ifp->if_softc;
|
||||
struct ifreq *ifr = (struct ifreq *)data;
|
||||
int s, error;
|
||||
|
||||
s = splnet();
|
||||
|
||||
switch (command) {
|
||||
case SIOCGIFMEDIA:
|
||||
case SIOCSIFMEDIA:
|
||||
error = ifmedia_ioctl(ifp, ifr, &sc->mii.mii_media, command);
|
||||
break;
|
||||
|
||||
default:
|
||||
error = ether_ioctl(ifp, command, data);
|
||||
if (error == ENETRESET) {
|
||||
if (ifp->if_flags & IFF_RUNNING) {
|
||||
/*
|
||||
* Multicast list has changed. Set the
|
||||
* hardware filter accordingly.
|
||||
*/
|
||||
rtk_setmulti(sc);
|
||||
}
|
||||
error = 0;
|
||||
error = ether_ioctl(ifp, command, data);
|
||||
if (error == ENETRESET) {
|
||||
if (ifp->if_flags & IFF_RUNNING) {
|
||||
/*
|
||||
* Multicast list has changed. Set the
|
||||
* hardware filter accordingly.
|
||||
*/
|
||||
rtk_setmulti(sc);
|
||||
}
|
||||
break;
|
||||
error = 0;
|
||||
}
|
||||
|
||||
splx(s);
|
||||
|
||||
return error;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: smc83c170.c,v 1.70 2007/12/30 00:04:47 dyoung Exp $ */
|
||||
/* $NetBSD: smc83c170.c,v 1.71 2008/01/19 22:10:17 dyoung Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
|
||||
@ -43,7 +43,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: smc83c170.c,v 1.70 2007/12/30 00:04:47 dyoung Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: smc83c170.c,v 1.71 2008/01/19 22:10:17 dyoung Exp $");
|
||||
|
||||
#include "bpfilter.h"
|
||||
|
||||
@ -99,7 +99,6 @@ void epic_tick(void *);
|
||||
|
||||
void epic_statchg(struct device *);
|
||||
int epic_mediachange(struct ifnet *);
|
||||
void epic_mediastatus(struct ifnet *, struct ifmediareq *);
|
||||
|
||||
#define INTMASK (INTSTAT_FATAL_INT | INTSTAT_TXU | \
|
||||
INTSTAT_TXC | INTSTAT_RXE | INTSTAT_RQE | INTSTAT_RCC)
|
||||
@ -262,8 +261,10 @@ epic_attach(sc)
|
||||
sc->sc_mii.mii_readreg = epic_mii_read;
|
||||
sc->sc_mii.mii_writereg = epic_mii_write;
|
||||
sc->sc_mii.mii_statchg = epic_statchg;
|
||||
|
||||
sc->sc_ethercom.ec_mii = &sc->sc_mii;
|
||||
ifmedia_init(&sc->sc_mii.mii_media, IFM_IMASK, epic_mediachange,
|
||||
epic_mediastatus);
|
||||
ether_mediastatus);
|
||||
mii_attach(&sc->sc_dev, &sc->sc_mii, 0xffffffff, MII_PHY_ANY,
|
||||
MII_OFFSET_ANY, miiflags);
|
||||
if (LIST_EMPTY(&sc->sc_mii.mii_phys)) {
|
||||
@ -570,32 +571,22 @@ epic_ioctl(ifp, cmd, data)
|
||||
void *data;
|
||||
{
|
||||
struct epic_softc *sc = ifp->if_softc;
|
||||
struct ifreq *ifr = (struct ifreq *)data;
|
||||
int s, error;
|
||||
|
||||
s = splnet();
|
||||
|
||||
switch (cmd) {
|
||||
case SIOCSIFMEDIA:
|
||||
case SIOCGIFMEDIA:
|
||||
error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, cmd);
|
||||
break;
|
||||
|
||||
default:
|
||||
error = ether_ioctl(ifp, cmd, data);
|
||||
if (error == ENETRESET) {
|
||||
/*
|
||||
* Multicast list has changed; set the hardware filter
|
||||
* accordingly. Update our idea of the current media;
|
||||
* epic_set_mchash() needs to know what it is.
|
||||
*/
|
||||
if (ifp->if_flags & IFF_RUNNING) {
|
||||
mii_pollstat(&sc->sc_mii);
|
||||
epic_set_mchash(sc);
|
||||
}
|
||||
error = 0;
|
||||
error = ether_ioctl(ifp, cmd, data);
|
||||
if (error == ENETRESET) {
|
||||
/*
|
||||
* Multicast list has changed; set the hardware filter
|
||||
* accordingly. Update our idea of the current media;
|
||||
* epic_set_mchash() needs to know what it is.
|
||||
*/
|
||||
if (ifp->if_flags & IFF_RUNNING) {
|
||||
mii_pollstat(&sc->sc_mii);
|
||||
epic_set_mchash(sc);
|
||||
}
|
||||
break;
|
||||
error = 0;
|
||||
}
|
||||
|
||||
splx(s);
|
||||
@ -996,7 +987,8 @@ epic_init(ifp)
|
||||
bus_space_write_4(st, sh, EPIC_RXCON, reg0);
|
||||
|
||||
/* Set the current media. */
|
||||
epic_mediachange(ifp);
|
||||
if ((error = epic_mediachange(ifp)) != 0)
|
||||
goto out;
|
||||
|
||||
/* Set up the multicast hash table. */
|
||||
epic_set_mchash(sc);
|
||||
@ -1459,21 +1451,6 @@ epic_statchg(self)
|
||||
epic_set_mchash(sc);
|
||||
}
|
||||
|
||||
/*
|
||||
* Callback from ifmedia to request current media status.
|
||||
*/
|
||||
void
|
||||
epic_mediastatus(ifp, ifmr)
|
||||
struct ifnet *ifp;
|
||||
struct ifmediareq *ifmr;
|
||||
{
|
||||
struct epic_softc *sc = ifp->if_softc;
|
||||
|
||||
mii_pollstat(&sc->sc_mii);
|
||||
ifmr->ifm_status = sc->sc_mii.mii_media_status;
|
||||
ifmr->ifm_active = sc->sc_mii.mii_media_active;
|
||||
}
|
||||
|
||||
/*
|
||||
* Callback from ifmedia to request new media setting.
|
||||
*
|
||||
@ -1490,7 +1467,7 @@ epic_mediachange(ifp)
|
||||
int media = ifm->ifm_cur->ifm_media;
|
||||
uint32_t miicfg;
|
||||
struct mii_softc *miisc;
|
||||
int cfg;
|
||||
int cfg, rc;
|
||||
|
||||
if ((ifp->if_flags & IFF_UP) == 0)
|
||||
return (0);
|
||||
@ -1505,7 +1482,8 @@ epic_mediachange(ifp)
|
||||
bus_space_write_4(sc->sc_st, sc->sc_sh, EPIC_MIICFG, miicfg);
|
||||
}
|
||||
|
||||
mii_mediachg(mii);
|
||||
if ((rc = mii_mediachg(mii)) == ENXIO)
|
||||
rc = 0;
|
||||
|
||||
if (IFM_INST(media) == sc->sc_serinst) {
|
||||
/* select serial interface */
|
||||
@ -1557,5 +1535,5 @@ epic_mediachange(ifp)
|
||||
PHY_WRITE(miisc, MII_LXTPHY_CONFIG, cfg);
|
||||
}
|
||||
|
||||
return (0);
|
||||
return rc;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: smc91cxx.c,v 1.63 2007/10/19 12:00:01 ad Exp $ */
|
||||
/* $NetBSD: smc91cxx.c,v 1.64 2008/01/19 22:10:17 dyoung Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
@ -78,7 +78,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: smc91cxx.c,v 1.63 2007/10/19 12:00:01 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: smc91cxx.c,v 1.64 2008/01/19 22:10:17 dyoung Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
#include "bpfilter.h"
|
||||
@ -396,6 +396,7 @@ smc91cxx_set_media(sc, media)
|
||||
bus_space_tag_t bst = sc->sc_bst;
|
||||
bus_space_handle_t bsh = sc->sc_bsh;
|
||||
u_int16_t tmp;
|
||||
int rc;
|
||||
|
||||
/*
|
||||
* If the interface is not currently powered on, just return.
|
||||
@ -408,8 +409,9 @@ smc91cxx_set_media(sc, media)
|
||||
if (IFM_TYPE(media) != IFM_ETHER)
|
||||
return (EINVAL);
|
||||
|
||||
if (sc->sc_flags & SMC_FLAGS_HAS_MII)
|
||||
return (mii_mediachg(&sc->sc_mii));
|
||||
if ((sc->sc_flags & SMC_FLAGS_HAS_MII) == 0 ||
|
||||
(rc = mii_mediachg(&sc->sc_mii)) == ENXIO)
|
||||
rc = 0;
|
||||
|
||||
switch (IFM_SUBTYPE(media)) {
|
||||
case IFM_10_T:
|
||||
@ -428,7 +430,7 @@ smc91cxx_set_media(sc, media)
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
return (0);
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: tulip.c,v 1.156 2008/01/18 16:22:50 ad Exp $ */
|
||||
/* $NetBSD: tulip.c,v 1.157 2008/01/19 22:10:17 dyoung Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 1999, 2000, 2002 The NetBSD Foundation, Inc.
|
||||
@ -43,7 +43,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: tulip.c,v 1.156 2008/01/18 16:22:50 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: tulip.c,v 1.157 2008/01/19 22:10:17 dyoung Exp $");
|
||||
|
||||
#include "bpfilter.h"
|
||||
|
||||
@ -3394,22 +3394,24 @@ static int
|
||||
tlp_mii_setmedia(struct tulip_softc *sc)
|
||||
{
|
||||
struct ifnet *ifp = &sc->sc_ethercom.ec_if;
|
||||
int rc;
|
||||
|
||||
if (ifp->if_flags & IFF_UP) {
|
||||
switch (sc->sc_chip) {
|
||||
case TULIP_CHIP_21142:
|
||||
case TULIP_CHIP_21143:
|
||||
/* Disable the internal Nway engine. */
|
||||
TULIP_WRITE(sc, CSR_SIATXRX, 0);
|
||||
break;
|
||||
if ((ifp->if_flags & IFF_UP) == 0)
|
||||
return 0;
|
||||
switch (sc->sc_chip) {
|
||||
case TULIP_CHIP_21142:
|
||||
case TULIP_CHIP_21143:
|
||||
/* Disable the internal Nway engine. */
|
||||
TULIP_WRITE(sc, CSR_SIATXRX, 0);
|
||||
break;
|
||||
|
||||
default:
|
||||
/* Nothing. */
|
||||
break;
|
||||
}
|
||||
mii_mediachg(&sc->sc_mii);
|
||||
default:
|
||||
/* Nothing. */
|
||||
break;
|
||||
}
|
||||
return (0);
|
||||
if ((rc = mii_mediachg(&sc->sc_mii)) == ENXIO)
|
||||
return 0;
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_gfe.c,v 1.26 2007/10/19 12:00:33 ad Exp $ */
|
||||
/* $NetBSD: if_gfe.c,v 1.27 2008/01/19 22:10:18 dyoung Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002 Allegro Networks, Inc., Wasabi Systems, Inc.
|
||||
@ -42,7 +42,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_gfe.c,v 1.26 2007/10/19 12:00:33 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_gfe.c,v 1.27 2008/01/19 22:10:18 dyoung Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
#include "bpfilter.h"
|
||||
@ -155,8 +155,6 @@ STATIC int gfe_ifioctl (struct ifnet *, u_long, void *);
|
||||
STATIC void gfe_ifstart (struct ifnet *);
|
||||
STATIC void gfe_ifwatchdog (struct ifnet *);
|
||||
|
||||
STATIC int gfe_mii_mediachange (struct ifnet *);
|
||||
STATIC void gfe_mii_mediastatus (struct ifnet *, struct ifmediareq *);
|
||||
STATIC int gfe_mii_read (struct device *, int, int);
|
||||
STATIC void gfe_mii_write (struct device *, int, int, int);
|
||||
STATIC void gfe_mii_statchg (struct device *);
|
||||
@ -309,8 +307,9 @@ gfe_attach(struct device *parent, struct device *self, void *aux)
|
||||
sc->sc_mii.mii_writereg = gfe_mii_write;
|
||||
sc->sc_mii.mii_statchg = gfe_mii_statchg;
|
||||
|
||||
ifmedia_init(&sc->sc_mii.mii_media, 0, gfe_mii_mediachange,
|
||||
gfe_mii_mediastatus);
|
||||
sc->sc_ec.ec_mii = &sc->sc_mii;
|
||||
ifmedia_init(&sc->sc_mii.mii_media, 0, ether_mediachange,
|
||||
ether_mediastatus);
|
||||
|
||||
mii_attach(&sc->sc_dev, &sc->sc_mii, 0xffffffff, phyaddr,
|
||||
MII_OFFSET_ANY, MIIF_NOISOLATE);
|
||||
@ -469,6 +468,8 @@ gfe_ifioctl(struct ifnet *ifp, u_long cmd, void *data)
|
||||
}
|
||||
break;
|
||||
|
||||
case SIOCSIFMEDIA:
|
||||
case SIOCGIFMEDIA:
|
||||
case SIOCADDMULTI:
|
||||
case SIOCDELMULTI:
|
||||
if ((error = ether_ioctl(ifp, cmd, data)) == ENETRESET) {
|
||||
@ -487,11 +488,6 @@ gfe_ifioctl(struct ifnet *ifp, u_long cmd, void *data)
|
||||
ifp->if_mtu = ifr->ifr_mtu;
|
||||
break;
|
||||
|
||||
case SIOCSIFMEDIA:
|
||||
case SIOCGIFMEDIA:
|
||||
error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, cmd);
|
||||
break;
|
||||
|
||||
default:
|
||||
error = EINVAL;
|
||||
break;
|
||||
@ -1480,29 +1476,6 @@ gfe_intr(void *arg)
|
||||
return claim;
|
||||
}
|
||||
|
||||
int
|
||||
gfe_mii_mediachange (struct ifnet *ifp)
|
||||
{
|
||||
struct gfe_softc *sc = ifp->if_softc;
|
||||
|
||||
if (ifp->if_flags & IFF_UP)
|
||||
mii_mediachg(&sc->sc_mii);
|
||||
|
||||
return (0);
|
||||
}
|
||||
void
|
||||
gfe_mii_mediastatus (struct ifnet *ifp, struct ifmediareq *ifmr)
|
||||
{
|
||||
struct gfe_softc *sc = ifp->if_softc;
|
||||
|
||||
if (sc->sc_flags & GE_PHYSTSCHG) {
|
||||
sc->sc_flags &= ~GE_PHYSTSCHG;
|
||||
mii_pollstat(&sc->sc_mii);
|
||||
}
|
||||
ifmr->ifm_status = sc->sc_mii.mii_media_status;
|
||||
ifmr->ifm_active = sc->sc_mii.mii_media_active;
|
||||
}
|
||||
|
||||
int
|
||||
gfe_mii_read (struct device *self, int phy, int reg)
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_bge.c,v 1.141 2007/12/09 20:28:08 jmcneill Exp $ */
|
||||
/* $NetBSD: if_bge.c,v 1.142 2008/01/19 22:10:18 dyoung Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001 Wind River Systems
|
||||
@ -79,7 +79,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.141 2007/12/09 20:28:08 jmcneill Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.142 2008/01/19 22:10:18 dyoung Exp $");
|
||||
|
||||
#include "bpfilter.h"
|
||||
#include "vlan.h"
|
||||
@ -2710,7 +2710,7 @@ bge_attach(device_t parent, device_t self, void *aux)
|
||||
MII_PHY_ANY, MII_OFFSET_ANY,
|
||||
MIIF_FORCEANEG|MIIF_DOPAUSE);
|
||||
|
||||
if (LIST_FIRST(&sc->bge_mii.mii_phys) == NULL) {
|
||||
if (LIST_EMPTY(&sc->bge_mii.mii_phys)) {
|
||||
aprint_error_dev(sc->bge_dev, "no PHY found!\n");
|
||||
ifmedia_add(&sc->bge_mii.mii_media,
|
||||
IFM_ETHER|IFM_MANUAL, 0, NULL);
|
||||
@ -3269,7 +3269,6 @@ bge_tick(void *xsc)
|
||||
{
|
||||
struct bge_softc *sc = xsc;
|
||||
struct mii_data *mii = &sc->bge_mii;
|
||||
struct ifmedia *ifm = NULL;
|
||||
struct ifnet *ifp = &sc->ethercom.ec_if;
|
||||
int s;
|
||||
|
||||
@ -3283,7 +3282,6 @@ bge_tick(void *xsc)
|
||||
}
|
||||
|
||||
if (sc->bge_tbi) {
|
||||
ifm = &sc->bge_ifmedia;
|
||||
if (CSR_READ_4(sc, BGE_MAC_STS) &
|
||||
BGE_MACSTAT_TBI_PCS_SYNCHED) {
|
||||
sc->bge_link++;
|
||||
@ -3924,7 +3922,7 @@ bge_init(struct ifnet *ifp)
|
||||
{
|
||||
struct bge_softc *sc = ifp->if_softc;
|
||||
const u_int16_t *m;
|
||||
int s, error;
|
||||
int s, error = 0;
|
||||
|
||||
s = splnet();
|
||||
|
||||
@ -3997,16 +3995,18 @@ bge_init(struct ifnet *ifp)
|
||||
BGE_CLRBIT(sc, BGE_PCI_MISC_CTL, BGE_PCIMISCCTL_MASK_PCI_INTR);
|
||||
CSR_WRITE_4(sc, BGE_MBX_IRQ0_LO, 0);
|
||||
|
||||
bge_ifmedia_upd(ifp);
|
||||
if ((error = bge_ifmedia_upd(ifp)) != 0)
|
||||
goto out;
|
||||
|
||||
ifp->if_flags |= IFF_RUNNING;
|
||||
ifp->if_flags &= ~IFF_OACTIVE;
|
||||
|
||||
splx(s);
|
||||
|
||||
callout_reset(&sc->bge_timeout, hz, bge_tick, sc);
|
||||
|
||||
return 0;
|
||||
out:
|
||||
splx(s);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -4018,6 +4018,7 @@ bge_ifmedia_upd(struct ifnet *ifp)
|
||||
struct bge_softc *sc = ifp->if_softc;
|
||||
struct mii_data *mii = &sc->bge_mii;
|
||||
struct ifmedia *ifm = &sc->bge_ifmedia;
|
||||
int rc;
|
||||
|
||||
/* If this is a 1000baseX NIC, enable the TBI port. */
|
||||
if (sc->bge_tbi) {
|
||||
@ -4043,9 +4044,9 @@ bge_ifmedia_upd(struct ifnet *ifp)
|
||||
}
|
||||
|
||||
sc->bge_link = 0;
|
||||
mii_mediachg(mii);
|
||||
|
||||
return(0);
|
||||
if ((rc = mii_mediachg(mii)) == ENXIO)
|
||||
return 0;
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_msk.c,v 1.14 2007/12/11 11:25:51 lukem Exp $ */
|
||||
/* $NetBSD: if_msk.c,v 1.15 2008/01/19 22:10:18 dyoung Exp $ */
|
||||
/* $OpenBSD: if_msk.c,v 1.42 2007/01/17 02:43:02 krw Exp $ */
|
||||
|
||||
/*
|
||||
@ -52,7 +52,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.14 2007/12/11 11:25:51 lukem Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.15 2008/01/19 22:10:18 dyoung Exp $");
|
||||
|
||||
#include "bpfilter.h"
|
||||
#include "rnd.h"
|
||||
@ -116,8 +116,6 @@ int msk_init(struct ifnet *);
|
||||
void msk_init_yukon(struct sk_if_softc *);
|
||||
void msk_stop(struct ifnet *, int);
|
||||
void msk_watchdog(struct ifnet *);
|
||||
int msk_ifmedia_upd(struct ifnet *);
|
||||
void msk_ifmedia_sts(struct ifnet *, struct ifmediareq *);
|
||||
void msk_reset(struct sk_softc *);
|
||||
int msk_newbuf(struct sk_if_softc *, int, struct mbuf *, bus_dmamap_t);
|
||||
int msk_alloc_jumbo_mem(struct sk_if_softc *);
|
||||
@ -690,37 +688,11 @@ msk_jfree(struct mbuf *m, void *buf, size_t size, void *arg)
|
||||
splx(s);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set media options.
|
||||
*/
|
||||
int
|
||||
msk_ifmedia_upd(struct ifnet *ifp)
|
||||
{
|
||||
struct sk_if_softc *sc_if = ifp->if_softc;
|
||||
|
||||
mii_mediachg(&sc_if->sk_mii);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Report current media status.
|
||||
*/
|
||||
void
|
||||
msk_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
|
||||
{
|
||||
struct sk_if_softc *sc_if = ifp->if_softc;
|
||||
|
||||
mii_pollstat(&sc_if->sk_mii);
|
||||
ifmr->ifm_active = sc_if->sk_mii.mii_media_active;
|
||||
ifmr->ifm_status = sc_if->sk_mii.mii_media_status;
|
||||
}
|
||||
|
||||
int
|
||||
msk_ioctl(struct ifnet *ifp, u_long command, void *data)
|
||||
{
|
||||
struct sk_if_softc *sc_if = ifp->if_softc;
|
||||
struct ifreq *ifr = (struct ifreq *) data;
|
||||
struct mii_data *mii;
|
||||
int s, error = 0;
|
||||
|
||||
s = splnet();
|
||||
@ -736,13 +708,6 @@ msk_ioctl(struct ifnet *ifp, u_long command, void *data)
|
||||
error = EINVAL;
|
||||
ifp->if_mtu = ifr->ifr_mtu;
|
||||
break;
|
||||
case SIOCGIFMEDIA:
|
||||
case SIOCSIFMEDIA:
|
||||
DPRINTFN(2,("msk_ioctl: SIOC[GS]IFMEDIA\n"));
|
||||
mii = &sc_if->sk_mii;
|
||||
error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command);
|
||||
DPRINTFN(2,("msk_ioctl: SIOC[GS]IFMEDIA done\n"));
|
||||
break;
|
||||
default:
|
||||
DPRINTFN(2, ("msk_ioctl ETHER\n"));
|
||||
error = ether_ioctl(ifp, command, data);
|
||||
@ -1106,8 +1071,9 @@ msk_attach(struct device *parent, struct device *self, void *aux)
|
||||
sc_if->sk_mii.mii_writereg = msk_miibus_writereg;
|
||||
sc_if->sk_mii.mii_statchg = msk_miibus_statchg;
|
||||
|
||||
sc_if->sk_ethercom.ec_mii = &sc_if->sk_mii;
|
||||
ifmedia_init(&sc_if->sk_mii.mii_media, 0,
|
||||
msk_ifmedia_upd, msk_ifmedia_sts);
|
||||
ether_mediachange, ether_mediastatus);
|
||||
mii_attach(self, &sc_if->sk_mii, 0xffffffff, MII_PHY_ANY,
|
||||
MII_OFFSET_ANY, MIIF_DOPAUSE|MIIF_FORCEANEG);
|
||||
if (LIST_FIRST(&sc_if->sk_mii.mii_phys) == NULL) {
|
||||
@ -2073,8 +2039,7 @@ msk_init(struct ifnet *ifp)
|
||||
{
|
||||
struct sk_if_softc *sc_if = ifp->if_softc;
|
||||
struct sk_softc *sc = sc_if->sk_softc;
|
||||
struct mii_data *mii = &sc_if->sk_mii;
|
||||
int s;
|
||||
int rc = 0, s;
|
||||
uint32_t imr, imtimer_ticks;
|
||||
|
||||
|
||||
@ -2089,7 +2054,8 @@ msk_init(struct ifnet *ifp)
|
||||
|
||||
/* Configure XMAC(s) */
|
||||
msk_init_yukon(sc_if);
|
||||
mii_mediachg(mii);
|
||||
if ((rc = ether_mediachange(ifp)) != 0)
|
||||
goto out;
|
||||
|
||||
/* Configure transmit arbiter(s) */
|
||||
SK_IF_WRITE_1(sc_if, 0, SK_TXAR1_COUNTERCTL, SK_TXARCTL_ON);
|
||||
@ -2204,8 +2170,9 @@ msk_init(struct ifnet *ifp)
|
||||
|
||||
callout_schedule(&sc_if->sk_tick_ch, hz);
|
||||
|
||||
out:
|
||||
splx(s);
|
||||
return 0;
|
||||
return rc;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_nfe.c,v 1.25 2007/12/17 12:41:06 tsutsui Exp $ */
|
||||
/* $NetBSD: if_nfe.c,v 1.26 2008/01/19 22:10:18 dyoung Exp $ */
|
||||
/* $OpenBSD: if_nfe.c,v 1.52 2006/03/02 09:04:00 jsg Exp $ */
|
||||
|
||||
/*-
|
||||
@ -21,7 +21,7 @@
|
||||
/* Driver for NVIDIA nForce MCP Fast Ethernet and Gigabit Ethernet */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_nfe.c,v 1.25 2007/12/17 12:41:06 tsutsui Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_nfe.c,v 1.26 2008/01/19 22:10:18 dyoung Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
#include "bpfilter.h"
|
||||
@ -104,8 +104,6 @@ void nfe_free_rx_ring(struct nfe_softc *, struct nfe_rx_ring *);
|
||||
int nfe_alloc_tx_ring(struct nfe_softc *, struct nfe_tx_ring *);
|
||||
void nfe_reset_tx_ring(struct nfe_softc *, struct nfe_tx_ring *);
|
||||
void nfe_free_tx_ring(struct nfe_softc *, struct nfe_tx_ring *);
|
||||
int nfe_ifmedia_upd(struct ifnet *);
|
||||
void nfe_ifmedia_sts(struct ifnet *, struct ifmediareq *);
|
||||
void nfe_setmulti(struct nfe_softc *);
|
||||
void nfe_get_macaddr(struct nfe_softc *, uint8_t *);
|
||||
void nfe_set_macaddr(struct nfe_softc *, const uint8_t *);
|
||||
@ -352,8 +350,9 @@ nfe_attach(struct device *parent, struct device *self, void *aux)
|
||||
sc->sc_mii.mii_writereg = nfe_miibus_writereg;
|
||||
sc->sc_mii.mii_statchg = nfe_miibus_statchg;
|
||||
|
||||
ifmedia_init(&sc->sc_mii.mii_media, 0, nfe_ifmedia_upd,
|
||||
nfe_ifmedia_sts);
|
||||
sc->sc_ethercom.ec_mii = &sc->sc_mii;
|
||||
ifmedia_init(&sc->sc_mii.mii_media, 0, ether_mediachange,
|
||||
ether_mediastatus);
|
||||
mii_attach(self, &sc->sc_mii, 0xffffffff, MII_PHY_ANY,
|
||||
MII_OFFSET_ANY, 0);
|
||||
if (LIST_FIRST(&sc->sc_mii.mii_phys) == NULL) {
|
||||
@ -595,27 +594,13 @@ nfe_ioctl(struct ifnet *ifp, u_long cmd, void *data)
|
||||
}
|
||||
sc->sc_if_flags = ifp->if_flags;
|
||||
break;
|
||||
case SIOCADDMULTI:
|
||||
case SIOCDELMULTI:
|
||||
default:
|
||||
if ((error = ether_ioctl(ifp, cmd, data)) == ENETRESET) {
|
||||
if (ifp->if_flags & IFF_RUNNING)
|
||||
nfe_setmulti(sc);
|
||||
error = 0;
|
||||
}
|
||||
break;
|
||||
case SIOCSIFMEDIA:
|
||||
case SIOCGIFMEDIA:
|
||||
error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, cmd);
|
||||
break;
|
||||
default:
|
||||
error = ether_ioctl(ifp, cmd, data);
|
||||
if (error == ENETRESET) {
|
||||
if (ifp->if_flags & IFF_RUNNING)
|
||||
nfe_setmulti(sc);
|
||||
error = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
splx(s);
|
||||
@ -1173,7 +1158,7 @@ nfe_init(struct ifnet *ifp)
|
||||
{
|
||||
struct nfe_softc *sc = ifp->if_softc;
|
||||
uint32_t tmp;
|
||||
int s;
|
||||
int rc = 0, s;
|
||||
|
||||
if (ifp->if_flags & IFF_RUNNING)
|
||||
return 0;
|
||||
@ -1266,7 +1251,8 @@ nfe_init(struct ifnet *ifp)
|
||||
/* set Rx filter */
|
||||
nfe_setmulti(sc);
|
||||
|
||||
nfe_ifmedia_upd(ifp);
|
||||
if ((rc = ether_mediachange(ifp)) != 0)
|
||||
goto out;
|
||||
|
||||
nfe_tick(sc);
|
||||
|
||||
@ -1286,7 +1272,8 @@ nfe_init(struct ifnet *ifp)
|
||||
ifp->if_flags |= IFF_RUNNING;
|
||||
ifp->if_flags &= ~IFF_OACTIVE;
|
||||
|
||||
return 0;
|
||||
out:
|
||||
return rc;
|
||||
}
|
||||
|
||||
void
|
||||
@ -1787,31 +1774,6 @@ nfe_free_tx_ring(struct nfe_softc *sc, struct nfe_tx_ring *ring)
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
nfe_ifmedia_upd(struct ifnet *ifp)
|
||||
{
|
||||
struct nfe_softc *sc = ifp->if_softc;
|
||||
struct mii_data *mii = &sc->sc_mii;
|
||||
struct mii_softc *miisc;
|
||||
|
||||
if (mii->mii_instance != 0) {
|
||||
LIST_FOREACH(miisc, &mii->mii_phys, mii_list)
|
||||
mii_phy_reset(miisc);
|
||||
}
|
||||
return mii_mediachg(mii);
|
||||
}
|
||||
|
||||
void
|
||||
nfe_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
|
||||
{
|
||||
struct nfe_softc *sc = ifp->if_softc;
|
||||
struct mii_data *mii = &sc->sc_mii;
|
||||
|
||||
mii_pollstat(mii);
|
||||
ifmr->ifm_status = mii->mii_media_status;
|
||||
ifmr->ifm_active = mii->mii_media_active;
|
||||
}
|
||||
|
||||
void
|
||||
nfe_setmulti(struct nfe_softc *sc)
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_pcn.c,v 1.41 2007/10/19 12:00:47 ad Exp $ */
|
||||
/* $NetBSD: if_pcn.c,v 1.42 2008/01/19 22:10:18 dyoung Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001 Wasabi Systems, Inc.
|
||||
@ -65,7 +65,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_pcn.c,v 1.41 2007/10/19 12:00:47 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_pcn.c,v 1.42 2008/01/19 22:10:18 dyoung Exp $");
|
||||
|
||||
#include "bpfilter.h"
|
||||
#include "rnd.h"
|
||||
@ -422,8 +422,6 @@ static int pcn_79c970_mediachange(struct ifnet *);
|
||||
static void pcn_79c970_mediastatus(struct ifnet *, struct ifmediareq *);
|
||||
|
||||
static void pcn_79c971_mediainit(struct pcn_softc *);
|
||||
static int pcn_79c971_mediachange(struct ifnet *);
|
||||
static void pcn_79c971_mediastatus(struct ifnet *, struct ifmediareq *);
|
||||
|
||||
/*
|
||||
* Description of a PCnet-PCI variant. Used to select media access
|
||||
@ -1824,7 +1822,8 @@ pcn_init(struct ifnet *ifp)
|
||||
}
|
||||
|
||||
/* Set the media. */
|
||||
(void) (*sc->sc_mii.mii_media.ifm_change)(ifp);
|
||||
if ((error = mii_ifmedia_change(&sc->sc_mii)) != 0)
|
||||
goto out;
|
||||
|
||||
/* Enable interrupts and external activity (and ACK IDON). */
|
||||
pcn_csr_write(sc, LE_CSR0, LE_C0_INEA|LE_C0_STRT|LE_C0_IDON);
|
||||
@ -2142,8 +2141,10 @@ pcn_79c971_mediainit(struct pcn_softc *sc)
|
||||
sc->sc_mii.mii_readreg = pcn_mii_readreg;
|
||||
sc->sc_mii.mii_writereg = pcn_mii_writereg;
|
||||
sc->sc_mii.mii_statchg = pcn_mii_statchg;
|
||||
ifmedia_init(&sc->sc_mii.mii_media, 0, pcn_79c971_mediachange,
|
||||
pcn_79c971_mediastatus);
|
||||
|
||||
sc->sc_ethercom.ec_mii = &sc->sc_mii;
|
||||
ifmedia_init(&sc->sc_mii.mii_media, 0, ether_mediachange,
|
||||
ether_mediastatus);
|
||||
|
||||
mii_attach(&sc->sc_dev, &sc->sc_mii, 0xffffffff, MII_PHY_ANY,
|
||||
MII_OFFSET_ANY, 0);
|
||||
@ -2154,36 +2155,6 @@ pcn_79c971_mediainit(struct pcn_softc *sc)
|
||||
ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER|IFM_AUTO);
|
||||
}
|
||||
|
||||
/*
|
||||
* pcn_79c971_mediastatus: [ifmedia interface function]
|
||||
*
|
||||
* Get the current interface media status (Am79c971 version).
|
||||
*/
|
||||
static void
|
||||
pcn_79c971_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr)
|
||||
{
|
||||
struct pcn_softc *sc = ifp->if_softc;
|
||||
|
||||
mii_pollstat(&sc->sc_mii);
|
||||
ifmr->ifm_status = sc->sc_mii.mii_media_status;
|
||||
ifmr->ifm_active = sc->sc_mii.mii_media_active;
|
||||
}
|
||||
|
||||
/*
|
||||
* pcn_79c971_mediachange: [ifmedia interface function]
|
||||
*
|
||||
* Set hardware to newly-selected media (Am79c971 version).
|
||||
*/
|
||||
static int
|
||||
pcn_79c971_mediachange(struct ifnet *ifp)
|
||||
{
|
||||
struct pcn_softc *sc = ifp->if_softc;
|
||||
|
||||
if (ifp->if_flags & IFF_UP)
|
||||
mii_mediachg(&sc->sc_mii);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* pcn_mii_readreg: [mii interface function]
|
||||
*
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_sk.c,v 1.45 2007/12/11 11:25:52 lukem Exp $ */
|
||||
/* $NetBSD: if_sk.c,v 1.46 2008/01/19 22:10:18 dyoung Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2003 The NetBSD Foundation, Inc.
|
||||
@ -122,7 +122,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_sk.c,v 1.45 2007/12/11 11:25:52 lukem Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_sk.c,v 1.46 2008/01/19 22:10:18 dyoung Exp $");
|
||||
|
||||
#include "bpfilter.h"
|
||||
#include "rnd.h"
|
||||
@ -187,7 +187,6 @@ void sk_stop(struct ifnet *, int);
|
||||
void sk_watchdog(struct ifnet *);
|
||||
void sk_shutdown(void *);
|
||||
int sk_ifmedia_upd(struct ifnet *);
|
||||
void sk_ifmedia_sts(struct ifnet *, struct ifmediareq *);
|
||||
void sk_reset(struct sk_softc *);
|
||||
int sk_newbuf(struct sk_if_softc *, int, struct mbuf *, bus_dmamap_t);
|
||||
int sk_alloc_jumbo_mem(struct sk_if_softc *);
|
||||
@ -979,23 +978,12 @@ int
|
||||
sk_ifmedia_upd(struct ifnet *ifp)
|
||||
{
|
||||
struct sk_if_softc *sc_if = ifp->if_softc;
|
||||
int rc;
|
||||
|
||||
(void) sk_init(ifp);
|
||||
mii_mediachg(&sc_if->sk_mii);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Report current media status.
|
||||
*/
|
||||
void
|
||||
sk_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
|
||||
{
|
||||
struct sk_if_softc *sc_if = ifp->if_softc;
|
||||
|
||||
mii_pollstat(&sc_if->sk_mii);
|
||||
ifmr->ifm_active = sc_if->sk_mii.mii_media_active;
|
||||
ifmr->ifm_status = sc_if->sk_mii.mii_media_status;
|
||||
if ((rc = mii_mediachg(&sc_if->sk_mii)) == ENXIO)
|
||||
return 0;
|
||||
return rc;
|
||||
}
|
||||
|
||||
int
|
||||
@ -1003,8 +991,6 @@ sk_ioctl(struct ifnet *ifp, u_long command, void *data)
|
||||
{
|
||||
struct sk_if_softc *sc_if = ifp->if_softc;
|
||||
struct sk_softc *sc = sc_if->sk_softc;
|
||||
struct ifreq *ifr = (struct ifreq *) data;
|
||||
struct mii_data *mii;
|
||||
int s, error = 0;
|
||||
|
||||
/* DPRINTFN(2, ("sk_ioctl\n")); */
|
||||
@ -1059,12 +1045,6 @@ sk_ioctl(struct ifnet *ifp, u_long command, void *data)
|
||||
error = 0;
|
||||
break;
|
||||
|
||||
case SIOCGIFMEDIA:
|
||||
case SIOCSIFMEDIA:
|
||||
DPRINTFN(2, ("sk_ioctl MEDIA\n"));
|
||||
mii = &sc_if->sk_mii;
|
||||
error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command);
|
||||
break;
|
||||
default:
|
||||
DPRINTFN(2, ("sk_ioctl ETHER\n"));
|
||||
error = ether_ioctl(ifp, command, data);
|
||||
@ -1075,9 +1055,6 @@ sk_ioctl(struct ifnet *ifp, u_long command, void *data)
|
||||
DPRINTFN(2, ("sk_ioctl setmulti called\n"));
|
||||
}
|
||||
error = 0;
|
||||
} else if ( error ) {
|
||||
splx(s);
|
||||
return error;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1447,11 +1424,12 @@ sk_attach(struct device *parent, struct device *self, void *aux)
|
||||
break;
|
||||
}
|
||||
|
||||
sc_if->sk_ethercom.ec_mii = &sc_if->sk_mii;
|
||||
ifmedia_init(&sc_if->sk_mii.mii_media, 0,
|
||||
sk_ifmedia_upd, sk_ifmedia_sts);
|
||||
sk_ifmedia_upd, ether_mediastatus);
|
||||
mii_attach(self, &sc_if->sk_mii, 0xffffffff, MII_PHY_ANY,
|
||||
MII_OFFSET_ANY, 0);
|
||||
if (LIST_FIRST(&sc_if->sk_mii.mii_phys) == NULL) {
|
||||
if (LIST_EMPTY(&sc_if->sk_mii.mii_phys)) {
|
||||
aprint_error("%s: no PHY found!\n", sc_if->sk_dev.dv_xname);
|
||||
ifmedia_add(&sc_if->sk_mii.mii_media, IFM_ETHER|IFM_MANUAL,
|
||||
0, NULL);
|
||||
@ -2255,7 +2233,7 @@ sk_intr_bcom(struct sk_if_softc *sc_if)
|
||||
SK_PHYADDR_BCOM, BRGPHY_MII_AUXSTS);
|
||||
|
||||
if (!(lstat & BRGPHY_AUXSTS_LINK) && sc_if->sk_link) {
|
||||
mii_mediachg(mii);
|
||||
(void)mii_mediachg(mii);
|
||||
/* Turn off the link LED. */
|
||||
SK_IF_WRITE_1(sc_if, 0,
|
||||
SK_LINKLED1_CTL, SK_LINKLED_OFF);
|
||||
@ -2714,7 +2692,7 @@ sk_init(struct ifnet *ifp)
|
||||
struct sk_if_softc *sc_if = ifp->if_softc;
|
||||
struct sk_softc *sc = sc_if->sk_softc;
|
||||
struct mii_data *mii = &sc_if->sk_mii;
|
||||
int s;
|
||||
int rc = 0, s;
|
||||
u_int32_t imr, imtimer_ticks;
|
||||
|
||||
DPRINTFN(1, ("sk_init\n"));
|
||||
@ -2757,7 +2735,10 @@ sk_init(struct ifnet *ifp)
|
||||
sk_init_yukon(sc_if);
|
||||
break;
|
||||
}
|
||||
mii_mediachg(mii);
|
||||
if ((rc = mii_mediachg(mii)) == ENXIO)
|
||||
rc = 0;
|
||||
else if (rc != 0)
|
||||
goto out;
|
||||
|
||||
if (sc->sk_type == SK_GENESIS) {
|
||||
/* Configure MAC FIFOs */
|
||||
@ -2872,8 +2853,9 @@ sk_init(struct ifnet *ifp)
|
||||
ifp->if_flags |= IFF_RUNNING;
|
||||
ifp->if_flags &= ~IFF_OACTIVE;
|
||||
|
||||
out:
|
||||
splx(s);
|
||||
return 0;
|
||||
return rc;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_ste.c,v 1.31 2007/10/19 12:00:48 ad Exp $ */
|
||||
/* $NetBSD: if_ste.c,v 1.32 2008/01/19 22:10:19 dyoung Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
@ -42,7 +42,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_ste.c,v 1.31 2007/10/19 12:00:48 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_ste.c,v 1.32 2008/01/19 22:10:19 dyoung Exp $");
|
||||
|
||||
#include "bpfilter.h"
|
||||
|
||||
@ -232,9 +232,6 @@ static int ste_mii_readreg(struct device *, int, int);
|
||||
static void ste_mii_writereg(struct device *, int, int, int);
|
||||
static void ste_mii_statchg(struct device *);
|
||||
|
||||
static int ste_mediachange(struct ifnet *);
|
||||
static void ste_mediastatus(struct ifnet *, struct ifmediareq *);
|
||||
|
||||
static int ste_match(struct device *, struct cfdata *, void *);
|
||||
static void ste_attach(struct device *, struct device *, void *);
|
||||
|
||||
@ -474,8 +471,9 @@ ste_attach(struct device *parent, struct device *self, void *aux)
|
||||
sc->sc_mii.mii_readreg = ste_mii_readreg;
|
||||
sc->sc_mii.mii_writereg = ste_mii_writereg;
|
||||
sc->sc_mii.mii_statchg = ste_mii_statchg;
|
||||
ifmedia_init(&sc->sc_mii.mii_media, IFM_IMASK, ste_mediachange,
|
||||
ste_mediastatus);
|
||||
sc->sc_ethercom.ec_mii = &sc->sc_mii;
|
||||
ifmedia_init(&sc->sc_mii.mii_media, IFM_IMASK, ether_mediachange,
|
||||
ether_mediastatus);
|
||||
mii_attach(&sc->sc_dev, &sc->sc_mii, 0xffffffff, MII_PHY_ANY,
|
||||
MII_OFFSET_ANY, 0);
|
||||
if (LIST_FIRST(&sc->sc_mii.mii_phys) == NULL) {
|
||||
@ -804,29 +802,19 @@ static int
|
||||
ste_ioctl(struct ifnet *ifp, u_long cmd, void *data)
|
||||
{
|
||||
struct ste_softc *sc = ifp->if_softc;
|
||||
struct ifreq *ifr = (struct ifreq *)data;
|
||||
int s, error;
|
||||
|
||||
s = splnet();
|
||||
|
||||
switch (cmd) {
|
||||
case SIOCSIFMEDIA:
|
||||
case SIOCGIFMEDIA:
|
||||
error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, cmd);
|
||||
break;
|
||||
|
||||
default:
|
||||
error = ether_ioctl(ifp, cmd, data);
|
||||
if (error == ENETRESET) {
|
||||
/*
|
||||
* Multicast list has changed; set the hardware filter
|
||||
* accordingly.
|
||||
*/
|
||||
if (ifp->if_flags & IFF_RUNNING)
|
||||
ste_set_filter(sc);
|
||||
error = 0;
|
||||
}
|
||||
break;
|
||||
error = ether_ioctl(ifp, cmd, data);
|
||||
if (error == ENETRESET) {
|
||||
/*
|
||||
* Multicast list has changed; set the hardware filter
|
||||
* accordingly.
|
||||
*/
|
||||
if (ifp->if_flags & IFF_RUNNING)
|
||||
ste_set_filter(sc);
|
||||
error = 0;
|
||||
}
|
||||
|
||||
/* Try to get more packets going. */
|
||||
@ -1339,7 +1327,8 @@ ste_init(struct ifnet *ifp)
|
||||
/*
|
||||
* Set the current media.
|
||||
*/
|
||||
mii_mediachg(&sc->sc_mii);
|
||||
if ((error = ether_mediachange(ifp)) != 0)
|
||||
goto out;
|
||||
|
||||
/*
|
||||
* Start the MAC.
|
||||
@ -1683,33 +1672,3 @@ ste_mii_bitbang_write(struct device *self, uint32_t val)
|
||||
|
||||
bus_space_write_1(sc->sc_st, sc->sc_sh, STE_PhyCtrl, val);
|
||||
}
|
||||
|
||||
/*
|
||||
* ste_mediastatus: [ifmedia interface function]
|
||||
*
|
||||
* Get the current interface media status.
|
||||
*/
|
||||
static void
|
||||
ste_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr)
|
||||
{
|
||||
struct ste_softc *sc = ifp->if_softc;
|
||||
|
||||
mii_pollstat(&sc->sc_mii);
|
||||
ifmr->ifm_status = sc->sc_mii.mii_media_status;
|
||||
ifmr->ifm_active = sc->sc_mii.mii_media_active;
|
||||
}
|
||||
|
||||
/*
|
||||
* ste_mediachange: [ifmedia interface function]
|
||||
*
|
||||
* Set hardware to newly-selected media.
|
||||
*/
|
||||
static int
|
||||
ste_mediachange(struct ifnet *ifp)
|
||||
{
|
||||
struct ste_softc *sc = ifp->if_softc;
|
||||
|
||||
if (ifp->if_flags & IFF_UP)
|
||||
mii_mediachg(&sc->sc_mii);
|
||||
return (0);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_stge.c,v 1.39 2007/10/19 12:00:48 ad Exp $ */
|
||||
/* $NetBSD: if_stge.c,v 1.40 2008/01/19 22:10:19 dyoung Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
@ -42,7 +42,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_stge.c,v 1.39 2007/10/19 12:00:48 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_stge.c,v 1.40 2008/01/19 22:10:19 dyoung Exp $");
|
||||
|
||||
#include "bpfilter.h"
|
||||
|
||||
@ -293,9 +293,6 @@ static int stge_mii_readreg(struct device *, int, int);
|
||||
static void stge_mii_writereg(struct device *, int, int, int);
|
||||
static void stge_mii_statchg(struct device *);
|
||||
|
||||
static int stge_mediachange(struct ifnet *);
|
||||
static void stge_mediastatus(struct ifnet *, struct ifmediareq *);
|
||||
|
||||
static int stge_match(struct device *, struct cfdata *, void *);
|
||||
static void stge_attach(struct device *, struct device *, void *);
|
||||
|
||||
@ -596,8 +593,9 @@ stge_attach(struct device *parent, struct device *self, void *aux)
|
||||
sc->sc_mii.mii_readreg = stge_mii_readreg;
|
||||
sc->sc_mii.mii_writereg = stge_mii_writereg;
|
||||
sc->sc_mii.mii_statchg = stge_mii_statchg;
|
||||
ifmedia_init(&sc->sc_mii.mii_media, IFM_IMASK, stge_mediachange,
|
||||
stge_mediastatus);
|
||||
sc->sc_ethercom.ec_mii = &sc->sc_mii;
|
||||
ifmedia_init(&sc->sc_mii.mii_media, IFM_IMASK, ether_mediachange,
|
||||
ether_mediastatus);
|
||||
mii_attach(&sc->sc_dev, &sc->sc_mii, 0xffffffff, MII_PHY_ANY,
|
||||
MII_OFFSET_ANY, MIIF_DOPAUSE);
|
||||
if (LIST_FIRST(&sc->sc_mii.mii_phys) == NULL) {
|
||||
@ -1019,29 +1017,19 @@ static int
|
||||
stge_ioctl(struct ifnet *ifp, u_long cmd, void *data)
|
||||
{
|
||||
struct stge_softc *sc = ifp->if_softc;
|
||||
struct ifreq *ifr = (struct ifreq *)data;
|
||||
int s, error;
|
||||
|
||||
s = splnet();
|
||||
|
||||
switch (cmd) {
|
||||
case SIOCSIFMEDIA:
|
||||
case SIOCGIFMEDIA:
|
||||
error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, cmd);
|
||||
break;
|
||||
|
||||
default:
|
||||
error = ether_ioctl(ifp, cmd, data);
|
||||
if (error == ENETRESET) {
|
||||
/*
|
||||
* Multicast list has changed; set the hardware filter
|
||||
* accordingly.
|
||||
*/
|
||||
if (ifp->if_flags & IFF_RUNNING)
|
||||
stge_set_filter(sc);
|
||||
error = 0;
|
||||
}
|
||||
break;
|
||||
error = ether_ioctl(ifp, cmd, data);
|
||||
if (error == ENETRESET) {
|
||||
/*
|
||||
* Multicast list has changed; set the hardware filter
|
||||
* accordingly.
|
||||
*/
|
||||
if (ifp->if_flags & IFF_RUNNING)
|
||||
stge_set_filter(sc);
|
||||
error = 0;
|
||||
}
|
||||
|
||||
/* Try to get more packets going. */
|
||||
@ -1658,7 +1646,8 @@ stge_init(struct ifnet *ifp)
|
||||
/*
|
||||
* Set the current media.
|
||||
*/
|
||||
mii_mediachg(&sc->sc_mii);
|
||||
if ((error = ether_mediachange(ifp)) != 0)
|
||||
goto out;
|
||||
|
||||
/*
|
||||
* Start the one second MII clock.
|
||||
@ -2002,33 +1991,3 @@ stge_mii_bitbang_write(struct device *self, uint32_t val)
|
||||
bus_space_write_1(sc->sc_st, sc->sc_sh, STGE_PhyCtrl,
|
||||
val | sc->sc_PhyCtrl);
|
||||
}
|
||||
|
||||
/*
|
||||
* stge_mediastatus: [ifmedia interface function]
|
||||
*
|
||||
* Get the current interface media status.
|
||||
*/
|
||||
static void
|
||||
stge_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr)
|
||||
{
|
||||
struct stge_softc *sc = ifp->if_softc;
|
||||
|
||||
mii_pollstat(&sc->sc_mii);
|
||||
ifmr->ifm_status = sc->sc_mii.mii_media_status;
|
||||
ifmr->ifm_active = sc->sc_mii.mii_media_active;
|
||||
}
|
||||
|
||||
/*
|
||||
* stge_mediachange: [ifmedia interface function]
|
||||
*
|
||||
* Set hardware to newly-selected media.
|
||||
*/
|
||||
static int
|
||||
stge_mediachange(struct ifnet *ifp)
|
||||
{
|
||||
struct stge_softc *sc = ifp->if_softc;
|
||||
|
||||
if (ifp->if_flags & IFF_UP)
|
||||
mii_mediachg(&sc->sc_mii);
|
||||
return (0);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_tl.c,v 1.84 2007/10/19 12:00:48 ad Exp $ */
|
||||
/* $NetBSD: if_tl.c,v 1.85 2008/01/19 22:10:19 dyoung Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Manuel Bouyer. All rights reserved.
|
||||
@ -36,7 +36,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_tl.c,v 1.84 2007/10/19 12:00:48 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_tl.c,v 1.85 2008/01/19 22:10:19 dyoung Exp $");
|
||||
|
||||
#undef TLDEBUG
|
||||
#define TL_PRIV_STATS
|
||||
@ -124,7 +124,6 @@ static int tl_intr(void *);
|
||||
|
||||
static int tl_ifioctl(struct ifnet *, ioctl_cmd_t, void *);
|
||||
static int tl_mediachange(struct ifnet *);
|
||||
static void tl_mediastatus(struct ifnet *, struct ifmediareq *);
|
||||
static void tl_ifwatchdog(struct ifnet *);
|
||||
static void tl_shutdown(void*);
|
||||
|
||||
@ -453,8 +452,9 @@ tl_pci_attach(struct device *parent, struct device *self, void *aux)
|
||||
sc->tl_mii.mii_readreg = tl_mii_read;
|
||||
sc->tl_mii.mii_writereg = tl_mii_write;
|
||||
sc->tl_mii.mii_statchg = tl_statchg;
|
||||
sc->tl_ec.ec_mii = &sc->tl_mii;
|
||||
ifmedia_init(&sc->tl_mii.mii_media, IFM_IMASK, tl_mediachange,
|
||||
tl_mediastatus);
|
||||
ether_mediastatus);
|
||||
mii_attach(self, &sc->tl_mii, 0xffffffff, MII_PHY_ANY,
|
||||
MII_OFFSET_ANY, 0);
|
||||
if (LIST_FIRST(&sc->tl_mii.mii_phys) == NULL) {
|
||||
@ -751,7 +751,12 @@ static int tl_init(ifp)
|
||||
BUS_DMASYNC_PREWRITE);
|
||||
|
||||
/* set media */
|
||||
mii_mediachg(&sc->tl_mii);
|
||||
if ((error = mii_mediachg(&sc->tl_mii)) == ENXIO)
|
||||
error = 0;
|
||||
else if (error != 0) {
|
||||
errstring = "could not set media";
|
||||
goto bad;
|
||||
}
|
||||
|
||||
/* start ticks calls */
|
||||
callout_reset(&sc->tl_tick_ch, hz, tl_ticks, sc);
|
||||
@ -1258,22 +1263,14 @@ tl_ifioctl(ifp, cmd, data)
|
||||
void *data;
|
||||
{
|
||||
struct tl_softc *sc = ifp->if_softc;
|
||||
struct ifreq *ifr = (struct ifreq *)data;
|
||||
int s, error;
|
||||
|
||||
s = splnet();
|
||||
switch(cmd) {
|
||||
case SIOCSIFMEDIA:
|
||||
case SIOCGIFMEDIA:
|
||||
error = ifmedia_ioctl(ifp, ifr, &sc->tl_mii.mii_media, cmd);
|
||||
break;
|
||||
default:
|
||||
error = ether_ioctl(ifp, cmd, data);
|
||||
if (error == ENETRESET) {
|
||||
if (ifp->if_flags & IFF_RUNNING)
|
||||
tl_addr_filter(sc);
|
||||
error = 0;
|
||||
}
|
||||
error = ether_ioctl(ifp, cmd, data);
|
||||
if (error == ENETRESET) {
|
||||
if (ifp->if_flags & IFF_RUNNING)
|
||||
tl_addr_filter(sc);
|
||||
error = 0;
|
||||
}
|
||||
splx(s);
|
||||
return error;
|
||||
@ -1478,18 +1475,6 @@ tl_mediachange(ifp)
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void
|
||||
tl_mediastatus(ifp, ifmr)
|
||||
struct ifnet *ifp;
|
||||
struct ifmediareq *ifmr;
|
||||
{
|
||||
tl_softc_t *sc = ifp->if_softc;
|
||||
|
||||
mii_pollstat(&sc->tl_mii);
|
||||
ifmr->ifm_active = sc->tl_mii.mii_media_active;
|
||||
ifmr->ifm_status = sc->tl_mii.mii_media_status;
|
||||
}
|
||||
|
||||
static int tl_add_RxBuff(sc, Rx, oldm)
|
||||
tl_softc_t *sc;
|
||||
struct Rx_list *Rx;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_vge.c,v 1.38 2007/10/19 12:00:49 ad Exp $ */
|
||||
/* $NetBSD: if_vge.c,v 1.39 2008/01/19 22:10:19 dyoung Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2004
|
||||
@ -35,7 +35,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_vge.c,v 1.38 2007/10/19 12:00:49 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_vge.c,v 1.39 2008/01/19 22:10:19 dyoung Exp $");
|
||||
|
||||
/*
|
||||
* VIA Networking Technologies VT612x PCI gigabit ethernet NIC driver.
|
||||
@ -319,8 +319,6 @@ static int vge_suspend(struct device *);
|
||||
static int vge_resume(struct device *);
|
||||
#endif
|
||||
static void vge_shutdown(void *);
|
||||
static int vge_ifmedia_upd(struct ifnet *);
|
||||
static void vge_ifmedia_sts(struct ifnet *, struct ifmediareq *);
|
||||
|
||||
static uint16_t vge_read_eeprom(struct vge_softc *, int);
|
||||
|
||||
@ -1053,8 +1051,10 @@ vge_attach(struct device *parent, struct device *self, void *aux)
|
||||
sc->sc_mii.mii_readreg = vge_miibus_readreg;
|
||||
sc->sc_mii.mii_writereg = vge_miibus_writereg;
|
||||
sc->sc_mii.mii_statchg = vge_miibus_statchg;
|
||||
ifmedia_init(&sc->sc_mii.mii_media, 0, vge_ifmedia_upd,
|
||||
vge_ifmedia_sts);
|
||||
|
||||
sc->sc_ethercom.ec_mii = &sc->sc_mii;
|
||||
ifmedia_init(&sc->sc_mii.mii_media, 0, ether_mediachange,
|
||||
ether_mediastatus);
|
||||
mii_attach(&sc->sc_dev, &sc->sc_mii, 0xffffffff, MII_PHY_ANY,
|
||||
MII_OFFSET_ANY, MIIF_DOPAUSE);
|
||||
if (LIST_FIRST(&sc->sc_mii.mii_phys) == NULL) {
|
||||
@ -1781,7 +1781,7 @@ static int
|
||||
vge_init(struct ifnet *ifp)
|
||||
{
|
||||
struct vge_softc *sc;
|
||||
int i;
|
||||
int i, rc = 0;
|
||||
|
||||
sc = ifp->if_softc;
|
||||
|
||||
@ -1950,7 +1950,8 @@ vge_init(struct ifnet *ifp)
|
||||
CSR_WRITE_1(sc, VGE_CRS3, VGE_CR3_INT_GMSK);
|
||||
}
|
||||
|
||||
mii_mediachg(&sc->sc_mii);
|
||||
if ((rc = ether_mediachange(ifp)) != 0)
|
||||
goto out;
|
||||
|
||||
ifp->if_flags |= IFF_RUNNING;
|
||||
ifp->if_flags &= ~IFF_OACTIVE;
|
||||
@ -1960,38 +1961,8 @@ vge_init(struct ifnet *ifp)
|
||||
|
||||
callout_schedule(&sc->sc_timeout, hz);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Set media options.
|
||||
*/
|
||||
static int
|
||||
vge_ifmedia_upd(struct ifnet *ifp)
|
||||
{
|
||||
struct vge_softc *sc;
|
||||
|
||||
sc = ifp->if_softc;
|
||||
mii_mediachg(&sc->sc_mii);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Report current media status.
|
||||
*/
|
||||
static void
|
||||
vge_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
|
||||
{
|
||||
struct vge_softc *sc;
|
||||
struct mii_data *mii;
|
||||
|
||||
sc = ifp->if_softc;
|
||||
mii = &sc->sc_mii;
|
||||
|
||||
mii_pollstat(mii);
|
||||
ifmr->ifm_active = mii->mii_media_active;
|
||||
ifmr->ifm_status = mii->mii_media_status;
|
||||
out:
|
||||
return rc;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2046,7 +2017,6 @@ vge_ioctl(struct ifnet *ifp, u_long command, void *data)
|
||||
{
|
||||
struct vge_softc *sc;
|
||||
struct ifreq *ifr;
|
||||
struct mii_data *mii;
|
||||
int s, error;
|
||||
|
||||
sc = ifp->if_softc;
|
||||
@ -2083,8 +2053,7 @@ vge_ioctl(struct ifnet *ifp, u_long command, void *data)
|
||||
}
|
||||
sc->sc_if_flags = ifp->if_flags;
|
||||
break;
|
||||
case SIOCADDMULTI:
|
||||
case SIOCDELMULTI:
|
||||
default:
|
||||
if ((error = ether_ioctl(ifp, command, data)) == ENETRESET) {
|
||||
/*
|
||||
* Multicast list has changed; set the hardware filter
|
||||
@ -2095,14 +2064,6 @@ vge_ioctl(struct ifnet *ifp, u_long command, void *data)
|
||||
error = 0;
|
||||
}
|
||||
break;
|
||||
case SIOCGIFMEDIA:
|
||||
case SIOCSIFMEDIA:
|
||||
mii = &sc->sc_mii;
|
||||
error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command);
|
||||
break;
|
||||
default:
|
||||
error = ether_ioctl(ifp, command, data);
|
||||
break;
|
||||
}
|
||||
|
||||
splx(s);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_vr.c,v 1.88 2007/10/19 12:00:49 ad Exp $ */
|
||||
/* $NetBSD: if_vr.c,v 1.89 2008/01/19 22:10:19 dyoung Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
|
||||
@ -104,7 +104,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_vr.c,v 1.88 2007/10/19 12:00:49 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_vr.c,v 1.89 2008/01/19 22:10:19 dyoung Exp $");
|
||||
|
||||
#include "rnd.h"
|
||||
|
||||
@ -324,9 +324,6 @@ static void vr_rxdrain(struct vr_softc *);
|
||||
static void vr_watchdog(struct ifnet *);
|
||||
static void vr_tick(void *);
|
||||
|
||||
static int vr_ifmedia_upd(struct ifnet *);
|
||||
static void vr_ifmedia_sts(struct ifnet *, struct ifmediareq *);
|
||||
|
||||
static int vr_mii_readreg(struct device *, int, int);
|
||||
static void vr_mii_writereg(struct device *, int, int, int);
|
||||
static void vr_mii_statchg(struct device *);
|
||||
@ -1261,7 +1258,8 @@ vr_init(struct ifnet *ifp)
|
||||
CSR_WRITE_4(sc, VR_TXADDR, VR_CDTXADDR(sc, VR_NEXTTX(sc->vr_txlast)));
|
||||
|
||||
/* Set current media. */
|
||||
mii_mediachg(&sc->vr_mii);
|
||||
if ((error = ether_mediachange(ifp)) != 0)
|
||||
goto out;
|
||||
|
||||
/* Enable receiver and transmitter. */
|
||||
CSR_WRITE_2(sc, VR_COMMAND, VR_CMD_TX_NOPOLL|VR_CMD_START|
|
||||
@ -1287,59 +1285,23 @@ vr_init(struct ifnet *ifp)
|
||||
return (error);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set media options.
|
||||
*/
|
||||
static int
|
||||
vr_ifmedia_upd(struct ifnet *ifp)
|
||||
{
|
||||
struct vr_softc *sc = ifp->if_softc;
|
||||
|
||||
if (ifp->if_flags & IFF_UP)
|
||||
mii_mediachg(&sc->vr_mii);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Report current media status.
|
||||
*/
|
||||
static void
|
||||
vr_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
|
||||
{
|
||||
struct vr_softc *sc = ifp->if_softc;
|
||||
|
||||
mii_pollstat(&sc->vr_mii);
|
||||
ifmr->ifm_status = sc->vr_mii.mii_media_status;
|
||||
ifmr->ifm_active = sc->vr_mii.mii_media_active;
|
||||
}
|
||||
|
||||
static int
|
||||
vr_ioctl(struct ifnet *ifp, u_long command, void *data)
|
||||
{
|
||||
struct vr_softc *sc = ifp->if_softc;
|
||||
struct ifreq *ifr = (struct ifreq *)data;
|
||||
int s, error = 0;
|
||||
|
||||
s = splnet();
|
||||
|
||||
switch (command) {
|
||||
case SIOCGIFMEDIA:
|
||||
case SIOCSIFMEDIA:
|
||||
error = ifmedia_ioctl(ifp, ifr, &sc->vr_mii.mii_media, command);
|
||||
break;
|
||||
|
||||
default:
|
||||
error = ether_ioctl(ifp, command, data);
|
||||
if (error == ENETRESET) {
|
||||
/*
|
||||
* Multicast list has changed; set the hardware filter
|
||||
* accordingly.
|
||||
*/
|
||||
if (ifp->if_flags & IFF_RUNNING)
|
||||
vr_setmulti(sc);
|
||||
error = 0;
|
||||
}
|
||||
break;
|
||||
error = ether_ioctl(ifp, command, data);
|
||||
if (error == ENETRESET) {
|
||||
/*
|
||||
* Multicast list has changed; set the hardware filter
|
||||
* accordingly.
|
||||
*/
|
||||
if (ifp->if_flags & IFF_RUNNING)
|
||||
vr_setmulti(sc);
|
||||
error = 0;
|
||||
}
|
||||
|
||||
splx(s);
|
||||
@ -1738,8 +1700,10 @@ vr_attach(struct device *parent, struct device *self, void *aux)
|
||||
sc->vr_mii.mii_readreg = vr_mii_readreg;
|
||||
sc->vr_mii.mii_writereg = vr_mii_writereg;
|
||||
sc->vr_mii.mii_statchg = vr_mii_statchg;
|
||||
ifmedia_init(&sc->vr_mii.mii_media, IFM_IMASK, vr_ifmedia_upd,
|
||||
vr_ifmedia_sts);
|
||||
|
||||
sc->vr_ec.ec_mii = &sc->vr_mii;
|
||||
ifmedia_init(&sc->vr_mii.mii_media, IFM_IMASK, ether_mediachange,
|
||||
ether_mediastatus);
|
||||
mii_attach(&sc->vr_dev, &sc->vr_mii, 0xffffffff, MII_PHY_ANY,
|
||||
MII_OFFSET_ANY, MIIF_FORCEANEG);
|
||||
if (LIST_FIRST(&sc->vr_mii.mii_phys) == NULL) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_wm.c,v 1.151 2008/01/11 13:04:39 ragge Exp $ */
|
||||
/* $NetBSD: if_wm.c,v 1.152 2008/01/19 22:10:20 dyoung Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
|
||||
@ -79,7 +79,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.151 2008/01/11 13:04:39 ragge Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.152 2008/01/19 22:10:20 dyoung Exp $");
|
||||
|
||||
#include "bpfilter.h"
|
||||
#include "rnd.h"
|
||||
@ -3229,7 +3229,8 @@ wm_init(struct ifnet *ifp)
|
||||
CSR_WRITE(sc, WMREG_TCTL, sc->sc_tctl);
|
||||
|
||||
/* Set the media. */
|
||||
(void) (*sc->sc_mii.mii_media.ifm_change)(ifp);
|
||||
if ((error = mii_ifmedia_change(&sc->sc_mii)) != 0)
|
||||
goto out;
|
||||
|
||||
/*
|
||||
* Set up the receive control register; we actually program
|
||||
@ -4310,6 +4311,7 @@ wm_gmii_mediainit(struct wm_softc *sc)
|
||||
|
||||
wm_gmii_reset(sc);
|
||||
|
||||
sc->sc_ethercom.ec_mii = &sc->sc_mii;
|
||||
ifmedia_init(&sc->sc_mii.mii_media, IFM_IMASK, wm_gmii_mediachange,
|
||||
wm_gmii_mediastatus);
|
||||
|
||||
@ -4332,9 +4334,8 @@ wm_gmii_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr)
|
||||
{
|
||||
struct wm_softc *sc = ifp->if_softc;
|
||||
|
||||
mii_pollstat(&sc->sc_mii);
|
||||
ifmr->ifm_status = sc->sc_mii.mii_media_status;
|
||||
ifmr->ifm_active = (sc->sc_mii.mii_media_active & ~IFM_ETH_FMASK) |
|
||||
ether_mediastatus(ifp, ifmr);
|
||||
ifmr->ifm_active = (ifmr->ifm_active & ~IFM_ETH_FMASK) |
|
||||
sc->sc_flowflags;
|
||||
}
|
||||
|
||||
@ -4348,39 +4349,43 @@ wm_gmii_mediachange(struct ifnet *ifp)
|
||||
{
|
||||
struct wm_softc *sc = ifp->if_softc;
|
||||
struct ifmedia_entry *ife = sc->sc_mii.mii_media.ifm_cur;
|
||||
int rc;
|
||||
|
||||
if (ifp->if_flags & IFF_UP) {
|
||||
sc->sc_ctrl &= ~(CTRL_SPEED_MASK | CTRL_FD);
|
||||
sc->sc_ctrl |= CTRL_SLU;
|
||||
if ((IFM_SUBTYPE(ife->ifm_media) == IFM_AUTO)
|
||||
|| (sc->sc_type > WM_T_82543)) {
|
||||
sc->sc_ctrl &= ~(CTRL_FRCSPD | CTRL_FRCFDX);
|
||||
} else {
|
||||
sc->sc_ctrl &= ~CTRL_ASDE;
|
||||
sc->sc_ctrl |= CTRL_FRCSPD | CTRL_FRCFDX;
|
||||
if (ife->ifm_media & IFM_FDX)
|
||||
sc->sc_ctrl |= CTRL_FD;
|
||||
switch(IFM_SUBTYPE(ife->ifm_media)) {
|
||||
case IFM_10_T:
|
||||
sc->sc_ctrl |= CTRL_SPEED_10;
|
||||
break;
|
||||
case IFM_100_TX:
|
||||
sc->sc_ctrl |= CTRL_SPEED_100;
|
||||
break;
|
||||
case IFM_1000_T:
|
||||
sc->sc_ctrl |= CTRL_SPEED_1000;
|
||||
break;
|
||||
default:
|
||||
panic("wm_gmii_mediachange: bad media 0x%x",
|
||||
ife->ifm_media);
|
||||
}
|
||||
if ((ifp->if_flags & IFF_UP) == 0)
|
||||
return 0;
|
||||
|
||||
sc->sc_ctrl &= ~(CTRL_SPEED_MASK | CTRL_FD);
|
||||
sc->sc_ctrl |= CTRL_SLU;
|
||||
if ((IFM_SUBTYPE(ife->ifm_media) == IFM_AUTO)
|
||||
|| (sc->sc_type > WM_T_82543)) {
|
||||
sc->sc_ctrl &= ~(CTRL_FRCSPD | CTRL_FRCFDX);
|
||||
} else {
|
||||
sc->sc_ctrl &= ~CTRL_ASDE;
|
||||
sc->sc_ctrl |= CTRL_FRCSPD | CTRL_FRCFDX;
|
||||
if (ife->ifm_media & IFM_FDX)
|
||||
sc->sc_ctrl |= CTRL_FD;
|
||||
switch(IFM_SUBTYPE(ife->ifm_media)) {
|
||||
case IFM_10_T:
|
||||
sc->sc_ctrl |= CTRL_SPEED_10;
|
||||
break;
|
||||
case IFM_100_TX:
|
||||
sc->sc_ctrl |= CTRL_SPEED_100;
|
||||
break;
|
||||
case IFM_1000_T:
|
||||
sc->sc_ctrl |= CTRL_SPEED_1000;
|
||||
break;
|
||||
default:
|
||||
panic("wm_gmii_mediachange: bad media 0x%x",
|
||||
ife->ifm_media);
|
||||
}
|
||||
CSR_WRITE(sc, WMREG_CTRL, sc->sc_ctrl);
|
||||
if (sc->sc_type <= WM_T_82543)
|
||||
wm_gmii_reset(sc);
|
||||
mii_mediachg(&sc->sc_mii);
|
||||
}
|
||||
return (0);
|
||||
CSR_WRITE(sc, WMREG_CTRL, sc->sc_ctrl);
|
||||
if (sc->sc_type <= WM_T_82543)
|
||||
wm_gmii_reset(sc);
|
||||
|
||||
if ((rc = mii_mediachg(&sc->sc_mii)) == ENXIO)
|
||||
return 0;
|
||||
return rc;
|
||||
}
|
||||
|
||||
#define MDI_IO CTRL_SWDPIN(2)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_xi.c,v 1.62 2007/09/01 07:32:31 dyoung Exp $ */
|
||||
/* $NetBSD: if_xi.c,v 1.63 2008/01/19 22:10:21 dyoung Exp $ */
|
||||
/* OpenBSD: if_xe.c,v 1.9 1999/09/16 11:28:42 niklas Exp */
|
||||
|
||||
/*
|
||||
@ -55,7 +55,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_xi.c,v 1.62 2007/09/01 07:32:31 dyoung Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_xi.c,v 1.63 2008/01/19 22:10:21 dyoung Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
#include "opt_ipx.h"
|
||||
@ -152,7 +152,6 @@ STATIC int xi_ioctl(struct ifnet *, u_long, void *);
|
||||
STATIC int xi_mdi_read(struct device *, int, int);
|
||||
STATIC void xi_mdi_write(struct device *, int, int, int);
|
||||
STATIC int xi_mediachange(struct ifnet *);
|
||||
STATIC void xi_mediastatus(struct ifnet *, struct ifmediareq *);
|
||||
STATIC u_int16_t xi_get(struct xi_softc *);
|
||||
STATIC void xi_reset(struct xi_softc *);
|
||||
STATIC void xi_set_address(struct xi_softc *);
|
||||
@ -241,8 +240,9 @@ xi_attach(sc, myea)
|
||||
sc->sc_mii.mii_readreg = xi_mdi_read;
|
||||
sc->sc_mii.mii_writereg = xi_mdi_write;
|
||||
sc->sc_mii.mii_statchg = xi_statchg;
|
||||
sc->sc_ethercom.ec_mii = &sc->sc_mii;
|
||||
ifmedia_init(&sc->sc_mii.mii_media, 0, xi_mediachange,
|
||||
xi_mediastatus);
|
||||
ether_mediastatus);
|
||||
DPRINTF(XID_MII | XID_CONFIG,
|
||||
("xi: bmsr %x\n", xi_mdi_read(&sc->sc_dev, 0, 1)));
|
||||
|
||||
@ -689,25 +689,6 @@ xi_mediachange(ifp)
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Notify the world which media we're using.
|
||||
*/
|
||||
STATIC void
|
||||
xi_mediastatus(ifp, ifmr)
|
||||
struct ifnet *ifp;
|
||||
struct ifmediareq *ifmr;
|
||||
{
|
||||
struct xi_softc *sc = ifp->if_softc;
|
||||
|
||||
DPRINTF(XID_CONFIG, ("xi_mediastatus()\n"));
|
||||
|
||||
if (LIST_FIRST(&sc->sc_mii.mii_phys)) {
|
||||
mii_pollstat(&sc->sc_mii);
|
||||
ifmr->ifm_status = sc->sc_mii.mii_media_status;
|
||||
ifmr->ifm_active = sc->sc_mii.mii_media_active;
|
||||
}
|
||||
}
|
||||
|
||||
STATIC void
|
||||
xi_reset(sc)
|
||||
struct xi_softc *sc;
|
||||
@ -968,7 +949,6 @@ xi_ioctl(ifp, cmd, data)
|
||||
void *data;
|
||||
{
|
||||
struct xi_softc *sc = ifp->if_softc;
|
||||
struct ifreq *ifr = (struct ifreq *)data;
|
||||
int s, error = 0;
|
||||
|
||||
DPRINTF(XID_CONFIG, ("xi_ioctl()\n"));
|
||||
@ -1014,7 +994,9 @@ xi_ioctl(ifp, cmd, data)
|
||||
error = EIO;
|
||||
break;
|
||||
}
|
||||
|
||||
/*FALLTHROUGH*/
|
||||
case SIOCSIFMEDIA:
|
||||
case SIOCGIFMEDIA:
|
||||
if ((error = ether_ioctl(ifp, cmd, data)) == ENETRESET) {
|
||||
/*
|
||||
* Multicast list has changed; set the hardware
|
||||
@ -1026,11 +1008,6 @@ xi_ioctl(ifp, cmd, data)
|
||||
}
|
||||
break;
|
||||
|
||||
case SIOCSIFMEDIA:
|
||||
case SIOCGIFMEDIA:
|
||||
error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, cmd);
|
||||
break;
|
||||
|
||||
default:
|
||||
error = EINVAL;
|
||||
break;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: be.c,v 1.55 2007/10/19 12:01:10 ad Exp $ */
|
||||
/* $NetBSD: be.c,v 1.56 2008/01/19 22:10:20 dyoung Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
||||
@ -64,7 +64,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: be.c,v 1.55 2007/10/19 12:01:10 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: be.c,v 1.56 2008/01/19 22:10:20 dyoung Exp $");
|
||||
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_inet.h"
|
||||
@ -1077,7 +1077,7 @@ beinit(sc)
|
||||
u_int32_t v;
|
||||
u_int32_t qecaddr;
|
||||
u_int8_t *ea;
|
||||
int s;
|
||||
int rc, s;
|
||||
|
||||
s = splnet();
|
||||
|
||||
@ -1159,11 +1159,14 @@ beinit(sc)
|
||||
v |= BE_BR_RXCFG_FIFO | BE_BR_RXCFG_ENABLE;
|
||||
bus_space_write_4(t, br, BE_BRI_RXCFG, v);
|
||||
|
||||
if ((rc = be_ifmedia_upd(ifp)) != 0)
|
||||
goto out;
|
||||
|
||||
ifp->if_flags |= IFF_RUNNING;
|
||||
ifp->if_flags &= ~IFF_OACTIVE;
|
||||
|
||||
be_ifmedia_upd(ifp);
|
||||
callout_reset(&sc->sc_tick_ch, hz, be_tick, sc);
|
||||
out:
|
||||
splx(s);
|
||||
}
|
||||
|
||||
@ -1509,8 +1512,10 @@ be_ifmedia_upd(ifp)
|
||||
struct be_softc *sc = ifp->if_softc;
|
||||
int error;
|
||||
|
||||
if ((error = mii_mediachg(&sc->sc_mii)) != 0)
|
||||
return (error);
|
||||
if ((error = mii_mediachg(&sc->sc_mii)) == ENXIO)
|
||||
error = 0;
|
||||
else if (error != 0)
|
||||
return error;
|
||||
|
||||
return (be_intphy_service(sc, &sc->sc_mii, MII_MEDIACHG));
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_aue.c,v 1.108 2008/01/16 12:33:54 is Exp $ */
|
||||
/* $NetBSD: if_aue.c,v 1.109 2008/01/19 22:10:20 dyoung Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1997, 1998, 1999, 2000
|
||||
* Bill Paul <wpaul@ee.columbia.edu>. All rights reserved.
|
||||
@ -77,7 +77,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_aue.c,v 1.108 2008/01/16 12:33:54 is Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_aue.c,v 1.109 2008/01/19 22:10:20 dyoung Exp $");
|
||||
|
||||
#if defined(__NetBSD__)
|
||||
#include "opt_inet.h"
|
||||
@ -255,7 +255,6 @@ Static void aue_stop(struct aue_softc *);
|
||||
Static void aue_watchdog(struct ifnet *);
|
||||
Static int aue_openpipes(struct aue_softc *);
|
||||
Static int aue_ifmedia_upd(struct ifnet *);
|
||||
Static void aue_ifmedia_sts(struct ifnet *, struct ifmediareq *);
|
||||
|
||||
Static int aue_eeprom_getword(struct aue_softc *, int);
|
||||
Static void aue_read_mac(struct aue_softc *, u_char *);
|
||||
@ -871,7 +870,8 @@ USB_ATTACH(aue)
|
||||
mii->mii_writereg = aue_miibus_writereg;
|
||||
mii->mii_statchg = aue_miibus_statchg;
|
||||
mii->mii_flags = MIIF_AUTOTSLEEP;
|
||||
ifmedia_init(&mii->mii_media, 0, aue_ifmedia_upd, aue_ifmedia_sts);
|
||||
sc->aue_ec.ec_mii = mii;
|
||||
ifmedia_init(&mii->mii_media, 0, aue_ifmedia_upd, ether_mediastatus);
|
||||
mii_attach(self, mii, 0xffffffff, MII_PHY_ANY, MII_OFFSET_ANY, 0);
|
||||
if (LIST_FIRST(&mii->mii_phys) == NULL) {
|
||||
ifmedia_add(&mii->mii_media, IFM_ETHER | IFM_NONE, 0, NULL);
|
||||
@ -1561,6 +1561,7 @@ aue_ifmedia_upd(struct ifnet *ifp)
|
||||
{
|
||||
struct aue_softc *sc = ifp->if_softc;
|
||||
struct mii_data *mii = GET_MII(sc);
|
||||
int rc;
|
||||
|
||||
DPRINTFN(5,("%s: %s: enter\n", USBDEVNAME(sc->aue_dev), __func__));
|
||||
|
||||
@ -1568,31 +1569,10 @@ aue_ifmedia_upd(struct ifnet *ifp)
|
||||
return (0);
|
||||
|
||||
sc->aue_link = 0;
|
||||
if (mii->mii_instance) {
|
||||
struct mii_softc *miisc;
|
||||
for (miisc = LIST_FIRST(&mii->mii_phys); miisc != NULL;
|
||||
miisc = LIST_NEXT(miisc, mii_list))
|
||||
mii_phy_reset(miisc);
|
||||
}
|
||||
mii_mediachg(mii);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Report current media status.
|
||||
*/
|
||||
Static void
|
||||
aue_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
|
||||
{
|
||||
struct aue_softc *sc = ifp->if_softc;
|
||||
struct mii_data *mii = GET_MII(sc);
|
||||
|
||||
DPRINTFN(5,("%s: %s: enter\n", USBDEVNAME(sc->aue_dev), __func__));
|
||||
|
||||
mii_pollstat(mii);
|
||||
ifmr->ifm_active = mii->mii_media_active;
|
||||
ifmr->ifm_status = mii->mii_media_status;
|
||||
if ((rc = mii_mediachg(mii)) == ENXIO)
|
||||
return 0;
|
||||
return rc;
|
||||
}
|
||||
|
||||
Static int
|
||||
@ -1601,7 +1581,6 @@ aue_ioctl(struct ifnet *ifp, u_long command, void *data)
|
||||
struct aue_softc *sc = ifp->if_softc;
|
||||
struct ifaddr *ifa = (struct ifaddr *)data;
|
||||
struct ifreq *ifr = (struct ifreq *)data;
|
||||
struct mii_data *mii;
|
||||
int s, error = 0;
|
||||
|
||||
if (sc->aue_dying)
|
||||
@ -1655,6 +1634,8 @@ aue_ioctl(struct ifnet *ifp, u_long command, void *data)
|
||||
break;
|
||||
case SIOCADDMULTI:
|
||||
case SIOCDELMULTI:
|
||||
case SIOCGIFMEDIA:
|
||||
case SIOCSIFMEDIA:
|
||||
if ((error = ether_ioctl(ifp, command, data)) == ENETRESET) {
|
||||
if (ifp->if_flags & IFF_RUNNING) {
|
||||
#if defined(__NetBSD__)
|
||||
@ -1667,11 +1648,6 @@ aue_ioctl(struct ifnet *ifp, u_long command, void *data)
|
||||
error = 0;
|
||||
}
|
||||
break;
|
||||
case SIOCGIFMEDIA:
|
||||
case SIOCSIFMEDIA:
|
||||
mii = GET_MII(sc);
|
||||
error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command);
|
||||
break;
|
||||
default:
|
||||
error = EINVAL;
|
||||
break;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_axe.c,v 1.21 2007/12/05 07:58:32 ad Exp $ */
|
||||
/* $NetBSD: if_axe.c,v 1.22 2008/01/19 22:10:20 dyoung Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997, 1998, 1999, 2000-2003
|
||||
@ -73,7 +73,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.21 2007/12/05 07:58:32 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.22 2008/01/19 22:10:20 dyoung Exp $");
|
||||
|
||||
#if defined(__NetBSD__)
|
||||
#include "opt_inet.h"
|
||||
@ -186,8 +186,6 @@ Static int axe_miibus_readreg(device_ptr_t, int, int);
|
||||
Static void axe_miibus_writereg(device_ptr_t, int, int, int);
|
||||
Static void axe_miibus_statchg(device_ptr_t);
|
||||
Static int axe_cmd(struct axe_softc *, int, int, int, void *);
|
||||
Static int axe_ifmedia_upd(struct ifnet *);
|
||||
Static void axe_ifmedia_sts(struct ifnet *, struct ifmediareq *);
|
||||
Static void axe_reset(struct axe_softc *sc);
|
||||
|
||||
Static void axe_setmulti(struct axe_softc *);
|
||||
@ -328,40 +326,6 @@ axe_miibus_statchg(device_ptr_t dev)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Set media options.
|
||||
*/
|
||||
Static int
|
||||
axe_ifmedia_upd(struct ifnet *ifp)
|
||||
{
|
||||
struct axe_softc *sc = ifp->if_softc;
|
||||
struct mii_data *mii = GET_MII(sc);
|
||||
|
||||
sc->axe_link = 0;
|
||||
if (mii->mii_instance) {
|
||||
struct mii_softc *miisc;
|
||||
LIST_FOREACH(miisc, &mii->mii_phys, mii_list)
|
||||
mii_phy_reset(miisc);
|
||||
}
|
||||
mii_mediachg(mii);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Report current media status.
|
||||
*/
|
||||
Static void
|
||||
axe_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr)
|
||||
{
|
||||
struct axe_softc *sc = ifp->if_softc;
|
||||
struct mii_data *mii = GET_MII(sc);
|
||||
|
||||
mii_pollstat(mii);
|
||||
ifmr->ifm_active = mii->mii_media_active;
|
||||
ifmr->ifm_status = mii->mii_media_status;
|
||||
}
|
||||
|
||||
Static void
|
||||
axe_setmulti(struct axe_softc *sc)
|
||||
{
|
||||
@ -555,10 +519,11 @@ USB_ATTACH(axe)
|
||||
mii->mii_statchg = axe_miibus_statchg;
|
||||
mii->mii_flags = MIIF_AUTOTSLEEP;
|
||||
|
||||
ifmedia_init(&mii->mii_media, 0, axe_ifmedia_upd, axe_ifmedia_sts);
|
||||
sc->axe_ec.ec_mii = mii;
|
||||
ifmedia_init(&mii->mii_media, 0, ether_mediachange, ether_mediastatus);
|
||||
mii_attach(self, mii, 0xffffffff, MII_PHY_ANY, MII_OFFSET_ANY, 0);
|
||||
|
||||
if (LIST_FIRST(&mii->mii_phys) == NULL) {
|
||||
if (LIST_EMPTY(&mii->mii_phys)) {
|
||||
ifmedia_add(&mii->mii_media, IFM_ETHER | IFM_NONE, 0, NULL);
|
||||
ifmedia_set(&mii->mii_media, IFM_ETHER | IFM_NONE);
|
||||
} else
|
||||
@ -988,17 +953,6 @@ axe_tick_task(void *xsc)
|
||||
s = splnet();
|
||||
|
||||
mii_tick(mii);
|
||||
if (!sc->axe_link) {
|
||||
mii_pollstat(mii);
|
||||
if (mii->mii_media_status & IFM_ACTIVE &&
|
||||
IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) {
|
||||
DPRINTF(("%s: %s: got link\n",
|
||||
USBDEVNAME(sc->axe_dev), __func__));
|
||||
sc->axe_link++;
|
||||
if (IFQ_IS_EMPTY(&ifp->if_snd) == 0)
|
||||
axe_start(ifp);
|
||||
}
|
||||
}
|
||||
|
||||
usb_callout(sc->axe_stat_ch, hz, axe_tick, sc);
|
||||
|
||||
@ -1044,13 +998,8 @@ axe_start(struct ifnet *ifp)
|
||||
|
||||
sc = ifp->if_softc;
|
||||
|
||||
if (!sc->axe_link) {
|
||||
if ((ifp->if_flags & (IFF_OACTIVE|IFF_RUNNING)) != IFF_RUNNING)
|
||||
return;
|
||||
}
|
||||
|
||||
if (ifp->if_flags & IFF_OACTIVE) {
|
||||
return;
|
||||
}
|
||||
|
||||
IF_DEQUEUE(&ifp->if_snd, m_head);
|
||||
if (m_head == NULL) {
|
||||
@ -1184,7 +1133,6 @@ axe_ioctl(struct ifnet *ifp, u_long cmd, void *data)
|
||||
struct axe_softc *sc = ifp->if_softc;
|
||||
struct ifreq *ifr = (struct ifreq *)data;
|
||||
struct ifaddr *ifa = (struct ifaddr *)data;
|
||||
struct mii_data *mii;
|
||||
u_int16_t rxmode;
|
||||
int error = 0;
|
||||
|
||||
@ -1250,13 +1198,9 @@ axe_ioctl(struct ifnet *ifp, u_long cmd, void *data)
|
||||
break;
|
||||
case SIOCADDMULTI:
|
||||
case SIOCDELMULTI:
|
||||
#ifdef __NetBSD__
|
||||
case SIOCGIFMEDIA:
|
||||
case SIOCSIFMEDIA:
|
||||
error = ether_ioctl(ifp, cmd, data);
|
||||
#else
|
||||
error = (cmd == SIOCADDMULTI) ?
|
||||
ether_addmulti(ifr, &sc->arpcom) :
|
||||
ether_delmulti(ifr, &sc->arpcom);
|
||||
#endif /* __NetBSD__ */
|
||||
if (error == ENETRESET) {
|
||||
/*
|
||||
* Multicast list has changed; set the hardware
|
||||
@ -1267,12 +1211,6 @@ axe_ioctl(struct ifnet *ifp, u_long cmd, void *data)
|
||||
error = 0;
|
||||
}
|
||||
break;
|
||||
case SIOCGIFMEDIA:
|
||||
case SIOCSIFMEDIA:
|
||||
mii = GET_MII(sc);
|
||||
error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, cmd);
|
||||
break;
|
||||
|
||||
default:
|
||||
error = EINVAL;
|
||||
break;
|
||||
@ -1394,7 +1332,6 @@ axe_stop(struct axe_softc *sc)
|
||||
}
|
||||
}
|
||||
|
||||
sc->axe_link = 0;
|
||||
ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_axereg.h,v 1.4 2007/12/05 07:58:32 ad Exp $ */
|
||||
/* $NetBSD: if_axereg.h,v 1.5 2008/01/19 22:10:20 dyoung Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997, 1998, 1999, 2000-2003
|
||||
@ -195,7 +195,6 @@ struct axe_softc {
|
||||
|
||||
kmutex_t axe_mii_lock;
|
||||
|
||||
int axe_link;
|
||||
unsigned char axe_ipgs[3];
|
||||
unsigned char axe_phyaddrs[2];
|
||||
struct timeval axe_rx_notice;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_udav.c,v 1.20 2007/12/20 21:08:20 dyoung Exp $ */
|
||||
/* $NetBSD: if_udav.c,v 1.21 2008/01/19 22:10:20 dyoung Exp $ */
|
||||
/* $nabe: if_udav.c,v 1.3 2003/08/21 16:57:19 nabe Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2003
|
||||
@ -44,7 +44,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_udav.c,v 1.20 2007/12/20 21:08:20 dyoung Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_udav.c,v 1.21 2008/01/19 22:10:20 dyoung Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
#include "bpfilter.h"
|
||||
@ -281,6 +281,7 @@ USB_ATTACH(udav)
|
||||
mii->mii_writereg = udav_miibus_writereg;
|
||||
mii->mii_statchg = udav_miibus_statchg;
|
||||
mii->mii_flags = MIIF_AUTOTSLEEP;
|
||||
sc->sc_ec.ec_mii = mii;
|
||||
ifmedia_init(&mii->mii_media, 0,
|
||||
udav_ifmedia_change, udav_ifmedia_status);
|
||||
mii_attach(self, mii, 0xffffffff, MII_PHY_ANY, MII_OFFSET_ANY, 0);
|
||||
@ -615,7 +616,7 @@ udav_init(struct ifnet *ifp)
|
||||
struct udav_softc *sc = ifp->if_softc;
|
||||
struct mii_data *mii = GET_MII(sc);
|
||||
uint8_t eaddr[ETHER_ADDR_LEN];
|
||||
int s;
|
||||
int rc, s;
|
||||
|
||||
DPRINTF(("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__));
|
||||
|
||||
@ -667,7 +668,10 @@ udav_init(struct ifnet *ifp)
|
||||
UDAV_SETBIT(sc, UDAV_GPCR, UDAV_GPCR_GEP_CNTL0);
|
||||
UDAV_CLRBIT(sc, UDAV_GPR, UDAV_GPR_GEPIO0);
|
||||
|
||||
mii_mediachg(mii);
|
||||
if ((rc = mii_mediachg(mii)) == ENXIO)
|
||||
rc = 0;
|
||||
else if (rc != 0)
|
||||
goto out;
|
||||
|
||||
if (sc->sc_pipe_tx == NULL || sc->sc_pipe_rx == NULL) {
|
||||
if (udav_openpipes(sc)) {
|
||||
@ -679,11 +683,11 @@ udav_init(struct ifnet *ifp)
|
||||
ifp->if_flags |= IFF_RUNNING;
|
||||
ifp->if_flags &= ~IFF_OACTIVE;
|
||||
|
||||
splx(s);
|
||||
|
||||
usb_callout(sc->sc_stat_ch, hz, udav_tick, sc);
|
||||
|
||||
return (0);
|
||||
out:
|
||||
splx(s);
|
||||
return rc;
|
||||
}
|
||||
|
||||
Static void
|
||||
@ -1212,8 +1216,6 @@ Static int
|
||||
udav_ioctl(struct ifnet *ifp, u_long cmd, void *data)
|
||||
{
|
||||
struct udav_softc *sc = ifp->if_softc;
|
||||
struct ifreq *ifr = (struct ifreq *)data;
|
||||
struct mii_data *mii;
|
||||
int s, error = 0;
|
||||
|
||||
DPRINTF(("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__));
|
||||
@ -1223,21 +1225,11 @@ udav_ioctl(struct ifnet *ifp, u_long cmd, void *data)
|
||||
|
||||
s = splnet();
|
||||
|
||||
switch (cmd) {
|
||||
case SIOCGIFMEDIA:
|
||||
case SIOCSIFMEDIA:
|
||||
mii = GET_MII(sc);
|
||||
error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, cmd);
|
||||
break;
|
||||
|
||||
default:
|
||||
error = ether_ioctl(ifp, cmd, data);
|
||||
if (error == ENETRESET) {
|
||||
if (ifp->if_flags & IFF_RUNNING)
|
||||
udav_setmulti(sc);
|
||||
error = 0;
|
||||
}
|
||||
break;
|
||||
error = ether_ioctl(ifp, cmd, data);
|
||||
if (error == ENETRESET) {
|
||||
if (ifp->if_flags & IFF_RUNNING)
|
||||
udav_setmulti(sc);
|
||||
error = 0;
|
||||
}
|
||||
|
||||
splx(s);
|
||||
@ -1367,6 +1359,7 @@ udav_ifmedia_change(struct ifnet *ifp)
|
||||
{
|
||||
struct udav_softc *sc = ifp->if_softc;
|
||||
struct mii_data *mii = GET_MII(sc);
|
||||
int rc;
|
||||
|
||||
DPRINTF(("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__));
|
||||
|
||||
@ -1374,14 +1367,9 @@ udav_ifmedia_change(struct ifnet *ifp)
|
||||
return (0);
|
||||
|
||||
sc->sc_link = 0;
|
||||
if (mii->mii_instance) {
|
||||
struct mii_softc *miisc;
|
||||
for (miisc = LIST_FIRST(&mii->mii_phys); miisc != NULL;
|
||||
miisc = LIST_NEXT(miisc, mii_list))
|
||||
mii_phy_reset(miisc);
|
||||
}
|
||||
|
||||
return (mii_mediachg(mii));
|
||||
if ((rc = mii_mediachg(mii)) == ENXIO)
|
||||
return 0;
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* Report current media status. */
|
||||
@ -1389,22 +1377,13 @@ Static void
|
||||
udav_ifmedia_status(struct ifnet *ifp, struct ifmediareq *ifmr)
|
||||
{
|
||||
struct udav_softc *sc = ifp->if_softc;
|
||||
struct mii_data *mii = GET_MII(sc);
|
||||
|
||||
DPRINTF(("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__));
|
||||
|
||||
if (sc->sc_dying)
|
||||
return;
|
||||
|
||||
if ((ifp->if_flags & IFF_RUNNING) == 0) {
|
||||
ifmr->ifm_active = IFM_ETHER | IFM_NONE;
|
||||
ifmr->ifm_status = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
mii_pollstat(mii);
|
||||
ifmr->ifm_active = mii->mii_media_active;
|
||||
ifmr->ifm_status = mii->mii_media_status;
|
||||
ether_mediastatus(ifp, ifmr);
|
||||
}
|
||||
|
||||
Static void
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if_url.c,v 1.29 2007/08/29 22:33:44 dyoung Exp $ */
|
||||
/* $NetBSD: if_url.c,v 1.30 2008/01/19 22:10:21 dyoung Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2001, 2002
|
||||
* Shingo WATANABE <nabe@nabechan.org>. All rights reserved.
|
||||
@ -43,7 +43,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.29 2007/08/29 22:33:44 dyoung Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.30 2008/01/19 22:10:21 dyoung Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
#include "bpfilter.h"
|
||||
@ -291,6 +291,7 @@ USB_ATTACH(url)
|
||||
#endif
|
||||
mii->mii_statchg = url_miibus_statchg;
|
||||
mii->mii_flags = MIIF_AUTOTSLEEP;
|
||||
sc->sc_ec.ec_mii = mii;
|
||||
ifmedia_init(&mii->mii_media, 0,
|
||||
url_ifmedia_change, url_ifmedia_status);
|
||||
mii_attach(self, mii, 0xffffffff, MII_PHY_ANY, MII_OFFSET_ANY, 0);
|
||||
@ -506,7 +507,7 @@ url_init(struct ifnet *ifp)
|
||||
struct url_softc *sc = ifp->if_softc;
|
||||
struct mii_data *mii = GET_MII(sc);
|
||||
const u_char *eaddr;
|
||||
int i, s;
|
||||
int i, rc, s;
|
||||
|
||||
DPRINTF(("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__));
|
||||
|
||||
@ -562,7 +563,10 @@ url_init(struct ifnet *ifp)
|
||||
/* Enable RX and TX */
|
||||
URL_SETBIT(sc, URL_CR, URL_CR_TE | URL_CR_RE);
|
||||
|
||||
mii_mediachg(mii);
|
||||
if ((rc = mii_mediachg(mii)) == ENXIO)
|
||||
rc = 0;
|
||||
else if (rc != 0)
|
||||
goto out;
|
||||
|
||||
if (sc->sc_pipe_tx == NULL || sc->sc_pipe_rx == NULL) {
|
||||
if (url_openpipes(sc)) {
|
||||
@ -574,11 +578,11 @@ url_init(struct ifnet *ifp)
|
||||
ifp->if_flags |= IFF_RUNNING;
|
||||
ifp->if_flags &= ~IFF_OACTIVE;
|
||||
|
||||
splx(s);
|
||||
|
||||
usb_callout(sc->sc_stat_ch, hz, url_tick, sc);
|
||||
|
||||
return (0);
|
||||
out:
|
||||
splx(s);
|
||||
return rc;
|
||||
}
|
||||
|
||||
Static void
|
||||
@ -1095,8 +1099,6 @@ Static int
|
||||
url_ioctl(struct ifnet *ifp, u_long cmd, void *data)
|
||||
{
|
||||
struct url_softc *sc = ifp->if_softc;
|
||||
struct ifreq *ifr = (struct ifreq *)data;
|
||||
struct mii_data *mii;
|
||||
int s, error = 0;
|
||||
|
||||
DPRINTF(("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__));
|
||||
@ -1106,21 +1108,11 @@ url_ioctl(struct ifnet *ifp, u_long cmd, void *data)
|
||||
|
||||
s = splnet();
|
||||
|
||||
switch (cmd) {
|
||||
case SIOCGIFMEDIA:
|
||||
case SIOCSIFMEDIA:
|
||||
mii = GET_MII(sc);
|
||||
error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, cmd);
|
||||
break;
|
||||
|
||||
default:
|
||||
error = ether_ioctl(ifp, cmd, data);
|
||||
if (error == ENETRESET) {
|
||||
if (ifp->if_flags & IFF_RUNNING)
|
||||
url_setmulti(sc);
|
||||
error = 0;
|
||||
}
|
||||
break;
|
||||
error = ether_ioctl(ifp, cmd, data);
|
||||
if (error == ENETRESET) {
|
||||
if (ifp->if_flags & IFF_RUNNING)
|
||||
url_setmulti(sc);
|
||||
error = 0;
|
||||
}
|
||||
|
||||
splx(s);
|
||||
@ -1250,6 +1242,7 @@ url_ifmedia_change(struct ifnet *ifp)
|
||||
{
|
||||
struct url_softc *sc = ifp->if_softc;
|
||||
struct mii_data *mii = GET_MII(sc);
|
||||
int rc;
|
||||
|
||||
DPRINTF(("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__));
|
||||
|
||||
@ -1257,14 +1250,9 @@ url_ifmedia_change(struct ifnet *ifp)
|
||||
return (0);
|
||||
|
||||
sc->sc_link = 0;
|
||||
if (mii->mii_instance) {
|
||||
struct mii_softc *miisc;
|
||||
for (miisc = LIST_FIRST(&mii->mii_phys); miisc != NULL;
|
||||
miisc = LIST_NEXT(miisc, mii_list))
|
||||
mii_phy_reset(miisc);
|
||||
}
|
||||
|
||||
return (mii_mediachg(mii));
|
||||
if ((rc = mii_mediachg(mii)) == ENXIO)
|
||||
return 0;
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* Report current media status. */
|
||||
@ -1272,22 +1260,13 @@ Static void
|
||||
url_ifmedia_status(struct ifnet *ifp, struct ifmediareq *ifmr)
|
||||
{
|
||||
struct url_softc *sc = ifp->if_softc;
|
||||
struct mii_data *mii = GET_MII(sc);
|
||||
|
||||
DPRINTF(("%s: %s: enter\n", USBDEVNAME(sc->sc_dev), __func__));
|
||||
|
||||
if (sc->sc_dying)
|
||||
return;
|
||||
|
||||
if ((ifp->if_flags & IFF_RUNNING) == 0) {
|
||||
ifmr->ifm_active = IFM_ETHER | IFM_NONE;
|
||||
ifmr->ifm_status = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
mii_pollstat(mii);
|
||||
ifmr->ifm_active = mii->mii_media_active;
|
||||
ifmr->ifm_status = mii->mii_media_status;
|
||||
ether_mediastatus(ifp, ifmr);
|
||||
}
|
||||
|
||||
Static void
|
||||
|
Loading…
Reference in New Issue
Block a user