From: deraadt Date: Fri, 6 Aug 2010 05:24:16 +0000 (+0000) Subject: ca_activate function for suspend/resume; tested by mlarkin X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=7357b944d7e6411e967e02acd5c6167e2f77fe84;p=openbsd ca_activate function for suspend/resume; tested by mlarkin --- diff --git a/sys/dev/pci/if_sis.c b/sys/dev/pci/if_sis.c index 335b274f697..2d80c46805a 100644 --- a/sys/dev/pci/if_sis.c +++ b/sys/dev/pci/if_sis.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_sis.c,v 1.98 2010/05/19 15:27:35 oga Exp $ */ +/* $OpenBSD: if_sis.c,v 1.99 2010/08/06 05:24:16 deraadt Exp $ */ /* * Copyright (c) 1997, 1998, 1999 * Bill Paul . All rights reserved. @@ -104,9 +104,11 @@ int sis_probe(struct device *, void *, void *); void sis_attach(struct device *, struct device *, void *); +int sis_activate(struct device *, int); struct cfattach sis_ca = { - sizeof(struct sis_softc), sis_probe, sis_attach + sizeof(struct sis_softc), sis_probe, sis_attach, NULL, + sis_activate }; struct cfdriver sis_cd = { @@ -1151,6 +1153,27 @@ fail_1: bus_space_unmap(sc->sis_btag, sc->sis_bhandle, size); } +int +sis_activate(struct device *self, int act) +{ + struct sis_softc *sc = (struct sis_softc *)self; + struct ifnet *ifp = &sc->arpcom.ac_if; + + switch (act) { + case DVACT_SUSPEND: + if (ifp->if_flags & IFF_RUNNING) + sis_stop(sc); + config_activate_children(self, act); + break; + case DVACT_RESUME: + config_activate_children(self, act); + if (ifp->if_flags & IFF_UP) + sis_init(sc); + break; + } + return (0); +} + /* * Initialize the TX and RX descriptors and allocate mbufs for them. Note that * we arrange the descriptors in a closed ring, so that the last descriptor