diff options
author | Stuart Henderson <sthen@cvs.openbsd.org> | 2009-07-16 07:18:48 +0000 |
---|---|---|
committer | Stuart Henderson <sthen@cvs.openbsd.org> | 2009-07-16 07:18:48 +0000 |
commit | 901f966bc4144d5b4b996641f59f1f3d74dc7d07 (patch) | |
tree | 9ec515432a5bfdd9fffd0fb0d93b2b7b648b2873 /sys/arch/sparc/dev | |
parent | fe7fdd5d111172569b7bd8417912f7bf0f81abe2 (diff) |
- Add missing tick handler calling mii_tick().
- Stop hmestop() from fiddling with the flags directly and
calls mii_down() instead.
From Brad, tested by nick@.
Diffstat (limited to 'sys/arch/sparc/dev')
-rw-r--r-- | sys/arch/sparc/dev/hme.c | 26 | ||||
-rw-r--r-- | sys/arch/sparc/dev/hmevar.h | 3 |
2 files changed, 26 insertions, 3 deletions
diff --git a/sys/arch/sparc/dev/hme.c b/sys/arch/sparc/dev/hme.c index d13a95455a8..870a6ba865f 100644 --- a/sys/arch/sparc/dev/hme.c +++ b/sys/arch/sparc/dev/hme.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hme.c,v 1.60 2009/06/24 07:42:03 sthen Exp $ */ +/* $OpenBSD: hme.c,v 1.61 2009/07/16 07:18:47 sthen Exp $ */ /* * Copyright (c) 1998 Jason L. Wright (jason@thought.net) @@ -92,6 +92,8 @@ void hmestop(struct hme_softc *); void hmeinit(struct hme_softc *); void hme_meminit(struct hme_softc *); +void hme_tick(void *); + void hme_tcvr_bb_writeb(struct hme_softc *, int); int hme_tcvr_bb_readb(struct hme_softc *, int); @@ -262,6 +264,8 @@ hmeattach(parent, self, aux) (strcmp(bp->name, "qfe") == 0) || (strcmp(bp->name, "SUNW,hme") == 0))) bp->dev = &sc->sc_dev; + + timeout_set(&sc->sc_tick, hme_tick, sc); } /* @@ -333,18 +337,21 @@ hmestop(sc) struct ifnet *ifp = &sc->sc_arpcom.ac_if; int tries = 0; + timeout_del(&sc->sc_tick); + /* * Mark the interface down and cancel the watchdog timer. */ ifp->if_flags &= ~(IFF_RUNNING | IFF_OACTIVE); ifp->if_timer = 0; + mii_down(&sc->sc_mii); + sc->sc_gr->reset = GR_RESET_ALL; while (sc->sc_gr->reset && (++tries != MAX_STOP_TRIES)) DELAY(20); if (tries == MAX_STOP_TRIES) printf("%s: stop failed\n", sc->sc_dev.dv_xname); - sc->sc_mii.mii_media_status &= ~IFM_ACTIVE; } /* @@ -362,6 +369,19 @@ hmereset(sc) splx(s); } +void +hme_tick(void *arg) +{ + struct hme_softc *sc = arg; + int s; + + s = splnet(); + mii_tick(&sc->sc_mii); + splx(s); + + timeout_add_sec(&sc->sc_tick, 1); +} + /* * Device timeout/watchdog routine. Entered if the device neglects to generate * an interrupt after a transmit has been started on it. @@ -570,6 +590,8 @@ hmeinit(sc) mii_mediachg(&sc->sc_mii); + timeout_add_sec(&sc->sc_tick, 1); + ifp->if_flags |= IFF_RUNNING; ifp->if_flags &= ~IFF_OACTIVE; } diff --git a/sys/arch/sparc/dev/hmevar.h b/sys/arch/sparc/dev/hmevar.h index 3672e2c9a93..975f00a46a2 100644 --- a/sys/arch/sparc/dev/hmevar.h +++ b/sys/arch/sparc/dev/hmevar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: hmevar.h,v 1.13 2009/06/24 07:42:03 sthen Exp $ */ +/* $OpenBSD: hmevar.h,v 1.14 2009/07/16 07:18:47 sthen Exp $ */ /* * Copyright (c) 1998 Jason L. Wright (jason@thought.net) @@ -32,6 +32,7 @@ struct hme_softc { int sc_node; /* which sbus node */ mii_data_t sc_mii; /* mii bus */ + struct timeout sc_tick; /* tick timeout */ struct arpcom sc_arpcom; /* ethernet common */ |