Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/jmcneill-usbmp]: src/sys/dev/usb - add some more "XXXSMP ok" tags



details:   https://anonhg.NetBSD.org/src/rev/611addc5baa2
branches:  jmcneill-usbmp
changeset: 771823:611addc5baa2
user:      mrg <mrg%NetBSD.org@localhost>
date:      Sun Feb 26 05:05:44 2012 +0000

description:
- add some more "XXXSMP ok" tags
- use cpu_softintr_p() instead of checking LP_INTR directly

diffstat:

 sys/dev/usb/TODO.usbmp   |  24 ++++++++++++------------
 sys/dev/usb/ehci.c       |   8 ++++----
 sys/dev/usb/if_url.c     |   5 +++--
 sys/dev/usb/ohci.c       |   6 +++---
 sys/dev/usb/uhci.c       |   6 +++---
 sys/dev/usb/usb.c        |  10 +++++-----
 sys/dev/usb/usbdi.c      |   6 +++---
 sys/dev/usb/usbdi_util.c |  20 ++++++++++----------
 8 files changed, 43 insertions(+), 42 deletions(-)

diffs (truncated from 332 to 300 lines):

diff -r d8c14662f16d -r 611addc5baa2 sys/dev/usb/TODO.usbmp
--- a/sys/dev/usb/TODO.usbmp    Sat Feb 25 21:15:38 2012 +0000
+++ b/sys/dev/usb/TODO.usbmp    Sun Feb 26 05:05:44 2012 +0000
@@ -1,11 +1,11 @@
-$NetBSD: TODO.usbmp,v 1.1.2.4 2012/02/25 20:54:03 mrg Exp $
+$NetBSD: TODO.usbmp,v 1.1.2.5 2012/02/26 05:05:44 mrg Exp $
 
 
 the majority of the USB MP device interface is documented in usbdivar.h.
 
 
-host controller porting:
-  - slhci
+host controllers needing to be ported:
+  - dev/ic/slhci.c
   - arch/mips/adm5120/dev/ahci.c
   - rump/dev/lib/libugenhc/ugenhc.c
 
@@ -14,7 +14,10 @@
 eg, "if (lock_ptr) mutex_enter(lock_ptr); else s = splusb();"
 
 
-add lots of asserts
+add lots more asserts
+
+
+usb_event_thread() startup should use something to sync companions
 
 
 usb_transfer_complete() is sometimes called with host intr lock held,
@@ -22,7 +25,7 @@
 
 
 wake/wakeup conversion:
-  - usb_detach_wait/wakeup() -> add a usb_detach_cvwait/broadcast() that
+  - usb_detach_wait/wakeup() -> add a usb_detach_waitcv/broadcast() that
     take a mutex (done)
   - drivers:
       if_aue.c
@@ -37,7 +40,7 @@
       uhso.c
       uirda.c
       ulpt.c
-      umass.c          - done, untested
+      umass.c          - done
       urio.c
       usbdi_util.c
       usbdi_util.h
@@ -45,6 +48,8 @@
       usscanner.c
       ustir.c
       utoppy.c
+  - maybe rename usb_detach_wait() to usb_detach_waitold(), so that the
+    new one can be usb_detach_waitcv()
 
 
 convert uhidev users to MPSAFE:
@@ -74,8 +79,7 @@
   - uirda.c
   - ulpt.c
   - umass_isdata.c
-  - usb.c
-  - usb_subr.c
+  - usb_subr.c: usb_delay_ms() should use kpause
   - ustir.c
   - uthum.c
   - utoppy.c
@@ -110,10 +114,6 @@
   - ulpt
   - uyurex
 
-  - ohci
-  - uhci
-  - usbdi
-
 
 driver testing:                STATUS
   - uhub               working
diff -r d8c14662f16d -r 611addc5baa2 sys/dev/usb/ehci.c
--- a/sys/dev/usb/ehci.c        Sat Feb 25 21:15:38 2012 +0000
+++ b/sys/dev/usb/ehci.c        Sun Feb 26 05:05:44 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ehci.c,v 1.181.6.13 2012/02/25 20:46:33 mrg Exp $ */
+/*     $NetBSD: ehci.c,v 1.181.6.14 2012/02/26 05:05:44 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.13 2012/02/25 20:46:33 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.181.6.14 2012/02/26 05:05:44 mrg Exp $");
 
 #include "ohci.h"
 #include "uhci.h"
@@ -548,7 +548,7 @@
        sc->sc_async_head = sqh;
        EOWRITE4(sc, EHCI_ASYNCLISTADDR, sqh->physaddr | EHCI_LINK_QH);
 
-       callout_init(&(sc->sc_tmo_intrlist), CALLOUT_MPSAFE);
+       callout_init(&sc->sc_tmo_intrlist, CALLOUT_MPSAFE);
 
        /* Turn on controller */
        EOWRITE4(sc, EHCI_USBCMD,
@@ -3003,7 +3003,7 @@
                return;
        }
 
