diff options
author | Marcus Glocker <mglocker@cvs.openbsd.org> | 2010-08-06 05:26:25 +0000 |
---|---|---|
committer | Marcus Glocker <mglocker@cvs.openbsd.org> | 2010-08-06 05:26:25 +0000 |
commit | dab8198f4374f17bd4d58910e419155078d46624 (patch) | |
tree | fe17c81ec3b9c5e9ebcb9e12994b277b01bea908 /sys/dev/pci/if_bwi_pci.c | |
parent | 91da7e4b30336f80f8e4180d53861e117377c072 (diff) |
ACPI suspend/resume for bwi(4). Initial diff from todd@, finished and
tested by me on X40 with a BCM4306.
OK deraadt@
Diffstat (limited to 'sys/dev/pci/if_bwi_pci.c')
-rw-r--r-- | sys/dev/pci/if_bwi_pci.c | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/sys/dev/pci/if_bwi_pci.c b/sys/dev/pci/if_bwi_pci.c index 55d59cc89be..051caac5ad4 100644 --- a/sys/dev/pci/if_bwi_pci.c +++ b/sys/dev/pci/if_bwi_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bwi_pci.c,v 1.10 2009/03/29 21:53:52 sthen Exp $ */ +/* $OpenBSD: if_bwi_pci.c,v 1.11 2010/08/06 05:26:24 mglocker Exp $ */ /* * Copyright (c) 2007 Marcus Glocker <mglocker@openbsd.org> @@ -24,6 +24,7 @@ #include <sys/param.h> #include <sys/sockio.h> +#include <sys/workq.h> #include <sys/mbuf.h> #include <sys/kernel.h> #include <sys/socket.h> @@ -60,6 +61,8 @@ void bwi_pci_attach(struct device *, struct device *, void *); int bwi_pci_detach(struct device *, int); void bwi_pci_conf_write(void *, uint32_t, uint32_t); uint32_t bwi_pci_conf_read(void *, uint32_t); +int bwi_pci_activate(struct device *, int); +void bwi_resume(void *, void *); struct bwi_pci_softc { struct bwi_softc psc_bwi; @@ -73,7 +76,7 @@ struct bwi_pci_softc { struct cfattach bwi_pci_ca = { sizeof(struct bwi_pci_softc), bwi_pci_match, bwi_pci_attach, - bwi_pci_detach + bwi_pci_detach, bwi_pci_activate }; const struct pci_matchid bwi_pci_devices[] = { @@ -175,6 +178,37 @@ bwi_pci_detach(struct device *self, int flags) return (0); } +int +bwi_pci_activate(struct device *self, int act) +{ + struct bwi_pci_softc *psc = (struct bwi_pci_softc *)self; + struct bwi_softc *sc = &psc->psc_bwi; + struct ifnet *ifp = &sc->sc_ic.ic_if; + + switch (act) { + case DVACT_SUSPEND: + if (ifp->if_flags & IFF_RUNNING) + bwi_stop(sc, 1); + break; + case DVACT_RESUME: + workq_queue_task(NULL, &sc->sc_resume_wqt, 0, + bwi_resume, sc, NULL); + break; + } + + return (0); +} + +void +bwi_resume(void *arg1, void *arg2) +{ + struct bwi_softc *sc = arg1; + struct ifnet *ifp = &sc->sc_ic.ic_if; + + if (ifp->if_flags & IFF_UP) + bwi_init(ifp); +} + void bwi_pci_conf_write(void *self, uint32_t reg, uint32_t val) { |