Source-Changes-HG archive

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

[src/trunk]: src/sys merge the jmcneill-usbmp branch. many thanks to jared f...



details:   https://anonhg.NetBSD.org/src/rev/26784f60588f
branches:  trunk
changeset: 779676:26784f60588f
user:      mrg <mrg%NetBSD.org@localhost>
date:      Sun Jun 10 06:15:52 2012 +0000

description:
merge the jmcneill-usbmp branch.  many thanks to jared for the
initial work, and every one else who has tested things for me.
this is largely my fault at this point :-)

the main changes are something like:

        - usbd_bus_methods{} gains a get_lock() to enable the
          host controller to provide a lock for the USB code.
          if the lock isn't provided, old-style protection is
          (partially) applied.

        - ehci/ohci/uhci have been converted to the new
          interfaces, including mutex/cv/etc conversion.

        - usbdivar.h contains a discussion about locking and
          what locks are held for which method calls.  more
          to come for usbdi(9) here.

        - audio drivers (uaudio, umidi, auvitek) have been
          properly SMPified now that USB is ready.

        - scsi drivers have been modified to take the kernel
          lock explicitly before calling into scsi code.

        - usb pipes are associated with a lock, that is the
          same as the controller lock.  (this could be split
          up further in the future.)

        - several usbfoo_locked() or usbfoo_unlocked()
          functions have been added to the usbdi(9) to
          enable functionality with or without the USB
          lock (per controller) already being held.

the TODO.usbmp file has specific details on what is left to
do, including what device-specific changes should be done now
that the whole framework is ready.

diffstat:

 sys/dev/ic/sl811hs.c                |    5 +-
 sys/dev/pci/ehci_pci.c              |   15 +-
 sys/dev/pci/ohci_pci.c              |    6 +-
 sys/dev/pci/uhci_pci.c              |    6 +-
 sys/dev/usb/TODO.usbmp              |  186 ++++++++++++++
 sys/dev/usb/ehci.c                  |  461 ++++++++++++++++++++++-------------
 sys/dev/usb/ehcivar.h               |   11 +-
 sys/dev/usb/ohci.c                  |  436 ++++++++++++++++++++++-----------
 sys/dev/usb/ohcivar.h               |    8 +-
 sys/dev/usb/uaudio.c                |   48 +--
 sys/dev/usb/ugen.c                  |  142 +++++++---
 sys/dev/usb/uhci.c                  |  370 +++++++++++++++++++---------
 sys/dev/usb/uhcivar.h               |    7 +-
 sys/dev/usb/uhid.c                  |  120 ++++++--
 sys/dev/usb/uhidev.c                |   34 +-
 sys/dev/usb/uhidev.h                |    5 +-
 sys/dev/usb/ukbd.c                  |   10 +-
 sys/dev/usb/umass.c                 |   18 +-
 sys/dev/usb/umassvar.h              |    6 +-
 sys/dev/usb/umidi.c                 |   16 +-
 sys/dev/usb/usb.c                   |  211 +++++++++++-----
 sys/dev/usb/usb_mem.c               |   47 ++-
 sys/dev/usb/usb_subr.c              |   28 +-
 sys/dev/usb/usbdi.c                 |  112 ++++++--
 sys/dev/usb/usbdi.h                 |    5 +-
 sys/dev/usb/usbdi_util.c            |   78 +++--
 sys/dev/usb/usbdi_util.h            |    8 +-
 sys/dev/usb/usbdivar.h              |   78 +++++-
 sys/dev/usb/utoppy.c                |   20 +-
 sys/rump/dev/lib/libugenhc/ugenhc.c |    6 +-
 30 files changed, 1715 insertions(+), 788 deletions(-)

diffs (truncated from 7440 to 300 lines):

