Module Name: src
Committed By: mrg
Date: Mon Mar 12 06:42:15 UTC 2012
Modified Files:
src/sys/dev/pci [jmcneill-usbmp]: ehci_pci.c
src/sys/dev/usb [jmcneill-usbmp]: ehci.c usb.c
Log Message:
fix detach bugs:
- need to disestablish the ehci softint's.
- need to destroy needs_explore_cv
- note that ehci.c inits locks, but ehci_pci.c destroys them due to the
way that the (pci) front end does softint handling, and can only be
trusted to destroy them. XXX need to fix this, by looking at the many
ehci frontends as well and checking ohci/uhci.
To generate a diff of this commit:
cvs rdiff -u -r1.53.6.3 -r1.53.6.4 src/sys/dev/pci/ehci_pci.c
cvs rdiff -u -r1.181.6.17 -r1.181.6.18 src/sys/dev/usb/ehci.c
cvs rdiff -u -r1.125.6.12 -r1.125.6.13 src/sys/dev/usb/usb.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/pci/ehci_pci.c
diff -u src/sys/dev/pci/ehci_pci.c:1.53.6.3 src/sys/dev/pci/ehci_pci.c:1.53.6.4
--- src/sys/dev/pci/ehci_pci.c:1.53.6.3 Sat Feb 18 07:34:36 2012
+++ src/sys/dev/pci/ehci_pci.c Mon Mar 12 06:42:15 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: ehci_pci.c,v 1.53.6.3 2012/02/18 07:34:36 mrg Exp $ */
+/* $NetBSD: ehci_pci.c,v 1.53.6.4 2012/03/12 06:42:15 mrg Exp $ */
/*
* Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ehci_pci.c,v 1.53.6.3 2012/02/18 07:34:36 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci_pci.c,v 1.53.6.4 2012/03/12 06:42:15 mrg Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -299,9 +299,15 @@ ehci_pci_detach(device_t self, int flags
sc->sc.sc_size = 0;
}
+#if 1
+ /* XXX created in ehci.c */
mutex_destroy(&sc->sc.sc_lock);
mutex_destroy(&sc->sc.sc_intr_lock);
+ softint_disestablish(sc->sc.sc_doorbell_si);
+ softint_disestablish(sc->sc.sc_pcd_si);
+#endif
+
return 0;
}
Index: src/sys/dev/usb/ehci.c
diff -u src/sys/dev/usb/ehci.c:1.181.6.17 src/sys/dev/usb/ehci.c:1.181.6.18
--- src/sys/dev/usb/ehci.c:1.181.6.17 Sun Mar 11 01:52:28 2012
+++ src/sys/dev/usb/ehci.c Mon Mar 12 06:42:15 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: ehci.c,v 1.181.6.17 2012/03/11 01:52:28 mrg Exp $ */
+/* $NetBSD: ehci.c,v 1.181.6.18 2012/03/12 06:42:15 mrg Exp $ */
/*
* Copyright (c) 2004-2012 The NetBSD Foundation, Inc.
@@ -53,7 +53,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.181.6.17 2012/03/11 01:52:28 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.181.6.18 2012/03/12 06:42:15 mrg Exp $");
#include "ohci.h"
#include "uhci.h"
@@ -1165,9 +1165,16 @@ ehci_detach(struct ehci_softc *sc, int f
cv_destroy(&sc->sc_doorbell);
cv_destroy(&sc->sc_softwake_cv);
+#if 0
+ /* XXX destroyed in ehci_pci.c as it controls ehci_intr access */
+
softint_disestablish(sc->sc_doorbell_si);
softint_disestablish(sc->sc_pcd_si);
+ mutex_destroy(&sc->sc_lock);
+ mutex_destroy(&sc->sc_intr_lock);
+#endif
+
while ((xfer = SIMPLEQ_FIRST(&sc->sc_free_xfers)) != NULL) {
SIMPLEQ_REMOVE_HEAD(&sc->sc_free_xfers, next);
kmem_free(xfer, sizeof(struct ehci_xfer));
Index: src/sys/dev/usb/usb.c
diff -u src/sys/dev/usb/usb.c:1.125.6.12 src/sys/dev/usb/usb.c:1.125.6.13
--- src/sys/dev/usb/usb.c:1.125.6.12 Sun Feb 26 05:05:45 2012
+++ src/sys/dev/usb/usb.c Mon Mar 12 06:42:15 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: usb.c,v 1.125.6.12 2012/02/26 05:05:45 mrg Exp $ */
+/* $NetBSD: usb.c,v 1.125.6.13 2012/03/12 06:42:15 mrg Exp $ */
/*
* Copyright (c) 1998, 2002, 2008, 2012 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.125.6.12 2012/02/26 05:05:45 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.125.6.13 2012/03/12 06:42:15 mrg Exp $");
#include "opt_compat_netbsd.h"
#include "opt_usb.h"
@@ -1053,6 +1053,8 @@ usb_detach(device_t self, int flags)
ue->u.ue_ctrlr.ue_bus = device_unit(self);
usb_add_event(USB_EVENT_CTRLR_DETACH, ue);
+ cv_destroy(&sc->sc_bus->needs_explore_cv);
+
return (0);
}