Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/mrg-ohci-jmcneill-usbmp]: src/sys/dev/usb merge a few more things from t...
details: https://anonhg.NetBSD.org/src/rev/b027c2ca8447
branches: mrg-ohci-jmcneill-usbmp
changeset: 771774:b027c2ca8447
user: mrg <mrg%NetBSD.org@localhost>
date: Thu Dec 08 10:22:40 2011 +0000
description:
merge a few more things from the main branch. uaudio@ohci still works.
diffstat:
sys/dev/usb/ohci.c | 8 ++++--
sys/dev/usb/usb_subr.c | 8 +-----
sys/dev/usb/usbdi.c | 9 +------
sys/dev/usb/usbdivar.h | 51 +++++++++++++++++++++++++++++++++++--------------
4 files changed, 45 insertions(+), 31 deletions(-)
diffs (182 lines):
diff -r da874f86f8af -r b027c2ca8447 sys/dev/usb/ohci.c
--- a/sys/dev/usb/ohci.c Thu Dec 08 09:54:30 2011 +0000
+++ b/sys/dev/usb/ohci.c Thu Dec 08 10:22:40 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ohci.c,v 1.218.6.2.2.5 2011/12/08 09:36:49 mrg Exp $ */
+/* $NetBSD: ohci.c,v 1.218.6.2.2.6 2011/12/08 10:22:40 mrg Exp $ */
/* $FreeBSD: src/sys/dev/usb/ohci.c,v 1.22 1999/11/17 22:33:40 n_hibma Exp $ */
/*
@@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.218.6.2.2.5 2011/12/08 09:36:49 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.218.6.2.2.6 2011/12/08 10:22:40 mrg Exp $");
#include "opt_usb.h"
@@ -2961,8 +2961,10 @@
ohci_softc_t *sc = pipe->device->bus->hci_private;
DPRINTF(("ohci_device_ctrl_close: pipe=%p\n", pipe));
+ mutex_enter(&sc->sc_lock);
ohci_close_pipe(pipe, sc->sc_ctrl_head);
ohci_free_std(sc, opipe->tail.td);
+ mutex_exit(&sc->sc_lock);
}
/************************/
@@ -3125,8 +3127,8 @@
DPRINTF(("ohci_device_bulk_close: pipe=%p\n", pipe));
mutex_enter(&sc->sc_lock);
ohci_close_pipe(pipe, sc->sc_bulk_head);
+ ohci_free_std(sc, opipe->tail.td);
mutex_exit(&sc->sc_lock);
- ohci_free_std(sc, opipe->tail.td);
}
/************************/
diff -r da874f86f8af -r b027c2ca8447 sys/dev/usb/usb_subr.c
--- a/sys/dev/usb/usb_subr.c Thu Dec 08 09:54:30 2011 +0000
+++ b/sys/dev/usb/usb_subr.c Thu Dec 08 10:22:40 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: usb_subr.c,v 1.180.6.1.2.1 2011/12/08 09:36:49 mrg Exp $ */
+/* $NetBSD: usb_subr.c,v 1.180.6.1.2.2 2011/12/08 10:22:40 mrg Exp $ */
/* $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $ */
/*
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.180.6.1.2.1 2011/12/08 09:36:49 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.180.6.1.2.2 2011/12/08 10:22:40 mrg Exp $");
#include "opt_compat_netbsd.h"
#include "opt_usbverbose.h"
@@ -765,11 +765,7 @@
usbd_kill_pipe(usbd_pipe_handle pipe)
{
usbd_abort_pipe(pipe);
- if (pipe->lock)
- mutex_enter(pipe->lock);
pipe->methods->close(pipe);
- if (pipe->lock)
- mutex_exit(pipe->lock);
pipe->endpoint->refcnt--;
free(pipe, M_USB);
}
diff -r da874f86f8af -r b027c2ca8447 sys/dev/usb/usbdi.c
--- a/sys/dev/usb/usbdi.c Thu Dec 08 09:54:30 2011 +0000
+++ b/sys/dev/usb/usbdi.c Thu Dec 08 10:22:40 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: usbdi.c,v 1.134.2.1.2.1 2011/12/08 07:53:56 mrg Exp $ */
+/* $NetBSD: usbdi.c,v 1.134.2.1.2.2 2011/12/08 10:22:40 mrg Exp $ */
/* $FreeBSD: src/sys/dev/usb/usbdi.c,v 1.28 1999/11/17 22:33:49 n_hibma Exp $ */
/*
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.134.2.1.2.1 2011/12/08 07:53:56 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.134.2.1.2.2 2011/12/08 10:22:40 mrg Exp $");
#include "opt_compat_netbsd.h"
#include "opt_usb.h"
@@ -727,7 +727,6 @@
{
usbd_xfer_handle xfer;
- SPLUSBCHECK;
KASSERT(pipe->lock == NULL || mutex_owned(pipe->lock));
DPRINTFN(2,("usbd_ar_pipe: pipe=%p\n", pipe));
@@ -763,8 +762,6 @@
xfer->status == USBD_TIMEOUT;
int repeat, polling;
- SPLUSBCHECK;
-
DPRINTFN(5, ("usb_transfer_complete: pipe=%p xfer=%p status=%d "
"actlen=%d\n", pipe, xfer, xfer->status, xfer->actlen));
@@ -907,8 +904,6 @@
usbd_xfer_handle xfer;
usbd_status err;
- SPLUSBCHECK;
-
#ifdef DIAGNOSTIC
if (pipe == NULL) {
printf("usbd_start_next: pipe == NULL\n");
diff -r da874f86f8af -r b027c2ca8447 sys/dev/usb/usbdivar.h
--- a/sys/dev/usb/usbdivar.h Thu Dec 08 09:54:30 2011 +0000
+++ b/sys/dev/usb/usbdivar.h Thu Dec 08 10:22:40 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: usbdivar.h,v 1.93.8.1 2011/12/04 13:23:17 jmcneill Exp $ */
+/* $NetBSD: usbdivar.h,v 1.93.8.1.2.1 2011/12/08 10:22:40 mrg Exp $ */
/* $FreeBSD: src/sys/dev/usb/usbdivar.h,v 1.11 1999/11/17 22:33:51 n_hibma Exp $ */
/*
@@ -34,6 +34,41 @@
#include <sys/callout.h>
#include <sys/mutex.h>
+/*
+ * Discussion about locking in the USB code:
+ *
+ * There are two locks presented by the host controller: the interrupt lock
+ * and the thread lock. The interrupt lock, either a spin or adaptive mutex,
+ * manages hardware state and anything else touched in an interrupt context.
+ * The thread lock has everything else.
+ *
+ * List of hardware interface methods, and which locks are held when each
+ * is called by this module:
+ *
+ * BUS METHOD INTR THREAD NOTES
+ * ----------------------- ------- ------- -------------------------
+ * open_pipe - - might want to take thread lock?
+ * soft_intr - - intr lock is taken sometimes, thread lock taken often, but nothing demanded?
+ * do_poll - - might want to take thread lock?
+ * allocm - -
+ * freem - -
+ * allocx - -
+ * freex - -
+ * get_locks - - Called at attach time
+ *
+ * PIPE METHOD INTR THREAD NOTES
+ * ----------------------- ------- ------- -------------------------
+ * transfer - -
+ * start - -
+ * abort - -
+ * close - x
+ * cleartoggle - -
+ * done - x
+ *
+ * The above semantics are likely to change.
+ *
+ */
+
/* From usb_mem.h */
struct usb_dma_block;
typedef struct {
@@ -269,17 +304,3 @@
#define usbd_lock(m) if (m) { s = -1; mutex_enter(m); } else s = splusb()
#define usbd_unlock(m) if (m) { s = -1; mutex_exit(m); } else splx(s)
-
-/*
- * XXX This check is extremely bogus. Bad Bad Bad.
- */
-#if defined(DIAGNOSTIC) && 0
-#define SPLUSBCHECK \
- do { int _s = splusb(), _su = splusb(); \
- if (!cold && _s != _su) printf("SPLUSBCHECK failed 0x%x!=0x%x, %s:%d\n", \
- _s, _su, __FILE__, __LINE__); \
- splx(_s); \
- } while (0)
-#else
-#define SPLUSBCHECK
-#endif
Home |
Main Index |
Thread Index |
Old Index