-       if (cpu_intr_p() || (curlwp->l_pflag & LP_INTR) != 0)
+       if (cpu_intr_p() || cpu_softintr_p())
                panic("ehci_abort_xfer: not in process context");
 
        /*
diff -r d8c14662f16d -r 611addc5baa2 sys/dev/usb/if_url.c
--- a/sys/dev/usb/if_url.c      Sat Feb 25 21:15:38 2012 +0000
+++ b/sys/dev/usb/if_url.c      Sun Feb 26 05:05:44 2012 +0000
@@ -1,4 +1,5 @@
-/*     $NetBSD: if_url.c,v 1.38.12.1 2012/02/18 07:35:06 mrg Exp $     */
+/*     $NetBSD: if_url.c,v 1.38.12.2 2012/02/26 05:05:44 mrg Exp $     */
+
 /*
  * Copyright (c) 2001, 2002
  *     Shingo WATANABE <nabe%nabechan.org@localhost>.  All rights reserved.
@@ -43,7 +44,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.38.12.1 2012/02/18 07:35:06 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.38.12.2 2012/02/26 05:05:44 mrg Exp $");
 
 #include "opt_inet.h"
 
diff -r d8c14662f16d -r 611addc5baa2 sys/dev/usb/ohci.c
--- a/sys/dev/usb/ohci.c        Sat Feb 25 21:15:38 2012 +0000
+++ b/sys/dev/usb/ohci.c        Sun Feb 26 05:05:44 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ohci.c,v 1.218.6.15 2012/02/25 20:46:34 mrg Exp $      */
+/*     $NetBSD: ohci.c,v 1.218.6.16 2012/02/26 05:05:44 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.15 2012/02/25 20:46:34 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.218.6.16 2012/02/26 05:05:44 mrg Exp $");
 
 #include "opt_usb.h"
 
@@ -2317,7 +2317,7 @@
                return;
        }
 
-       if (cpu_intr_p() || (curlwp->l_pflag & LP_INTR) != 0)
+       if (cpu_intr_p() || cpu_softintr_p())
                panic("ohci_abort_xfer: not in process context");
 
        /*
diff -r d8c14662f16d -r 611addc5baa2 sys/dev/usb/uhci.c
--- a/sys/dev/usb/uhci.c        Sat Feb 25 21:15:38 2012 +0000
+++ b/sys/dev/usb/uhci.c        Sun Feb 26 05:05:44 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uhci.c,v 1.240.6.14 2012/02/25 20:46:33 mrg Exp $      */
+/*     $NetBSD: uhci.c,v 1.240.6.15 2012/02/26 05:05:44 mrg Exp $      */
 /*     $FreeBSD: src/sys/dev/usb/uhci.c,v 1.33 1999/11/17 22:33:41 n_hibma Exp $       */
 
 /*
@@ -43,7 +43,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.240.6.14 2012/02/25 20:46:33 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.240.6.15 2012/02/26 05:05:44 mrg Exp $");
 
 #include "opt_usb.h"
 
@@ -2146,7 +2146,7 @@
                return;
        }
 
-       if (cpu_intr_p() || (curlwp->l_pflag & LP_INTR) != 0)
+       if (cpu_intr_p() || cpu_softintr_p())
                panic("uhci_abort_xfer: not in process context");
 
        /*
diff -r d8c14662f16d -r 611addc5baa2 sys/dev/usb/usb.c
--- a/sys/dev/usb/usb.c Sat Feb 25 21:15:38 2012 +0000
+++ b/sys/dev/usb/usb.c Sun Feb 26 05:05:44 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usb.c,v 1.125.6.11 2012/02/25 10:26:24 mrg Exp $       */
+/*     $NetBSD: usb.c,v 1.125.6.12 2012/02/26 05:05:45 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.11 2012/02/25 10:26:24 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.125.6.12 2012/02/26 05:05:45 mrg Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_usb.h"
@@ -409,8 +409,8 @@
                        cv_timedwait(&sc->sc_bus->needs_explore_cv,
                            sc->sc_bus->lock, usb_noexplore ? 0 : hz * 60);
                else
-                       (void)tsleep(&sc->sc_bus->needs_explore, PWAIT,
-                           "usbevt", usb_noexplore ? 0 : hz * 60);
+                       (void)tsleep(&sc->sc_bus->needs_explore, /* XXXSMP ok */
+                           PWAIT, "usbevt", usb_noexplore ? 0 : hz * 60);
                DPRINTFN(2,("usb_event_thread: woke up\n"));
        }
        sc->sc_event_thread = NULL;
