summaryrefslogtreecommitdiff
path: root/sys/dev/ic/qwx.c
diff options
context:
space:
mode:
authorStefan Sperling <stsp@cvs.openbsd.org>2024-02-22 09:06:12 +0000
committerStefan Sperling <stsp@cvs.openbsd.org>2024-02-22 09:06:12 +0000
commit5ee4a51030dc19e42764c5fdfa4f3a25314514f6 (patch)
treec2219d9c85d5630f8c60927df069cb52b722e607 /sys/dev/ic/qwx.c
parent47ce2a7631d431412b4d96223e249ee3ea4edf95 (diff)
add suspend/resume support to qwx(4)
testing + ok phessler@ deraadt@
Diffstat (limited to 'sys/dev/ic/qwx.c')
-rw-r--r--sys/dev/ic/qwx.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/sys/dev/ic/qwx.c b/sys/dev/ic/qwx.c
index 70c3cad0dd8..68fea8bf88b 100644
--- a/sys/dev/ic/qwx.c
+++ b/sys/dev/ic/qwx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: qwx.c,v 1.48 2024/02/20 11:48:19 stsp Exp $ */
+/* $OpenBSD: qwx.c,v 1.49 2024/02/22 09:06:11 stsp Exp $ */
/*
* Copyright 2023 Stefan Sperling <stsp@openbsd.org>
@@ -24762,3 +24762,33 @@ qwx_dmamem_free(bus_dma_tag_t dmat, struct qwx_dmamem *adm)
bus_dmamap_destroy(dmat, adm->map);
free(adm, M_DEVBUF, sizeof(*adm));
}
+
+int
+qwx_activate(struct device *self, int act)
+{
+ struct qwx_softc *sc = (struct qwx_softc *)self;
+ struct ifnet *ifp = &sc->sc_ic.ic_if;
+ int err = 0;
+
+ switch (act) {
+ case DVACT_QUIESCE:
+ if (ifp->if_flags & IFF_RUNNING) {
+ rw_enter_write(&sc->ioctl_rwl);
+ qwx_stop(ifp);
+ rw_exit(&sc->ioctl_rwl);
+ }
+ break;
+ case DVACT_RESUME:
+ break;
+ case DVACT_WAKEUP:
+ if ((ifp->if_flags & (IFF_UP | IFF_RUNNING)) == IFF_UP) {
+ err = qwx_init(ifp);
+ if (err)
+ printf("%s: could not initialize hardware\n",
+ sc->sc_dev.dv_xname);
+ }
+ break;
+ }
+
+ return 0;
+}