History log of /src/sys/dev/usb/usbdivar.h |
Revision | | Date | Author | Comments |
1.139 |
| 31-Mar-2025 |
riastradh | usbdivar.h: Add missing usbdi.h include for usbd_status &c.
Sort includes while here.
Prompted by:
PR port-amd64/59180: System reboots instead of shutting down
|
1.138 |
| 04-Feb-2024 |
mrg | branches: 1.138.2; update my email address.
|
1.137 |
| 13-Mar-2022 |
riastradh | usb: Fix roothub ctrl xfer aborts.
No mechanism for actually aborting, but at least this now waits for the xfer to have completed instead of blithely barging ahead whether it's done or not.
|
1.136 |
| 13-Mar-2022 |
riastradh | usbdi(9): Assert no concurrent aborts on a single pipe.
It is a driver bug to try to abort a pipe at the same time in two different threads.
HCI drivers may release the bus lock to sleep in upm_abort while waiting for the hardware to acknowledge an abort, so it won't try to, e.g., scribble over a DMA buffer in the xfer that we've recycled after usbd_abort_pipe returns.
If this happens, a concurrent usbd_abort_pipe might try to apply upm_abort to the same xfer, which HCI drivers are not prepared for and may wreak havoc.
To avoid this, allow only one usbd_abort_pipe in flight at any given time.
|
1.135 |
| 09-Mar-2022 |
riastradh | usb: Provisionally release bus lock around ubm_rhctrl.
This isn't quite correct, but it avoids a deadlock:
- *_roothub_ctrl holds bus lock, waits in usb_delay_ms for kpause - softint waits for bus lock, holds up kpause wakeup
The deadlock is new since recent changes to hold the bus lock over upm_start/upm_transfer. Making this change regresses to other problems:
- *_suspend/resume and *_roothub_ctrl often touch the same portsc registers
- roothub_ctrl_abort needs to wait for ubm_rhctrl to complete.
When the bus lock was held across both, a noop served here, but we can't hold the bus lock across both, so that doesn't work.
However, these problems -- which we've had for a long time -- seem to be less bad than the deadlock. So let's avoid the deadlock for now and then work out another way to serialize suspend/resume/rhctrl and aborts.
Candidate fix for PR kern/56739.
|
1.134 |
| 03-Mar-2022 |
riastradh | usb: Hold pipe lock across upm_transfer and upm_start.
This simplifies the code and fixes races with abort. Access to the pipe's queue is now done exclusively while the pipe is locked.
|
1.133 |
| 03-Mar-2022 |
riastradh | usb: Update tables of bus/pipe method locking rules.
No functional change.
|
1.132 |
| 03-Mar-2022 |
riastradh | usb: Factor usb_insert_transfer out of upm_transfer and make private.
Almost every upm_transfer function starts with:
mutex_enter(&sc->sc_lock); err = usb_insert_transfer(xfer); mutex_exit(&sc->sc_lock); if (err) return err;
Some of them have debug messages sprinkled in here too, or assert that err == USBD_NORMAL_COMPLETION (alternative is USBD_IN_PROGRESS, only for pipes with up_running or up_serialise, presumably not applicable for these types of pipes). Some of them also assert xfer->ux_status == USBD_NOT_STARTED, which is guaranteed on entry and preserved by usb_insert_transer.
Exceptions:
- arch/mips/adm5120/dev/ahci.c ahci_device_isoc_transfer just returns USBD_NORMAL_COMPLETION, but I'm pretty sure this is and always has been broken anyway, so won't make anything worse (if anything, might make it better...)
- external/bsd/dwc2/dwc2.c dwc2_device_bulk_transfer and dwc2_device_isoc_transfer _also_ issue dwc2_device_start(xfer) under the lock. This is probably a better way to do it, but let's do it uniformly across all HCIs at once.
- rump/dev/lib/libugenhc/ugenhc.c rumpusb_device_bulk_transfer sometimes returns USBD_IN_PROGRESS _without_ queueing the transfer, in the !rump_threads case. Not really sure how this is supposed to work... If it actually breaks anything, we can figure it out.
|
1.131 |
| 14-Feb-2022 |
riastradh | usbdi(9): Add some missing header include guards.
|
1.130 |
| 07-Sep-2021 |
riastradh | usb(4): Fix xfer race between software abort and hardware completion.
This fixes a bug in the API contract of usbd_abort_pipe: with the change, the caller is guaranteed the xfer completion callbacks have returned; without the change, completion callbacks could still be running on the queued xfers while the caller of usbd_abort_pipe proceeds to concurrently issue usbd_destroy_xfer.
This also fixes the following problem for interrupt pipes, whose xfers stay on the queue until the pipe is aborted:
Thread 1: Hardware completion interrupt calls usb_transfer_complete. Thread 1: pipe->up_repeat is 1, so usb_transfer_complete keeps xfer queued. Thread 2: Calls usbd_abort_pipe (e.g., in detach). Thread 2: usbd_abort_pipe waits for bus lock. Thread 1: usb_transfer_complete releases bus lock to invoke callback. Thread 2: Sets pipe->up_repeat := 0 (too late for thread 1 to see). Thread 1: usb_transfer_complete waits to reacquire bus lock before resetting xfer status to USBD_NOT_STARTED. Thread 2: Repeatdly calls upm_abort on the same xfer, which does nothing because upm_abort just does usbd_abort_xfer which does nothing because the xfer status is (e.g.) USBD_IOERROR and not USBD_IN_PROGRESS.
Thread 2 is now spinning forever with the bus lock held (and possibly the kernel lock) waiting for queue or xfer status to change, which will never happen as long as it holds the bus lock.
The resolution is for thread 2 to notice that thread 1 is busy invoking a callback, and to wait until thread 1 has finished invoking the callback and updated the xfer status to reset it to USBD_NOT_STARTED at which point thread 1 can make progress again.
XXX pullup-9
|
1.129 |
| 02-Aug-2021 |
andvar | fix various typos in comments and log messages.
|
1.128 |
| 13-Jun-2021 |
riastradh | usb(4): Tighten interface locking and pipe references.
- Just use a reference count, not a list of pipes.
- Take the reference in usbd_open_pipe*, before we even look up the endpoint by address; the endpoint is not stable until we hold the interface and prevent usbd_set_interface.
- Make opening pipes just fail if usbd_set_interface is in progress. => No need to block -- might block for a while, and this is essentially a driver error rather than a legitimate reason to block. => This should maybe be a kassert, but it's not clear that ugen(4) doesn't have a user-triggerable path to that kassert, so let's keep it as a graceful failure for now until someone can audit ugen(4) and make an informed decision.
- No need for a separate interface pipe lock; just use the bus lock.
This is a little bit longer than before, but makes the bracketed nature of the references a little clearer and introduces more kasserts to detect mistakes with internal API usage.
|
1.127 |
| 12-Jun-2021 |
riastradh | usb(4): Nix unused struct usbd_interface::ui_priv.
|
1.126 |
| 12-Jun-2021 |
riastradh | usb(4): Fix races between usbd_open_pipe* and usbd_set_interface.
|
1.125 |
| 12-Jun-2021 |
riastradh | usb(4): Fix racy endpoint reference counting.
Rules:
1. After usbd_setup_pipe*, must usbd_kill_pipe. 2. After usbd_open_pipe*, must usbd_close_pipe.
Still haven't merged the logic in usbd_kill_pipe and usbd_close_pipe, but getting closer.
|
1.124 |
| 05-Jun-2020 |
maxv | branches: 1.124.6; Register eight vHCI buses, and use separate KCOV mailboxes for them.
|
1.123 |
| 15-May-2020 |
maxv | Introduce KCOV remote support. This allows to collect KCOV coverage on threads other than curlwp, which is useful when fuzzing components that defer processing, such as the network stack (partially runs in softints) and the USB stack (partially runs in uhub kthreads).
A subsystem that whishes to provide coverage for its threads creates a "mailbox" via kcov_remote_register() and gives it a (subsystem, id) identifier. There is one mailbox per "target lwp". The target lwp(s) must then call kcov_remote_enter() and kcov_remote_leave() with the identifier, to respectively enable and disable coverage within the thread.
On the userland side, the fuzzer has access to the mailboxes on the system with the KCOV_IOC_REMOTE_ATTACH and KCOV_IOC_REMOTE_DETACH ioctls. When attached to a mailbox with a given identifier, the KCOV_IOC_ENABLE, KCOV_IOC_DISABLE and mmap() operations will affect the mailbox.
As a demonstrator, the vHCI subsystem is changed to use KCOV mailboxes. When the vHCI bus attaches it creates as many mailboxes as it has USB ports, each mailbox being associated with a distinct port. Uhub is changed to enable KCOV coverage in usbd_new_device(). With that in place, all of the USB enumeration procedure can be traced with KCOV.
|
1.122 |
| 12-Feb-2020 |
riastradh | Factor out HCI-independent xfer completion logic.
New API for HCI drivers to synchronize hardware completion interrupts, synchronous aborts, and asynchronous timeouts:
- When submitting an xfer to hardware, call usbd_xfer_schedule_timeout(xfer).
- On HCI completion interrupt for xfer completion:
if (!usbd_xfer_trycomplete(xfer)) return; /* timed out or aborted, ignore it */
- In upm_abort methods, call usbd_xfer_abort(xfer).
For HCI drivers that use this API (not needed in drivers that don't, or for xfers like root intr xfers that don't use it):
- New ubm_abortx method serves role of former *hci_abort_xfer, but without any logic for wrangling timeouts/callouts/tasks -- caller in usbd_xfer_abort has already handled them.
- New ubm_dying method, returns true if the device is in the process of detaching, used by the timeout logic.
Converted and tested: - ehci - ohci
Converted and compile-tested: - ahci (XXX did this ever work?) - dwc2 - motg (XXX missing usbd_xfer_schedule_timeout in motg_*_start?) - uhci - xhci
Not changed:
- slhci (sys/dev/ic/sl811hs.c) -- doesn't use a separate per-xfer callout for timeouts (XXX but maybe should?)
- ugenhc (sys/rump/dev/lib/libugenhc/ugenhc.c) -- doesn't manage its own transfer timeouts
- vhci -- times transfers out only on detach; could be adapted easily if we wanted to use the xfer->ux_callout
|
1.121 |
| 12-Feb-2020 |
riastradh | New xfer state variables ux_timeout_set and ux_timeout_reset.
These are needed because:
- The host controller interrupt cannot wait for the callout or task to finish running.
- Nothing in the USBD API as is waits for the callout or task to finish running.
- Callers expect to be able to resubmit USB xfers from xfer callbacks without waiting for anything to finish running.
The variable ux_timeout_set can be used by a host controller to decide on submission whether to schedule the callout or to ask an already-scheduled callout or already-queued task to reschedule the callout, by setting the variable ux_timeout_reset to true.
When the callout or task runs and sees that ux_timeout_reset is true, rather than queue the task or abort the xfer, it can instead just schedule the callout anew.
|
1.120 |
| 08-Feb-2020 |
maxv | Move three functions into usbdi_util.c, where they belong. No functional change.
|
1.119 |
| 26-Sep-2019 |
christos | branches: 1.119.2; subdevlen is an array length, make it unsigned
|
1.118 |
| 27-Jan-2019 |
pgoyette | branches: 1.118.4; Merge the [pgoyette-compat] branch
|
1.117 |
| 09-Aug-2018 |
mrg | pull across abort fixes from nick-nhusb. add more abort fixes, using ideas from Taylor and Nick, and myself. special thanks to both who inspired much of the code here, if not wrote it directly.
among other problems, this assert should no longer trigger:
panic: kernel diagnostic assertion "xfer->ux_state == XFER_ONQU" failed: file "/current/src/sys/dev/usb/usbdi.c", line 914
using usbhist i was able to track down my instance of it being related to userland close() beginning, dropping the sc_lock, and then the usb softintr completes the transfer normally, and when it is done, the abort path attempts to re-complete the transfer, and the above assert is tripped.
changes from nhusb were commited with these logs: -- Move the struct usb_task to struct usbd_xfer for everyone to use. -- Set device transfer status to USBD_IN_PROGRESS if start methods succeeds -- Actually set the transfer status on transfers in ohci_abort_xfer and the controller is dying -- Don't supply the lock to callout_halt when polling as it won't be held -- Improve transfer abort -- Mark device transfers as USBD_IN_PROGRESS appropriately and improve abort handling -- #ifdef DIAGNOSTIC -> KASSERT and add another KASSERT -- Mark device transfers as USBD_IN_PROGRESS appropriately and improve abort handling --
additional changes include: - initialise the usb abort task in the HCI allocx routine, so that it can be safely usb_rem_task()'d. - rework the handling of softintr vs cancellation vs timeout abort based upon a scheme from Taylor: when completing a transfer normally: - if the status is not in progress, it must be cancelled or timed out, and we should not process this xfer. - set the status as normal. - unconditionallly callout_stop() and usb_rem_task(). they're safe and either aren't running, or will run and do nothing. - finally call usb_transfer_complete(). when aborting a transfer: - status should be cancelled or timed out. - if cancelling, callout_halt and usb_rem_task_wait() to make sure the timer is either done or cancelled. - at this point, the ux_status must not be cancelled or timed out, and if it is not in progress we're done. - set the status. - if the controller is dying, just return. - perform HCI-specific tasks to abort this xfer. - finally call usb_transfer_complete(). for the timeout and timeout task: - if the HCI is not dying, and the ux_status is in progress, then trigger the usb abort task. - remove UXFER_ABORTWAIT and UXFER_ABORTING.
tested on: - multiple PC systems with several types of devices: ugen/UPS, ucom, umass with disk, ssd and cdrom backends, kbd, ms, using uhci, ehci and xhci. - erlite3: sd@umass on dwc2. - sunblade2000: kbd/ms and umass disk on ohci.
untested: - motg, slhci and ahci. motg has some portion of the new scheme applied, but slhci and ahci require more study.
future work includes pushing a lot of the common abort handling into usbdi.c and leaving upm_abort() for HC specific tasks, but this change is pullup-able to netbsd-7 and netbsd-8 as it does not change any external API, as well as removing over 100 lines of code while adding over 30 new asserts.
XXX: pullup-7, pullup-8.
|
1.116 |
| 29-Jun-2018 |
msaitoh | Detect USB 3.1.
|
1.115 |
| 19-Apr-2018 |
christos | branches: 1.115.2; s/static inline/static __inline/g for consistency.
|
1.114 |
| 19-Jan-2017 |
skrll | branches: 1.114.6; 1.114.12; Pull across xhci(4) improvemnts from nick-nhusb
|
1.113 |
| 23-Apr-2016 |
skrll | branches: 1.113.2; 1.113.4; 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
|
1.112 |
| 16-Feb-2016 |
skrll | Re-enable the TT support that existed previously.
|
1.111 |
| 06-Jan-2016 |
skrll | Get the iManufacturer, iProduct, and iSerialNumber strings before probing for drivers and cache them for later use. This reduces bus transactions and fixes attachment for at least two of my umass(4)s.
|
1.110 |
| 23-Aug-2015 |
skrll | Expose usbd_xfer_isread
|
1.109 |
| 06-Sep-2014 |
skrll | branches: 1.109.2; Trailing whitespace.
|
1.108 |
| 12-Aug-2014 |
skrll | Some USB3 / SS support - baby steps. From Takahiro HAYASHI.
|
1.107 |
| 03-Oct-2013 |
skrll | branches: 1.107.4; Update a comment. Thanks mrg@
|
1.106 |
| 03-Oct-2013 |
skrll | Simply the code now that all (real) HCDs provide a get_lock method.
|
1.105 |
| 14-Sep-2013 |
jakllsch | Add work-in-progress xhci(4) driver code. Currently (mostly) supports interrupt-driven control, interrupt and bulk transfers at the three USB 2.0 speeds on root hub ports.
|
1.104 |
| 07-Sep-2013 |
skrll | Some lock comments.
|
1.103 |
| 24-Mar-2013 |
skrll | branches: 1.103.4; Add || defined(OHCI_DEBUG) to pick up usbd_dump_pipe
Fixes kern/47690
|
1.102 |
| 23-Jan-2013 |
skrll | Whitespace
|
1.101 |
| 22-Jan-2013 |
jmcneill | - Add a USBD_MPSAFE flag to usbd_open_pipe. If not set, acquire KERNEL_LOCK before invoking xfer callbacks on this pipe. - Add an extra flags parameter to usb_init_task. If USBD_TASKQ_MPSAFE is not present, acquire KERNEL_LOCK before invoking the task callback.
|
1.100 |
| 08-Jan-2013 |
skrll | Fix the IPL level of the HC lock in a comment.
|
1.99 |
| 11-Aug-2012 |
mrg | branches: 1.99.2; minor correction to some comments.
|
1.98 |
| 15-Jul-2012 |
mrg | commit my workaround for PR 46648 for now, as the more involved fix is not ready yet:
move the clear endpoint stall async call into the task thread, to avoid trying to call kmem_alloc() from a softint thread.
XXX ideally moving callbacks into the task thread (or perhaps a different high priority task thread) would be better than this workaround, once that method is working.
|
1.97 |
| 10-Jun-2012 |
mrg | 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.
|
1.96 |
| 11-Mar-2012 |
mrg | minor cleanups from usbmp: - move usbd_delay_ms() into usbdivar.h in the usb_subr.c section - minor rcsid fixes - copyright maintenence
|
1.95 |
| 11-Mar-2012 |
mrg | pull down from usbmp branch: - remove usbd_bus{} intr_context member, and replace the checks against it with cpu_intr_p() and cpu_softintr_p().
|
1.94 |
| 06-Mar-2012 |
mrg | pull down from usbmp branch:
- remove SPLUSBCHECK. it has been broken and disabled for ages.
|
1.93 |
| 27-May-2011 |
drochner | branches: 1.93.4; 1.93.8; remember the data toggle bit per (bulk) endpoint rather than per pipe, as required by the spec This helps in cases where pipes are opened/closed without reconfiguring the device in between, eg with the ugen driver. only for UHCI/EHCI, don't have an OHCI to test
|
1.92 |
| 20-Dec-2010 |
phx | branches: 1.92.2; usbd_dump_*() functions are also needed when just EHCI_DEBUG is defined, without USB_DEBUG.
|
1.91 |
| 12-Nov-2009 |
dyoung | branches: 1.91.4; Re-order operations in usb_detach() so that if a usb(4) instance's children will not detach, the instance is not left in an inconsistent state.
If uhub(4) port is disconnected, forcefully detach the children on that port.
Simplify detachment hooks. (sc_dying must die!)
Pass along and respect detachment flags, esp. DETACH_FORCE, throughout.
|
1.90 |
| 12-Nov-2009 |
uebayasi | Indent.
|
1.89 |
| 04-Sep-2009 |
dyoung | Expand <dev/usb/usb_port.h> definitions, and lightly unifdef(1).
|
1.88 |
| 18-Aug-2008 |
kent | branches: 1.88.12; Implement uhub_rescan(). After this change, "modload uaudio.kmod" configures an audio device correctly for a device which is already plugged.
* usb_subr.c Add locators parameter to usbd_attachinterfaces() Add usbd_reatach_device()
* usbdivar.h Export usbd_reatach_device()
|
1.87 |
| 28-Jul-2008 |
drochner | -in usbd_probe_and_attach(), split out the code for per-device and per-interface attachment into individual functions, to ease maintainance and allow easier plugin of new attachment functions -keep a counter of USB interfaces in use on a device, and try to keep track of interfaces claimed by drivers behind the framework's back
|
1.86 |
| 26-May-2008 |
drochner | branches: 1.86.2; 1.86.4; some cleanup: -unifdef -since the roothub attach doesn't use locators, don't call config_stdsubmatch() -- it is a no-op in that case -ifsubmatch has configuration and interface always set to useful values, remove unnecessary checks -remove now unused locator definitions from shared header
|
1.85 |
| 25-May-2008 |
drochner | -make the list of USB child devices a (possibly sparse) array rather than a zero-terminated list; this makes the code simpler and also hopefully fixes the recent "childdet" botch, see PR kern/38528 -handle the root hub specially a bit earlier, this allows to kick out the "submatch" functions completely which needed to second-guess from the port number (where "0" meant root hub") (we could handle the root hub specially even earlier, but as done now big parts of the hub emulation code are exercised regularely, this would bitrot otherwise)
|
1.84 |
| 28-Apr-2008 |
martin | branches: 1.84.2; Remove clause 3 and 4 from TNF licenses
|
1.83 |
| 28-Mar-2008 |
drochner | branches: 1.83.2; 1.83.4; 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
|
1.82 |
| 18-Feb-2008 |
dyoung | branches: 1.82.6; Use device_t and its accessor functions.
Register _childdetached methods with drivers that attach children. Wait to set child references to NULL there, instead of doing that in the detach method.
Replace many uses of USB_DECLARE_DRIVER() with CFATTACH_DECL2().
|
1.81 |
| 09-Jul-2007 |
ad | branches: 1.81.8; 1.81.14; Merge some of the less invasive changes from the vmlocking branch:
- kthread, callout, devsw API changes - select()/poll() improvements - miscellaneous MT safety improvements
|
1.80 |
| 26-Feb-2007 |
drochner | branches: 1.80.4; 1.80.6; 1.80.12; allow the bus/pipes methods tables to be const
|
1.79 |
| 01-Dec-2006 |
drochner | branches: 1.79.4; -comment out transaction translator support for now, it doesn't do more than allocating memory, and it does wrongly use the hub's capabilities but not the actual setting -switch a high-speed hub to "multiple TTs" but ignore errors; since we don't care whether there is one or multiple this is a "best effort" thing
|
1.78 |
| 24-Oct-2006 |
drochner | clean up the USB attachment stuff a bit: use a dedicated interface attribute ("usbdevif") to attach USB devices, be it a plain device or a hub, and remove some strangeness caused by the former usb/uhub mess
|
1.77 |
| 27-Dec-2005 |
chs | branches: 1.77.20; 1.77.22; 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.
|
1.76 |
| 24-Dec-2005 |
perry | Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
|
1.75 |
| 11-Dec-2005 |
christos | merge ktrace-lwp.
|
1.74 |
| 30-Apr-2005 |
augustss | branches: 1.74.2; Fix a race condition in xfer abort. Derived from a FreeBSD patch.
An xfer could be aborted twice (which means that the second abort might access deallocated memory). This happened when an xfer timed out and the timeout started an abort. While that abort was taking place the xfer could be cancelled (usually by closing the pipe), causing a second abort to begin. This is now handled by having flags indicating the abort state of an xfer.
Hopefully this will fix the occasional crashes when printing.
|
1.73 |
| 24-Jan-2005 |
joff | branches: 1.73.6; 1.73.8; Implementation requirements of usb_needs_reattach(), from OpenBSD and required for atu(4) to do a USB reconnect after firmware upload.
|
1.72 |
| 23-Oct-2004 |
augustss | branches: 1.72.4; Keep track of what high speed port (if any) a device belongs to so we can set the transaction translator fields for the transfer. Add a gross hack for split transaction completion in the ehci driver that allows control transfers to be translated. Interrupt transfers do not work. Warn when any low/full speed device is opened.
|
1.71 |
| 23-Apr-2004 |
itojun | use bounded string ops (snprintf, strl*)
|
1.70 |
| 11-Jul-2002 |
augustss | branches: 1.70.6; Get rid of trailing white space.
|
1.69 |
| 27-Dec-2001 |
augustss | branches: 1.69.8; Change some DIAGNOSTIC #defines.
|
1.68 |
| 24-Dec-2001 |
augustss | Add some more DIAGNOSTIC tests. Make usb_match_device() match on USB_PRODUCT_ANY.
|
1.67 |
| 21-Nov-2001 |
augustss | Wrap dump routine prototypes in #ifdef USB_DEBUG
|
1.66 |
| 20-Nov-2001 |
augustss | Keep track of device speed for USB 2.0.
|
1.65 |
| 10-Nov-2001 |
augustss | Get rid of unused abort_handle.
|
1.64 |
| 10-Nov-2001 |
augustss | Add some dump routines for debugging.
|
1.63 |
| 21-Jan-2001 |
augustss | branches: 1.63.2; 1.63.4; 1.63.8; Change the operation of the USB event thread. Before it only performed USB device discovery, now it can also perform (short) tasks for device drivers that need a process context, but don't have one. This is not pretty, but better than using busy-wait in an interrupt context.
|
1.62 |
| 21-Jan-2001 |
augustss | Add code to use soft interrupt to handle USB interrupt processing. Don't enable the code since it doesn't work with the kludgy Ethernet drivers.
|
1.61 |
| 18-Jan-2001 |
jdolecek | constify
|
1.60 |
| 28-Dec-2000 |
augustss | #define for USB_2_0
|
1.59 |
| 13-Dec-2000 |
augustss | Don't try to access a device that is being disconnected when generating the detach event. Fixes (I hope) PR 11713 from itohy@netbsd.org (ITOH Yasufumi).
|
1.58 |
| 24-Jun-2000 |
thorpej | Kill SPLUSBCHECK -- it's not portable, and quite annoying on some platforms which otherwise function just fine.
|
1.57 |
| 01-Jun-2000 |
augustss | branches: 1.57.2; Bring the coding style into the 80s, i.e., get rid of __P and use ANSI prototypes and declarations.
|
1.56 |
| 27-Apr-2000 |
augustss | branches: 1.56.2; Change my email address.
|
1.55 |
| 30-Mar-2000 |
augustss | Afew more OpenBSD portability fixes.
|
1.54 |
| 29-Mar-2000 |
simonb | Remove redundant decl of cold - it's in <sys/kernel.h>.
|
1.53 |
| 29-Mar-2000 |
augustss | Do not accept new xfers for queuing while a pipe is aborting.
|
1.52 |
| 25-Mar-2000 |
augustss | Rename and move around callout handles to make it more sane. Add some DIAGNOSTIC. Fix buglet in isoc abort on UHCI.
|
1.51 |
| 25-Mar-2000 |
augustss | More DIAGNOSTIC. Initialize a callout handle I forgot.
|
1.50 |
| 25-Mar-2000 |
augustss | GC an unsued field and add some DIAGNOSTIC in xfer.
|
1.49 |
| 24-Mar-2000 |
augustss | Some cleanup and renaming of the callouts used in USB drivers.
|
1.48 |
| 23-Mar-2000 |
thorpej | New callout mechanism with two major improvements over the old timeout()/untimeout() API: - Clients supply callout handle storage, thus eliminating problems of resource allocation. - Insertion and removal of callouts is constant time, important as this facility is used quite a lot in the kernel.
The old timeout()/untimeout() API has been removed from the kernel.
|
1.47 |
| 22-Feb-2000 |
augustss | Prepare a little for having USB interrupt processing done outside the hard interrupt level (in a thread or a softintr). No real soft processing done yet.
|
1.46 |
| 19-Jan-2000 |
augustss | Fix typos. Never, never, never commit without compiling first.
|
1.45 |
| 19-Jan-2000 |
augustss | Add an argument to usbd_open_pipe_intr() to specify the polling interval for an interrupt pipe in case we don't what what the descriptor suggests.
|
1.44 |
| 18-Jan-2000 |
augustss | Turn xfer allocation into a method in the HC driver. The reason is that an HC driver may want to subclass the xfer to have additional private fields.
|
1.43 |
| 16-Jan-2000 |
augustss | Add comments.
|
1.42 |
| 20-Nov-1999 |
augustss | Propagate the USB revision number to the usb driver.
|
1.41 |
| 18-Nov-1999 |
augustss | Cosmetic changes and some small improvements. From FreeBSD and Nick Hibma.
|
1.40 |
| 12-Nov-1999 |
augustss | A number of stylistic changes to increase readability (many suggested by Nick Hibma): use NULL not 0 declare all local definitions static rename s/usbd_request/usbd_xfer/ s/reqh/xfer/ rename s/r/err/ use implicit test for no err KNF
|
1.39 |
| 10-Nov-1999 |
mycroft | branches: 1.39.2; Fix an obvious bug is some diagnostic code; we must lower our spl again...
|
1.38 |
| 25-Oct-1999 |
augustss | Make the SPLUSBCHECK diagnostic test silent durning cold boot.
|
1.37 |
| 12-Oct-1999 |
augustss | branches: 1.37.2; 1.37.4; Fix some bugs in USB controller detach code.
|
1.36 |
| 12-Oct-1999 |
augustss | Add an event mechanism so that a userland process can watch devices come and go.
|
1.35 |
| 15-Sep-1999 |
augustss | branches: 1.35.2; Change SPLUSBCHECK diagnostic macro a little.
|
1.34 |
| 15-Sep-1999 |
augustss | Add preliminary (untested) code for detaching the USB host controller (needed for CardBus based controllers).
|
1.33 |
| 13-Sep-1999 |
augustss | * Make sure an aborted pipe is marked as not running. * Start queued request in the right order. * Insert some more DIAGNOSTIC sanity checks.
|
1.32 |
| 13-Sep-1999 |
augustss | Make sure timeouts count as interrupt context too.
|
1.31 |
| 13-Sep-1999 |
augustss | Rearrange the code a little so we can decide if we are in process or interrupt context in a reliable way. Mainly used for DIAGNOSTIC.
|
1.30 |
| 11-Sep-1999 |
augustss | * Move DMA buffer allocation to HC independent code. * Remove (almost) unused definitions USBD_XFER_OUT and USBD_XFER_IN.
|
1.29 |
| 09-Sep-1999 |
augustss | Change the internal API to allow DMA buffers to be pre-allocated by the device driver instead of happening automagically in the HC driver. This affects both the HC-USBD interface as well as the USBD-device interface. This change will allow DMA buffers to be reused e.g. in isochronous traffic.
Add isochronous support to the UHCI driver (not for OHCI yet).
|
1.28 |
| 05-Sep-1999 |
augustss | Change the way the `struct device' base part of all driver softc are declared and accessed to make it more portable. Idea from Nick Hibma, FreeBSD. No functional changes.
|
1.27 |
| 29-Aug-1999 |
thorpej | Since we poll around the `done' member of a usbd_request, make it volatile.
|
1.26 |
| 28-Aug-1999 |
augustss | Change some 'struct device' to 'bdevice'. From FreeBSD.
|
1.25 |
| 22-Aug-1999 |
augustss | Move more of the transfer completion processing to HC independent code. Fix some problems with transfer abort & timeout.
|
1.24 |
| 17-Aug-1999 |
augustss | Redo the UHCI data toggle handling. Make sure data toggles get synchronized on open and when clearing an endpoint stall.
|
1.23 |
| 17-Aug-1999 |
augustss | Make some small changes to make it compile on OpenBSD.
|
1.22 |
| 30-Jun-1999 |
augustss | Totally redo the way device detach is done. It now uses a kernel event thread and the config detach method. Squish a number of space leaks on detach.
|
1.21 |
| 14-Jun-1999 |
augustss | Get rid of a bunch of code that was part of an old USBDI proposal, but that is unused in our USB stack.
Once upon a time, when I started writing the USB stack for NetBSD, there was an effort to make a standard for how USB device drivers should interact with the rest of the USB stack. This effort had contributors from just about all Un*x camps (but not Micro$oft :). I based my design on one of their early proposals since I thought it would be a good idea if we could all share device drivers with a minimum effort. Shortly after I started my work all the free Un*x people were thrown out of the USBDI work since we did not pay the USB membership fee. Well, some time has passed now and the work of the standardization group is almost public again. But alas, the new standard has grown to be a monster! I do not want to have this as the basis for the *BSD USB stack; it is far too complicated. So, since we are not even close to being compilant with the standard, I've thrown out some old baggage.
|
1.20 |
| 16-May-1999 |
augustss | Add vendor/product/release locators. Added in frustration as my HID devices appeared as different devices after some plugging and unplugging. :-)
|
1.19 |
| 13-May-1999 |
thorpej | Rework the way ukbd attaches itself as the console (again). We now allow the code to pick the first USB keyboard instance as the console, ignoring which USB controller it's on. Should eventually allow detaching of the console keyboard.
From Jason Thorpe <thorpej@nas.nasa.gov>
|
1.18 |
| 06-May-1999 |
thorpej | Add a way for machine-dependent code to tell a USB controller that it has the console input device. The USB keyboard driver uses this to attach the first USB keyboard instance as the console keyboard.
Unfortunately, this must still be deferred to autoconfiguration time, but there's not much we can do about that right now.
|
1.17 |
| 10-Jan-1999 |
augustss | branches: 1.17.2; Some minor updates from FreeBSD.
|
1.16 |
| 08-Jan-1999 |
augustss | Various little fixes from the FreeBSD version.
|
1.15 |
| 07-Jan-1999 |
augustss | Fix some FreeBSD compiler warnings.
|
1.14 |
| 30-Dec-1998 |
augustss | Split usbd_delay_ms() into two functions, one can be used in device drivers.
|
1.13 |
| 29-Dec-1998 |
augustss | Do not blindly assume that a device supports language id 0, instead ask it what languages it supports.
|
1.12 |
| 28-Dec-1998 |
augustss | Change the host controller internal API a little and add some incomplete support for isochronous transfers.
|
1.11 |
| 26-Dec-1998 |
augustss | Merge changes to make the USB stack work with FreeBSD. The original diffs from Nick Hibma <n_hibma@freebsd.org>, but with substantial changes from me. XXX Not tested on FreeBSD yet.
|
1.10 |
| 09-Dec-1998 |
augustss | Improvement to the ugen driver. Better error checking. Some code rearrengment.
|
1.9 |
| 02-Dec-1998 |
augustss | Add configuration and interface locators.
|
1.8 |
| 25-Nov-1998 |
augustss | Make the copyright header conform to the NetBSD template.
|
1.7 |
| 02-Aug-1998 |
augustss | Improve some error messages. Make some preparations for isochronous transfers.
|
1.6 |
| 01-Aug-1998 |
augustss | Switch from a global flag to tell if the host controller should use polling to a local one for each controller.
|
1.5 |
| 26-Jul-1998 |
augustss | A first stab att supporting console access with a USB keyboard.
|
1.4 |
| 25-Jul-1998 |
augustss | Add an ioctl() to get host controller statistics.
|
1.3 |
| 24-Jul-1998 |
augustss | Make sure requests are aborted properly when the pipe is aborted.
|
1.2 |
| 22-Jul-1998 |
augustss | Loop over all configurations when trying to probe for interface drivers.
|
1.1 |
| 12-Jul-1998 |
augustss | Add USB support. Supported so far: * UHCI and OHCI host controllers on PCI * Hubs * HID devices withe special drivers for mouse and keyboard * Printers
|
1.17.2.1 |
| 06-May-1999 |
perry | branches: 1.17.2.1.2; pullup 1.17->1.18 (thorpej)
|
1.17.2.1.2.2 |
| 01-Jul-1999 |
thorpej | Sync w/ -current.
|
1.17.2.1.2.1 |
| 21-Jun-1999 |
thorpej | Sync w/ -current.
|
1.35.2.1 |
| 27-Dec-1999 |
wrstuden | Pull up to last week's -current.
|
1.37.4.1 |
| 15-Nov-1999 |
fvdl | Sync with -current
|
1.37.2.4 |
| 11-Feb-2001 |
bouyer | Sync with HEAD.
|
1.37.2.3 |
| 05-Jan-2001 |
bouyer | Sync with HEAD
|
1.37.2.2 |
| 13-Dec-2000 |
bouyer | Sync with HEAD (for UBC fixes).
|
1.37.2.1 |
| 20-Nov-2000 |
bouyer | Update thorpej_scsipi to -current as of a month ago A i386 GENERIC kernel compiles without the siop, ahc and bha drivers (will be updated later). i386 IDE/ATAPI and ncr work, as well as sparc/esp_sbus. alpha should work as well (untested yet). siop, ahc and bha will be updated once I've updated the branch to current -current, as well as machine-dependant code.
|
1.39.2.2 |
| 10-Nov-1999 |
mycroft | Fix an obvious bug is some diagnostic code; we must lower our spl again...
|
1.39.2.1 |
| 10-Nov-1999 |
mycroft | file usbdivar.h was added on branch comdex-fall-1999 on 1999-11-10 04:20:00 +0000
|
1.56.2.1 |
| 22-Jun-2000 |
minoura | Sync w/ netbsd-1-5-base.
|
1.57.2.1 |
| 27-Jun-2000 |
thorpej | Pull up rev. 1.58: Kill SPLUSBCHECK -- it's not portable, and quite annoying on some platforms which otherwise function just fine.
|
1.63.8.1 |
| 12-Nov-2001 |
thorpej | Sync the thorpej-mips-cache branch with -current.
|
1.63.4.2 |
| 06-Sep-2002 |
jdolecek | sync kqueue branch with HEAD
|
1.63.4.1 |
| 10-Jan-2002 |
thorpej | Sync kqueue branch with -current.
|
1.63.2.3 |
| 01-Aug-2002 |
nathanw | Catch up to -current.
|
1.63.2.2 |
| 08-Jan-2002 |
nathanw | Catch up to -current.
|
1.63.2.1 |
| 14-Nov-2001 |
nathanw | Catch up to -current.
|
1.69.8.1 |
| 15-Jul-2002 |
gehenna | catch up with -current.
|
1.70.6.6 |
| 10-Nov-2005 |
skrll | Sync with HEAD. Here we go again...
|
1.70.6.5 |
| 24-Jan-2005 |
skrll | Sync with HEAD.
|
1.70.6.4 |
| 02-Nov-2004 |
skrll | Sync with HEAD.
|
1.70.6.3 |
| 21-Sep-2004 |
skrll | Fix the sync with head I botched.
|
1.70.6.2 |
| 18-Sep-2004 |
skrll | Sync with HEAD.
|
1.70.6.1 |
| 03-Aug-2004 |
skrll | Sync with HEAD
|
1.72.4.1 |
| 29-Apr-2005 |
kent | sync with -current
|
1.73.8.1 |
| 11-Aug-2006 |
riz | Pull up following revision(s) (requested by abs in ticket #1459): sys/dev/usb/ehci.c: revision 1.96 sys/dev/usb/uhci.c: revision 1.188 sys/dev/usb/ohci.c: revision 1.159 sys/dev/usb/usbdivar.h: revision 1.74 Fix a race condition in xfer abort. Derived from a FreeBSD patch. An xfer could be aborted twice (which means that the second abort might access deallocated memory). This happened when an xfer timed out and the timeout started an abort. While that abort was taking place the xfer could be cancelled (usually by closing the pipe), causing a second abort to begin. This is now handled by having flags indicating the abort state of an xfer. Hopefully this will fix the occasional crashes when printing.
|
1.73.6.1 |
| 11-Aug-2006 |
riz | Pull up following revision(s) (requested by abs in ticket #1459): sys/dev/usb/ehci.c: revision 1.96 sys/dev/usb/uhci.c: revision 1.188 sys/dev/usb/ohci.c: revision 1.159 sys/dev/usb/usbdivar.h: revision 1.74 Fix a race condition in xfer abort. Derived from a FreeBSD patch. An xfer could be aborted twice (which means that the second abort might access deallocated memory). This happened when an xfer timed out and the timeout started an abort. While that abort was taking place the xfer could be cancelled (usually by closing the pipe), causing a second abort to begin. This is now handled by having flags indicating the abort state of an xfer. Hopefully this will fix the occasional crashes when printing.
|
1.74.2.4 |
| 27-Feb-2008 |
yamt | sync with head.
|
1.74.2.3 |
| 03-Sep-2007 |
yamt | sync with head.
|
1.74.2.2 |
| 30-Dec-2006 |
yamt | sync with head.
|
1.74.2.1 |
| 21-Jun-2006 |
yamt | sync with head.
|
1.77.22.1 |
| 10-Dec-2006 |
yamt | sync with head.
|
1.77.20.2 |
| 12-Jan-2007 |
ad | Sync with head.
|
1.77.20.1 |
| 18-Nov-2006 |
ad | Sync with head.
|
1.79.4.1 |
| 27-Feb-2007 |
yamt | - sync with head. - move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
|
1.80.12.5 |
| 12-Nov-2009 |
uebayasi | Sort members in struct usbd_bus_methods. Comments.
|
1.80.12.4 |
| 21-May-2008 |
itohy | Hold mbuf chain in struct usbd_xfer.
|
1.80.12.3 |
| 22-Jun-2007 |
itohy | - Introduce USBD_CALLBACK_AS_TASK flag, which causes the callback function is called as a USB_TASKQ_DRIVER task, with thread context. This makes sharing Ethernet drivers with FreeBSD (that requires context for some network-related code) much easier. The flag is not used by NetBSD/OpenBSD for now.
- Rename xfer->async_task as xfer->task, now used by both async xfer and the callback above.
- Use 0 as idle task queue ID (definition USB_TASKQ_IDLE added), and increase USB_TASKQ_HC and USB_TASKQ_DRIVER accordingly. This makes passing zero-initialized (but not initialized by usb_init_task()) usb_task to usb_rem_task() be ignored, rather than panic the system.
|
1.80.12.2 |
| 31-May-2007 |
itohy | usbdi(9): Change usbd_map_buffer_mbuf to return the result, since mbuf(9) chain may be fragmented and mapping failure will happen. -void usbd_map_buffer_mbuf(usbd_xfer_handle xfer, struct mbuf *chain) +usbd_status usbd_map_buffer_mbuf(usbd_xfer_handle xfer, struct mbuf *chain)
usbdi(9): Add more diagnostic assertions. uhci(4): fix aux dma for mbuf mapping. slhci(4): fix repeated interrupt transfer (not tested). ehci/slhci/ohci/uhci: Add checks where mbuf(4) transfer is not supported.
usb_port.h: Add some compat macros for FreeBSD. usb_mem_nodma.c: Fix typos.
|
1.80.12.1 |
| 22-May-2007 |
itohy | Overhaul of USB stack, mostly DMA related
This applies to NetBSD 4.99.13 (March 1, 2007)
usbdi(9) interface is based on FreeBSD version, excluding - removal of portability code
Patch most NetBSD changes, excluding - DMA memory "reserve", since we don't need contiguous buffers any longer - volatiles in DMA structure, since it should not be needed with proper bus_dmamap_sync(9)s
DMA/non-DMA memory management overhaul - Move all DMA related code to usb_mem.[ch] (add usb_alloc_buffer_dma(), usb_free_buffer_dma(), etc.). XXX Should usb_mem.[ch] be renamed as usb_mem_dma.[ch] ? - Add corresponding non-DMA code to usb_mem_nodma.[ch] . Currently just use malloc(9). - Above files are conditionally used by config framework (added attributes to conf/files and dev/usb/files.usb). - Add diagnostic panics when resource allocation is requested on interrupt context. - Change memory allocations (that require context) from NOWAIT to WAITOK.
Allocate DMA/non-DMA buffer per host interface, not globally. advantage: Buffers can be freed on detaching host interface. Activity of a host interface does not affect others. disadvantages: It possibly consumes more memory.
API changes - usbd_alloc_xfer() is changed: old: usbd_xfer_handle usbd_alloc_xfer(usbd_device_handle dev); new: usbd_xfer_handle usbd_alloc_xfer(usbd_device_handle dev, usbd_pipe_handle pipe); - pipe argument of usbd_setup_*xfer() are now unused XXX the pipe argument should be removed? - add mapping APIs - async request will be processed as a task (kernel thread context), and delayed to some extent - usbdivar.h: struct usbd_xfer: renamed a member "allocbuf" to "hcbuffer" (mapped/allocated/refered buffer for HCI driver) - usb_port.h: change usb_proc_ptr from struct ptoc * to struct lwp * - usb_port.h: add usb_sigproc_ptr for psignal(9) (struct proc *) - usb.h: add UE_MAXPKTSZ(ep) and UE_MAXPKTSZ_MASK macros for USB 2.0
changes to USB device drivers - atu, aue, axe, cdce, cue, kue, rum, udav, upl, ural, url, uaudio, ubt, ucom, ugen, uhidev, uirda, ulpt, umidi, urio, uscanner, ustir, utoppy: * catch up API change of usbd_alloc_xfer() - umass, usscanner: * catch up API change of usbd_alloc_xfer() * eliminate memory copy for large transfer
ohci - free resources on detach - add lots of bus_dmamap_sync() operations - simplify the code of loading std chain - rewrite code of looking up TD/ITD from DMA addr by using allocation chunk - add workaround for CMD Tech 670 and 673 chipsets - make sure resources are not allocated in interrupt context - add support for mapping buffer and mbuf
slhci - allocate xfer and slhci_xfer at once, and simplify relevant code - add slhci_detach() - remove second arg of slhci_attach() since it is the same as the first arg. - add support for "mapping" (no, it doesn't map since it doesn't do DMA) buffer and mbuf - add pcmcia frontend - NOT TESTED, missing hardware
ehci - add lots of bus_dmamap_sync() operations, possibly too many - make sure resources are not allocated in interrupt context - add support for mapping buffer and mbuf - done only simple test
uhci - add lots of bus_dmamap_sync() operations, possibly too many - make sure resources are not allocated in interrupt context - add support for mapping buffer and mbuf
To do - review, test, debug - rewrite network drivers to utilize usbd_map_buffer_mbuf() - rewrite uaudio(4) to eliminate memcpy - "pipe" argument of usbd_setup_*xfer() should eventually be removed
|
1.80.6.1 |
| 11-Jul-2007 |
mjf | Sync with head.
|
1.80.4.1 |
| 01-Jul-2007 |
ad | Adapt to callout API change.
|
1.81.14.1 |
| 18-Feb-2008 |
mjf | Sync with HEAD.
|
1.81.8.1 |
| 23-Mar-2008 |
matt | sync with HEAD
|
1.82.6.3 |
| 28-Sep-2008 |
mjf | Sync with HEAD.
|
1.82.6.2 |
| 02-Jun-2008 |
mjf | Sync with HEAD.
|
1.82.6.1 |
| 03-Apr-2008 |
mjf | Sync with HEAD.
|
1.83.4.4 |
| 11-Mar-2010 |
yamt | sync with head
|
1.83.4.3 |
| 16-Sep-2009 |
yamt | sync with head
|
1.83.4.2 |
| 04-May-2009 |
yamt | sync with head.
|
1.83.4.1 |
| 16-May-2008 |
yamt | sync with head.
|
1.83.2.2 |
| 04-Jun-2008 |
yamt | sync with head
|
1.83.2.1 |
| 18-May-2008 |
yamt | sync with head.
|
1.84.2.2 |
| 18-Sep-2008 |
wrstuden | Sync with wrstuden-revivesa-base-2.
|
1.84.2.1 |
| 23-Jun-2008 |
wrstuden | Sync w/ -current. 34 merge conflicts to follow.
|
1.86.4.1 |
| 19-Oct-2008 |
haad | Sync with HEAD.
|
1.86.2.1 |
| 31-Jul-2008 |
simonb | Sync with head.
|
1.88.12.1 |
| 05-Nov-2013 |
matt | Pull down xhci support from HEAD
|
1.91.4.2 |
| 31-May-2011 |
rmind | sync with head
|
1.91.4.1 |
| 05-Mar-2011 |
rmind | sync with head
|
1.92.2.1 |
| 06-Jun-2011 |
jruoho | Sync with HEAD.
|
1.93.8.13 |
| 11-Mar-2012 |
mrg | sync to latest -current
|
1.93.8.12 |
| 06-Mar-2012 |
mrg | sync to -current
|
1.93.8.11 |
| 26-Feb-2012 |
mrg | use kpause() in usb{d,}_delay_ms(), and add a version that takes a mutex
|
1.93.8.10 |
| 25-Feb-2012 |
mrg | replace the (diagnostic-only) intr_context with checks against LP_INTR and cpu_intr_p().
XXX: there's one check that changes behaviour
|
1.93.8.9 |
| 25-Feb-2012 |
mrg | copyright maintenence.
|
1.93.8.8 |
| 23-Feb-2012 |
mrg | update a bunch of comments for reality. usb lock isn't a "thread lock", which is terminology we copied from the audiomp code.
|
1.93.8.7 |
| 20-Feb-2012 |
mrg | expand a command slightly
|
1.93.8.6 |
| 20-Feb-2012 |
mrg | remove the intr_lock from the mp usb api, it wasn't used.
|
1.93.8.5 |
| 20-Feb-2012 |
mrg | several changes to the MP usb apis, and other misc changes:
- usb_transfer_complete()/usb_insert_transfer()/usb_start_next() all must have the thread lock held
- (*soft_intr) now is called with the thread lock held unless we are in polling mode. add a usb_soft_intr() to deal with this
- XXX usbd_set_polling() api exists to increase/decrease the polling count, but only ukbd uses. everyone else open codes it, but this should probably be changed
- (*abort) is now called with the thread lock held
- update several comments to not refer to splusb() anymore
- add many more asserts
- use more c99 struct initialisers
|
1.93.8.4 |
| 09-Dec-2011 |
mrg | - make pipe->close method take the thread lock
- convert usb_taskq to use mutex/cv
- convert needs_explore usage into a cv on the thread lock
- remove KERNEL_*LOCK from uaudio and umidi, since we're supposedly MPSAFE here now
- use IPL_SCHED instead of IPL_USB (aka biglocked) interrupts
- drop the audio thread lock when calling into usb when it may sleep, avoiding a deadlock between audiowrite and audioioctl. this fixes mixerctl -a vs. playing hanging the system XXX probably need to check this in a bunch more places.
|
1.93.8.3 |
| 08-Dec-2011 |
mrg | make ohci mostly work again.
|
1.93.8.2 |
| 08-Dec-2011 |
mrg | - convert usbd_bus_methods{} and usbd_pipe_methods{} to use c99 struct initialisers
- move the locks from the pipe to the bus, since we'll need access to them from bus-level ops
- remove dead-for-years SPLUSBCHECK and replaced it with asserts that the thread lock is held
- begin to document the locking scheme
- convert usbd_*lock_pipe() into real function-like macros
|
1.93.8.1 |
| 04-Dec-2011 |
jmcneill | branches: 1.93.8.1.2; Make ehci mpsafe.
|
1.93.8.1.2.3 |
| 08-Dec-2011 |
mrg | sync usb_subr.c and usbdivar.h with the branch entirely, and most of usbdi.c as well.
|
1.93.8.1.2.2 |
| 08-Dec-2011 |
mrg | merge a few more changes from the main branch.
|
1.93.8.1.2.1 |
| 08-Dec-2011 |
mrg | merge a few more things from the main branch. uaudio@ohci still works.
|
1.93.4.4 |
| 22-May-2014 |
yamt | sync with head.
for a reference, the tree before this commit was tagged as yamt-pagecache-tag8.
this commit was splitted into small chunks to avoid a limitation of cvs. ("Protocol error: too many arguments")
|
1.93.4.3 |
| 23-Jan-2013 |
yamt | sync with head
|
1.93.4.2 |
| 30-Oct-2012 |
yamt | sync with head
|
1.93.4.1 |
| 17-Apr-2012 |
yamt | sync with head
|
1.99.2.4 |
| 03-Dec-2017 |
jdolecek | update from HEAD
|
1.99.2.3 |
| 20-Aug-2014 |
tls | Rebase to HEAD as of a few days ago.
|
1.99.2.2 |
| 23-Jun-2013 |
tls | resync from head
|
1.99.2.1 |
| 25-Feb-2013 |
tls | resync with head
|
1.103.4.1 |
| 18-May-2014 |
rmind | sync with head
|
1.107.4.3 |
| 25-Aug-2018 |
martin | Pull up following revision(s) (requested by mrg in ticket #1632):
sys/dev/usb/usbdivar.h: revision 1.117 sys/external/bsd/dwc2/dwc2.c: revision 1.52 sys/dev/usb/xhcivar.h: revision 1.10 sys/dev/usb/motg.c: revision 1.22 sys/dev/usb/ehci.c: revision 1.260 sys/dev/usb/ehci.c: revision 1.261 sys/dev/usb/xhci.c: revision 1.96 sys/dev/usb/ohci.c: revision 1.282 sys/dev/usb/ohci.c: revision 1.283 sys/dev/usb/ehcivar.h: revision 1.45 sys/dev/usb/uhci.c: revision 1.281 sys/dev/usb/uhci.c: revision 1.282 sys/dev/usb/usbdi.c: revision 1.177 sys/dev/usb/ohcivar.h: revision 1.60 sys/dev/usb/uhcivar.h: revision 1.55 (all via patch)
pull across abort fixes from nick-nhusb. add more abort fixes, using ideas from Taylor and Nick, and myself. special thanks to both who inspired much of the code here, if not wrote it directly.
among other problems, this assert should no longer trigger:
panic: kernel diagnostic assertion "xfer->ux_state == XFER_ONQU" failed: file "/current/src/sys/dev/usb/usbdi.c", line 914
using usbhist i was able to track down my instance of it being related to userland close() beginning, dropping the sc_lock, and then the usb softintr completes the transfer normally, and when it is done, the abort path attempts to re-complete the transfer, and the above assert is tripped.
changes from nhusb were commited with these logs: -- Move the struct usb_task to struct usbd_xfer for everyone to use. -- Set device transfer status to USBD_IN_PROGRESS if start methods succeeds -- Actually set the transfer status on transfers in ohci_abort_xfer and the controller is dying -- Don't supply the lock to callout_halt when polling as it won't be held -- Improve transfer abort -- Mark device transfers as USBD_IN_PROGRESS appropriately and improve abort handling -- -- Mark device transfers as USBD_IN_PROGRESS appropriately and improve abort handling --
additional changes include: - initialise the usb abort task in the HCI allocx routine, so that it can be safely usb_rem_task()'d. - rework the handling of softintr vs cancellation vs timeout abort based upon a scheme from Taylor: when completing a transfer normally: - if the status is not in progress, it must be cancelled or timed out, and we should not process this xfer. - set the status as normal. - unconditionallly callout_stop() and usb_rem_task(). they're safe and either aren't running, or will run and do nothing. - finally call usb_transfer_complete(). when aborting a transfer: - status should be cancelled or timed out. - if cancelling, callout_halt and usb_rem_task_wait() to make sure the timer is either done or cancelled. - at this point, the ux_status must not be cancelled or timed out, and if it is not in progress we're done. - set the status. - if the controller is dying, just return. - perform HCI-specific tasks to abort this xfer. - finally call usb_transfer_complete(). for the timeout and timeout task: - if the HCI is not dying, and the ux_status is in progress, then trigger the usb abort task. - remove UXFER_ABORTWAIT and UXFER_ABORTING.
tested on: - multiple PC systems with several types of devices: ugen/UPS, ucom, umass with disk, ssd and cdrom backends, kbd, ms, using uhci, ehci and xhci. - erlite3: sd@umass on dwc2. - sunblade2000: kbd/ms and umass disk on ohci.
untested: - motg, slhci and ahci. motg has some portion of the new scheme applied, but slhci and ahci require more study.
future work includes pushing a lot of the common abort handling into usbdi.c and leaving upm_abort() for HC specific tasks, but this change is pullup-able to netbsd-7 and netbsd-8 as it does not change any external API, as well as removing over 100 lines of code while adding over 30 new asserts.
XXX: pullup-7, pullup-8.
fix DIAGNOSTIC build by not copying ub_usepolling to stack before use
Sprinkle __diagused
|
1.107.4.2 |
| 05-Apr-2017 |
snj | Pull up following revision(s) (requested by skrll in ticket #1395): share/man/man4/axe.4: netbsd-7-nhusb share/man/man4/axen.4: netbsd-7-nhusb share/man/man4/cdce.4: netbsd-7-nhusb share/man/man4/uaudio.4: netbsd-7-nhusb share/man/man4/ucom.4: netbsd-7-nhusb share/man/man4/uep.4: netbsd-7-nhusb share/man/man4/urtw.4: netbsd-7-nhusb share/man/man4/usb.4: netbsd-7-nhusb share/man/man4/uyap.4: netbsd-7-nhusb share/man/man4/xhci.4: netbsd-7-nhusb share/man/man9/usbdi.9: netbsd-7-nhusb sys/arch/amd64/conf/ALL: netbsd-7-nhusb sys/arch/amd64/conf/GENERIC: netbsd-7-nhusb sys/arch/amiga/dev/slhci_zbus.c: netbsd-7-nhusb sys/arch/arm/allwinner/awin_otg.c: netbsd-7-nhusb sys/arch/arm/allwinner/awin_usb.c: netbsd-7-nhusb sys/arch/arm/amlogic/amlogic_dwctwo.c: netbsd-7-nhusb sys/arch/arm/at91/at91ohci.c: netbsd-7-nhusb sys/arch/arm/broadcom/bcm2835_dwctwo.c: netbsd-7-nhusb sys/arch/arm/broadcom/bcm53xx_usb.c: netbsd-7-nhusb sys/arch/arm/ep93xx/epohci.c: netbsd-7-nhusb sys/arch/arm/gemini/obio_ehci.c: netbsd-7-nhusb sys/arch/arm/imx/files.imx23: netbsd-7-nhusb sys/arch/arm/imx/imxusb.c: netbsd-7-nhusb sys/arch/arm/imx/imxusbreg.h: netbsd-7-nhusb sys/arch/arm/omap/obio_ohci.c: netbsd-7-nhusb sys/arch/arm/omap/omap3_ehci.c: netbsd-7-nhusb sys/arch/arm/omap/omapl1x_ohci.c: netbsd-7-nhusb sys/arch/arm/omap/tiotg.c: netbsd-7-nhusb sys/arch/arm/s3c2xx0/ohci_s3c24x0.c: netbsd-7-nhusb sys/arch/arm/samsung/exynos_usb.c: netbsd-7-nhusb sys/arch/arm/xscale/pxa2x0_ohci.c: netbsd-7-nhusb sys/arch/arm/zynq/zynq_usb.c: netbsd-7-nhusb sys/arch/hpcarm/dev/nbp_slhci.c: netbsd-7-nhusb sys/arch/hpcmips/dev/plumohci.c: netbsd-7-nhusb sys/arch/i386/conf/ALL: netbsd-7-nhusb sys/arch/i386/conf/GENERIC: netbsd-7-nhusb sys/arch/i386/pci/gcscehci.c: netbsd-7-nhusb sys/arch/luna68k/conf/GENERIC: netbsd-7-nhusb sys/arch/mips/adm5120/dev/ahci.c: netbsd-7-nhusb sys/arch/mips/adm5120/dev/ahcivar.h: netbsd-7-nhusb sys/arch/mips/alchemy/dev/ohci_aubus.c: netbsd-7-nhusb sys/arch/mips/atheros/dev/ehci_arbus.c: netbsd-7-nhusb sys/arch/mips/atheros/dev/ohci_arbus.c: netbsd-7-nhusb sys/arch/mips/conf/files.adm5120: netbsd-7-nhusb sys/arch/mips/ralink/ralink_ehci.c: netbsd-7-nhusb sys/arch/mips/ralink/ralink_ohci.c: netbsd-7-nhusb sys/arch/mips/rmi/rmixl_ehci.c: netbsd-7-nhusb sys/arch/mips/rmi/rmixl_ohci.c: netbsd-7-nhusb sys/arch/playstation2/dev/ohci_sbus.c: netbsd-7-nhusb sys/arch/powerpc/booke/dev/pq3ehci.c: netbsd-7-nhusb sys/arch/powerpc/ibm4xx/dev/dwctwo_plb.c: netbsd-7-nhusb sys/arch/x68k/dev/slhci_intio.c: netbsd-7-nhusb sys/conf/files: netbsd-7-nhusb sys/dev/cardbus/ehci_cardbus.c: netbsd-7-nhusb sys/dev/cardbus/ohci_cardbus.c: netbsd-7-nhusb sys/dev/cardbus/uhci_cardbus.c: netbsd-7-nhusb sys/dev/ic/sl811hs.c: netbsd-7-nhusb sys/dev/ic/sl811hsvar.h: netbsd-7-nhusb sys/dev/isa/slhci_isa.c: netbsd-7-nhusb sys/dev/marvell/ehci_mv.c: netbsd-7-nhusb sys/dev/pci/ehci_pci.c: netbsd-7-nhusb sys/dev/pci/ohci_pci.c: netbsd-7-nhusb sys/dev/pci/uhci_pci.c: netbsd-7-nhusb sys/dev/pci/xhci_pci.c: netbsd-7-nhusb sys/dev/pcmcia/slhci_pcmcia.c: netbsd-7-nhusb sys/dev/usb/Makefile.usbdevs: netbsd-7-nhusb sys/dev/usb/TODO: netbsd-7-nhusb sys/dev/usb/TODO.usbmp: netbsd-7-nhusb sys/dev/usb/aubtfwl.c: netbsd-7-nhusb sys/dev/usb/auvitek.c: netbsd-7-nhusb sys/dev/usb/auvitek_audio.c: netbsd-7-nhusb sys/dev/usb/auvitek_dtv.c: netbsd-7-nhusb sys/dev/usb/auvitek_i2c.c: netbsd-7-nhusb sys/dev/usb/auvitek_video.c: netbsd-7-nhusb sys/dev/usb/auvitekvar.h: netbsd-7-nhusb sys/dev/usb/ehci.c: netbsd-7-nhusb sys/dev/usb/ehcireg.h: netbsd-7-nhusb sys/dev/usb/ehcivar.h: netbsd-7-nhusb sys/dev/usb/emdtv.c: netbsd-7-nhusb sys/dev/usb/emdtv_dtv.c: netbsd-7-nhusb sys/dev/usb/emdtv_ir.c: netbsd-7-nhusb sys/dev/usb/emdtvvar.h: netbsd-7-nhusb sys/dev/usb/ezload.c: netbsd-7-nhusb sys/dev/usb/ezload.h: netbsd-7-nhusb sys/dev/usb/files.usb: netbsd-7-nhusb sys/dev/usb/hid.c: netbsd-7-nhusb sys/dev/usb/hid.h: netbsd-7-nhusb sys/dev/usb/if_athn_usb.c: netbsd-7-nhusb sys/dev/usb/if_athn_usb.h: netbsd-7-nhusb sys/dev/usb/if_atu.c: netbsd-7-nhusb sys/dev/usb/if_atureg.h: netbsd-7-nhusb sys/dev/usb/if_aue.c: netbsd-7-nhusb sys/dev/usb/if_auereg.h: netbsd-7-nhusb sys/dev/usb/if_axe.c: netbsd-7-nhusb sys/dev/usb/if_axen.c: netbsd-7-nhusb sys/dev/usb/if_axenreg.h: netbsd-7-nhusb sys/dev/usb/if_axereg.h: netbsd-7-nhusb sys/dev/usb/if_cdce.c: netbsd-7-nhusb sys/dev/usb/if_cdcereg.h: netbsd-7-nhusb sys/dev/usb/if_cue.c: netbsd-7-nhusb sys/dev/usb/if_cuereg.h: netbsd-7-nhusb sys/dev/usb/if_kue.c: netbsd-7-nhusb sys/dev/usb/if_kuereg.h: netbsd-7-nhusb sys/dev/usb/if_otus.c: netbsd-7-nhusb sys/dev/usb/if_otusvar.h: netbsd-7-nhusb sys/dev/usb/if_rum.c: netbsd-7-nhusb sys/dev/usb/if_rumreg.h: netbsd-7-nhusb sys/dev/usb/if_rumvar.h: netbsd-7-nhusb sys/dev/usb/if_run.c: netbsd-7-nhusb sys/dev/usb/if_runvar.h: netbsd-7-nhusb sys/dev/usb/if_smsc.c: netbsd-7-nhusb sys/dev/usb/if_smscreg.h: netbsd-7-nhusb sys/dev/usb/if_smscvar.h: netbsd-7-nhusb sys/dev/usb/if_udav.c: netbsd-7-nhusb sys/dev/usb/if_udavreg.h: netbsd-7-nhusb sys/dev/usb/if_upgt.c: netbsd-7-nhusb sys/dev/usb/if_upgtvar.h: netbsd-7-nhusb sys/dev/usb/if_upl.c: netbsd-7-nhusb sys/dev/usb/if_ural.c: netbsd-7-nhusb sys/dev/usb/if_uralreg.h: netbsd-7-nhusb sys/dev/usb/if_uralvar.h: netbsd-7-nhusb sys/dev/usb/if_url.c: netbsd-7-nhusb sys/dev/usb/if_urlreg.h: netbsd-7-nhusb sys/dev/usb/if_urndis.c: netbsd-7-nhusb sys/dev/usb/if_urndisreg.h: netbsd-7-nhusb sys/dev/usb/if_urtw.c: netbsd-7-nhusb sys/dev/usb/if_urtwn.c: netbsd-7-nhusb sys/dev/usb/if_urtwn_data.h: netbsd-7-nhusb sys/dev/usb/if_urtwnreg.h: netbsd-7-nhusb sys/dev/usb/if_urtwnvar.h: netbsd-7-nhusb sys/dev/usb/if_urtwreg.h: netbsd-7-nhusb sys/dev/usb/if_zyd.c: netbsd-7-nhusb sys/dev/usb/if_zydreg.h: netbsd-7-nhusb sys/dev/usb/irmce.c: netbsd-7-nhusb sys/dev/usb/moscom.c: netbsd-7-nhusb sys/dev/usb/motg.c: netbsd-7-nhusb sys/dev/usb/motgvar.h: netbsd-7-nhusb sys/dev/usb/ohci.c: netbsd-7-nhusb sys/dev/usb/ohcireg.h: netbsd-7-nhusb sys/dev/usb/ohcivar.h: netbsd-7-nhusb sys/dev/usb/pseye.c: netbsd-7-nhusb sys/dev/usb/slurm.c: netbsd-7-nhusb sys/dev/usb/stuirda.c: netbsd-7-nhusb sys/dev/usb/u3g.c: netbsd-7-nhusb sys/dev/usb/uark.c: netbsd-7-nhusb sys/dev/usb/uatp.c: netbsd-7-nhusb sys/dev/usb/uaudio.c: netbsd-7-nhusb sys/dev/usb/uberry.c: netbsd-7-nhusb sys/dev/usb/ubsa.c: netbsd-7-nhusb sys/dev/usb/ubsa_common.c: netbsd-7-nhusb sys/dev/usb/ubsavar.h: netbsd-7-nhusb sys/dev/usb/ubt.c: netbsd-7-nhusb sys/dev/usb/uchcom.c: netbsd-7-nhusb sys/dev/usb/ucom.c: netbsd-7-nhusb sys/dev/usb/ucomvar.h: netbsd-7-nhusb sys/dev/usb/ucycom.c: netbsd-7-nhusb sys/dev/usb/udl.c: netbsd-7-nhusb sys/dev/usb/udl.h: netbsd-7-nhusb sys/dev/usb/udsbr.c: netbsd-7-nhusb sys/dev/usb/udsir.c: netbsd-7-nhusb sys/dev/usb/uep.c: netbsd-7-nhusb sys/dev/usb/uftdi.c: netbsd-7-nhusb sys/dev/usb/uftdireg.h: netbsd-7-nhusb sys/dev/usb/ugen.c: netbsd-7-nhusb sys/dev/usb/ugensa.c: netbsd-7-nhusb sys/dev/usb/uhci.c: netbsd-7-nhusb sys/dev/usb/uhcireg.h: netbsd-7-nhusb sys/dev/usb/uhcivar.h: netbsd-7-nhusb sys/dev/usb/uhid.c: netbsd-7-nhusb sys/dev/usb/uhidev.c: netbsd-7-nhusb sys/dev/usb/uhidev.h: netbsd-7-nhusb sys/dev/usb/uhmodem.c: netbsd-7-nhusb sys/dev/usb/uhso.c: netbsd-7-nhusb sys/dev/usb/uhub.c: netbsd-7-nhusb sys/dev/usb/uipad.c: netbsd-7-nhusb sys/dev/usb/uipaq.c: netbsd-7-nhusb sys/dev/usb/uirda.c: netbsd-7-nhusb sys/dev/usb/uirdavar.h: netbsd-7-nhusb sys/dev/usb/ukbd.c: netbsd-7-nhusb sys/dev/usb/ukbdmap.c: netbsd-7-nhusb sys/dev/usb/ukyopon.c: netbsd-7-nhusb sys/dev/usb/ukyopon.h: netbsd-7-nhusb sys/dev/usb/ulpt.c: netbsd-7-nhusb sys/dev/usb/umass.c: netbsd-7-nhusb sys/dev/usb/umass_isdata.c: netbsd-7-nhusb sys/dev/usb/umass_isdata.h: netbsd-7-nhusb sys/dev/usb/umass_quirks.c: netbsd-7-nhusb sys/dev/usb/umass_quirks.h: netbsd-7-nhusb sys/dev/usb/umass_scsipi.c: netbsd-7-nhusb sys/dev/usb/umass_scsipi.h: netbsd-7-nhusb sys/dev/usb/umassvar.h: netbsd-7-nhusb sys/dev/usb/umcs.c: netbsd-7-nhusb sys/dev/usb/umct.c: netbsd-7-nhusb sys/dev/usb/umidi.c: netbsd-7-nhusb sys/dev/usb/umidi_quirks.c: netbsd-7-nhusb sys/dev/usb/umidi_quirks.h: netbsd-7-nhusb sys/dev/usb/umodem.c: netbsd-7-nhusb sys/dev/usb/umodem_common.c: netbsd-7-nhusb sys/dev/usb/umodemvar.h: netbsd-7-nhusb sys/dev/usb/ums.c: netbsd-7-nhusb sys/dev/usb/uplcom.c: netbsd-7-nhusb sys/dev/usb/urio.c: netbsd-7-nhusb sys/dev/usb/urio.h: netbsd-7-nhusb sys/dev/usb/usb.c: netbsd-7-nhusb sys/dev/usb/usb.h: netbsd-7-nhusb sys/dev/usb/usb_mem.c: netbsd-7-nhusb sys/dev/usb/usb_mem.h: netbsd-7-nhusb sys/dev/usb/usb_quirks.c: netbsd-7-nhusb sys/dev/usb/usb_quirks.h: netbsd-7-nhusb sys/dev/usb/usb_subr.c: netbsd-7-nhusb sys/dev/usb/usbdevices.config: netbsd-7-nhusb sys/dev/usb/usbdevs: netbsd-7-nhusb sys/dev/usb/usbdevs.h: netbsd-7-nhusb sys/dev/usb/usbdevs_data.h: netbsd-7-nhusb sys/dev/usb/usbdi.c: netbsd-7-nhusb sys/dev/usb/usbdi.h: netbsd-7-nhusb sys/dev/usb/usbdi_util.c: netbsd-7-nhusb sys/dev/usb/usbdi_util.h: netbsd-7-nhusb sys/dev/usb/usbdivar.h: netbsd-7-nhusb sys/dev/usb/usbhid.h: netbsd-7-nhusb sys/dev/usb/usbhist.h: netbsd-7-nhusb sys/dev/usb/usbroothub.c: netbsd-7-nhusb sys/dev/usb/usbroothub.h: netbsd-7-nhusb sys/dev/usb/usbroothub_subr.c: delete sys/dev/usb/usbroothub_subr.h: delete sys/dev/usb/uscanner.c: netbsd-7-nhusb sys/dev/usb/uslsa.c: netbsd-7-nhusb sys/dev/usb/usscanner.c: netbsd-7-nhusb sys/dev/usb/ustir.c: netbsd-7-nhusb sys/dev/usb/uthum.c: netbsd-7-nhusb sys/dev/usb/utoppy.c: netbsd-7-nhusb sys/dev/usb/uts.c: netbsd-7-nhusb sys/dev/usb/uvideo.c: netbsd-7-nhusb sys/dev/usb/uvisor.c: netbsd-7-nhusb sys/dev/usb/uvscom.c: netbsd-7-nhusb sys/dev/usb/uyap.c: netbsd-7-nhusb sys/dev/usb/uyap_firmware.h: netbsd-7-nhusb sys/dev/usb/uyurex.c: netbsd-7-nhusb sys/dev/usb/x1input_rdesc.h: netbsd-7-nhusb sys/dev/usb/xhci.c: netbsd-7-nhusb sys/dev/usb/xhcireg.h: netbsd-7-nhusb sys/dev/usb/xhcivar.h: netbsd-7-nhusb sys/dev/usb/xinput_rdesc.h: netbsd-7-nhusb sys/external/bsd/common/conf/files.linux: netbsd-7-nhusb sys/external/bsd/common/include/linux/err.h: netbsd-7-nhusb sys/external/bsd/common/include/linux/kernel.h: netbsd-7-nhusb sys/external/bsd/common/include/linux/workqueue.h: netbsd-7-nhusb sys/external/bsd/common/linux/linux_work.c: netbsd-7-nhusb sys/external/bsd/drm2/dist/drm/radeon/atombios_encoders.c: netbsd-7-nhusb sys/external/bsd/drm2/dist/drm/radeon/radeon_legacy_encoders.c: netbsd-7-nhusb sys/external/bsd/drm2/drm/files.drmkms: netbsd-7-nhusb sys/external/bsd/drm2/i915drm/files.i915drmkms: netbsd-7-nhusb sys/external/bsd/drm2/include/linux/err.h: delete sys/external/bsd/drm2/include/linux/workqueue.h: delete sys/external/bsd/drm2/linux/files.drmkms_linux: netbsd-7-nhusb sys/external/bsd/drm2/linux/linux_work.c: delete sys/external/bsd/dwc2/dwc2.c: netbsd-7-nhusb sys/external/bsd/dwc2/dwc2.h: netbsd-7-nhusb sys/external/bsd/dwc2/dwc2var.h: netbsd-7-nhusb sys/external/bsd/dwc2/dwctwo2netbsd: netbsd-7-nhusb sys/external/bsd/dwc2/conf/files.dwc2: netbsd-7-nhusb sys/external/bsd/dwc2/dist/dwc2_core.c: netbsd-7-nhusb sys/external/bsd/dwc2/dist/dwc2_core.h: netbsd-7-nhusb sys/external/bsd/dwc2/dist/dwc2_coreintr.c: netbsd-7-nhusb sys/external/bsd/dwc2/dist/dwc2_hcd.c: netbsd-7-nhusb sys/external/bsd/dwc2/dist/dwc2_hcd.h: netbsd-7-nhusb sys/external/bsd/dwc2/dist/dwc2_hcdddma.c: netbsd-7-nhusb sys/external/bsd/dwc2/dist/dwc2_hcdintr.c: netbsd-7-nhusb sys/external/bsd/dwc2/dist/dwc2_hcdqueue.c: netbsd-7-nhusb sys/external/bsd/dwc2/dist/dwc2_hw.h: netbsd-7-nhusb sys/modules/drmkms_linux/Makefile: netbsd-7-nhusb sys/modules/i915drmkms/Makefile: netbsd-7-nhusb sys/rump/dev/lib/libugenhc/ugenhc.c: netbsd-7-nhusb sys/rump/dev/lib/libusb/Makefile: netbsd-7-nhusb sys/rump/dev/lib/libusb/USB.ioconf: netbsd-7-nhusb sys/rump/dev/lib/libusb/usb_at_ugenhc.c: delete sys/rump/dev/lib/libusb/opt/opt_usb.h: delete sys/rump/dev/lib/libusb/opt/opt_usbverbose.h: delete sys/sys/mbuf.h: netbsd-7-nhusb usr.sbin/usbdevs/usbdevs.8: netbsd-7-nhusb usr.sbin/usbdevs/usbdevs.c: netbsd-7-nhusb Merge netbsd-7-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 - Change the SOFTINT level from NET to SERIAL for the USB softint handler. This gives the callback a chance of running when another softint handler at SOFTINT_NET has blocked holding a lock, e.g. softnet_lock and most of the network stack. - kern/49065 - ifconfig tun0 ... sequence locks up system / lockup: softnet_lock held across usb xfr - kern/50491 - unkillable wait in usbd_transfer while using usmsc0 on raspberry pi 2 - kern/51395 - USB Ethernet makes xhci hang - Various improvements to slhci(4) - Various improvements to dwc2(4)
|
1.107.4.1 |
| 06-Feb-2016 |
snj | branches: 1.107.4.1.2; Pull up following revision(s) (requested by skrll in ticket #1097): sys/dev/usb/usb.c: revision 1.161 sys/dev/usb/usb_subr.c: revisions 1.207, 1.208 sys/dev/usb/usbdivar.h: revision 1.111 sys/dev/usb/xhci.c: revision 1.33 Get the iManufacturer, iProduct, and iSerialNumber strings before probing for drivers and cache them for later use. This reduces bus transactions and fixes attachment for at least two of my umass(4)s. -- Need sys/kmem.h
|
1.107.4.1.2.2 |
| 26-Jan-2017 |
skrll | Sync with HEAD/nhusb
|
1.107.4.1.2.1 |
| 06-Sep-2016 |
skrll | First pass at netbsd-7 updated with USB code from HEAD
|
1.109.2.28 |
| 03-Jan-2017 |
skrll | Improve handling of roothub device and free up a bus address for LS/FS/HS controllers.
|
1.109.2.27 |
| 30-Apr-2016 |
skrll | Move the struct usb_task to struct usbd_xfer for everyone to use.
|
1.109.2.26 |
| 29-Mar-2016 |
skrll | Whitespace
|
1.109.2.25 |
| 17-Mar-2016 |
skrll | All HCDs were fighting the seriaisation of transfers in usbdi.c for isoc transfers. Instead allow the HCDs to specify which pipes can handle removing this serialisation and apply it appropriately.
dwctwo(4) can handle this for all transfer types, but only enable bulk/isoc for now.
|
1.109.2.24 |
| 06-Mar-2016 |
skrll | Whitespace
|
1.109.2.23 |
| 16-Feb-2016 |
skrll | Re-enable the TT support that existed previously here as well
|
1.109.2.22 |
| 10-Jan-2016 |
skrll | Bring the following change from HEAD
Get the iManufacturer, iProduct, and iSerialNumber strings before probing for drivers and cache them for later use. This reduces bus transactions and fixes attachment for at least two of my umass(4)s.
|
1.109.2.21 |
| 28-Dec-2015 |
skrll | Strictly follow the sequence abort pipe, destroy xfers, and close pipe as API now requires. Plug some memory leaks in some drivers while doing this.
Also, remove up_refcnt as it was broken and helped leak more memory.
|
1.109.2.20 |
| 21-Oct-2015 |
skrll | Cache the usbd_bus pointer in the usbd_xfer struct for memory allocation and softc access. This removes a level of indirection for memory allocation.
Also cache the xfer pipe methods for later (temporary?) use.
|
1.109.2.19 |
| 12-Oct-2015 |
skrll | Provide init/fini methods for HCDs
|
1.109.2.18 |
| 11-Oct-2015 |
skrll | Update ubm_allocx with the isoc frame count parameter and use it in dwctwo(4)
|
1.109.2.17 |
| 06-Jun-2015 |
skrll | Read Binary Object Store descriptor and store to ud_bdesc.
From t-hash
|
1.109.2.16 |
| 19-Mar-2015 |
skrll | Do the same as OpenBSD and get rid of the *_handle typedefs and use plain structures insteads
|
1.109.2.15 |
| 18-Mar-2015 |
skrll | Expose usbd_xfer_isread
|
1.109.2.14 |
| 05-Mar-2015 |
skrll | What was I thinking... usbd_free_xfer handles the buffer free.
Need more coffee
|
1.109.2.13 |
| 05-Mar-2015 |
skrll | Don't leak memory in previous
|
1.109.2.12 |
| 05-Mar-2015 |
skrll | Kill URQ_AUTO_BUFFER
|
1.109.2.11 |
| 22-Feb-2015 |
skrll | Simplify #ifdef.
USB_DEBUG is defined if either of EHCI_DEBUG or OHCI_DEBUG (or others) are defined.
|
1.109.2.10 |
| 19-Dec-2014 |
skrll | Update a comment
|
1.109.2.9 |
| 14-Dec-2014 |
skrll | Match comment to code
|
1.109.2.8 |
| 06-Dec-2014 |
skrll | KNF. Remove argument name from function declarations.
No functional change.
|
1.109.2.7 |
| 04-Dec-2014 |
skrll | Rework roothub control transfers so that much of the code is shared across HCDs.
I have retained the vendor/product reporting for each HCD for now, but it maybe get removed later.
ahci(4) now reports a language table and uses the usb_makestrdesc function instead of rolling its own version.
|
1.109.2.6 |
| 03-Dec-2014 |
skrll | Rearrange the usbd_bus struct member to match the comments about who fills them.
|
1.109.2.5 |
| 03-Dec-2014 |
skrll | The grand renaming of structure members.
No functional change.
|
1.109.2.4 |
| 02-Dec-2014 |
skrll | Step #1 of memory allocation re-organisation.
Centralised the buffer allocation routine which now supports DMA and non-DMA capable host controllers. Remove the ubm_{alloc,free}m methods from usbd_bus_methods.
The buffer allocation is only allowed in thread context and, therefore, negates the usefulness of the reserve dma code which is removed in this change.
USBD_NO_COPY is also no longer required as usbd_transfer and usbd_transfer_complete now track buffer usage and handle any copying.
|
1.109.2.3 |
| 01-Dec-2014 |
skrll | Add prefixes to method structures member names. No functional change.
|
1.109.2.2 |
| 01-Dec-2014 |
skrll | Remove usbd_bus no_intrs member it was (virtually) unused.
|
1.109.2.1 |
| 30-Nov-2014 |
skrll | Use C99 types. u_int{8,16,32,64}_t to uint{8,16,32,64}_t.
No functional change.
|
1.113.4.1 |
| 21-Apr-2017 |
bouyer | Sync with HEAD
|
1.113.2.1 |
| 20-Mar-2017 |
pgoyette | Sync with HEAD
|
1.114.12.5 |
| 06-Sep-2018 |
pgoyette | Sync with HEAD
Resolve a couple of conflicts (result of the uimin/uimax changes)
|
1.114.12.4 |
| 28-Jul-2018 |
pgoyette | Sync with HEAD
|
1.114.12.3 |
| 22-Apr-2018 |
pgoyette | Sync with HEAD
|
1.114.12.2 |
| 29-Mar-2018 |
pgoyette | Revert previous. Instead, we'll just move usbd_printBCD() to usbdi.h
|
1.114.12.1 |
| 29-Mar-2018 |
pgoyette | Protect against multiple-inclusion
|
1.114.6.2 |
| 16-Nov-2019 |
martin | Pull up the following revisions, requested by msaitoh in ticket #1443:
sys/arch/arm/nvidia/tegra_xusb.c 1.13-1.14 via patch sys/dev/pci/xhci_pci.c 1.13 sys/dev/usb/usb.c 1.169 sys/dev/usb/usbdivar.h 1.116 sys/dev/usb/xhci.c 1.93, 1.95, 1.97 sys/dev/usb/xhcireg.h 1.11-1.12
Detect USB 3.1
|
1.114.6.1 |
| 25-Aug-2018 |
martin | Pull up following revision(s) (requested by mrg in ticket #980):
sys/dev/usb/usbdivar.h: revision 1.117 sys/external/bsd/dwc2/dwc2.c: revision 1.52 sys/dev/usb/xhcivar.h: revision 1.10 sys/dev/usb/motg.c: revision 1.22 sys/dev/usb/ehci.c: revision 1.260 sys/dev/usb/ehci.c: revision 1.261 sys/dev/usb/xhci.c: revision 1.96 sys/dev/usb/ohci.c: revision 1.282 sys/dev/usb/ohci.c: revision 1.283 sys/dev/usb/ehcivar.h: revision 1.45 sys/dev/usb/uhci.c: revision 1.281 sys/dev/usb/uhci.c: revision 1.282 sys/dev/usb/usbdi.c: revision 1.177 sys/dev/usb/ohcivar.h: revision 1.60 sys/dev/usb/uhcivar.h: revision 1.55 (all via patch)
pull across abort fixes from nick-nhusb. add more abort fixes, using ideas from Taylor and Nick, and myself. special thanks to both who inspired much of the code here, if not wrote it directly. among other problems, this assert should no longer trigger:
panic: kernel diagnostic assertion "xfer->ux_state == XFER_ONQU" failed: file "/current/src/sys/dev/usb/usbdi.c", line 914
using usbhist i was able to track down my instance of it being related to userland close() beginning, dropping the sc_lock, and then the usb softintr completes the transfer normally, and when it is done, the abort path attempts to re-complete the transfer, and the above assert is tripped.
changes from nhusb were commited with these logs: -- Move the struct usb_task to struct usbd_xfer for everyone to use. -- Set device transfer status to USBD_IN_PROGRESS if start methods succeeds -- Actually set the transfer status on transfers in ohci_abort_xfer and the controller is dying -- Don't supply the lock to callout_halt when polling as it won't be held -- Improve transfer abort -- Mark device transfers as USBD_IN_PROGRESS appropriately and improve abort handling -- -- Mark device transfers as USBD_IN_PROGRESS appropriately and improve abort handling --
additional changes include: - initialise the usb abort task in the HCI allocx routine, so that it can be safely usb_rem_task()'d. - rework the handling of softintr vs cancellation vs timeout abort based upon a scheme from Taylor: when completing a transfer normally: - if the status is not in progress, it must be cancelled or timed out, and we should not process this xfer. - set the status as normal. - unconditionallly callout_stop() and usb_rem_task(). they're safe and either aren't running, or will run and do nothing. - finally call usb_transfer_complete(). when aborting a transfer: - status should be cancelled or timed out. - if cancelling, callout_halt and usb_rem_task_wait() to make sure the timer is either done or cancelled. - at this point, the ux_status must not be cancelled or timed out, and if it is not in progress we're done. - set the status. - if the controller is dying, just return. - perform HCI-specific tasks to abort this xfer. - finally call usb_transfer_complete(). for the timeout and timeout task: - if the HCI is not dying, and the ux_status is in progress, then trigger the usb abort task. - remove UXFER_ABORTWAIT and UXFER_ABORTING.
tested on: - multiple PC systems with several types of devices: ugen/UPS, ucom, umass with disk, ssd and cdrom backends, kbd, ms, using uhci, ehci and xhci. - erlite3: sd@umass on dwc2. - sunblade2000: kbd/ms and umass disk on ohci.
untested: - motg, slhci and ahci. motg has some portion of the new scheme applied, but slhci and ahci require more study.
future work includes pushing a lot of the common abort handling into usbdi.c and leaving upm_abort() for HC specific tasks, but this change is pullup-able to netbsd-7 and netbsd-8 as it does not change any external API, as well as removing over 100 lines of code while adding over 30 new asserts.
XXX: pullup-7, pullup-8.
fix DIAGNOSTIC build by not copying ub_usepolling to stack before use
Sprinkle __diagused
|
1.115.2.3 |
| 13-Apr-2020 |
martin | Mostly merge changes from HEAD upto 20200411
|
1.115.2.2 |
| 08-Apr-2020 |
martin | Merge changes from current as of 20200406
|
1.115.2.1 |
| 10-Jun-2019 |
christos | Sync with HEAD
|
1.118.4.1 |
| 01-Mar-2020 |
martin | Pull up following revision(s) (requested by riastradh in ticket #744):
sys/dev/usb/uhci.c: revision 1.292 sys/dev/usb/uhci.c: revision 1.293 sys/dev/usb/usbdi.h: revision 1.99 sys/dev/usb/motg.c: revision 1.26 sys/dev/usb/motg.c: revision 1.27 sys/dev/usb/motg.c: revision 1.28 sys/dev/usb/motg.c: revision 1.29 sys/external/bsd/dwc2/dwc2.c: revision 1.70 sys/external/bsd/dwc2/dwc2.c: revision 1.71 sys/dev/usb/usb.c: revision 1.181 sys/arch/mips/adm5120/dev/ahci.c: revision 1.20 sys/dev/usb/usb.c: revision 1.182 sys/dev/usb/xhci.c: revision 1.116 sys/dev/usb/xhci.c: revision 1.117 sys/dev/usb/xhci.c: revision 1.118 sys/dev/usb/uhci.c: revision 1.289 sys/dev/usb/usbdivar.h: revision 1.121 sys/dev/usb/usbdi.c: revision 1.190 sys/dev/usb/usbdivar.h: revision 1.122 sys/dev/usb/usbdi.c: revision 1.191 sys/dev/usb/usbdi.c: revision 1.192 sys/external/bsd/dwc2/dwc2var.h: revision 1.7 sys/dev/usb/motg.c: revision 1.30 sys/dev/usb/motg.c: revision 1.31 sys/dev/usb/motg.c: revision 1.32 sys/dev/usb/motg.c: revision 1.33 sys/external/bsd/dwc2/dwc2.c: revision 1.67 sys/external/bsd/dwc2/dwc2.c: revision 1.68 sys/dev/usb/ehci.c: revision 1.270 sys/external/bsd/dwc2/dwc2.c: revision 1.69 sys/dev/usb/usbdi.h: revision 1.100 sys/dev/usb/ehci.c: revision 1.271 sys/arch/mips/adm5120/dev/ahci.c: revision 1.18 sys/dev/usb/usbdi.h: revision 1.101 sys/dev/usb/ehci.c: revision 1.272 sys/dev/ic/sl811hs.c: revision 1.103 sys/arch/mips/adm5120/dev/ahci.c: revision 1.19 sys/dev/usb/ehci.c: revision 1.273 sys/dev/usb/ohci.c: revision 1.293 sys/dev/usb/uhci.c: revision 1.290 sys/dev/usb/ohci.c: revision 1.294 sys/dev/usb/uhci.c: revision 1.291 sys/dev/usb/ohci.c: revision 1.295
Teach usb_rem_task to return whether removed from queue or not.
New function usb_task_pending for diagnostic assertions. Usable only for negative diagnostic assertions:
KASSERT(!usb_task_pending(dev, task))
If you can think of a better name for this than !usb_task_pending, I'm all ears.
-
Nothing guarantees xfer's timeout has completed.
Wait for it when we free the xfer.
-
New xfer state variables ux_timeout_set and ux_timeout_reset.
These are needed because: - The host controller interrupt cannot wait for the callout or task to finish running. - Nothing in the USBD API as is waits for the callout or task to finish running. - Callers expect to be able to resubmit USB xfers from xfer callbacks without waiting for anything to finish running.
The variable ux_timeout_set can be used by a host controller to decide on submission whether to schedule the callout or to ask an already-scheduled callout or already-queued task to reschedule the callout, by setting the variable ux_timeout_reset to true.
When the callout or task runs and sees that ux_timeout_reset is true, rather than queue the task or abort the xfer, it can instead just schedule the callout anew.
-
Fix steady state of timeouts in ehci.
This is complicated because: 1. There are three ways that an xfer can be completed: (a) hardware interrupt completes xfer (b) software decision aborts xfer with USBD_CANCELLED (c) timeout aborts xfer with USBD_TIMEOUT 2. The timeout abort can't be done in callout because ehci_sync_hc, called unconditionally by ehci_abort_xfer to wait until the device has finished using any references to the xfer, may sleep. So we have to schedule a callout that, when run, will schedule a usb_task. 3. The hardware completion interrupt can't sleep waiting for a callout or task to finish -- can't use callout_halt or usb_rem_task_wait. So the callout and usb_task must be able to run _after_ the hardware completion interrupt, and recognize that they're late to the party. (Note, though, that usbd_free_xfer does wait for the callout and task to complete, so there's no danger they may use themselves after free.) 4. The xfer may resubmitted -- and the timeout may be rescheduled -- immediately after the hardware completion interrupt, _while_ the callout and/or usb_task may still be scheduled. Specifically, we may have the following sequence of events: (a) hardware completion interrupt (b) callout or usb_task fires (c) driver resubmits xfer (d) callout or usb_task acquires lock and looks around dazed and bewildered at the firehose of events like reading the news in 2019
The mechanism for sorting this out is that we have two bits of state: - xfer->ux_timeout_set informs the driver, when submitting an xfer and setting up its timeout, whether either the callout or usb_task is already scheduled or not. - xfer->ux_timeout_reset informs the callout or usb_task whether it should reschedule the callout, because the xfer got resubmitted, or not.
-
Factor out HCI-independent xfer completion logic.
New API for HCI drivers to synchronize hardware completion interrupts, synchronous aborts, and asynchronous timeouts: - When submitting an xfer to hardware, call usbd_xfer_schedule_timeout(xfer). - On HCI completion interrupt for xfer completion: if (!usbd_xfer_trycomplete(xfer)) return; /* timed out or aborted, ignore it */ - In upm_abort methods, call usbd_xfer_abort(xfer).
For HCI drivers that use this API (not needed in drivers that don't, or for xfers like root intr xfers that don't use it): - New ubm_abortx method serves role of former *hci_abort_xfer, but without any logic for wrangling timeouts/callouts/tasks -- caller in usbd_xfer_abort has already handled them. - New ubm_dying method, returns true if the device is in the process of detaching, used by the timeout logic.
Converted and tested: - ehci - ohci
Converted and compile-tested: - ahci (XXX did this ever work?) - dwc2 - motg (XXX missing usbd_xfer_schedule_timeout in motg_*_start?) - uhci - xhci
Not changed: - slhci (sys/dev/ic/sl811hs.c) -- doesn't use a separate per-xfer callout for timeouts (XXX but maybe should?) - ugenhc (sys/rump/dev/lib/libugenhc/ugenhc.c) -- doesn't manage its own transfer timeouts
-
Fix steady state of root intr xfers.
Why? - Avoid completing a root intr xfer multiple times in races. - Avoid potential use-after-free in poll_hub callouts (uhci, ahci).
How? - Use sc->sc_intr_xfer or equivalent to store only a pending xfer that has not yet completed -- whether successfully, by timeout, or by synchronous abort. When any of those happens, set it to null under the lock, so the xfer is completed only once. - For hci drivers that use a callout to poll the root hub (uhci, ahci): . Pass the softc pointer, not the xfer, to the callout, so the callout is not even tempted to use xfer after free -- if the callout fires, but the xfer is synchronously aborted before the callout can do anything, the xfer might be freed by the time the callout starts to examine it. . Teach the callout to do nothing if it is callout_pending after it has fired. This way: 1. completion or synchronous abort can just callout_stop 2. start can just callout_schedule If the callout had already fired before (1), and doesn't acquire the bus lock until after (2), it may be tempted to abort the new root intr xfer just after submission, which would be wrong -- so instead we just have the callout do nothing if it notices it has been rescheduled, since it will fire again after the appropriate time has elapsed.
-
Initialize xfer->ux_status in uhci_root_intr_start.
Otherwise, it will be USBD_NOT_STARTED, so usbd_ar_pipe will skip calling upm_abort. Candidate fix for PR kern/54963, same problem as reported at: href="https://mail-index.NetBSD.org/current-users/2020/02/13/msg037740.html
-
Set ux_isdone in uhci_poll_hub for DIAGNOSTIC.
-
Fix mistakes in previous sloppy change with root intr xfers. - Make sure ux_status is set to USBD_IN_PROGRESS when started. Otherwise, if it is still in flight when we abort the pipe, usbd_ar_pipe will skip calling upm_abort. - Initialize ux_status under the lock; in principle a completion interrupt (or a delay) could race with the initialization. - KASSERT that the xfer is in progress when we're about to complete it.
Candidate fix for PR kern/54963 for other HCI drivers than uhci. ok nick ok phone (This is the change that nick evidently MEANT to ok when he ok'd the previous one!)
-
Fix build
-
Fix non-DIAGNOSTIC builds.
-
Fix wrong KASSERT in motg abort. This has been wrong since last summer when we did the transition to xfer->ux_status = USBD_CANCELLED earlier. XXX pullup-9
-
Fix mistakes in timeout/abort/completion changes in motg(4). - Call usbd_xfer_schedule_timeout so we actually do time out. - Don't call usbd_xfer_trycomplete until all the data have been transferred -- it commits to completion, not timeout. - Use xfer->ux_status != USBD_IN_PROGRESS to test whether, after a partial write, an xfer has been interrupted or timed out and need not be continued. - Remove wrong assertion.
-
Fix mistake in use of usbd_xfer_schedule_timeout in motg.
This code path is used both for xfers that are new, and xfers that are being done piece by piece and are partway done. For the latter case, skip usbd_xfer_schedule_timeout so we schedule it only once per xfer.
-
Simplify some branches and kassert some redundant assignments.
|
1.119.2.1 |
| 29-Feb-2020 |
ad | Sync with head.
|
1.124.6.1 |
| 17-Jun-2021 |
thorpej | Sync w/ HEAD.
|
1.138.2.1 |
| 02-Aug-2025 |
perseant | Sync with HEAD
|