@@ -1039,7 +1039,7 @@
                        mutex_exit(sc->sc_bus->lock);
                } else {
                        wakeup(&sc->sc_bus->needs_explore);     /* XXXSMP ok */
-                       tsleep(sc, PWAIT, "usbdet", hz * 60);
+                       tsleep(sc, PWAIT, "usbdet", hz * 60);   /* XXXSMP ok */
                }
        }
        DPRINTF(("usb_detach: event thread dead\n"));
diff -r d8c14662f16d -r 611addc5baa2 sys/dev/usb/usbdi.c
--- a/sys/dev/usb/usbdi.c       Sat Feb 25 21:15:38 2012 +0000
+++ b/sys/dev/usb/usbdi.c       Sun Feb 26 05:05:44 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usbdi.c,v 1.134.2.13 2012/02/25 20:46:34 mrg Exp $     */
+/*     $NetBSD: usbdi.c,v 1.134.2.14 2012/02/26 05:05:45 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.13 2012/02/25 20:46:34 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.134.2.14 2012/02/26 05:05:45 mrg Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_usb.h"
@@ -968,7 +968,7 @@
        usbd_status err;
 
 #ifdef DIAGNOSTIC
-       if (cpu_intr_p() || (curlwp->l_pflag & LP_INTR) != 0) {
+       if (cpu_intr_p() || cpu_softintr_p()) {
                printf("usbd_do_request: not in process context\n");
                return (USBD_INVAL);
        }
diff -r d8c14662f16d -r 611addc5baa2 sys/dev/usb/usbdi_util.c
--- a/sys/dev/usb/usbdi_util.c  Sat Feb 25 21:15:38 2012 +0000
+++ b/sys/dev/usb/usbdi_util.c  Sun Feb 26 05:05:44 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usbdi_util.c,v 1.55.12.3 2012/02/25 20:47:32 mrg Exp $ */
+/*     $NetBSD: usbdi_util.c,v 1.55.12.4 2012/02/26 05:05:45 mrg Exp $ */
 
 /*
  * Copyright (c) 1998, 2012 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usbdi_util.c,v 1.55.12.3 2012/02/25 20:47:32 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi_util.c,v 1.55.12.4 2012/02/26 05:05:45 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -439,7 +439,7 @@
        usbd_setup_xfer(xfer, pipe, 0, buf, *size,
                        flags, timeout, usbd_bulk_transfer_cb);
        DPRINTFN(1, ("usbd_bulk_transfer: start transfer %d bytes\n", *size));
-       usbd_lock_pipe(pipe);   /* don't want callback until tsleep() */
+       usbd_lock_pipe(pipe);   /* don't want callback until block */
        err = usbd_transfer(xfer);
        if (err != USBD_IN_PROGRESS) {
                usbd_unlock_pipe(pipe);
@@ -448,10 +448,10 @@
        if (pipe->device->bus->lock)
                error = cv_wait_sig(&xfer->cv, pipe->device->bus->lock);
        else
-               error = tsleep(xfer, PZERO | PCATCH, lbl, 0);
+               error = tsleep(xfer, PZERO | PCATCH, lbl, 0); /* XXXSMP ok */
        usbd_unlock_pipe(pipe);
        if (error) {
-               DPRINTF(("usbd_bulk_transfer: tsleep=%d\n", error));
+               DPRINTF(("usbd_bulk_transfer: wait=%d\n", error));
                usbd_abort_pipe(pipe);
                return (USBD_INTERRUPTED);
        }
@@ -488,7 +488,7 @@
        usbd_setup_xfer(xfer, pipe, 0, buf, *size,
                        flags, timeout, usbd_intr_transfer_cb);
        DPRINTFN(1, ("usbd_intr_transfer: start transfer %d bytes\n", *size));
-       usbd_lock_pipe(pipe);   /* don't want callback until tsleep() */
+       usbd_lock_pipe(pipe);   /* don't want callback until block */
        err = usbd_transfer(xfer);
        if (err != USBD_IN_PROGRESS) {



Home | Main Index | Thread Index | Old Index