From 7145906dd6473fcc8ca8c7e8bfa3aca9c5e9c391 Mon Sep 17 00:00:00 2001 From: Guido van Rooij Date: Wed, 5 Dec 2001 10:34:07 +0000 Subject: [PATCH] Add suspend/resume hooks to this driver; necessary to overcome problems on HP Omnibook 500. MFC after: 1 week --- sys/pci/if_xl.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/sys/pci/if_xl.c b/sys/pci/if_xl.c index 3c0b28d8173e..7378d83870ca 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); +}