Commit Graph

43 Commits

Author SHA1 Message Date
skrll
4e8e66439e Merge nick-nhusb
- API / infrastructure changes to support memory management changes.
- Memory management improvements and bug fixes.
- HCDs should now be MP safe
- conversion to KERNHIST based debug
- FS/LS isoc support on ehci(4).
- conversion to kmem(9)
- Some USB 3 support - mostly from Takahiro HAYASHI (t-hash).
- interrupt transfers now get proper DMA operations
- general bug fixes
    - kern/48308
    - uhub status notification improvements
    - umass(4) probe fix (applied to HEAD already)
    - ohci(4) short transfer fix
2016-04-23 10:15:27 +00:00
matt
e4ea5ea184 Use CACHE_LINE_SIZE for EHCI_SQTD_ALIGN to make sure the sqtd fully consume
a cacheline.
2013-02-02 14:15:55 +00:00
christos
b9fd652795 use a pool instead of a linked list to avoid synchronization problems. 2013-01-29 00:00:15 +00:00
mrg
dc74fbbf85 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.
2012-06-10 06:15:52 +00:00
mrg
574ae8c2d4 pull down from usbmp:
kill the !USE_USE_SOFTINTR code.
2012-03-06 02:49:02 +00:00
matt
09db588a4e Add preliminary support for Embedded Transaction Translator Function (as
found on the MPC8536 and AR9334) which allows low/full devices to be
connected to an EHCI root hub.
2011-01-18 08:29:24 +00:00
kiyohara
992efa8a89 Add vendor dependent functions.
sc_vendor_init()/sc_vendor_port_status().
2010-10-16 05:23:41 +00:00
dyoung
c1b390d493 A pointer typedef entails trading too much flexibility to declare const
and non-const types, and the kernel uses both const and non-const
PMF qualifiers and device suspensors, so change the pmf_qual_t and
device_suspensor_t typedefs from "pointers to const" to non-pointer,
non-const types.
2010-02-24 22:37:54 +00:00
dyoung
cd6e1fbf91 Expand PMF_FN_* macros. 2010-01-08 19:53:10 +00:00
dyoung
786bda7e17 Expand <dev/usb/usb_port.h> definitions, and lightly unifdef(1). 2009-09-04 17:53:12 +00:00
jmcneill
b8aea8193c kern/39727: race condition in ehci isoc abort xfer path
From Jeremy Morse:

  * Serialize access to the ehci intrlist.
  * Change the ehci intrlist to a tailq so xfers are not queued out of order.
  * In ehci_check_itd_intr, don't treat a transfer error as an indication
    that the xfer is no longer active.
