-/* $OpenBSD: if_athn_pci.c,v 1.7 2010/07/21 14:01:58 kettenis Exp $ */
+/* $OpenBSD: if_athn_pci.c,v 1.8 2010/08/04 19:49:49 damien Exp $ */
/*-
* Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr>
#include <sys/malloc.h>
#include <sys/timeout.h>
#include <sys/device.h>
+#include <sys/workq.h>
#include <machine/bus.h>
#include <machine/intr.h>
void *sc_ih;
bus_size_t sc_mapsize;
int sc_cap_off;
+ struct workq_task sc_resume_wqt;
};
int athn_pci_match(struct device *, void *, void *);
void athn_pci_attach(struct device *, struct device *, void *);
int athn_pci_detach(struct device *, int);
int athn_pci_activate(struct device *, int);
+void athn_pci_resume(void *, void *);
void athn_pci_disable_aspm(struct athn_softc *);
struct cfattach athn_pci_ca = {
int
athn_pci_activate(struct device *self, int act)
{
- struct athn_softc *sc = (struct athn_softc *)self;
+ struct athn_pci_softc *psc = (struct athn_pci_softc *)self;
+ struct athn_softc *sc = &psc->sc_sc;
switch (act) {
case DVACT_SUSPEND:
athn_suspend(sc);
break;
case DVACT_RESUME:
- athn_resume(sc);
+ workq_queue_task(NULL, &psc->sc_resume_wqt, 0,
+ athn_pci_resume, psc, NULL);
break;
}
return (0);
}
+void
+athn_pci_resume(void *arg1, void *arg2)
+{
+ struct athn_pci_softc *psc = arg1;
+ struct athn_softc *sc = &psc->sc_sc;
+ int s;
+
+ s = splnet();
+ athn_resume(sc);
+ splx(s);
+}
+
void
athn_pci_disable_aspm(struct athn_softc *sc)
{