diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/pci/if_xl.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/sys/pci/if_xl.c b/sys/pci/if_xl.c index 3c0b28d..7378d83 100644 --- a/sys/pci/if_xl.c +++ b/sys/pci/if_xl.c @@ -239,6 +239,9 @@ static void xl_init __P((void *)); static void xl_stop __P((struct xl_softc *)); static void xl_watchdog __P((struct ifnet *)); static void xl_shutdown __P((device_t)); +static int xl_suspend __P((device_t)); +static int xl_resume __P((device_t)); + static int xl_ifmedia_upd __P((struct ifnet *)); static void xl_ifmedia_sts __P((struct ifnet *, struct ifmediareq *)); @@ -285,6 +288,8 @@ static device_method_t xl_methods[] = { DEVMETHOD(device_attach, xl_attach), DEVMETHOD(device_detach, xl_detach), DEVMETHOD(device_shutdown, xl_shutdown), + DEVMETHOD(device_suspend, xl_suspend), + DEVMETHOD(device_resume, xl_resume), /* bus interface */ DEVMETHOD(bus_print_child, bus_generic_print_child), @@ -2591,6 +2596,7 @@ static void xl_init(xsc) printf("xl%d: initialization failed: no " "memory for rx buffers\n", sc->xl_unit); xl_stop(sc); + XL_UNLOCK(sc); return; } @@ -3048,3 +3054,35 @@ static void xl_shutdown(dev) return; } + +static int xl_suspend(dev) + device_t dev; +{ + struct xl_softc *sc; + + sc = device_get_softc(dev); + + XL_LOCK(sc); + xl_stop(sc); + XL_UNLOCK(sc); + + return(0); +} + +static int xl_resume(dev) + device_t dev; +{ + struct xl_softc *sc; + struct ifnet *ifp; + + sc = device_get_softc(dev); + XL_LOCK(sc); + ifp = &sc->arpcom.ac_if; + + xl_reset(sc); + if (ifp->if_flags & IFF_UP) + xl_init(sc); + + XL_UNLOCK(sc); + return(0); +} |