2008-10-14 18:12:38 +00:00
jmcneill
4e6a458107 High speed isochronous support, from Jeremy Morse as part of Google
Summer of Code 2008.
2008-08-02 22:23:18 +00:00
bouyer
efe8b350b3 Add appropriate bus_dmamap_sync() calls to uhci(4), ohci(4) and ehci(4),
as proposed on tech-kern@.
While all DMA memory used in the USB framework is mapped BUS_DMAMAP_COHERENT
(including data memory, which is memcpy'd from/to USB-private buffers),
the CPU can reorder loads or stores from/to main memory, causing the
controller to have an incoherent view of the DMA descriptors lists for a
short time. bus_dmamap_sync() should contain memory barriers that prevents
the CPU from reordering load/store. Note that BUS_DMAMAP_COHERENT is
still required for the DMA descriptor lists - these can't work properly
with software cache coherency.
This fixes "host controller process error/host controller halted" errors
I'm occasionally seeing with a umodem device on uhci on x86.
Thanks to Michael Lorenz for testing it on his O2, and Izumi Tsutsui on
his Cobalt Qube 2700.
2008-06-28 17:42:53 +00:00
martin
ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
drochner
fd0ded75ed split device/softc for USB host controllers and the usb (control)
device,
this is hairy stuff, and I've only tested with uhci/ehci at pci,
please test the rest and report problems
2008-03-28 17:14:45 +00:00
dyoung
9a0e417e90 Use device_t and accessors. Setup power management in the PCI
front-end (XXX needs to look more alike the Cardbus front-end).
Establish the shutdown hook using PMF.
2008-03-07 22:32:52 +00:00
dyoung
cd44c43b28 Add a method to detach child.
Cosmetic: use device_t and accessors.  Use aprint_*_dev().  Use
PMF_FN_{ARGS,CALL,PROTO}.
2008-02-22 23:04:52 +00:00
jmcneill
4c1d81b2b5 Merge jmcneill-pm branch. 2007-12-09 20:27:42 +00:00
ad
5a24480bf8 lockmgr -> mutex 2007-12-05 07:15:53 +00:00
drochner
bd2757a152 Remove the code which disables port status change interrupts for 1s
when one occured -- this makes that events get lost (or delayed until
the next change), in particular in the handover process from the EHCI
to a companion controller, laeving the port dead under some circumstances.
This fixes the "can't reconnect" symptom for me.
I don't see why the interrupt should be disabled - it is acknowledged
in the interrupt handler and shouldn't be active again until the next
status change.
2007-01-07 16:44:44 +00:00
xtraeme
e2aca22c8e From OpenBSD:
--
Add a workaround for VIA EHCI controllers which, under load, signal qTD
completion before they have performed writeback from the overlay qTD.

This condition would exhibit itself as a umass stall that never recovers.
--

This fixes the problem reported by Thomas Klausner on current-users@:
http://mail-index.netbsd.org/current-users/2006/01/17/0000.html
2006-01-17 12:30:00 +00:00
chs
0545b6e0cb changes for making DIAGNOSTIC not change the kernel ABI:
- for structure fields that are conditionally present,
   make those fields always present.
 - for functions which are conditionally inline, make them never inline.
 - remove some other functions which are conditionally defined but
   don't actually do anything anymore.
 - make a lock-debugging function conditional on only LOCKDEBUG.

as discussed on tech-kern some time back.
2005-12-27 04:06:45 +00:00
augustss
992297a008 Keep a flag for each port that keeps track of if the port has been reset
instead of having one flag for the controller.

Also, don't try to modify read-only power bits if the controller doesn't
support power cobntrol.
2005-11-20 14:27:25 +00:00
augustss
407c604a0e Minor cosmetic change. 2005-08-28 12:10:37 +00:00
augustss
17e2d8f05a Allow 32 chars in the saved vendor string. Fixes kern/29760. 2005-04-29 15:04:29 +00:00
augustss
35f6423e4f Add define for EHCI_MAX_POLLRATE. 2005-04-27 21:23:41 +00:00
imp
f2bd93408a Merge from FreeBSD:
sc_child is only used on NetBSD and OpenBSD, ifdef appropriately
FreeBSD revisions:
	ehcivar.h	1.8
	ohcivar.h	1.39
	uhicvar.h	1.39
2005-01-11 07:45:34 +00:00
fvdl
a3cea30b50 Implement an USB memory reserve. Allocate some memory per host controller
in the wanted bus_dma space. If an allocation fails during operation
(i.e. when hotplugging an umass device), fall back to using the reserve.

The amount can be configured as USB_MEM_RESERVE. The default value is
256k.

Ideally, there would be a way to steal pages in the desired area from
UVM, but that's far more complicated, and this is not intrusive, plus
it works.
2004-12-21 16:41:24 +00:00
augustss
2c051a4b85 Add interrupt transfers. From OpenBSD.
Having interrupt transfers enables some more device types to be used,
most notably USB2 hubs.  USB2 hubs still cannot handle anything but
USB2 devices, because there is node code to handle hub Transaction Translation
yet.
XXX This code doesn't do good bw scheduling, but it's certainly better than
nothing. :)
2004-10-22 10:38:17 +00:00
augustss
6f9df049df Insert from ifdefs for soft interrupt related stuff. From OpenBSD. 2004-10-22 09:58:00 +00:00
augustss
ab7b7be2f8 Add suspend/resume support.
From OpenBSD.
2004-10-21 11:18:21 +00:00
augustss
096f451f64 Change abort slightly.
Change debug output.
2001-12-31 12:16:57 +00:00
augustss
2d72c2726c Add some interrupt processing. 2001-11-21 12:28:23 +00:00
augustss
4f7b354305 Set up control xfers.
Handle xfer timeouts.
Better debug messages.
2001-11-21 02:44:30 +00:00
augustss
a598bed92e Simplify async list handling. 2001-11-20 13:49:23 +00:00
augustss
2db9b8d2c8 Start of pipe open routine. 2001-11-19 02:57:16 +00:00
augustss
0f70418027 Add more fields to hardware structs.
Add memory allocation for various data structures.
2001-11-18 00:39:46 +00:00
augustss
f73c358f8c Add some more data structure defs. 2001-11-16 15:33:13 +00:00
augustss
07ea2e28cb Recognize port status changes.
Hand over low and full speed devices to companion controller.
2001-11-16 01:57:08 +00:00
augustss
122d2863d8 Add root hub emulation. 2001-11-15 23:25:09 +00:00
augustss
1b0216af5c Add some register defines.
Print companion controllers.
2001-11-10 17:06:11 +00:00
augustss
c342a3beab Add some useful macros. 2001-11-06 03:16:17 +00:00
augustss
63fbac9a7d Add some placeholders for the EHCI (USB 2) driver.
Don't get your hopes up.  I've not even finished reading the
(100+) page spec, and I have no hardware.
2000-12-24 06:39:01 +00:00