diff -r 1971d8626d80 -r 26784f60588f sys/dev/ic/sl811hs.c
--- a/sys/dev/ic/sl811hs.c      Sun Jun 10 00:25:51 2012 +0000
+++ b/sys/dev/ic/sl811hs.c      Sun Jun 10 06:15:52 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sl811hs.c,v 1.32 2012/03/11 00:34:46 mrg Exp $ */
+/*     $NetBSD: sl811hs.c,v 1.33 2012/06/10 06:15:52 mrg Exp $ */
 
 /*
  * Not (c) 2007 Matthew Orgass
@@ -84,7 +84,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.32 2012/03/11 00:34:46 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.33 2012/06/10 06:15:52 mrg Exp $");
 
 #include "opt_slhci.h"
 
@@ -694,6 +694,7 @@
        slhci_freem,
        slhci_allocx,
        slhci_freex,
+       NULL, /* slhci_get_lock */
 };
 
 const struct usbd_pipe_methods slhci_pipe_methods = {
diff -r 1971d8626d80 -r 26784f60588f sys/dev/pci/ehci_pci.c
--- a/sys/dev/pci/ehci_pci.c    Sun Jun 10 00:25:51 2012 +0000
+++ b/sys/dev/pci/ehci_pci.c    Sun Jun 10 06:15:52 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ehci_pci.c,v 1.54 2012/01/30 19:41:19 drochner Exp $   */
+/*     $NetBSD: ehci_pci.c,v 1.55 2012/06/10 06:15:53 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.54 2012/01/30 19:41:19 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci_pci.c,v 1.55 2012/06/10 06:15:53 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -177,7 +177,7 @@
         * Allocate IRQ
         */
        intrstr = pci_intr_string(pc, ih);
-       sc->sc_ih = pci_intr_establish(pc, ih, IPL_USB, ehci_intr, sc);
+       sc->sc_ih = pci_intr_establish(pc, ih, IPL_SCHED, ehci_intr, sc);
        if (sc->sc_ih == NULL) {
                aprint_error_dev(self, "couldn't establish interrupt");
                if (intrstr != NULL)
@@ -299,6 +299,15 @@
                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;
 }
 
diff -r 1971d8626d80 -r 26784f60588f sys/dev/pci/ohci_pci.c
--- a/sys/dev/pci/ohci_pci.c    Sun Jun 10 00:25:51 2012 +0000
+++ b/sys/dev/pci/ohci_pci.c    Sun Jun 10 06:15:52 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ohci_pci.c,v 1.49 2012/04/05 04:04:05 macallan Exp $   */
+/*     $NetBSD: ohci_pci.c,v 1.50 2012/06/10 06:15:53 mrg Exp $        */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ohci_pci.c,v 1.49 2012/04/05 04:04:05 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci_pci.c,v 1.50 2012/06/10 06:15:53 mrg Exp $");
 
 #include "ehci.h"
 
@@ -136,7 +136,7 @@
         * Allocate IRQ
         */
        intrstr = pci_intr_string(pc, ih);
-       sc->sc_ih = pci_intr_establish(pc, ih, IPL_USB, ohci_intr, sc);
+       sc->sc_ih = pci_intr_establish(pc, ih, IPL_SCHED, ohci_intr, sc);
        if (sc->sc_ih == NULL) {
                aprint_error_dev(self, "couldn't establish interrupt");
                if (intrstr != NULL)
diff -r 1971d8626d80 -r 26784f60588f sys/dev/pci/uhci_pci.c
--- a/sys/dev/pci/uhci_pci.c    Sun Jun 10 00:25:51 2012 +0000
+++ b/sys/dev/pci/uhci_pci.c    Sun Jun 10 06:15:52 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uhci_pci.c,v 1.54 2012/01/30 19:41:23 drochner Exp $   */
+/*     $NetBSD: uhci_pci.c,v 1.55 2012/06/10 06:15:53 mrg Exp $        */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uhci_pci.c,v 1.54 2012/01/30 19:41:23 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhci_pci.c,v 1.55 2012/06/10 06:15:53 mrg Exp $");
 
 #include "ehci.h"
 
@@ -129,7 +129,7 @@
                return;
        }
        intrstr = pci_intr_string(pc, ih);
-       sc->sc_ih = pci_intr_establish(pc, ih, IPL_USB, uhci_intr, sc);
+       sc->sc_ih = pci_intr_establish(pc, ih, IPL_SCHED, uhci_intr, sc);
        if (sc->sc_ih == NULL) {
                aprint_error_dev(self, "couldn't establish interrupt");
                if (intrstr != NULL)
diff -r 1971d8626d80 -r 26784f60588f sys/dev/usb/TODO.usbmp
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/usb/TODO.usbmp    Sun Jun 10 06:15:52 2012 +0000
@@ -0,0 +1,186 @@
+$NetBSD: TODO.usbmp,v 1.2 2012/06/10 06:15:53 mrg Exp $
+
+
+the majority of the USB MP device interface is documented in usbdivar.h.
+
+
+flesh out most of usbdi(9).
+
+
+host controllers needing to be ported:
+  - dev/ic/slhci.c
+  - arch/mips/adm5120/dev/ahci.c
+  - rump/dev/lib/libugenhc/ugenhc.c
+
+
+use /* XXXSMP ok */ markers for non-SMP-safe host controller driver uses.
+eg, "if (lock_ptr) mutex_enter(lock_ptr); else s = splusb();"
+
+
+add lots more asserts
+
+
+usb_event_thread() startup should use something to sync companions
+
+
+wake/wakeup conversion:
+  - usb_detach_waitold/wakeupold() -> usb_detach_wait/broadcast()
+  - drivers:
+      if_aue.c
+      if_axe.c
+      if_udav.c
+      if_url.c
+      ubt.c
+      ucom.c
+      ucycom.c
+      ugen.c           - done
+      uhid.c           - done
+      uhso.c
+      uirda.c
+      ulpt.c
+      umass.c          - done, partially done -- need to check umass_scsipi.c change
+      urio.c
+      uscanner.c
+      usscanner.c
+      ustir.c
+      utoppy.c
+
+
+use usb_delay_ms_locked() in places
+
+
+convert uhidev users to MPSAFE:
+  ucycom(4) 
+  - own cdevsw that isn't D_MPSAFE; need to check intr handlers
+
+  uhid(4)
+  - needs some locking here (not completely tested changes)
+  - done
+
+  ukbd(4)
+  ums(4)
+  uts(4)
+  pbms(4)
+  - depends upon wscons? check intr
+
+  uyurex(4)
+  - sysmon -- hm?
+
+
+wakeup/tsleep drivers:
+  - if_otus.c
+  - if_upgt.c
+  - if_zyd.c
+  - ucom.c
+  - ucycom.c
+  - ugen.c             - done
+  - uirda.c
+  - ulpt.c
+  - umass_isdata.c
+  - ustir.c
+  - uthum.c
+  - utoppy.c
+  - uvscom.c
+  - uyurex.c
+
+
+missing D_MPSAFE drivers:
+  - ucom
+  - ucycom
+  - ugen               - partially ready
+  - uhso
+  - ulpt
+  - urio
+  - usb
+  - uscanner
+  - utoppy
+
+
+missing CALLOUT_MPSAFE drivers:
+  - if_aue
+  - if_axe
+  - if_cue
+  - if_otus
+  - if_rum
+  - if_run
+  - if_udav
+  - if_upgt
+  - if_ural
+  - if_url
+  - if_urtw
+  - if_urtwn
+  - if_zyd
+  - ukbd
+  - ulpt
+  - uyurex
+
+
+driver testing:                STATUS
+  - uhub               working
+  - uhid               working
+  - uhidev             working
+  - ums                        working
+  - uts
+  - ukbd               working
+  - ucycom
+  - uep
+  - udl
+  - ulpt               attaches ok
+  - uhso               working (must take kernel lock for scsipi)
+  - umass              working (must take kernel lock for scsipi)
+  - uaudio             working
+  - umidi              working
+  - uirda
+  - stuirda
+  - ustir
+  - irmce
+  - aue
+  - axe                        working
+  - cdce
+  - cue
+  - kue
+  - udav
+  - url
+  - urndis
+  - atu
+  - otus
+  - ral
+  - rum
+  - run
+  - urtw
+  - urtwn
+  - upgt
+  - zyd
+  - upl
+  - uberry
+  - uipad
+  - urio
+  - uscanner           ? (must take kernel lock for scsipi)
+  - usscanner
+  - utoppy
+  - uyap
+  - udsbr
+  - ugen               mostly done
+  - pseye              working
+  - uvideo
+  - auvitek            ? (must take kernel lock for scsipi)
+  - emdtv              ? (must take kernel lock for scsipi)
+  - ubt                        working (must take kernel lock for scsipi)
+  - aubtfwl
+  - u3ginit
+ucom attachments:
+  - umodem             working
+  - uark



Home | Main Index | Thread Index | Old Index