summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorJolan Luff <jolan@cvs.openbsd.org>2006-05-18 16:46:06 +0000
committerJolan Luff <jolan@cvs.openbsd.org>2006-05-18 16:46:06 +0000
commiteb8526929c2e188b7312e11896738ba3caf18dca (patch)
treea8eed3346fce7186a4739eefbc484bc27a73a3ba /sys/dev
parent85c7a7fb45eac0154866ce6fe410a387e1611842 (diff)
some devices can do weird things upon a warm reboot so add a shutdown
hook which explicitly resets and stops the device; fixes pr/5001 ok dlg@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/usb/if_aue.c18
-rw-r--r--sys/dev/usb/if_auereg.h3
2 files changed, 19 insertions, 2 deletions
diff --git a/sys/dev/usb/if_aue.c b/sys/dev/usb/if_aue.c
index 2b33a46339d..3b1404efbcd 100644
--- a/sys/dev/usb/if_aue.c
+++ b/sys/dev/usb/if_aue.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_aue.c,v 1.45 2006/03/25 22:41:46 djm Exp $ */
+/* $OpenBSD: if_aue.c,v 1.46 2006/05/18 16:46:05 jolan Exp $ */
/* $NetBSD: if_aue.c,v 1.82 2003/03/05 17:37:36 shiba Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000
@@ -245,6 +245,7 @@ Static void aue_tick_task(void *);
Static void aue_start(struct ifnet *);
Static int aue_ioctl(struct ifnet *, u_long, caddr_t);
Static void aue_init(void *);
+Static void aue_shutdown(void *);
Static void aue_stop(struct aue_softc *);
Static void aue_watchdog(struct ifnet *);
Static int aue_openpipes(struct aue_softc *);
@@ -846,6 +847,7 @@ USB_ATTACH(aue)
usb_callout_init(sc->aue_stat_ch);
sc->aue_attached = 1;
+ sc->sc_sdhook = shutdownhook_establish(aue_shutdown, sc);
splx(s);
usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->aue_udev,
@@ -894,6 +896,7 @@ USB_DETACH(aue)
#endif
sc->aue_attached = 0;
+ shutdownhook_disestablish(sc->sc_sdhook);
if (--sc->aue_refcnt >= 0) {
/* Wait for processes to go away. */
@@ -1633,6 +1636,19 @@ aue_watchdog(struct ifnet *ifp)
}
/*
+ * Stop all chip I/O so that the kernel's probe routines don't
+ * get confused by errant DMAs when rebooting.
+ */
+Static void
+aue_shutdown(void *arg)
+{
+ struct aue_softc *sc = (struct aue_softc *)arg;
+
+ aue_reset(sc);
+ aue_stop(sc);
+}
+
+/*
* Stop the adapter and free any mbufs allocated to the
* RX and TX lists.
*/
diff --git a/sys/dev/usb/if_auereg.h b/sys/dev/usb/if_auereg.h
index d78cdb908fa..5d11ceb6911 100644
--- a/sys/dev/usb/if_auereg.h
+++ b/sys/dev/usb/if_auereg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_auereg.h,v 1.8 2006/03/07 04:41:19 krw Exp $ */
+/* $OpenBSD: if_auereg.h,v 1.9 2006/05/18 16:46:05 jolan Exp $ */
/* $NetBSD: if_auereg.h,v 1.16 2001/10/10 02:14:17 augustss Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -270,6 +270,7 @@ struct aue_softc {
struct lock aue_mii_lock;
+ void *sc_sdhook;
};
#define AUE_TIMEOUT 1000