From fe4dbca5b913f33b1391b68389884d8516ce85f5 Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Tue, 24 Nov 2009 17:40:44 +0000 Subject: Reset the chip an re-initialise the interface after reset. Resetting the PHY doesn't seem to be necessary on re(4) so don't descend further for now. Based on a diff from mlarkin@ ok deraadt@ --- sys/dev/ic/re.c | 3 +-- sys/dev/ic/revar.h | 3 ++- sys/dev/pci/if_re_pci.c | 25 +++++++++++++++++++++++-- 3 files changed, 26 insertions(+), 5 deletions(-) (limited to 'sys') diff --git a/sys/dev/ic/re.c b/sys/dev/ic/re.c index 36293124453..29069056e6f 100644 --- a/sys/dev/ic/re.c +++ b/sys/dev/ic/re.c @@ -1,4 +1,4 @@ -/* $OpenBSD: re.c,v 1.115 2009/11/13 23:50:30 sthen Exp $ */ +/* $OpenBSD: re.c,v 1.116 2009/11/24 17:40:43 kettenis Exp $ */ /* $FreeBSD: if_re.c,v 1.31 2004/09/04 07:54:05 ru Exp $ */ /* * Copyright (c) 1997, 1998-2003 @@ -187,7 +187,6 @@ void re_miibus_writereg(struct device *, int, int, int); void re_miibus_statchg(struct device *); void re_iff(struct rl_softc *); -void re_reset(struct rl_softc *); void re_setup_hw_im(struct rl_softc *); void re_setup_sim_im(struct rl_softc *); diff --git a/sys/dev/ic/revar.h b/sys/dev/ic/revar.h index b2034299033..ba96758a6fd 100644 --- a/sys/dev/ic/revar.h +++ b/sys/dev/ic/revar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: revar.h,v 1.5 2006/11/28 20:04:02 brad Exp $ */ +/* $OpenBSD: revar.h,v 1.6 2009/11/24 17:40:43 kettenis Exp $ */ /* * Copyright (c) 2005 Peter Valchev @@ -18,5 +18,6 @@ int re_intr(void *); int re_attach(struct rl_softc *, const char *); +void re_reset(struct rl_softc *); int re_init(struct ifnet *); void re_stop(struct ifnet *, int); diff --git a/sys/dev/pci/if_re_pci.c b/sys/dev/pci/if_re_pci.c index 0e2a0ade841..89f7a2d9c1c 100644 --- a/sys/dev/pci/if_re_pci.c +++ b/sys/dev/pci/if_re_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_re_pci.c,v 1.25 2009/08/10 20:29:52 deraadt Exp $ */ +/* $OpenBSD: if_re_pci.c,v 1.26 2009/11/24 17:40:43 kettenis Exp $ */ /* * Copyright (c) 2005 Peter Valchev @@ -81,6 +81,7 @@ const struct pci_matchid re_pci_devices[] = { int re_pci_probe(struct device *, void *, void *); void re_pci_attach(struct device *, struct device *, void *); int re_pci_detach(struct device *, int); +int re_pci_activate(struct device *, int); /* * PCI autoconfig definitions @@ -89,7 +90,8 @@ struct cfattach re_pci_ca = { sizeof(struct re_pci_softc), re_pci_probe, re_pci_attach, - re_pci_detach + re_pci_detach, + re_pci_activate }; /* @@ -237,3 +239,22 @@ re_pci_detach(struct device *self, int flags) return (0); } + +int +re_pci_activate(struct device *self, int act) +{ + struct re_pci_softc *psc = (struct re_pci_softc *)self; + struct rl_softc *sc = &psc->sc_rl; + struct ifnet *ifp = &sc->sc_arpcom.ac_if; + + switch(act) { + case DVACT_SUSPEND: + break; + case DVACT_RESUME: + re_reset(sc); + re_init(ifp); + break; + } + + return (0); +} -- cgit v1.2.3