From 840b56f3adc2d6a6e8e4c232c7ef3fd0840d523e Mon Sep 17 00:00:00 2001 From: mlarkin Date: Fri, 6 Aug 2010 03:02:24 +0000 Subject: [PATCH] ca_activate function for nfe(4) for suspend/resume tested on nvidia mcp51 ok deraadt@ --- sys/dev/pci/if_nfe.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/sys/dev/pci/if_nfe.c b/sys/dev/pci/if_nfe.c index 60bdea92877..989b5959342 100644 --- a/sys/dev/pci/if_nfe.c +++ b/sys/dev/pci/if_nfe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_nfe.c,v 1.90 2010/05/19 15:27:35 oga Exp $ */ +/* $OpenBSD: if_nfe.c,v 1.91 2010/08/06 03:02:24 mlarkin Exp $ */ /*- * Copyright (c) 2006, 2007 Damien Bergamini @@ -69,6 +69,7 @@ int nfe_match(struct device *, void *, void *); void nfe_attach(struct device *, struct device *, void *); +int nfe_activate(struct device *, int); void nfe_power(int, void *); void nfe_miibus_statchg(struct device *); int nfe_miibus_readreg(struct device *, int, int); @@ -106,7 +107,8 @@ void nfe_set_macaddr(struct nfe_softc *, const uint8_t *); void nfe_tick(void *); struct cfattach nfe_ca = { - sizeof (struct nfe_softc), nfe_match, nfe_attach + sizeof (struct nfe_softc), nfe_match, nfe_attach, NULL, + nfe_activate }; struct cfdriver nfe_cd = { @@ -172,6 +174,28 @@ nfe_match(struct device *dev, void *match, void *aux) sizeof (nfe_devices) / sizeof (nfe_devices[0])); } +int +nfe_activate(struct device *self, int act) +{ + struct nfe_softc *sc = (struct nfe_softc *)self; + struct ifnet *ifp = &sc->sc_arpcom.ac_if; + + switch (act) { + case DVACT_SUSPEND: + if (ifp->if_flags & IFF_RUNNING) + nfe_stop(ifp, 0); + config_activate_children(self, act); + break; + case DVACT_RESUME: + config_activate_children(self, act); + if (ifp->if_flags & IFF_UP) + nfe_init(ifp); + break; + } + return (0); +} + + void nfe_attach(struct device *parent, struct device *self, void *aux) { -- 2.20.1