From 91da7e4b30336f80f8e4180d53861e117377c072 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Fri, 6 Aug 2010 05:24:17 +0000 Subject: ca_activate function for suspend/resume; tested by mlarkin --- sys/dev/pci/if_sis.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'sys') 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 -- cgit v1.2.3