From 1f54e2b1f3e6d6a9b94afb7516a9e81fc156caac Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Fri, 6 Aug 2010 02:45:55 +0000 Subject: ca_activate function for suspend/resume tested by mlarkin --- sys/dev/pci/if_xl_pci.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'sys/dev/pci/if_xl_pci.c') 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) { -- cgit v1.2.3