summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2010-07-27 22:39:59 +0000
committerderaadt <deraadt@openbsd.org>2010-07-27 22:39:59 +0000
commit61f1690226e40593c25cefe0d4adc5ba9d9bbe0c (patch)
tree4a7ff59809284a110f2224f2846fa0d0e60eb4ec
parentSpaces vs tab (diff)
downloadwireguard-openbsd-61f1690226e40593c25cefe0d4adc5ba9d9bbe0c.tar.xz
wireguard-openbsd-61f1690226e40593c25cefe0d4adc5ba9d9bbe0c.zip
ca_activate handler for suspend/resume. untested -- if someone tests
this let me know.
-rw-r--r--sys/dev/pci/if_alc.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/sys/dev/pci/if_alc.c b/sys/dev/pci/if_alc.c
index 95936997560..1d1a63e1993 100644
--- a/sys/dev/pci/if_alc.c
+++ b/sys/dev/pci/if_alc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_alc.c,v 1.5 2010/04/08 00:23:53 tedu Exp $ */
+/* $OpenBSD: if_alc.c,v 1.6 2010/07/27 22:39:59 deraadt Exp $ */
/*-
* Copyright (c) 2009, Pyun YongHyeon <yongari@FreeBSD.org>
* All rights reserved.
@@ -79,6 +79,7 @@
int alc_match(struct device *, void *, void *);
void alc_attach(struct device *, struct device *, void *);
int alc_detach(struct device *, int);
+int alc_activate(struct device *, int);
int alc_init(struct ifnet *);
void alc_start(struct ifnet *);
@@ -128,7 +129,8 @@ const struct pci_matchid alc_devices[] = {
};
struct cfattach alc_ca = {
- sizeof (struct alc_softc), alc_match, alc_attach
+ sizeof (struct alc_softc), alc_match, alc_attach, NULL,
+ alc_activate
};
struct cfdriver alc_cd = {
@@ -676,6 +678,28 @@ alc_detach(struct device *self, int flags)
}
int
+alc_activate(struct device *self, int act)
+{
+ struct alc_softc *sc = (struct alc_softc *)self;
+ struct ifnet *ifp = &sc->sc_arpcom.ac_if;
+ int rv = 0;
+
+ switch (act) {
+ case DVACT_SUSPEND:
+ if (ifp->if_flags & IFF_RUNNING)
+ alc_stop(sc);
+ rv = config_activate_children(self, act);
+ break;
+ case DVACT_RESUME:
+ rv = config_activate_children(self, act);
+ if (ifp->if_flags & IFF_UP)
+ alc_init(ifp);
+ break;
+ }
+ return rv;
+}
+
+int
alc_dma_alloc(struct alc_softc *sc)
{
struct alc_txdesc *txd;