summaryrefslogtreecommitdiffstats
path: root/sys/pci/if_fxp.c
diff options
context:
space:
mode:
authordg <dg@FreeBSD.org>1996-09-20 04:11:53 +0000
committerdg <dg@FreeBSD.org>1996-09-20 04:11:53 +0000
commit6065d244a1e714e1e09836684ebde7bd8dfd9f14 (patch)
tree382dfbdbe00b0175fb239b5dd9441453aec36e54 /sys/pci/if_fxp.c
parent717bed3db1c5294c140c3c0e8f0a9b87745a09d7 (diff)
downloadFreeBSD-src-6065d244a1e714e1e09836684ebde7bd8dfd9f14.zip
FreeBSD-src-6065d244a1e714e1e09836684ebde7bd8dfd9f14.tar.gz
When the devconf stuff was ripped out of the kernel, the ripper neglected
to deal with the fact that we relied on devconf to do the shutdown callouts in various drivers. The changes in this commit are to add support for device shutdown in this driver via the new at_shutdown() mechanism. Similar changes need to be made to all of the other drivers that need a shutdown routine called (if_de.c comes to mind immediately).
Diffstat (limited to 'sys/pci/if_fxp.c')
-rw-r--r--sys/pci/if_fxp.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/sys/pci/if_fxp.c b/sys/pci/if_fxp.c
index 7e72bec..28d0686 100644
--- a/sys/pci/if_fxp.c
+++ b/sys/pci/if_fxp.c
@@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: if_fxp.c,v 1.15 1996/09/18 16:18:05 davidg Exp $
+ * $Id: if_fxp.c,v 1.16 1996/09/19 09:15:20 davidg Exp $
*/
/*
@@ -89,9 +89,6 @@ struct fxp_softc {
int promisc_mode; /* promiscuous mode enabled */
};
-#include "fxp.h"
-static struct fxp_softc *fxp_sc[NFXP]; /* XXX Yuck */
-
static u_long fxp_count;
/*
@@ -130,7 +127,6 @@ static u_char fxp_cb_config_template[] = {
static inline int fxp_scb_wait __P((struct fxp_csr *));
static char *fxp_probe __P((pcici_t, pcidi_t));
static void fxp_attach __P((pcici_t, int));
-static int fxp_shutdown __P((int, int));
static void fxp_intr __P((void *));
static void fxp_start __P((struct ifnet *));
static int fxp_ioctl __P((struct ifnet *, int, caddr_t));
@@ -139,6 +135,7 @@ static void fxp_stop __P((struct fxp_softc *));
static void fxp_watchdog __P((struct ifnet *));
static void fxp_get_macaddr __P((struct fxp_softc *));
static int fxp_add_rfabuf __P((struct fxp_softc *, struct mbuf *));
+static void fxp_shutdown __P((int, void *));
timeout_t fxp_stats_update;
@@ -147,7 +144,7 @@ static struct pci_device fxp_device = {
fxp_probe,
fxp_attach,
&fxp_count,
- fxp_shutdown
+ NULL
};
DATA_SET(pcidevice_set, fxp_device);
@@ -278,8 +275,6 @@ fxp_attach(config_id, unit)
}
}
- fxp_sc[unit] = sc;
-
ifp = &sc->arpcom.ac_if;
ifp->if_softc = sc;
ifp->if_unit = unit;
@@ -304,6 +299,14 @@ fxp_attach(config_id, unit)
#if NBPFILTER > 0
bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
#endif
+
+ /*
+ * Add shutdown hook so that DMA is disabled prior to reboot. Not
+ * doing do could allow DMA to corrupt kernel memory during the
+ * reboot before the driver initializes.
+ */
+ at_shutdown(fxp_shutdown, sc, SHUTDOWN_POST_SYNC);
+
splx(s);
return;
@@ -393,20 +396,16 @@ fxp_get_macaddr(sc)
}
/*
- * Device shutdown routine. Usually called at system shutdown. The
+ * Device shutdown routine. Called at system shutdown after sync. The
* main purpose of this routine is to shut off receiver DMA so that
* kernel memory doesn't get clobbered during warmboot.
*/
-static int
-fxp_shutdown(unit, force)
- int unit;
- int force;
+static void
+fxp_shutdown(howto, sc)
+ int howto;
+ void *sc;
{
- struct fxp_softc *sc = fxp_sc[unit];
-
- fxp_stop(sc);
-
- return 0;
+ fxp_stop((struct fxp_softc *) sc);
}
/*
OpenPOWER on IntegriCloud