From: deraadt Date: Fri, 6 Aug 2010 02:45:53 +0000 (+0000) Subject: ca_activate function for suspend/resume X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=0935757b34b9dc44084d9e53d1aa90d268ddde3a;p=openbsd ca_activate function for suspend/resume tested by mlarkin --- diff --git a/sys/dev/ic/xl.c b/sys/dev/ic/xl.c index 64f41ee9268..c2e7b172870 100644 --- a/sys/dev/ic/xl.c +++ b/sys/dev/ic/xl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xl.c,v 1.89 2010/05/19 15:27:35 oga Exp $ */ +/* $OpenBSD: xl.c,v 1.90 2010/08/06 02:45:53 deraadt Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -161,8 +161,6 @@ int xl_intr(void *); void xl_start(struct ifnet *); void xl_start_90xB(struct ifnet *); int xl_ioctl(struct ifnet *, u_long, caddr_t); -void xl_init(void *); -void xl_stop(struct xl_softc *); void xl_freetxrx(struct xl_softc *); void xl_watchdog(struct ifnet *); void xl_shutdown(void *); diff --git a/sys/dev/ic/xlreg.h b/sys/dev/ic/xlreg.h index cacfde8cb9c..77949edd418 100644 --- a/sys/dev/ic/xlreg.h +++ b/sys/dev/ic/xlreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: xlreg.h,v 1.20 2009/12/22 21:10:25 naddy Exp $ */ +/* $OpenBSD: xlreg.h,v 1.21 2010/08/06 02:45:53 deraadt Exp $ */ /* * Copyright (c) 1997, 1998 @@ -743,3 +743,5 @@ struct xl_stats { extern int xl_intr(void *); extern void xl_attach(struct xl_softc *); extern int xl_detach(struct xl_softc *); +void xl_init(void *); +void xl_stop(struct xl_softc *); diff --git a/sys/dev/pci/if_xl_pci.c b/sys/dev/pci/if_xl_pci.c index b950efa9aaa..c01e9ea77c4 100644 --- a/sys/dev/pci/if_xl_pci.c +++ b/sys/dev/pci/if_xl_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_xl_pci.c,v 1.29 2010/04/08 00:23:53 tedu Exp $ */ +/* $OpenBSD: if_xl_pci.c,v 1.30 2010/08/06 02:45:54 deraadt Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -91,6 +91,7 @@ int xl_pci_match(struct device *, void *, void *); void xl_pci_attach(struct device *, struct device *, void *); int xl_pci_detach(struct device *, int); +int xl_pci_activate(struct device *, int); void xl_pci_intr_ack(struct xl_softc *); struct xl_pci_softc { @@ -101,7 +102,8 @@ struct xl_pci_softc { }; struct cfattach xl_pci_ca = { - sizeof(struct xl_pci_softc), xl_pci_match, xl_pci_attach, xl_pci_detach + sizeof(struct xl_pci_softc), xl_pci_match, xl_pci_attach, xl_pci_detach, + xl_pci_activate }; const struct pci_matchid xl_pci_devices[] = { @@ -335,6 +337,28 @@ xl_pci_detach(struct device *self, int flags) return (0); } +int +xl_pci_activate(struct device *self, int act) +{ + struct xl_pci_softc *psc = (void *)self; + struct xl_softc *sc = &psc->psc_softc; + struct ifnet *ifp = &sc->sc_arpcom.ac_if; + + switch (act) { + case DVACT_SUSPEND: + if (ifp->if_flags & IFF_RUNNING) + xl_stop(sc); + config_activate_children(self, act); + break; + case DVACT_RESUME: + config_activate_children(self, act); + if (ifp->if_flags & IFF_UP) + xl_init(sc); + break; + } + return (0); +} + void xl_pci_intr_ack(struct xl_softc *sc) {