summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ic/qwx.c32
-rw-r--r--sys/dev/ic/qwxvar.h3
-rw-r--r--sys/dev/pci/if_qwx_pci.c18
3 files changed, 35 insertions, 18 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;
+}
diff --git a/sys/dev/ic/qwxvar.h b/sys/dev/ic/qwxvar.h
index 5aee2a6c551..89ab3c237ed 100644
--- a/sys/dev/ic/qwxvar.h
+++ b/sys/dev/ic/qwxvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: qwxvar.h,v 1.20 2024/02/16 14:13:45 stsp Exp $ */
+/* $OpenBSD: qwxvar.h,v 1.21 2024/02/22 09:06:11 stsp Exp $ */
/*
* Copyright (c) 2018-2019 The Linux Foundation.
@@ -1901,6 +1901,7 @@ int qwx_dp_service_srng(struct qwx_softc *, int);
int qwx_init_hw_params(struct qwx_softc *);
int qwx_attach(struct qwx_softc *);
void qwx_detach(struct qwx_softc *);
+int qwx_activate(struct device *, int);
void qwx_core_deinit(struct qwx_softc *);
void qwx_ce_cleanup_pipes(struct qwx_softc *);
diff --git a/sys/dev/pci/if_qwx_pci.c b/sys/dev/pci/if_qwx_pci.c
index 05cab4d0fc2..016b456ca2a 100644
--- a/sys/dev/pci/if_qwx_pci.c
+++ b/sys/dev/pci/if_qwx_pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_qwx_pci.c,v 1.10 2024/02/16 16:37:42 stsp Exp $ */
+/* $OpenBSD: if_qwx_pci.c,v 1.11 2024/02/22 09:06:11 stsp Exp $ */
/*
* Copyright 2023 Stefan Sperling <stsp@openbsd.org>
@@ -402,7 +402,6 @@ int qwx_pci_match(struct device *, void *, void *);
void qwx_pci_attach(struct device *, struct device *, void *);
int qwx_pci_detach(struct device *, int);
void qwx_pci_attach_hook(struct device *);
-int qwx_pci_activate(struct device *, int);
void qwx_pci_free_xfer_rings(struct qwx_pci_softc *);
int qwx_pci_alloc_xfer_ring(struct qwx_softc *, struct qwx_pci_xfer_ring *,
uint32_t, uint32_t, uint32_t, size_t);
@@ -526,7 +525,7 @@ const struct cfattach qwx_pci_ca = {
qwx_pci_match,
qwx_pci_attach,
qwx_pci_detach,
- qwx_pci_activate
+ qwx_activate
};
/* XXX pcidev */
@@ -1204,19 +1203,6 @@ qwx_pci_attach_hook(struct device *self)
splx(s);
}
-int
-qwx_pci_activate(struct device *self, int act)
-{
- switch (act) {
- case DVACT_SUSPEND:
- break;
- case DVACT_WAKEUP:
- break;
- }
-
- return 0;
-}
-
void
qwx_pci_free_xfer_rings(struct qwx_pci_softc *psc)
{