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 changes from ...
details: https://anonhg.NetBSD.org/src/rev/1bbd8a0ed827
branches: mrg-ohci-jmcneill-usbmp
changeset: 771775:1bbd8a0ed827
user: mrg <mrg%NetBSD.org@localhost>
date: Thu Dec 08 10:41:28 2011 +0000
description:
merge a few more changes from the main branch.
diffstat:
sys/dev/usb/usb.c | 11 +++++++++--
sys/dev/usb/usb_subr.c | 6 ++++--
sys/dev/usb/usbdivar.h | 21 +++++++++++++++++++--
sys/dev/usb/utoppy.c | 22 +++++++++++++++-------
4 files changed, 47 insertions(+), 13 deletions(-)
diffs (167 lines):
diff -r b027c2ca8447 -r 1bbd8a0ed827 sys/dev/usb/usb.c
--- a/sys/dev/usb/usb.c Thu Dec 08 10:22:40 2011 +0000
+++ b/sys/dev/usb/usb.c Thu Dec 08 10:41:28 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: usb.c,v 1.125.6.1.2.1 2011/12/08 09:54:30 mrg Exp $ */
+/* $NetBSD: usb.c,v 1.125.6.1.2.2 2011/12/08 10:41:28 mrg Exp $ */
/*
* Copyright (c) 1998, 2002, 2008 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.125.6.1.2.1 2011/12/08 09:54:30 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.125.6.1.2.2 2011/12/08 10:41:28 mrg Exp $");
#include "opt_compat_netbsd.h"
#include "opt_usb.h"
@@ -226,6 +226,13 @@
panic("usb_doattach");
}
+ if (mpsafe) {
+ sc->sc_bus->methods->get_locks(sc->sc_bus,
+ &sc->sc_bus->intr_lock, &sc->sc_bus->lock);
+ } else {
+ sc->sc_bus->intr_lock = sc->sc_bus->lock = NULL;
+ }
+
ue = usb_alloc_event();
ue->u.ue_ctrlr.ue_bus = device_unit(self);
usb_add_event(USB_EVENT_CTRLR_ATTACH, ue);
diff -r b027c2ca8447 -r 1bbd8a0ed827 sys/dev/usb/usb_subr.c
--- a/sys/dev/usb/usb_subr.c Thu Dec 08 10:22:40 2011 +0000
+++ b/sys/dev/usb/usb_subr.c Thu Dec 08 10:41:28 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: usb_subr.c,v 1.180.6.1.2.2 2011/12/08 10:22:40 mrg Exp $ */
+/* $NetBSD: usb_subr.c,v 1.180.6.1.2.3 2011/12/08 10:41:28 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.2 2011/12/08 10:22:40 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.180.6.1.2.3 2011/12/08 10:41:28 mrg Exp $");
#include "opt_compat_netbsd.h"
#include "opt_usbverbose.h"
@@ -751,11 +751,13 @@
free(p, M_USB);
return (err);
}
+#if 1
if (dev->bus->methods->get_locks) {
dev->bus->methods->get_locks(dev->bus, &p->intr_lock, &p->lock);
} else {
p->intr_lock = p->lock = NULL;
}
+#endif
*pipe = p;
return (USBD_NORMAL_COMPLETION);
}
diff -r b027c2ca8447 -r 1bbd8a0ed827 sys/dev/usb/usbdivar.h
--- a/sys/dev/usb/usbdivar.h Thu Dec 08 10:22:40 2011 +0000
+++ b/sys/dev/usb/usbdivar.h Thu Dec 08 10:41:28 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: usbdivar.h,v 1.93.8.1.2.1 2011/12/08 10:22:40 mrg Exp $ */
+/* $NetBSD: usbdivar.h,v 1.93.8.1.2.2 2011/12/08 10:41:28 mrg Exp $ */
/* $FreeBSD: src/sys/dev/usb/usbdivar.h,v 1.11 1999/11/17 22:33:51 n_hibma Exp $ */
/*
@@ -142,7 +142,9 @@
const struct usbd_bus_methods *methods;
u_int32_t pipe_size; /* size of a pipe struct */
/* Filled by usb driver */
- struct usbd_device *root_hub;
+ kmutex_t *intr_lock;
+ kmutex_t *lock;
+ struct usbd_device *root_hub;
usbd_device_handle devices[USB_MAX_DEVICES];
char needs_explore;/* a hub a signalled a change */
char use_polling;
@@ -304,3 +306,18 @@
#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)
+#define usbd_lock_pipe(p) do { \
+ if ((p)->device->bus->lock) { \
+ s = -1; \
+ mutex_enter((p)->device->bus->lock); \
+ } else \
+ s = splusb(); \
+} while (0)
+
+#define usbd_unlock_pipe(p) do { \
+ if ((p)->device->bus->lock) { \
+ s = -1; \
+ mutex_exit((p)->device->bus->lock); \
+ } else \
+ splx(s); \
+} while (0)
diff -r b027c2ca8447 -r 1bbd8a0ed827 sys/dev/usb/utoppy.c
--- a/sys/dev/usb/utoppy.c Thu Dec 08 10:22:40 2011 +0000
+++ b/sys/dev/usb/utoppy.c Thu Dec 08 10:41:28 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: utoppy.c,v 1.15 2010/11/03 22:34:24 dyoung Exp $ */
+/* $NetBSD: utoppy.c,v 1.15.14.1 2011/12/08 10:41:28 mrg Exp $ */
/*-
* Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: utoppy.c,v 1.15 2010/11/03 22:34:24 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: utoppy.c,v 1.15.14.1 2011/12/08 10:41:28 mrg Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -43,9 +43,11 @@
#include <sys/uio.h>
#include <sys/conf.h>
#include <sys/vnode.h>
+#include <sys/bus.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
+#include <dev/usb/usbdivar.h>
#include <dev/usb/usbdi_util.h>
#include <dev/usb/usbdevs.h>
#include <dev/usb/usb_quirks.h>
@@ -519,7 +521,10 @@
usbd_status status)
{
- wakeup(xfer);
+ if (xfer->pipe->device->bus->lock)
+ cv_broadcast(&xfer->cv);
+ else
+ wakeup(xfer);
}
static usbd_status
@@ -532,14 +537,17 @@
usbd_setup_xfer(xfer, pipe, 0, buf, *size, flags, timeout,
utoppy_bulk_transfer_cb);
- s = splusb();
+ usbd_lock_pipe(pipe); /* don't want callback until tsleep() */
err = usbd_transfer(xfer);
if (err != USBD_IN_PROGRESS) {
- splx(s);
+ usbd_unlock_pipe(pipe);
return (err);
}
- error = tsleep((void *)xfer, PZERO, lbl, 0);
- splx(s);
+ if (pipe->device->bus->lock)
+ error = cv_wait_sig(&xfer->cv, pipe->device->bus->lock);
+ else
+ error = tsleep((void *)xfer, PZERO, lbl, 0);
+ usbd_unlock_pipe(pipe);
if (error) {
usbd_abort_pipe(pipe);
return (USBD_INTERRUPTED);
Home |
Main Index |
Thread Index |
Old Index