Implement suspend/resume methods to be more ACPI friendly.

I'm able to suspend/resume my laptop without this change, but then I need
to wait for the watchdog to reset the card.
With this change, it is ready immediately.

Glanced at by:	glebius
This commit is contained in:
Pawel Jakub Dawidek 2005-09-28 19:20:49 +00:00
parent 4c163f4c32
commit 14afefa3db

View File

@ -192,6 +192,8 @@ static struct bge_type bge_devs[] = {
static int bge_probe (device_t);
static int bge_attach (device_t);
static int bge_detach (device_t);
static int bge_suspend (device_t);
static int bge_resume (device_t);
static void bge_release_resources
(struct bge_softc *);
static void bge_dma_map_addr (void *, bus_dma_segment_t *, int, int);
@ -272,6 +274,8 @@ static device_method_t bge_methods[] = {
DEVMETHOD(device_attach, bge_attach),
DEVMETHOD(device_detach, bge_detach),
DEVMETHOD(device_shutdown, bge_shutdown),
DEVMETHOD(device_suspend, bge_suspend),
DEVMETHOD(device_resume, bge_resume),
/* bus interface */
DEVMETHOD(bus_print_child, bus_generic_print_child),
@ -3791,3 +3795,35 @@ bge_shutdown(dev)
return;
}
static int
bge_suspend(device_t dev)
{
struct bge_softc *sc;
sc = device_get_softc(dev);
BGE_LOCK(sc);
bge_stop(sc);
BGE_UNLOCK(sc);
return (0);
}
static int
bge_resume(device_t dev)
{
struct bge_softc *sc;
struct ifnet *ifp;
sc = device_get_softc(dev);
BGE_LOCK(sc);
ifp = sc->bge_ifp;
if (ifp->if_flags & IFF_UP) {
bge_init_locked(sc);
if (ifp->if_drv_flags & IFF_DRV_RUNNING)
bge_start_locked(ifp);
}
BGE_UNLOCK(sc);
return (0);
}