-/* $OpenBSD: athn.c,v 1.55 2010/07/15 20:37:38 damien Exp $ */
+/* $OpenBSD: athn.c,v 1.56 2010/07/21 14:01:58 kettenis Exp $ */
/*-
* Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr>
if (disable && sc->sc_disable != NULL)
sc->sc_disable(sc);
}
+
+void
+athn_suspend(struct athn_softc *sc)
+{
+ struct ifnet *ifp = &sc->sc_ic.ic_if;
+
+ athn_stop(ifp, 1);
+}
+
+void
+athn_resume(struct athn_softc *sc)
+{
+ struct ifnet *ifp = &sc->sc_ic.ic_if;
+
+ if (ifp->if_flags & IFF_UP) {
+ athn_init(ifp);
+ if (ifp->if_flags & IFF_RUNNING)
+ athn_start(ifp);
+ }
+}
-/* $OpenBSD: athnvar.h,v 1.19 2010/07/15 20:37:38 damien Exp $ */
+/* $OpenBSD: athnvar.h,v 1.20 2010/07/21 14:01:58 kettenis Exp $ */
/*-
* Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr>
extern int athn_attach(struct athn_softc *);
extern void athn_detach(struct athn_softc *);
+extern void athn_suspend(struct athn_softc *);
+extern void athn_resume(struct athn_softc *);
extern int athn_intr(void *);
-/* $OpenBSD: if_athn_pci.c,v 1.6 2010/05/16 15:06:22 damien Exp $ */
+/* $OpenBSD: if_athn_pci.c,v 1.7 2010/07/21 14:01:58 kettenis Exp $ */
/*-
* Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr>
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_disable_aspm(struct athn_softc *);
struct cfattach athn_pci_ca = {
sizeof (struct athn_pci_softc),
athn_pci_match,
athn_pci_attach,
- athn_pci_detach
+ athn_pci_detach,
+ athn_pci_activate
};
static const struct pci_matchid athn_pci_devices[] = {
return (0);
}
+int
+athn_pci_activate(struct device *self, int act)
+{
+ struct athn_softc *sc = (struct athn_softc *)self;
+
+ switch (act) {
+ case DVACT_SUSPEND:
+ athn_suspend(sc);
+ break;
+ case DVACT_RESUME:
+ athn_resume(sc);
+ break;
+ }
+
+ return (0);
+}
+
void
athn_pci_disable_aspm(struct athn_softc *sc)
{