History log of /src/sys/dev/usb/uhci.c |
Revision | | Date | Author | Comments |
1.320 |
| 26-Apr-2025 |
skrll | A USBHIST (aka KERNHIST) fix from sc.dying on current-users.
|
1.319 |
| 06-Oct-2024 |
jakllsch | Simplify/optimize usb_syncmem() in uhci_device_isoc_done()
Matches ohci(4)
|
1.318 |
| 05-Apr-2024 |
riastradh | usb *hci: Always set ux_status before usbd_xfer_schedule_timeout.
Add an assert to usbd_xfer_schedule_timeout to enforce this.
Since access to ux_status is serialized by the bus lock, and nothing releases the bus lock in the interim, this doesn't make a functional change. But it does reduce confusion by readers, who no longer have to worry if some callers got the order wrong. It could also now potentially be factored out in a subsequent commit.
|
1.317 |
| 04-Feb-2024 |
mrg | update my email address.
|
1.316 |
| 17-Aug-2022 |
riastradh | uhci(4): Fix wrong lock in callout_halt in uhci_suspend.
Maybe this should just be unconditional and outside the lock to make it simpler.
Found by code inspection. Maybe someone should test uhci suspend resume...
|
1.315 |
| 13-Mar-2022 |
riastradh | uhci(4): Stop taking the intr lock in uhci_run.
Not needed for anything here.
|
1.314 |
| 13-Mar-2022 |
riastradh | uhci(4): Simplify uhci_run.
`locked' is always 0 now.
No functional change intended.
|
1.313 |
| 13-Mar-2022 |
riastradh | uhci(4): Fix synchronization between suspend/resume and poll hub.
- sc_intr_lock is not relevant to anything here -- stop using it. - Never schedule the callout while suspended. - Don't futz with usepolling; it makes sense only when all other CPUs and threads are quiesced, which is not the case here.
|
1.312 |
| 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.311 |
| 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.310 |
| 03-Mar-2022 |
riastradh | usb: Factor usb_transfer_complete out of ubm_abortx method.
|
1.309 |
| 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.308 |
| 21-Dec-2021 |
skrll | Change the usb_mem API to take a bus_dma_tag_t in usb_allocmem instead of a struct usbd_bus *.
This allows an HCD to use more than one tag.
|
1.307 |
| 04-Oct-2021 |
andvar | remove duplicate the article in comments.
|
1.306 |
| 05-Jan-2021 |
skrll | More converstion from usbd_status to int for function error reporting. This time it's the turn of usb_allocmem.
|
1.305 |
| 22-Dec-2020 |
riastradh | usb: Omit bogus assertions about struct usbd_pipe::up_intrxfer.
These assertions were only valid for pipes at UE_IN_DIR, UE_INTERRUPT endpoints created with usbd_open_pipe_intr, which uses up_intrxfer to pass the struct usbd_xfer object to usbd_close_pipe to free later.
In contrast, for pipes at UE_OUT_DIR, UE_INTERRUPT endpoints, up_intrxfer is never initialized, so the assertion cannot be right. In principle we might even have more than one outstanding interrupt transfer at a time, rendering the point of the assertion moot anyway.
Found by interrupting a uhidev write to a u2f device.
ok nick
|
1.304 |
| 07-Jul-2020 |
skrll | branches: 1.304.2; KASSERT polling or holding sc_lock in a few more places.
kern/52569: Entering ddb using USB keyboard panics with "locking against myself"
|
1.303 |
| 26-May-2020 |
skrll | Copyright maintenance
|
1.302 |
| 25-May-2020 |
skrll | Be more careful with transfer descriptors and crossing page boundaries
Enable USBMALLOC_MULTISEG
|
1.301 |
| 15-May-2020 |
skrll | Update ux_length in usbd_setup_isoc_xfer and use this to usb_syncmem in the HCDs
|
1.300 |
| 05-Apr-2020 |
skrll | Switch USB to use non-coherent buffers for data transfers in the same way as OpenBSD.
The use of coherent (uncacheable on ARM and other arches) mappings for transfer buffers impacts performance, espcially where memcpys are involved.
Audit the necessary usb_syncmem operations - a few were missing.
|
1.299 |
| 15-Mar-2020 |
skrll | Fix a comment
|
1.298 |
| 15-Mar-2020 |
skrll | Move some comments
|
1.297 |
| 15-Mar-2020 |
skrll | Use howmany. NFCI.
|
1.296 |
| 14-Mar-2020 |
christos | revert the 0x% -> %# change for fixed width formats pointed out by uwe.
|
1.295 |
| 13-Mar-2020 |
christos | PR/55068: sc.dying: Fix printf formats: - no %s/%p for kernel log - 0x% -> %# - always %j for kernel log
|
1.294 |
| 21-Feb-2020 |
skrll | Fix a memory leak. Spotted by nat@
|
1.293 |
| 15-Feb-2020 |
riastradh | 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!)
|
1.292 |
| 14-Feb-2020 |
riastradh | Set ux_isdone in uhci_poll_hub for DIAGNOSTIC.
|
1.291 |
| 14-Feb-2020 |
riastradh | 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: https://mail-index.NetBSD.org/current-users/2020/02/13/msg037740.html
|
1.290 |
| 12-Feb-2020 |
riastradh | 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.
|
1.289 |
| 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.288 |
| 17-Feb-2019 |
rin | branches: 1.288.4; 1.288.6; Fix assertion failures triggered by usbdi.c,v 1.182, when devices are detached.
This is because xfers of USBD_NOT_STARTED can be removed from queue in an invisible way to host controller drivers.
Discussed on tech-kern.
|
1.287 |
| 07-Feb-2019 |
skrll | join lines. NFC.
|
1.286 |
| 22-Jan-2019 |
skrll | Revert the KASSERT
|
1.285 |
| 22-Jan-2019 |
skrll | Add a KASSERT
|
1.284 |
| 16-Sep-2018 |
mrg | consolidate the handling of polling across HC drivers, and generic USB: - don't take mutexes if polling - normalise the code across all drivers - add some not yet code to block discovery to/from polling - minor CSE - adjust comment for usbd_set_polling() to reality now i properly understand what it is used for and why.
this, with a hack to make RB_ASKNAME to wait 5 seconds allows boot -a work with USB keyboards. there are still multiple issues remaining: - discovery and polling need to be mutually exclusive - attachment of ukbd and wskbd is not handled by config_pending, and the 5 second delay isn't going to always be enough.
|
1.283 |
| 03-Sep-2018 |
riastradh | Rename min/max -> uimin/uimax for better honesty.
These functions are defined on unsigned int. The generic name min/max should not silently truncate to 32 bits on 64-bit systems. This is purely a name change -- no functional change intended.
HOWEVER! Some subsystems have
#define min(a, b) ((a) < (b) ? (a) : (b)) #define max(a, b) ((a) > (b) ? (a) : (b))
even though our standard name for that is MIN/MAX. Although these may invite multiple evaluation bugs, these do _not_ cause integer truncation.
To avoid `fixing' these cases, I first changed the name in libkern, and then compile-tested every file where min/max occurred in order to confirm that it failed -- and thus confirm that nothing shadowed min/max -- before changing it.
I have left a handful of bootloaders that are too annoying to compile-test, and some dead code:
cobalt ews4800mips hp300 hppa ia64 luna68k vax acorn32/if_ie.c (not included in any kernels) macppc/if_gm.c (superseded by gem(4))
It should be easy to fix the fallout once identified -- this way of doing things fails safe, and the goal here, after all, is to _avoid_ silent integer truncations, not introduce them.
Maybe one day we can reintroduce min/max as type-generic things that never silently truncate. But we should avoid doing that for a while, so that existing code has a chance to be detected by the compiler for conversion to uimin/uimax without changing the semantics until we can properly audit it all. (Who knows, maybe in some cases integer truncation is actually intended!)
|
1.282 |
| 09-Aug-2018 |
prlw1 | Sprinkle __diagused
|
1.281 |
| 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.280 |
| 09-Apr-2018 |
jakllsch | branches: 1.280.2; Stop potential misuse of vendor names and USB vendor IDs in root hub device and string descriptors.
Firstly: Few vendors have identical PCI-SIG vendor IDs and USB-IF vendor IDs. As such, using the PCI vendor ID as a USB vendor ID may trample on whomever is allocated that USB vendor ID.
Secondly: The vendor of the host controller hardware implementation has little to nothing to do with our usbroothub implementation. Thus we should not potentially associate any problems therewith to such third party.
This change will result in root hubs being identified by USB Vendor ID 0x0000. Root hub vendor string will now be "NetBSD" (or, specifically: ostype). Product ID (0x0000) and product strings remain unchanged.
|
1.279 |
| 17-Nov-2017 |
skrll | branches: 1.279.2; s/PR_NOWAIT/PR_WAITOK/ in HCD allocx (allocate xfer) method
|
1.278 |
| 16-Nov-2017 |
christos | don't lock if we are polling because we are already holding a spin lock from uhci_poll().
|
1.277 |
| 28-Oct-2017 |
pgoyette | Update the kernhist(9) kernel history code to address issues identified in PR kern/52639, as well as some general cleaning-up...
(As proposed on tech-kern@ with additional changes and enhancements.)
Details of changes:
* All history arguments are now stored as uintmax_t values[1], both in the kernel and in the structures used for exporting the history data to userland via sysctl(9). This avoids problems on some architectures where passing a 64-bit (or larger) value to printf(3) can cause it to process the value as multiple arguments. (This can be particularly problematic when printf()'s format string is not a literal, since in that case the compiler cannot know how large each argument should be.)
* Update the data structures used for exporting kernel history data to include a version number as well as the length of history arguments.
* All [2] existing users of kernhist(9) have had their format strings updated. Each format specifier now includes an explicit length modifier 'j' to refer to numeric values of the size of uintmax_t.
* All [2] existing users of kernhist(9) have had their format strings updated to replace uses of "%p" with "%#jx", and the pointer arguments are now cast to (uintptr_t) before being subsequently cast to (uintmax_t). This is needed to avoid compiler warnings about casting "pointer to integer of a different size."
* All [2] existing users of kernhist(9) have had instances of "%s" or "%c" format strings replaced with numeric formats; several instances of mis-match between format string and argument list have been fixed.
* vmstat(1) has been modified to handle the new size of arguments in the history data as exported by sysctl(9).
* vmstat(1) now provides a warning message if the history requested with the -u option does not exist (previously, this condition was silently ignored, with only a single blank line being printed).
* vmstat(1) now checks the version and argument length included in the data exported via sysctl(9) and exits if they do not match the values with which vmstat was built.
* The kernhist(9) man-page has been updated to note the additional requirements imposed on the format strings, along with several other minor changes and enhancements.
[1] It would have been possible to use an explicit length (for example, uint64_t) for the history arguments. But that would require another "rototill" of all the users in the future when we add support for an architecture that supports a larger size. Also, the printf(3) format specifiers for explicitly-sized values, such as "%"PRIu64, are much more verbose (and less aesthetically appealing, IMHO) than simply using "%ju".
[2] I've tried very hard to find "all [the] existing users of kernhist(9)" but it is possible that I've missed some of them. I would be glad to update any stragglers that anyone identifies.
|
1.276 |
| 14-Jul-2017 |
skrll | Only call uhci_free_stds if there are TDs to free.
In uhci_alloc_std_chain ensure we fill the TD array correctly and note the number of allocated TDs so that uhci_free_stds will do the right thing
Fixes a problem seen by anon
|
1.275 |
| 01-Jun-2017 |
chs | branches: 1.275.2; remove checks for failure after memory allocation calls that cannot fail:
kmem_alloc() with KM_SLEEP kmem_zalloc() with KM_SLEEP percpu_alloc() pserialize_create() psref_class_create()
all of these paths include an assertion that the allocation has not failed, so callers should not assert that again.
|
1.274 |
| 04-Dec-2016 |
skrll | Whitespace
|
1.273 |
| 10-May-2016 |
pooka | branches: 1.273.2; sprinkle _KERNEL_OPT
|
1.272 |
| 06-May-2016 |
christos | - don't require the lock if we are polling (early autoconf) - unfold a line
|
1.271 |
| 06-May-2016 |
skrll | usb is attached with config_interrupts so we can G/C the code to support transfers when this wasn't the case.
|
1.270 |
| 25-Apr-2016 |
joerg | Don't use uninitialized data variable when len == 0.
|
1.269 |
| 23-Apr-2016 |
skrll | Fix non-DIAGNOSTIC build
|
1.268 |
| 23-Apr-2016 |
skrll | 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.267 |
| 13-Mar-2016 |
skrll | KNF
|
1.266 |
| 19-Aug-2015 |
skrll | More IPL_SCHED -> IPL_USB
|
1.265 |
| 01-Mar-2015 |
skrll | Whitespace.
|
1.264 |
| 05-Aug-2014 |
skrll | branches: 1.264.2; 1.264.4; 1.264.8; Simplify the freeing of the interrupt pipe transfer. Inspired by OpenBSD.
|
1.263 |
| 01-Dec-2013 |
skrll | branches: 1.263.2; Adjust KASSERT in device_ctrl_done to polling case.
PR/48213: ehci assertion failure during boot
|
1.262 |
| 28-Oct-2013 |
matt | Add an explicit initialization of .new_device = NULL
|
1.261 |
| 29-Sep-2013 |
skrll | Really dump all by calling uhci_dump_qhs and not uhci_dump_qh
|
1.260 |
| 14-Sep-2013 |
joerg | Put UREAD4 under UHCI_DEBUG
|
1.259 |
| 08-Sep-2013 |
skrll | Add sc->sc_bus.use_polling || to a couple of KASSERTs
PR/46826
|
1.258 |
| 07-Sep-2013 |
skrll | Deal with control transfers better by
- removing the UHCI_PTR_VF flag for the setup and status stages which means they are scheduled less aggressively. Some devices appear to require this (blymn@ has one). The flag was introduced as a performance improvement for bulk transfers.
- Checking for short reads and making sure the status stage runs if they're encountered.
PR/47522 Enumeration of LUFA/Atmel devices on UHCI fails
Thanks to jak@ and blymn@ for testing and mlelstv@ for comments.
|
1.257 |
| 04-Apr-2013 |
skrll | branches: 1.257.4; Don't take the bus lock in usbd_transfer_complete when polling.
Sprinkle || polling in KASSERTsw
|
1.256 |
| 01-Feb-2013 |
tsutsui | Call usb_syncmem() against descriptors more strictly. (not sure if the previous ones were fatal though)
|
1.255 |
| 30-Jan-2013 |
tsutsui | Add missed byteswap ops for BE machines in block added in rev 1.223.
|
1.254 |
| 29-Jan-2013 |
christos | correct previous. assign the sc, and move the destroy later where it is safe
|
1.253 |
| 29-Jan-2013 |
christos | use a pool instead of a linked list to avoid synchronization problems.
|
1.252 |
| 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.251 |
| 05-Jan-2013 |
christos | fix debug variables. - include opt_usb.h in usb.h so that USB_DEBUG gets set properly in it. - normalize and sort debugging variables
|
1.250 |
| 05-Jan-2013 |
christos | - need opt_usb.h if depending on USB_DEBUG - remove trailing whitespace - add missing KERNEL_RCSID
|
1.249 |
| 24-Jun-2012 |
drochner | branches: 1.249.2; stopgap fix for recursive locking on suspend/resume (This can be simplified imo because interrupts should be disabled at this point.)
|
1.248 |
| 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.247 |
| 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.246 |
| 10-Mar-2012 |
mrg | remove checks against "!curproc".
|
1.245 |
| 06-Mar-2012 |
mrg | pull down from usbmp branch:
- rename usb_detach_{wake,waitup}() to usb_detach_{wake,waitup}old() - use some c99 struct .initialisers
|
1.244 |
| 06-Mar-2012 |
mrg | pull down from usbmp:
kill the !USE_USE_SOFTINTR code.
|
1.243 |
| 06-Mar-2012 |
mrg | pull down from usbmp branch:
- remove SPLUSBCHECK. it has been broken and disabled for ages.
|
1.242 |
| 23-Dec-2011 |
jakllsch | branches: 1.242.2; 1.242.6; 1.242.8; Revert previous due to active usbmp branch(es).
|
1.241 |
| 22-Dec-2011 |
jakllsch | Adjust-away inconsistent and trailing whitespace.
|
1.240 |
| 07-Aug-2011 |
jakllsch | branches: 1.240.2; 1.240.6; Make uhci_find_prev_qh() always 'static inline', just 'inline" leads to trouble.
|
1.239 |
| 09-Jun-2011 |
matt | Move EHCI_DEBUG, OHCI_DEBUG, UHCI_DEBUG, USB_DEBUG, UHUB_DEBUG to opt_usb.h (ya dependencies). Cleanup usb_mem.c a little more and add block tracking code. Help find corruption problems. Comment out the SPEED check for ETTF. XXX why doesn't that work right?
|
1.238 |
| 28-May-2011 |
tsutsui | branches: 1.238.2; Revert changes for PR kern/44907 http://mail-index.NetBSD.org/source-changes/2011/05/27/msg022584.html for now. It might cause a panic in ehci_freex() on device detach as reported by Paul Goyette on current-users@.
|
1.237 |
| 27-May-2011 |
tsutsui | Apply patch in PR kern/44907 (crash due to race in ehci.c): - make sure to remove abort_task in ehci_freex - always initialize abort_task in ehci_allocx, not in ehci_timeout just before adding the task Also apply similar fixes to ohci and uhci.
XXX: should we also call abort_task handler before removing it from queue if *hci_freex() is called for usbd_xfer_handle with queued abort_task?
|
1.236 |
| 27-May-2011 |
drochner | 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.235 |
| 13-Nov-2010 |
uebayasi | branches: 1.235.2; Don't pull in the whole uvm(9) API to access only PAGE_SIZE and some other constants. These are provided by sys/param.h now.
|
1.234 |
| 03-Nov-2010 |
dyoung | Stop using the compatibility macros USB_ATTACH(), USB_DETACH(), USB_MATCH(), et cetera. These files produce the same assembly (according to objdump -d) before and after the change
|
1.233 |
| 29-Jun-2010 |
msaitoh | Do not process the abnormality system procedure, when Run/Stop=0 and HCHalted=1 - this is normal. Fixes a bug that system hangs at boot time when a USB mass storage is connected via UHCI. This problem was observed on Intel D410PT and was fixed by Katsumi Yamada.
|
1.232 |
| 24-Feb-2010 |
dyoung | branches: 1.232.2; 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.
|
1.231 |
| 08-Jan-2010 |
dyoung | branches: 1.231.2; Expand PMF_FN_* macros.
|
1.230 |
| 12-Nov-2009 |
dyoung | Simplify activation hook. (sc_dying must die!)
unifdef -D__NetBSD__ -U__FreeBSD__ -U__OpenBSD__.
|
1.229 |
| 01-Nov-2009 |
uebayasi | Update referencial URLs.
|
1.228 |
| 02-May-2009 |
martin | Correct previous: detaching uhubN makes the bus pointer NULL
|
1.227 |
| 02-May-2009 |
martin | If we are unlucky, during detach of child devices, after a uhub has detached, our uhci_poll_hub callout might strike. The detaching of the uhub has left the device member in the pipe NULL, so make sure we do not dereference it.
We could halt the callout before detaching child devices, but it this would likely interfere with proper servicing the child devices while they are still around.
|
1.226 |
| 19-Apr-2009 |
ad | In this case "XXX free other data structures XXX" includes stopping and destroying the callout.
|
1.225 |
| 06-Mar-2009 |
bouyer | Make it safe to call uhci_init() from a kernel thread with interrupts enabled: - don't enable interrupts before calling uhci_run() - check if the controller's interrupt is enabled in uhci_intr() The issue is that uhci_run() may tsleep(), uhci_intr1() may be called before uhci_run() is complete and disable it because it found it halted.
Now a uhci controller can be successfully exported to a NetBSD Xen domU :)
|
1.224 |
| 16-Dec-2008 |
christos | branches: 1.224.2; replace bitmask_snprintf(9) with snprintb(3)
|
1.223 |
| 28-Jun-2008 |
bouyer | branches: 1.223.4; 1.223.6; 1.223.12; 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.
|
1.222 |
| 16-Jun-2008 |
drochner | fix selective port resume signaling (not used in normal operation, just for correctness)
|
1.221 |
| 06-Jun-2008 |
jmcneill | branches: 1.221.2; uhci_device_intr_done: when re-queueing, pass pipe direction to uhci_alloc_std_chain instead of always 1 (read). ok drochner
|
1.220 |
| 02-Jun-2008 |
bouyer | Fix probable cut-n-paste error: make the virtual QH link match the physical one. The effect of this was just that the virtual list missed the chsqh entry, it only shows up when looking at debug outputs.
|
1.219 |
| 02-Jun-2008 |
jmcneill | Set sc_suspend properly so we can avoid a potential HCH on resume.
|
1.218 |
| 21-May-2008 |
drochner | fix argument to usb_setup_reserve() (called from USB host adapter drivers) to be device_t consistently, from Quentin Garnier
|
1.217 |
| 28-Apr-2008 |
martin | branches: 1.217.2; Remove clause 3 and 4 from TNF licenses
|
1.216 |
| 28-Mar-2008 |
drochner | branches: 1.216.2; 1.216.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.215 |
| 22-Feb-2008 |
dyoung | Add a method to detach child.
Cosmetic: use device_t and accessors. Use aprint_*_dev(). Use PMF_FN_{ARGS,CALL,PROTO}.
|
1.214 |
| 13-Feb-2008 |
smb | branches: 1.214.2; 1.214.6; Patch from Jared McNeill to prevent USB interrupt storms on resume on Thinkpad T61. (Note: to prevent a very similar-seeming problem, T61 users should also install firmware 2.06 or later, according to thinkwiki.)
|
1.213 |
| 03-Feb-2008 |
drochner | share some code for USB root hub emulation which is common in the 3 host controller implementations, start with two little functions which fake up string descriptors (which were inconststent, language table fetching didn't interoperate with other code in the tree)
|
1.212 |
| 09-Dec-2007 |
jmcneill | Merge jmcneill-pm branch.
|
1.211 |
| 19-Oct-2007 |
ad | branches: 1.211.2; 1.211.4; 1.211.6; machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
|
1.210 |
| 15-Aug-2007 |
kiyohara | branches: 1.210.2; 1.210.6; * splsoftusb, IPL_SOFTUSB, and IPL_HARDUSB defines in usbdi.h -> the current names are confusing (didn't change other drivers) * fix invalid memory access in usbd_transfer (kern/24636) -> needed for this driver * fix USB HC detach race condition (kern/32011) -> main patch needed for this driver, sc_dying changes in other drivers not necessary but seem right to me
Patch from Matthew Orgass. http://mail-index.netbsd.org/tech-kern/2007/06/26/0001.html
|
1.209 |
| 01-Aug-2007 |
jmcneill | branches: 1.209.2; 1.209.4; Clear the run flag in the command register when powering down, from FreeBSD. Makes my laptop, and hopefully others, successfully sleep. Waking up is a different story...
|
1.208 |
| 26-Feb-2007 |
drochner | branches: 1.208.4; 1.208.12; 1.208.14; -in root hub emulation, return a sane value as language code -constify "methods" tables and (partly) descriptor templates
|
1.207 |
| 10-Feb-2007 |
mlelstv | branches: 1.207.2; The diagnostic code doesn't track busy_free correctly when a device gets removed. However, when the diagnostic check fails, it is much better to complete the free operation than to abort it, because this just causes an infinite loop.
|
1.206 |
| 19-Jan-2007 |
drochner | Kill the "bus powered" bit in the configuration descriptor. This doesn't exist in newer spec revisions, and is recommended to be set to 1. So call it _MBO and also use it in the fake root hub descriptors, just for sanity, even if nothing ever looks at it.
|
1.205 |
| 16-Nov-2006 |
christos | branches: 1.205.2; __unused removal on arguments; approved by core.
|
1.204 |
| 31-Oct-2006 |
joerg | Split the USB task queue into two parts, one for normal device tasks and one for tasks of the host controllers. This is needed for drivers like ural(4) that want to do synchronous USB transfers from the task handler. Before the split timeouts could not be handled correctly as the task thread was still blocked. From FreeBSD.
|
1.203 |
| 12-Oct-2006 |
christos | - sprinkle __unused on function decls. - fix a couple of unused bugs - no more -Wno-unused for i386
|
1.202 |
| 03-Oct-2006 |
christos | Coverity CID 3061: Add KASSERT (from Arnaud Lacombe)
|
1.201 |
| 25-Sep-2006 |
jmcneill | Only display "interrupt while not running ignored" if DIAGNOSTIC is set, as whenever this happens, so many messages are spewed to the screen from the kernel that the system is effectively useless. Hardly ignored :-)
|
1.200 |
| 24-Sep-2006 |
jmcneill | Add "name" parameter to powerhook_establish, to aid debugging. No objections on tech-kern@
|
1.199 |
| 03-Sep-2006 |
christos | branches: 1.199.2; 1.199.4; add missing initializers.
|
1.198 |
| 03-Sep-2006 |
christos | add missing initializer.
|
1.197 |
| 19-Jun-2006 |
gdamore | Initial import of bluetooth stack on behalf of Iain Hibbert. (plunky@, NetBSD Foundation Membership still pending.) This stack was written by Iain under sponsorship from Itronix Inc.
The stack includes support for rfcomm networking (networking via your bluetooth enabled cell phone), hid devices (keyboards/mice), and headsets.
Drivers for both PCMCIA and USB bluetooth controllers are included.
|
1.196 |
| 12-May-2006 |
mrg | branches: 1.196.2; 1.196.4; make [OU]READ[124]() real inline functions instead of macros.
|
1.195 |
| 14-Apr-2006 |
christos | Coverity CID 1133: Abort quickly if we don't have a buffer in all the cases.
|
1.194 |
| 31-Mar-2006 |
christos | Only do the software reset if we are dying, like we do in ohci and ehci. Pointed out by SAITOH Masanobu
|
1.193 |
| 05-Mar-2006 |
augustss | branches: 1.193.2; 1.193.4; Use polling while shutting down the host controller since interrupts cannot be trusted at this point. From Iain Hibbert <plunky@rya-online.net>.
|
1.192 |
| 24-Dec-2005 |
perry | branches: 1.192.4; 1.192.6; 1.192.8; __inline__ -> inline
|
1.191 |
| 11-Dec-2005 |
christos | merge ktrace-lwp.
|
1.190 |
| 18-Jul-2005 |
augustss | Make sure we don't enable host controller interrupts until all initialization is finished.
|
1.189 |
| 30-May-2005 |
christos | branches: 1.189.2; - const poisoning - eliminate variable shadowing
|
1.188 |
| 30-Apr-2005 |
augustss | 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.187 |
| 29-Apr-2005 |
skrll | Complete the interrupt output transfer support copy from FreeBSD, but remove the incorrect access to the bulk part of the union.
Reviewed and OK'ed by Lennart.
|
1.186 |
| 27-Apr-2005 |
skrll | KNF and s/a an/an/
|
1.185 |
| 02-Mar-2005 |
mycroft | branches: 1.185.2; Copyright maintenance.
|
1.184 |
| 27-Feb-2005 |
perry | nuke trailing whitespace
|
1.183 |
| 21-Dec-2004 |
fvdl | branches: 1.183.2; 1.183.4; 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.
|
1.182 |
| 26-Oct-2004 |
augustss | Allow strings descriptor 0 to be fetched. It's the default language index.
|
1.181 |
| 22-Jul-2004 |
drochner | typo in comment
|
1.180 |
| 17-Jul-2004 |
mycroft | hcpriv is not actually used here. Remove references to it.
|
1.179 |
| 29-Jun-2004 |
mycroft | Make one message dependent on ohcidebug, so it doesn't interfere with polled operation; e.g. when entering a root device or in DDB.
|
1.178 |
| 02-Mar-2004 |
martin | branches: 1.178.2; Interrupt descriptors might become invalid while being processed in uhci_check_intr - so remember their next pointer before calling it. Patch provided by Matthew Orgass in PR kern/24542.
|
1.177 |
| 29-Dec-2003 |
toshii | Use the correct wValue to get hub desriptors. Also, make wValue checks of root hub codes less strict.
|
1.176 |
| 04-Nov-2003 |
mycroft | Ignore a CRCTO error on a SETUP transaction in combination with STALLED or NAK. This fixes problems with the GL641.
|
1.175 |
| 12-Sep-2003 |
mycroft | Tweak a debugging printf().
|
1.174 |
| 03-Jul-2003 |
drochner | avoid a gcc3 warning about a never-true comparision in the mstohz() macro
|
1.173 |
| 13-May-2003 |
gson | branches: 1.173.2; Function names printed in debug messages did not always match the actual name of the function.
|
1.172 |
| 23-Feb-2003 |
simonb | Remove unreachable break after return.
|
1.171 |
| 22-Feb-2003 |
tsutsui | Use mstohz() in <sys/param.h> rather than homegrown MS_TO_TICKS().
|
1.170 |
| 19-Feb-2003 |
augustss | Bail out early in isoc_done if the ii is not on the interrupt list.
|
1.169 |
| 16-Feb-2003 |
augustss | Don't take xfers off the interrupt list if they are not on it yet.
|
1.168 |
| 08-Feb-2003 |
ichiro | change URL pointers of USB[1,2] specification
|
1.167 |
| 01-Jan-2003 |
augustss | Reissue the MAXP command on resume. From FreeBSD.
|
1.166 |
| 31-Dec-2002 |
dsainty | Be somewhat more persuasive about enabling the port on a port reset. USB protocol dictates that the port enable must be implied by the port reset. To implement this on (at least) the VIA VT83C572 this means we need to wait around tweaking the chip state until the port actually transitions to enabled (or the device goes away). Likely fixes kern/11018.
|
1.165 |
| 31-Dec-2002 |
dsainty | CONSTCOND away some lint warnings
|
1.164 |
| 29-Sep-2002 |
augustss | Add #ifdef USB_USE_SOFTINTR for some softintr code. From FreeBSD.
|
1.163 |
| 27-Sep-2002 |
provos | remove trailing \n in panic(). approved perry.
|
1.162 |
| 11-Jul-2002 |
augustss | Get rid of trailing white space.
|
1.161 |
| 01-Jun-2002 |
lukem | SIMPLEQ rototill: - implement SIMPLEQ_REMOVE(head, elm, type, field). whilst it's O(n), this mirrors the functionality of SLIST_REMOVE() (the other singly-linked list type) and FreeBSD's STAILQ_REMOVE() - remove the unnecessary elm arg from SIMPLEQ_REMOVE_HEAD(). this mirrors the functionality of SLIST_REMOVE_HEAD() (the other singly-linked list type) and FreeBSD's STAILQ_REMOVE_HEAD() - remove notes about SIMPLEQ not supporting arbitrary element removal - use SIMPLEQ_FOREACH() instead of home-grown for loops - use SIMPLEQ_EMPTY() appropriately - use SIMPLEQ_*() instead of accessing sqh_first,sqh_last,sqe_next directly - reorder manual page; be consistent about how the types are listed - other minor cleanups
|
1.160 |
| 28-May-2002 |
augustss | Change DMAADDR macro slightly.
|
1.159 |
| 19-May-2002 |
augustss | branches: 1.159.2; Update dma memory access API a little.
|
1.158 |
| 17-Mar-2002 |
augustss | branches: 1.158.4; Whitespace fixes.
|
1.157 |
| 16-Mar-2002 |
tsutsui | Fix a couple of typo: - s/ehci/uhci/ (in unused arg of macro) - s/ohci/uhci/ (in panic message)
|
1.156 |
| 04-Mar-2002 |
augustss | Use the correct pointer for the timeout abort.
|
1.155 |
| 27-Feb-2002 |
augustss | Move the interrupt bailout when a cancelled ii is found.
|
1.154 |
| 27-Feb-2002 |
augustss | Remove spurious splusb(). Lower abort hardware wait.
|
1.153 |
| 11-Feb-2002 |
augustss | Switch to the same abort mechanism as in [eo]hci; it should be more robust.
|
1.152 |
| 03-Feb-2002 |
augustss | Some white space fixes from FreeBSD.
|
1.151 |
| 27-Jan-2002 |
augustss | Use M_WAITOK instead of M_NOWAIT when allocating extra descriptors. Spotted by OpenBSD.
|
1.150 |
| 14-Jan-2002 |
tsutsui | Call malloc(9) with M_ZERO flag instead of memset() after malloc().
|
1.149 |
| 21-Nov-2001 |
augustss | Use NULL not 0.
|
1.148 |
| 21-Nov-2001 |
augustss | Fix typo in comment.
|
1.147 |
| 21-Nov-2001 |
augustss | Cast some args to bitmask_snprintf().
|
1.146 |
| 20-Nov-2001 |
augustss | Don't bother with interrupts when being disconnected.
|
1.145 |
| 20-Nov-2001 |
augustss | Use longer reset for root hubs (as told in the spec).
|
1.144 |
| 20-Nov-2001 |
augustss | Keep track of device speed for USB 2.0.
|
1.143 |
| 13-Nov-2001 |
lukem | add RCSIDs
|
1.142 |
| 25-Oct-2001 |
augustss | Change reset sequence to get status change bits set right on startup.
|
1.141 |
| 24-Oct-2001 |
augustss | Some more paranoia tests when entering the interrupt routine.
|
1.140 |
| 24-Oct-2001 |
augustss | More debug.
|
1.139 |
| 24-Oct-2001 |
augustss | More null pointer checks in dump routine.
|
1.138 |
| 02-Oct-2001 |
pooka | branches: 1.138.2; move DIAGNOSTIC-printf up one block to make it reachable
noted by Christophe Kalt in private email
|
1.137 |
| 06-Aug-2001 |
augustss | branches: 1.137.2; Don't write back status bits that are cleared when written.
|
1.136 |
| 11-Jul-2001 |
augustss | Rearrange register dump when the controller is dying. Fixes PR 13430.
|
1.135 |
| 01-Apr-2001 |
augustss | branches: 1.135.2; Avoid a potential null pointer dereference. From OpenBSD.
|
1.134 |
| 25-Mar-2001 |
augustss | Try to make resume work on more machines.
|
1.133 |
| 21-Jan-2001 |
augustss | branches: 1.133.2; 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.132 |
| 20-Jan-2001 |
augustss | Change some splusb() to splhardusb().
|
1.131 |
| 29-Dec-2000 |
augustss | Update many URLs.
|
1.130 |
| 18-Dec-2000 |
tsutsui | Add missed le32toh() in uhci_device_isoc_abort().
|
1.129 |
| 16-Dec-2000 |
augustss | Don't repeat 'host controller halted' message. From OpenBSD.
|
1.128 |
| 26-Nov-2000 |
takemura | Add new powerhook argument values, PWR_SOFTSUSPEND, PWR_SOFTSTANDBY and PWR_SOFTRESUME. Apm calls powerhook with the values in normal interrupt priority level while others are protected with splhigh().
|
1.127 |
| 22-Nov-2000 |
soren | In uhci_intr(), only warn about power state confusion if the interrupt was actually for us.
|
1.126 |
| 10-Nov-2000 |
augustss | Update frlengths after a isoc transfer. Suggested by Yuri <yuri@tsoft.com>
|
1.125 |
| 23-Sep-2000 |
augustss | Avoid "bandwidth reclamation" for control transfers. The kue device chokes on it.
|
1.124 |
| 13-Aug-2000 |
augustss | Fix race condition when unlinking xfers. Thanks to IWAMOTO Toshihiro <iwamoto@sat.t.u-tokyo.ac.jp> for analyzing the problem and suggesting a fix. Fixes PR 10662.
|
1.123 |
| 13-Aug-2000 |
augustss | Implement what in Intel-speech is known as "bandwidth reclamation". It means that we continously poll USB devices that have a pending transfer instead of polling just once every ms. This speeds up some transfers at the expense of using more PCI bandwidth.
|
1.122 |
| 08-Aug-2000 |
tv | %b -> bitmask_snprintf()
Because this code is shared, add a macro for bitmask_snprintf() that should expand to the equivalent snprintf() on non-NetBSD systems. This is only used in ?HCI_DEBUG cases anyway.
|
1.121 |
| 23-Jul-2000 |
augustss | Be a little more explicit and careful about setting links in TDs and QHs.
|
1.120 |
| 01-Jun-2000 |
augustss | branches: 1.120.2; Make it compile with USB_DEBUG.
|
1.119 |
| 01-Jun-2000 |
augustss | Bring the coding style into the 80s, i.e., get rid of __P and use ANSI prototypes and declarations.
|
1.118 |
| 30-May-2000 |
augustss | Don't print anything when detecting resume.
|
1.117 |
| 30-May-2000 |
augustss | As a safety, check that the controller is not suspended when we get an interrupt.
|
1.116 |
| 28-May-2000 |
jhawk | Make this compile with UHCI_DEBUG in the presence of -Werror: uhci_dump is no longer static.
|
1.115 |
| 03-May-2000 |
mycroft | branches: 1.115.2; Use USBD_NORMAL_COMPLETION in the previous.
|
1.114 |
| 03-May-2000 |
mycroft | When emulating UHF_PORT_POWER for the internal hub, make sure to initialize the status return value.
|
1.113 |
| 27-Apr-2000 |
augustss | Change my email address.
|
1.112 |
| 25-Apr-2000 |
augustss | Insert (very conservative!) bus_space_barrier() calls at all register accesses. The bus_space(9) man page says you've gotta have them...
|
1.111 |
| 21-Apr-2000 |
augustss | Pretend we know how to turn on port power (it's always on).
|
1.110 |
| 14-Apr-2000 |
augustss | Generate a diagnistic dump on "Host Controller Halted".
|
1.109 |
| 06-Apr-2000 |
augustss | Fix typos in comments.
|
1.108 |
| 29-Mar-2000 |
augustss | Remove some unused prototypes.
|
1.107 |
| 29-Mar-2000 |
augustss | Some OpenBSD portability fixes.
|
1.106 |
| 29-Mar-2000 |
augustss | *SIGH* Revert back to the old method of aborting xfers. I had tested the new stuff for two months now, but as soon as I commited it the problems started to appear. Murphy, no doubt...
|
1.105 |
| 28-Mar-2000 |
augustss | Be more defensive in a DIAGNOSTIC test.
|
1.104 |
| 28-Mar-2000 |
augustss | Correct a debug message.
|
1.103 |
| 28-Mar-2000 |
augustss | Another patch for xfer abort... XXX The current xfer queueing and aborting semantics should really XXX be changed. It cannot be implemented in a sane way on UHCI. XXX One day when I have lots of time I'll redesign it...
|
1.102 |
| 27-Mar-2000 |
augustss | Be a little more careful when aborting. Preallocate some TDs for large buffers.
|
1.101 |
| 27-Mar-2000 |
augustss | Change (almost) all static to Static. The symbol `Static' can then be defined to `' or `static' depending on if you want to debug or not.
|
1.100 |
| 27-Mar-2000 |
augustss | Don't mess with QH in bulk abort for the moment.
|
1.99 |
| 27-Mar-2000 |
augustss | Remove some debug nonsense.
|
1.98 |
| 27-Mar-2000 |
augustss | Make it compile without DIAGNOSTIC.
|
1.97 |
| 26-Mar-2000 |
augustss | Fix typo. Found by Aaron Campbell <aaron@cs.dal.ca>.
|
1.96 |
| 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.95 |
| 25-Mar-2000 |
augustss | Improve uhci_dump_ii().
|
1.94 |
| 25-Mar-2000 |
augustss | More DIAGNOSTIC. Initialize a callout handle I forgot.
|
1.93 |
| 25-Mar-2000 |
augustss | Add more DIAGNOSTIC when aborting isoc.
|
1.92 |
| 24-Mar-2000 |
augustss | Two major changes:
Make each xfer have its own intr_info. This is necessary if we want to queue multiple xfers on an endpoint. This should get rid of the (mostly harmless) DIAGNOSTICs about intr_infos (not) being done.
Change (again!) how xfers are aborted. Aborting a TD is a nightmare on the braindead UHCI controller. (Unless you stop the HC, thereby losing isoc traffic.) Hopefully I got it right this time.
|
1.91 |
| 24-Mar-2000 |
augustss | Some cleanup and renaming of the callouts used in USB drivers.
|
1.90 |
| 23-Mar-2000 |
thorpej | Shake out some bugs from the callout changes.
|
1.89 |
| 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.88 |
| 16-Mar-2000 |
tsutsui | Replace LE() macro with le32toh()/le32toh().
|
1.87 |
| 29-Feb-2000 |
augustss | Distinguish between device and interface classes. (I finally found a document that said that they were different.)
|
1.86 |
| 22-Feb-2000 |
augustss | Save and restore a couple ofregisters in the power hook in case BIOS doesn't.
|
1.85 |
| 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.84 |
| 28-Jan-2000 |
augustss | Add uhci_root_ctrl_done() method.
|
1.83 |
| 28-Jan-2000 |
augustss | Change the test to check if transfers are done. The old test was broken and sometimes reported transfers as done prematurely. This fix seems to stabilize the Ethernet drivers.
|
1.82 |
| 26-Jan-2000 |
augustss | Try to avoid accessing the HC if it is dead. Suggested by mycroft.
|
1.81 |
| 25-Jan-2000 |
augustss | Switch the HSE and HCPE messages. Pointed out my mycroft.
|
1.80 |
| 19-Jan-2000 |
augustss | Fix typos. Never, never, never commit without compiling first.
|
1.79 |
| 19-Jan-2000 |
augustss | Obey the interrupt interval here also.
|
1.78 |
| 19-Jan-2000 |
augustss | Fix a buglet in framelist locking.
|
1.77 |
| 18-Jan-2000 |
augustss | Move the zeroing of the xfer to the individual methods.
|
1.76 |
| 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.75 |
| 17-Jan-2000 |
augustss | Be a little more talkative on with UHCIDEBUG on errors.
|
1.74 |
| 16-Jan-2000 |
augustss | Remove some debug code that was commited by mistake.
|
1.73 |
| 16-Jan-2000 |
augustss | Add a flag, USBD_FORCE_SHORT_XFER, to transfers. Using this flag will force the last packet of a transfer to be smaller than the maximum packet size. The only time this matters is if the transfer size is a multiple of the maximum packet size, in which case a 0 length packet is sent last. Some weird devices require this behaviour to determine the end of a transfer.
|
1.72 |
| 16-Jan-2000 |
augustss | Add shutdown hooks to ensure that the host controller is halted when a reboot occurs.
|
1.71 |
| 24-Dec-1999 |
augustss | Turn on the MAXP bit in the controller to allow 64 byte packets at the end of a frame.
|
1.70 |
| 06-Dec-1999 |
augustss | Cosmetics and a couple of diagnostic messages.
|
1.69 |
| 01-Dec-1999 |
augustss | Use vertical nscheduling for bulk traffic. It improves bulk thruput a lot. From FreeBSD and Nick Hibma.
|
1.68 |
| 23-Nov-1999 |
augustss | A little cosmetic.
|
1.67 |
| 18-Nov-1999 |
augustss | Cosmetic changes and some small improvements. From FreeBSD and Nick Hibma.
|
1.66 |
| 17-Nov-1999 |
augustss | A few more purely stylistic changes that I missed in the last round.
|
1.65 |
| 16-Nov-1999 |
augustss | Add a few more diagnostics.
|
1.64 |
| 13-Nov-1999 |
augustss | Get transfer status right on short transfers. From FreeBSD, Nick Hibma.
|
1.63 |
| 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.62 |
| 23-Oct-1999 |
augustss | Fix PR8666, to verbose diagnostics.
|
1.61 |
| 17-Oct-1999 |
augustss | branches: 1.61.2; 1.61.4; Handle the (weird) case when the power hook is called with a resume without a prior suspend.
|
1.60 |
| 16-Oct-1999 |
augustss | Add a DIAGNOSTIC to check that the polling flag is set when resuming.
|
1.59 |
| 13-Oct-1999 |
augustss | Merge in a large batch of changes from Nick Hibma <hibma@skylink.it> so the USB stack compiles on FreeBSD again.
|
1.58 |
| 12-Oct-1999 |
augustss | Fix some bugs in USB controller detach code.
|
1.57 |
| 12-Oct-1999 |
augustss | Deallocate resources (bus space and interrupts) when detaching from the bus.
|
1.56 |
| 18-Sep-1999 |
augustss | branches: 1.56.2; Make sure the HC deactivation is propagated.
|
1.55 |
| 15-Sep-1999 |
augustss | Cosmetic change: s/xfer/data/
|
1.54 |
| 15-Sep-1999 |
augustss | Handle the use_polling flag with a lttle more care and only set it if we are cold booting.
|
1.53 |
| 15-Sep-1999 |
augustss | Add preliminary (untested) code for detaching the USB host controller (needed for CardBus based controllers).
|
1.52 |
| 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.51 |
| 13-Sep-1999 |
augustss | Make sure timeouts count as interrupt context too.
|
1.50 |
| 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.49 |
| 11-Sep-1999 |
augustss | * Move DMA buffer allocation to HC independent code. * Remove (almost) unused definitions USBD_XFER_OUT and USBD_XFER_IN.
|
1.48 |
| 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.47 |
| 05-Sep-1999 |
augustss | Change some printf to DPRINTF for consistency. From Nick Hibma, FreeBSD.
|
1.46 |
| 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.45 |
| 04-Sep-1999 |
augustss | Change the way the direction is extracted from the endpoint descriptor. No functional changes to the drivers. From Nick Hibma, FreeBSD.
|
1.44 |
| 02-Sep-1999 |
augustss | Rewrite interrupt routine from clarity. From Nick Hibma, FreeBSD.
|
1.43 |
| 22-Aug-1999 |
augustss | Merge the soft_{td,ed} with the real {td,ed}. This saves time and space. (And fix typo in corresponding uhci change.)
|
1.42 |
| 22-Aug-1999 |
augustss | Merge the soft_{td,qh} with the real {td,qh}. This saves time and space.
|
1.41 |
| 22-Aug-1999 |
augustss | Move more of the transfer completion processing to HC independent code. Fix some problems with transfer abort & timeout.
|
1.40 |
| 20-Aug-1999 |
augustss | Make sure not to call tsleep() from suspend/resume routine.
|
1.39 |
| 19-Aug-1999 |
augustss | A first stab at making the UHCI driver endian independent. (It doesn't seem to be quite working yet.)
|
1.38 |
| 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.37 |
| 17-Aug-1999 |
augustss | Make some small changes to make it compile on OpenBSD.
|
1.36 |
| 16-Aug-1999 |
augustss | Change the way transfers are dequeued so thet we know that they are removed from the queue before being deallocated.
|
1.35 |
| 14-Aug-1999 |
augustss | Some changes from FreeBSD (no functional differences).
|
1.34 |
| 02-Aug-1999 |
augustss | Get data toggle right for short bulk transfers. (XXX This code needs to be rewritten.)
|
1.33 |
| 02-Aug-1999 |
augustss | Do abort of transfers in a sane way. Fixes PR 8041.
|
1.32 |
| 12-Jul-1999 |
augustss | Apply some bulk transfer bug fixes from FreeBSD.
|
1.31 |
| 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.30 |
| 26-Jun-1999 |
augustss | Add suspend/resume handling to the UHCI driver. Currently it only works if the BIOS saves enough state of the controller. Once I find a machine with a dumber BIOS I'll try to improve that.
|
1.29 |
| 09-Jun-1999 |
augustss | Remove a redundant test.
|
1.28 |
| 21-May-1999 |
augustss | Update documentation URLs.
|
1.27 |
| 20-May-1999 |
augustss | Keep track of vendor id and make sure the vendor string is NUL terminated.
|
1.26 |
| 16-May-1999 |
augustss | Improve error handling. Mostly from FreeBSD.
|
1.25 |
| 03-Apr-1999 |
augustss | Improve debug output a little.
|
1.24 |
| 20-Feb-1999 |
augustss | branches: 1.24.4; Move the bus reset up. This makes the VIA chipset work. From FreeBSD.
|
1.23 |
| 10-Jan-1999 |
augustss | Update/add URLs to relevant USB specs.
|
1.22 |
| 08-Jan-1999 |
augustss | Various little fixes from the FreeBSD version.
|
1.21 |
| 07-Jan-1999 |
augustss | Fix some FreeBSD compiler warnings.
|
1.20 |
| 30-Dec-1998 |
augustss | Split usbd_delay_ms() into two functions, one can be used in device drivers.
|
1.19 |
| 30-Dec-1998 |
augustss | Make it compile without USB_DEBUG, fixes PR 6689. Patch from taca@sky.yamashina.kyoto.jp (Takahiro Kambe).
|
1.18 |
| 29-Dec-1998 |
augustss | Implement short transfers.
|
1.17 |
| 28-Dec-1998 |
augustss | Imprive debugging message.
|
1.16 |
| 28-Dec-1998 |
augustss | Change the host controller internal API a little and add some incomplete support for isochronous transfers.
|
1.15 |
| 28-Dec-1998 |
augustss | Update for new name in usb.h
|
1.14 |
| 28-Dec-1998 |
augustss | Cosmetics.
|
1.13 |
| 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.12 |
| 10-Dec-1998 |
augustss | Take care of some lines > 80 chars.
|
1.11 |
| 25-Nov-1998 |
augustss | Make the copyright header conform to the NetBSD template.
|
1.10 |
| 02-Aug-1998 |
augustss | Improve some error messages. Make some preparations for isochronous transfers.
|
1.9 |
| 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.8 |
| 26-Jul-1998 |
augustss | A first stab att supporting console access with a USB keyboard.
|
1.7 |
| 24-Jul-1998 |
augustss | Add special memory allocation routines that supports allocation DMA-able memory in small chunks (USB uses a lot of 8 byte chunks). Using the bus_dma functions directly is inefficient.
|
1.6 |
| 23-Jul-1998 |
augustss | Add some comments and a function to set the alternate settings in an interface.
|
1.5 |
| 23-Jul-1998 |
augustss | Don't leak memory if opening a pipe fails.
|
1.4 |
| 23-Jul-1998 |
augustss | Use the pipe maximum packet length rather than the device max length when setting up a transfer. Update the UHCI data toggle correctly.
|
1.3 |
| 23-Jul-1998 |
augustss | Fix bug in freeing TD chain after bulk transfer.
|
1.2 |
| 15-Jul-1998 |
drochner | fix egcs warnings
|
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.24.4.3 |
| 02-Aug-1999 |
thorpej | Update from trunk.
|
1.24.4.2 |
| 01-Jul-1999 |
thorpej | Sync w/ -current.
|
1.24.4.1 |
| 21-Jun-1999 |
thorpej | Sync w/ -current.
|
1.56.2.1 |
| 27-Dec-1999 |
wrstuden | Pull up to last week's -current.
|
1.61.4.1 |
| 15-Nov-1999 |
fvdl | Sync with -current
|
1.61.2.7 |
| 21-Apr-2001 |
bouyer | Sync with HEAD
|
1.61.2.6 |
| 27-Mar-2001 |
bouyer | Sync with HEAD.
|
1.61.2.5 |
| 11-Feb-2001 |
bouyer | Sync with HEAD.
|
1.61.2.4 |
| 05-Jan-2001 |
bouyer | Sync with HEAD
|
1.61.2.3 |
| 08-Dec-2000 |
bouyer | Sync with HEAD.
|
1.61.2.2 |
| 22-Nov-2000 |
bouyer | Sync with HEAD.
|
1.61.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.115.2.1 |
| 22-Jun-2000 |
minoura | Sync w/ netbsd-1-5-base.
|
1.120.2.3 |
| 27-Oct-2001 |
he | Pull up revision 1.127 (requested by pooka): Fix warnings about interrupts which were not for uhci.
|
1.120.2.2 |
| 06-May-2001 |
he | Pull up revision 1.128 (requested by he): Add new powerhook argument values, PWR_SOFTSUSPEND, PWR_SOFTSTANDBY and PWR_SOFTRESUME. Apm calls powerhook with the values in normal interrupt priority level while others are protected with splhigh().
|
1.120.2.1 |
| 22-Aug-2000 |
augustss | Pull up (approved by thorpej): Fix race condition when unlinking xfers. Thanks to IWAMOTO Toshihiro <iwamoto@sat.t.u-tokyo.ac.jp> for analyzing the problem and suggesting a fix. Fixes PR 10662.
|
1.133.2.13 |
| 03-Jan-2003 |
thorpej | Sync with HEAD.
|
1.133.2.12 |
| 18-Oct-2002 |
nathanw | Catch up to -current.
|
1.133.2.11 |
| 01-Aug-2002 |
nathanw | Catch up to -current.
|
1.133.2.10 |
| 10-Jul-2002 |
nathanw | Don't need curlwp here.
|
1.133.2.9 |
| 24-Jun-2002 |
nathanw | Curproc->curlwp renaming.
Change uses of "curproc->l_proc" back to "curproc", which is more like the original use. Bare uses of "curproc" are now "curlwp".
"curproc" is now #defined in proc.h as ((curlwp) ? (curlwp)->l_proc) : NULL) so that it is always safe to reference curproc (*de*referencing curproc is another story, but that's always been true).
|
1.133.2.8 |
| 20-Jun-2002 |
nathanw | Catch up to -current.
|
1.133.2.7 |
| 01-Apr-2002 |
nathanw | Catch up to -current. (CVS: It's not just a program. It's an adventure!)
|
1.133.2.6 |
| 28-Feb-2002 |
nathanw | Catch up to -current.
|
1.133.2.5 |
| 08-Jan-2002 |
nathanw | Catch up to -current.
|
1.133.2.4 |
| 14-Nov-2001 |
nathanw | Catch up to -current.
|
1.133.2.3 |
| 08-Oct-2001 |
nathanw | Catch up to -current.
|
1.133.2.2 |
| 24-Aug-2001 |
nathanw | Catch up with -current.
|
1.133.2.1 |
| 09-Apr-2001 |
nathanw | Catch up with -current.
|
1.135.2.8 |
| 10-Oct-2002 |
jdolecek | sync kqueue with -current; this includes merge of gehenna-devsw branch, merge of i386 MP branch, and part of autoconf rototil work
|
1.135.2.7 |
| 06-Sep-2002 |
jdolecek | sync kqueue branch with HEAD
|
1.135.2.6 |
| 23-Jun-2002 |
jdolecek | catch up with -current on kqueue branch
|
1.135.2.5 |
| 16-Mar-2002 |
jdolecek | Catch up with -current.
|
1.135.2.4 |
| 11-Feb-2002 |
jdolecek | Sync w/ -current.
|
1.135.2.3 |
| 10-Jan-2002 |
thorpej | Sync kqueue branch with -current.
|
1.135.2.2 |
| 25-Aug-2001 |
thorpej | Merge Aug 24 -current into the kqueue branch.
|
1.135.2.1 |
| 03-Aug-2001 |
lukem | update to -current
|
1.137.2.1 |
| 11-Oct-2001 |
fvdl | Catch up with -current. Fix some bogons in the sparc64 kbd/ms attach code. cd18xx conversion provided by mrg.
|
1.138.2.1 |
| 12-Nov-2001 |
thorpej | Sync the thorpej-mips-cache branch with -current.
|
1.158.4.3 |
| 15-Jul-2002 |
gehenna | catch up with -current.
|
1.158.4.2 |
| 20-Jun-2002 |
gehenna | catch up with -current.
|
1.158.4.1 |
| 30-May-2002 |
gehenna | Catch up with -current.
|
1.159.2.2 |
| 15-Mar-2004 |
jmc | Pullup rev 1.177 (requested by toshii in ticket #1599)
Use the correct wValue to get hub desriptors. Also, make wValue checks of root hub codes less strict.
|
1.159.2.1 |
| 26-Jan-2003 |
jmc | Pullup revisions 1.165-1.167 (requested by dsainty in ticket #1079) Be somewhat more persuasive about enabling the port on a port reset. USB protocol dictates that the port enable must be implied by the port reset. To implement this on (at least) the VIA VT83C572 this means we need to wait around tweaking the chip state until the port actually transitions to enabled (or the device goes away). Likely fixes kern/11018.
Reissue the MAXP command on resume. From FreeBSD.
|
1.173.2.5 |
| 10-Nov-2005 |
skrll | Sync with HEAD. Here we go again...
|
1.173.2.4 |
| 04-Mar-2005 |
skrll | Sync with HEAD.
Hi Perry!
|
1.173.2.3 |
| 17-Jan-2005 |
skrll | Sync with HEAD.
|
1.173.2.2 |
| 02-Nov-2004 |
skrll | Sync with HEAD.
|
1.173.2.1 |
| 03-Aug-2004 |
skrll | Sync with HEAD
|
1.178.2.1 |
| 02-Jul-2004 |
he | branches: 1.178.2.1.2; Pull up revision 1.179 (requested by mycroft in ticket #572): Several fixes mostly related to USB: o Make a message dependent on ohcidebug, so it does not interfere with polled operation, e.g. when entering a root device or in DDB.
|
1.178.2.1.2.1 |
| 13-May-2005 |
riz | Pull up revision 1.183 (requested by bad in ticket #1479): 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.
|
1.183.4.1 |
| 19-Mar-2005 |
yamt | sync with head. xen and whitespace. xen part is not finished.
|
1.183.2.1 |
| 29-Apr-2005 |
kent | sync with -current
|
1.185.2.3 |
| 28-Sep-2008 |
jdc | Pull up revisions: sys/dev/usb/ehci.c 1.138 via patch sys/dev/usb/ehcivar.h 1.31 via patch sys/dev/usb/ohci.c 1.195 via patch sys/dev/usb/ohcivar.h 1.45 via patch sys/dev/usb/uhci.c 1.223 via patch sys/dev/usb/uhcivar.h 1.45 via patch sys/dev/usb/usb_mem.c 1.37 via patch sys/dev/usb/usb_mem.h 1.27 via patch requested by bouyer in ticket 1946.
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.
|
1.185.2.2 |
| 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.185.2.1 |
| 22-May-2005 |
snj | branches: 1.185.2.1.2; Pull up revision 1.187 (requested by skrll in ticket #313): Complete the interrupt output transfer support copy from FreeBSD, but remove the incorrect access to the bulk part of the union. Reviewed and OK'ed by Lennart.
|
1.185.2.1.2.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.189.2.8 |
| 27-Feb-2008 |
yamt | sync with head.
|
1.189.2.7 |
| 04-Feb-2008 |
yamt | sync with head.
|
1.189.2.6 |
| 21-Jan-2008 |
yamt | sync with head
|
1.189.2.5 |
| 27-Oct-2007 |
yamt | sync with head.
|
1.189.2.4 |
| 03-Sep-2007 |
yamt | sync with head.
|
1.189.2.3 |
| 26-Feb-2007 |
yamt | sync with head.
|
1.189.2.2 |
| 30-Dec-2006 |
yamt | sync with head.
|
1.189.2.1 |
| 21-Jun-2006 |
yamt | sync with head.
|
1.192.8.5 |
| 14-Sep-2006 |
yamt | sync with head.
|
1.192.8.4 |
| 26-Jun-2006 |
yamt | sync with head.
|
1.192.8.3 |
| 24-May-2006 |
yamt | sync with head.
|
1.192.8.2 |
| 01-Apr-2006 |
yamt | sync with head.
|
1.192.8.1 |
| 13-Mar-2006 |
yamt | sync with head.
|
1.192.6.2 |
| 01-Jun-2006 |
kardel | Sync with head.
|
1.192.6.1 |
| 22-Apr-2006 |
simonb | Sync with head.
|
1.192.4.1 |
| 09-Sep-2006 |
rpaulo | sync with head
|
1.193.4.1 |
| 24-May-2006 |
tron | Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
|
1.193.2.1 |
| 19-Apr-2006 |
elad | sync with head.
|
1.196.4.1 |
| 13-Jul-2006 |
gdamore | Merge from HEAD.
|
1.196.2.1 |
| 22-Jun-2006 |
chap | Complete a sync sys/ with head.
|
1.199.4.2 |
| 10-Dec-2006 |
yamt | sync with head.
|
1.199.4.1 |
| 22-Oct-2006 |
yamt | sync with head
|
1.199.2.2 |
| 01-Feb-2007 |
ad | Sync with head.
|
1.199.2.1 |
| 18-Nov-2006 |
ad | Sync with head.
|
1.205.2.2 |
| 31-Aug-2008 |
jdc | Pull up revisions: src/sys/dev/usb/ehci.c:1.138 src/sys/dev/usb/ehcivar.h:1.31 src/sys/dev/usb/ohci.c:1.195 src/sys/dev/usb/ohcivar.h:1.45 src/sys/dev/usb/uhcivar.h:1.45 src/sys/dev/usb/uhci.c:1.223 src/sys/dev/usb/usb_mem.c:1.37 src/sys/dev/usb/usb_mem.h:1.27 via patch (requested by bouyer in ticket #1166).
|
1.205.2.1 |
| 21-Feb-2007 |
tron | branches: 1.205.2.1.2; Pull up following revision(s) (requested by mlelstv in ticket #450): sys/dev/usb/ohci.c: revision 1.181 sys/dev/usb/uhci.c: revision 1.207 sys/dev/usb/ehci.c: revision 1.122 sys/dev/usb/usbdi.c: revision 1.118 The diagnostic code doesn't track busy_free correctly when a device gets removed. However, when the diagnostic check fails, it is much better to complete the free operation than to abort it, because this just causes an infinite loop.
|
1.205.2.1.2.1 |
| 04-Sep-2008 |
skrll | Sync with netbsd-4.
|
1.207.2.1 |
| 27-Feb-2007 |
yamt | - sync with head. - move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
|
1.208.14.1 |
| 15-Aug-2007 |
skrll | Sync with HEAD.
|
1.208.12.7 |
| 12-Nov-2009 |
uebayasi | Sort struct usbd_bus_methods member initializers.
|
1.208.12.6 |
| 21-May-2008 |
itohy | Change buffer memory interface (move to common file).
|
1.208.12.5 |
| 22-Jun-2007 |
itohy | Swap names of uhci_bufptr_rd() and uhci_bufptr_wr() in order to avoid awkwardness like if (isread) { uhci_bufptr_wr(...) }
|
1.208.12.4 |
| 05-Jun-2007 |
itohy | Fix problem where aux buffer is overwritten if multiple aux buffers are used on a transfer.
|
1.208.12.3 |
| 03-Jun-2007 |
itohy | Fix mbuf transfer.
|
1.208.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.208.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.208.4.2 |
| 23-Oct-2007 |
ad | Sync with head.
|
1.208.4.1 |
| 20-Aug-2007 |
ad | Sync with HEAD.
|
1.209.4.2 |
| 01-Aug-2007 |
jmcneill | Clear the run flag in the command register when powering down, from FreeBSD. Makes my laptop, and hopefully others, successfully sleep. Waking up is a different story...
|
1.209.4.1 |
| 01-Aug-2007 |
jmcneill | file uhci.c was added on branch matt-mips64 on 2007-08-01 22:40:17 +0000
|
1.209.2.7 |
| 14-Nov-2007 |
joerg | Remove UHCI shutdown hook, it has been superseded in functionality by the suspend handler. It can also awake the controller which creates funny error messages.
|
1.209.2.6 |
| 07-Nov-2007 |
joerg | Introduce device_has_power to fix a race between resuming a device and the device enabling interrupts as seen by jmcneill@ with uhci. Change ehci, ohci, uhci and azalia to use this function to protect the interrupt handler.
|
1.209.2.5 |
| 06-Nov-2007 |
joerg | Refactor PNP API: - Make suspend/resume directly a device functionality. It consists of three layers (class logic, device logic, bus logic), all of them being optional. This replaces D0/D3 transitions. - device_is_active returns true if the device was not disabled and was not suspended (even partially), device_is_enabled returns true if the device was enabled. - Change pnp_global_transition into pnp_system_suspend and pnp_system_resume. Before running any suspend/resume handlers, check that all currently attached devices support power management and bail out otherwise. The latter is not done for the shutdown/panic case. - Make the former bus-specific generic network handlers a class handler. - Make PNP message like volume up/down/toogle PNP events. Each device can register what events they are interested in and whether the handler should be global or not. - Introduce device_active API for devices to mark themselve in use from either the system or the device. Use this to implement the idle handling for audio and input devices. This is intended to replace most ad-hoc watchdogs as well. - Fix somes situations in which audio resume would lose mixer settings. - Make USB host controllers better deal with suspend in the light of shared interrupts. - Flush filesystem cache on suspend. - Flush disk caches on suspend. Put ATA disks into standby on suspend as well. - Adopt drivers to use the new PNP API. - Fix a critical bug in the generic cardbus layer that made D0->D3 break. - Fix ral(4) to set if_stop. - Convert cbb(4) to the new PNP API. - Apply the PCI Express SCI fix on resume again.
|
1.209.2.4 |
| 26-Oct-2007 |
joerg | Sync with HEAD.
Follow the merge of pmap.c on i386 and amd64 and move pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup code to restore CR4 before jumping back into kernel space as the large page option might cover that.
|
1.209.2.3 |
| 01-Oct-2007 |
joerg | Extend device API by device_power_private and device_power_set_private. The latter is a temporary mean until the pnp_register API itself is overhault. This functions allow a generic power handler to store its state independent of the driver.
Use this and revamp the PCI power handling. Pretty much all PCI devices had power handlers that did the same thing, generalize this in pci_generic_power_register/deregister and the handler. This interface offers callbacks for the drivers to save and restore state on transistions. After a long discussion with jmcneill@ it was considered to be powerful enough until evidence is shown that devices can handle D1/D2 with less code and higher speed than without the full save/restore. The generic code is carefully written to handle device without PCI-PM support and ensure that the correct registers are written to when D3 loses all state.
Reimplement the generic PCI network device handling on top of PCI generic power handling.
Introduce pci_disable_retry as used and implemented locally at least by ath(4) and iwi(4). Use it in this drivers to restore behaviour from before the introduction of generic PCI network handling.
Convert all PCI drivers that were using pnp_register to the new framework. The only exception is vga(4) as it is commonly used as console device. Add a note therein that this should be fixed later.
|
1.209.2.2 |
| 16-Aug-2007 |
jmcneill | Sync with HEAD.
|
1.209.2.1 |
| 03-Aug-2007 |
jmcneill | Pull in power management changes from private branch.
|
1.210.6.1 |
| 25-Oct-2007 |
bouyer | Sync with HEAD.
|
1.210.2.3 |
| 23-Mar-2008 |
matt | sync with HEAD
|
1.210.2.2 |
| 09-Jan-2008 |
matt | sync with HEAD
|
1.210.2.1 |
| 06-Nov-2007 |
matt | sync with HEAD
|
1.211.6.1 |
| 11-Dec-2007 |
yamt | sync with head.
|
1.211.4.1 |
| 26-Dec-2007 |
ad | Sync with head.
|
1.211.2.1 |
| 18-Feb-2008 |
mjf | Sync with HEAD.
|
1.214.6.5 |
| 17-Jan-2009 |
mjf | Sync with HEAD.
|
1.214.6.4 |
| 29-Jun-2008 |
mjf | Sync with HEAD.
|
1.214.6.3 |
| 05-Jun-2008 |
mjf | Sync with HEAD.
Also fix build.
|
1.214.6.2 |
| 02-Jun-2008 |
mjf | Sync with HEAD.
|
1.214.6.1 |
| 03-Apr-2008 |
mjf | Sync with HEAD.
|
1.214.2.1 |
| 24-Mar-2008 |
keiichi | sync with head.
|
1.216.4.4 |
| 11-Aug-2010 |
yamt | sync with head.
|
1.216.4.3 |
| 11-Mar-2010 |
yamt | sync with head
|
1.216.4.2 |
| 04-May-2009 |
yamt | sync with head.
|
1.216.4.1 |
| 16-May-2008 |
yamt | sync with head.
|
1.216.2.3 |
| 17-Jun-2008 |
yamt | sync with head.
|
1.216.2.2 |
| 04-Jun-2008 |
yamt | sync with head
|
1.216.2.1 |
| 18-May-2008 |
yamt | sync with head.
|
1.217.2.2 |
| 18-Sep-2008 |
wrstuden | Sync with wrstuden-revivesa-base-2.
|
1.217.2.1 |
| 23-Jun-2008 |
wrstuden | Sync w/ -current. 34 merge conflicts to follow.
|
1.221.2.2 |
| 03-Jul-2008 |
simonb | Sync with head.
|
1.221.2.1 |
| 18-Jun-2008 |
simonb | Sync with head.
|
1.223.12.1 |
| 21-Apr-2010 |
matt | sync to netbsd-5
|
1.223.6.1 |
| 04-Oct-2009 |
snj | Pull up following revision(s) (requested by bouyer in ticket #1054): sys/dev/usb/uhci.c: revision 1.225 Make it safe to call uhci_init() from a kernel thread with interrupts enabled: - don't enable interrupts before calling uhci_run() - check if the controller's interrupt is enabled in uhci_intr() The issue is that uhci_run() may tsleep(), uhci_intr1() may be called before uhci_run() is complete and disable it because it found it halted. Now a uhci controller can be successfully exported to a NetBSD Xen domU :)
|
1.223.4.2 |
| 28-Apr-2009 |
skrll | Sync with HEAD.
|
1.223.4.1 |
| 19-Jan-2009 |
skrll | Sync with HEAD.
|
1.224.2.1 |
| 13-May-2009 |
jym | Sync with HEAD.
Commit is split, to avoid a "too many arguments" protocol error.
|
1.231.2.3 |
| 06-Nov-2010 |
uebayasi | Sync with HEAD.
|
1.231.2.2 |
| 17-Aug-2010 |
uebayasi | Sync with HEAD.
|
1.231.2.1 |
| 30-Apr-2010 |
uebayasi | Sync with HEAD.
|
1.232.2.4 |
| 12-Jun-2011 |
rmind | sync with head
|
1.232.2.3 |
| 31-May-2011 |
rmind | sync with head
|
1.232.2.2 |
| 05-Mar-2011 |
rmind | sync with head
|
1.232.2.1 |
| 03-Jul-2010 |
rmind | sync with head
|
1.235.2.1 |
| 06-Jun-2011 |
jruoho | Sync with HEAD.
|
1.238.2.1 |
| 23-Jun-2011 |
cherry | Catchup with rmind-uvmplock merge.
|
1.240.6.20 |
| 06-Apr-2012 |
mrg | take the thread lock earlier in uhci_device_intr_start(). avoids failed mutex owned asserts, and now bt* work.
|
1.240.6.19 |
| 05-Apr-2012 |
mrg | make these compile without DIAGNOSTIC.
|
1.240.6.18 |
| 11-Mar-2012 |
mrg | sync to latest -current
|
1.240.6.17 |
| 06-Mar-2012 |
mrg | sync to -current
|
1.240.6.16 |
| 03-Mar-2012 |
mrg | use usb_delay_ms_locked() in some more places
|
1.240.6.15 |
| 26-Feb-2012 |
mrg | - add some more "XXXSMP ok" tags - use cpu_softintr_p() instead of checking LP_INTR directly
|
1.240.6.14 |
| 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.240.6.13 |
| 25-Feb-2012 |
mrg | remove curproc references
|
1.240.6.12 |
| 25-Feb-2012 |
mrg | copyright maintenence.
|
1.240.6.11 |
| 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.240.6.10 |
| 20-Feb-2012 |
mrg | remove the intr_lock from the mp usb api, it wasn't used.
|
1.240.6.9 |
| 20-Feb-2012 |
mrg | fix a panic() message to refer to the correct function
|
1.240.6.8 |
| 20-Feb-2012 |
mrg | adjust some comments to reality. copy some XXX comments from ehci into uhci/ohci since it's probably right there too
|
1.240.6.7 |
| 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.240.6.6 |
| 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.240.6.5 |
| 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.240.6.4 |
| 06-Dec-2011 |
mrg | don't take the sc_lock in uhci_device_request() since it is already taken (as verified by the assert at the top of this function.)
|
1.240.6.3 |
| 06-Dec-2011 |
mrg | kassert the right lock.
|
1.240.6.2 |
| 06-Dec-2011 |
mrg | my compiles-but-un-runtime-tested port of uhci to usbmp branch. based upon the ohci and ehci changes.
|
1.240.6.1 |
| 04-Dec-2011 |
jmcneill | branches: 1.240.6.1.2; Make ehci mpsafe.
|
1.240.6.1.2.1 |
| 08-Dec-2011 |
mrg | sync with main branch
|
1.240.2.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.240.2.3 |
| 23-Jan-2013 |
yamt | sync with head
|
1.240.2.2 |
| 30-Oct-2012 |
yamt | sync with head
|
1.240.2.1 |
| 17-Apr-2012 |
yamt | sync with head
|
1.242.8.1 |
| 26-Sep-2013 |
riz | Pull up following revision(s) (requested by skrll in ticket #950): sys/dev/usb/uhci.c: revision 1.255 sys/dev/usb/uhci.c: revision 1.256 sys/dev/usb/ehci.c: revision 1.205 sys/dev/usb/uhci.c: revision 1.258 Add missed byteswap ops for BE machines in block added in rev 1.223. Call usb_syncmem() against descriptors more strictly. (not sure if the previous ones were fatal though) Deal with control transfers better by - removing the UHCI_PTR_VF flag for the setup and status stages which means they are scheduled less aggressively. Some devices appear to require this (blymn@ has one). The flag was introduced as a performance improvement for bulk transfers. - Checking for short reads and making sure the status stage runs if they're encountered. PR/47522 Enumeration of LUFA/Atmel devices on UHCI fails Thanks to jak@ and blymn@ for testing and mlelstv@ for comments.
|
1.242.6.1 |
| 26-Sep-2013 |
riz | Pull up following revision(s) (requested by skrll in ticket #950): sys/dev/usb/uhci.c: revision 1.255 sys/dev/usb/uhci.c: revision 1.256 sys/dev/usb/ehci.c: revision 1.205 sys/dev/usb/uhci.c: revision 1.258 Add missed byteswap ops for BE machines in block added in rev 1.223. Call usb_syncmem() against descriptors more strictly. (not sure if the previous ones were fatal though) Deal with control transfers better by - removing the UHCI_PTR_VF flag for the setup and status stages which means they are scheduled less aggressively. Some devices appear to require this (blymn@ has one). The flag was introduced as a performance improvement for bulk transfers. - Checking for short reads and making sure the status stage runs if they're encountered. PR/47522 Enumeration of LUFA/Atmel devices on UHCI fails Thanks to jak@ and blymn@ for testing and mlelstv@ for comments.
|
1.242.2.1 |
| 26-Sep-2013 |
riz | Pull up following revision(s) (requested by skrll in ticket #950): sys/dev/usb/uhci.c: revision 1.255 sys/dev/usb/uhci.c: revision 1.256 sys/dev/usb/ehci.c: revision 1.205 sys/dev/usb/uhci.c: revision 1.258 Add missed byteswap ops for BE machines in block added in rev 1.223. Call usb_syncmem() against descriptors more strictly. (not sure if the previous ones were fatal though) Deal with control transfers better by - removing the UHCI_PTR_VF flag for the setup and status stages which means they are scheduled less aggressively. Some devices appear to require this (blymn@ has one). The flag was introduced as a performance improvement for bulk transfers. - Checking for short reads and making sure the status stage runs if they're encountered. PR/47522 Enumeration of LUFA/Atmel devices on UHCI fails Thanks to jak@ and blymn@ for testing and mlelstv@ for comments.
|
1.249.2.4 |
| 03-Dec-2017 |
jdolecek | update from HEAD
|
1.249.2.3 |
| 20-Aug-2014 |
tls | Rebase to HEAD as of a few days ago.
|
1.249.2.2 |
| 23-Jun-2013 |
tls | resync from head
|
1.249.2.1 |
| 25-Feb-2013 |
tls | resync with head
|
1.257.4.1 |
| 18-May-2014 |
rmind | sync with head
|
1.263.2.1 |
| 10-Aug-2014 |
tls | Rebase.
|
1.264.8.1 |
| 06-Sep-2016 |
skrll | First pass at netbsd-7 updated with USB code from HEAD
|
1.264.4.80 |
| 28-Aug-2017 |
skrll | Sync with HEAD
|
1.264.4.79 |
| 28-Dec-2016 |
skrll | Improve transfer abort
|
1.264.4.78 |
| 05-Dec-2016 |
skrll | Sync with HEAD
|
1.264.4.77 |
| 30-May-2016 |
skrll | Unwrap some lines
|
1.264.4.76 |
| 29-May-2016 |
skrll | Sync with HEAD
|
1.264.4.75 |
| 30-Apr-2016 |
skrll | Move the struct usb_task to struct usbd_xfer for everyone to use.
|
1.264.4.74 |
| 16-Apr-2016 |
skrll | Fix usbd_status vs int in *_alloc_*_chain
|
1.264.4.73 |
| 16-Apr-2016 |
skrll | Don't leak memory in *_alloc_*td_chain if allocation fails.
|
1.264.4.72 |
| 11-Apr-2016 |
skrll | more build fixes
|
1.264.4.71 |
| 11-Apr-2016 |
skrll | Fix non UHCI_DEBUG build
|
1.264.4.70 |
| 04-Apr-2016 |
skrll | Rework {alloc,reset}_*_chain functions to perform all of TD setup in reset chain. The initial motivation for this was to fix ZLP.
|
1.264.4.69 |
| 25-Mar-2016 |
skrll | More __BIT conversion. No functional change.
|
1.264.4.68 |
| 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.264.4.67 |
| 17-Mar-2016 |
skrll | Protect read of isoc->next with bus lock
|
1.264.4.66 |
| 13-Mar-2016 |
skrll | KASSERTMSG
|
1.264.4.65 |
| 28-Feb-2016 |
skrll | Use __func__ in printfs
|
1.264.4.64 |
| 28-Feb-2016 |
skrll | Use __func__ in printf
|
1.264.4.63 |
| 28-Feb-2016 |
skrll | Centralise the up_repeat handling and use the standard pipe method to start the next transfer. This allows the removal of a bunch of code in the upm_done methods for interrupt transfers which had copies of the upm_start method code.
At the same time we can perform the upm_done method before calling the transfer callback allowing correct bus_dma(9) operations before using the transfer DMA buffer.
|
1.264.4.62 |
| 27-Feb-2016 |
skrll | In uhci_device_isoc_enter define
struct uhci_xfer *ux = UHCI_XFER2UXFER(xfer);
and use it. No functionaly change.
|
1.264.4.61 |
| 16-Feb-2016 |
skrll | Make interrupt handling MP safe by not dropping the bus lock while traversing the active transfer list. Instead move the complete transfers from the active list to a complete list while holding the bus lock.
Once the interrupt list has been traversed we can do callbacks on the complete list. usbd_transfer_complete can safely drop the bus lock while traversing this private list.
|
1.264.4.60 |
| 16-Feb-2016 |
skrll | Use TAILQ_FOREACH. No functional change.
|
1.264.4.59 |
| 15-Feb-2016 |
skrll | KF
|
1.264.4.58 |
| 08-Feb-2016 |
skrll | Remove the fstd argument from uhci_reset_std_chain as it is always ux_stds[0]
|
1.264.4.57 |
| 06-Feb-2016 |
skrll | Remove uhci_device_request declaration as it doesn't exist anymore
|
1.264.4.56 |
| 20-Nov-2015 |
skrll | Rename interrupt list macros s/intr_info/intr_list/
No functional change
|
1.264.4.55 |
| 10-Nov-2015 |
skrll | Restructure the xfer methods so that (close to) minimal work in done in softint context. Now all memory allocation is done in thread context.
Addresses kern/48308 for uhci(4), fixes a bunch of locking bugs around the *TD free lists, and plugs some memory leaks on error conditions.
|
1.264.4.54 |
| 09-Nov-2015 |
skrll | KNF (whitespace)
|
1.264.4.53 |
| 08-Nov-2015 |
skrll | Improve debug output
|
1.264.4.52 |
| 08-Nov-2015 |
skrll | s/0/NULL/ for pointer return value
|
1.264.4.51 |
| 08-Nov-2015 |
skrll | Perform required DMA operation on bulk transfers
|
1.264.4.50 |
| 08-Nov-2015 |
skrll | Provide and use UHCI_PIPE2UPIPE
|
1.264.4.49 |
| 08-Nov-2015 |
skrll | Whitespace
|
1.264.4.48 |
| 08-Nov-2015 |
skrll | Whitespace
|
1.264.4.47 |
| 07-Nov-2015 |
skrll | Debug consistency / standard output
|
1.264.4.46 |
| 01-Nov-2015 |
skrll | Missed a s:uhcidebug >:uhcidebug >=: in the consistency with USBHIST_LOGN commit
|
1.264.4.45 |
| 01-Nov-2015 |
skrll | Print 0 or 1 and not bit value
|
1.264.4.44 |
| 01-Nov-2015 |
skrll | Prefix hex values in debug output with "0x"
|
1.264.4.43 |
| 01-Nov-2015 |
skrll | Consistency with USBHIST_LOGN
|
1.264.4.42 |
| 01-Nov-2015 |
skrll | Whitespace
|
1.264.4.41 |
| 27-Oct-2015 |
skrll | Rename uhci_xfer struct members.
No funciotnal change.
|
1.264.4.40 |
| 27-Oct-2015 |
skrll | Make the previous compile with other options.
|
1.264.4.39 |
| 27-Oct-2015 |
skrll | Collapse uhcl_intr_info into uhci_xfer and use TAILQ for list of transfers that are active.
|
1.264.4.38 |
| 27-Oct-2015 |
skrll | Remove barely used softc copy in uhci_intr_info_t
|
1.264.4.37 |
| 20-Oct-2015 |
skrll | Consistently providei/use *_{XFER,PIPE,BUS}2SC, etc macros
|
1.264.4.36 |
| 11-Oct-2015 |
skrll | Update ubm_allocx with the isoc frame count parameter and use it in dwctwo(4)
|
1.264.4.35 |
| 29-Sep-2015 |
skrll | sizeof KNF
|
1.264.4.34 |
| 22-Sep-2015 |
skrll | Sync with HEAD
|
1.264.4.33 |
| 06-Apr-2015 |
skrll | Use anonymous unions in various structs and rename the ctl/iso members of the pipe structs to ctrl/isoc.
No functional change intended.
|
1.264.4.32 |
| 05-Apr-2015 |
skrll | Fix inverted logic. Spotted by Takahiro HAYASHI. Thanks.
|
1.264.4.31 |
| 03-Apr-2015 |
skrll | Various readability changes.
#ifdef DIAGNOSTIC -> KASSERT / __diagused
|
1.264.4.30 |
| 01-Apr-2015 |
skrll | Include opt_usb.h
|
1.264.4.29 |
| 29-Mar-2015 |
skrll | Unwrap short lines.
|
1.264.4.28 |
| 29-Mar-2015 |
skrll | Typo in comment
|
1.264.4.27 |
| 29-Mar-2015 |
skrll | DPRINTFN(1, ...) -> DPRINTF(...)
No functional change
|
1.264.4.26 |
| 29-Mar-2015 |
skrll | s/0/NULL/ for pointers
|
1.264.4.25 |
| 19-Mar-2015 |
skrll | Do the same as OpenBSD and get rid of the *_handle typedefs and use plain structures insteads
|
1.264.4.24 |
| 10-Mar-2015 |
skrll | Whitespace
|
1.264.4.23 |
| 10-Mar-2015 |
skrll | usb_quirks.h isn't needed here
|
1.264.4.22 |
| 03-Mar-2015 |
skrll | Whitespace.
|
1.264.4.21 |
| 20-Feb-2015 |
skrll | Convert to USBHIST
|
1.264.4.20 |
| 20-Feb-2015 |
skrll | KNF
|
1.264.4.19 |
| 01-Feb-2015 |
skrll | Remove unused #includes
|
1.264.4.18 |
| 01-Feb-2015 |
skrll | KNF
|
1.264.4.17 |
| 01-Feb-2015 |
skrll | KNF
|
1.264.4.16 |
| 01-Feb-2015 |
skrll | Return success when clearing port reset.
|
1.264.4.15 |
| 06-Dec-2014 |
skrll | KNF. Remove argument name from function declarations.
No functional change.
|
1.264.4.14 |
| 05-Dec-2014 |
skrll | Use int for return type for [eou]chi_init and motg_init.
|
1.264.4.13 |
| 05-Dec-2014 |
skrll | KNF. Remove ( ) from return statements.
|
1.264.4.12 |
| 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.264.4.11 |
| 03-Dec-2014 |
skrll | Rename usbroothub_subr.[ch] to usbroothub.[ch]
|
1.264.4.10 |
| 03-Dec-2014 |
skrll | Provide a USETWD macro for use with USB words designated initialisers.
|
1.264.4.9 |
| 03-Dec-2014 |
skrll | Use designated initializers for more descriptors.
|
1.264.4.8 |
| 03-Dec-2014 |
skrll | Use designated initialisers for usb_device_descriptor_t structs.
|
1.264.4.7 |
| 03-Dec-2014 |
skrll | The grand renaming of structure members.
No functional change.
|
1.264.4.6 |
| 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.264.4.5 |
| 01-Dec-2014 |
skrll | Add prefixes to method structures member names. No functional change.
|
1.264.4.4 |
| 01-Dec-2014 |
skrll | Remove usbd_bus no_intrs member it was (virtually) unused.
|
1.264.4.3 |
| 30-Nov-2014 |
skrll | Use ASSERT_SLEEPABLE.
|
1.264.4.2 |
| 30-Nov-2014 |
skrll | Whitespace
|
1.264.4.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.264.2.4 |
| 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.264.2.3 |
| 03-Jan-2018 |
snj | Pull up following revision(s) (requested by skrll in ticket #1529): sys/dev/usb/ehci.c: revision 1.257 sys/dev/usb/motg.c: revision 1.19 sys/dev/usb/ohci.c: revision 1.276 sys/dev/usb/uhci.c: revision 1.279 sys/dev/usb/xhci.c: revision 1.77 sys/external/bsd/dwc2/dwc2.c: revision 1.47 s/PR_NOWAIT/PR_WAITOK/ in HCD allocx (allocate xfer) method
|
1.264.2.2 |
| 23-Jul-2017 |
snj | Pull up following revision(s) (requested by skrll in ticket #1456): sys/dev/usb/uhci.c: revision 1.276 Only call uhci_free_stds if there are TDs to free. In uhci_alloc_std_chain ensure we fill the TD array correctly and note the number of allocated TDs so that uhci_free_stds will do the right thing Fixes a problem seen by anon
|
1.264.2.1 |
| 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.273.2.1 |
| 07-Jan-2017 |
pgoyette | Sync with HEAD. (Note that most of these changes are simply $NetBSD$ tag issues.)
|
1.275.2.6 |
| 25-Feb-2020 |
martin | Pull up following revision(s) (requested by skrll in ticket #1507):
sys/dev/usb/ohci.c: revision 1.296 sys/dev/usb/uhci.c: revision 1.294 sys/external/bsd/dwc2/dwc2.c: revision 1.72 sys/arch/mips/adm5120/dev/ahci.c: revision 1.21 sys/dev/usb/ehci.c: revision 1.274
Fix a memory leak. Spotted by nat@
|
1.275.2.5 |
| 27-Sep-2018 |
martin | Pull up following revision(s) (requested by mrg in ticket #1037):
sys/dev/usb/uhub.c: revision 1.139 sys/external/bsd/dwc2/dwc2.c: revision 1.55 sys/ddb/db_output.c: revision 1.34 sys/ddb/db_command.c: revision 1.160 sys/dev/usb/ehci.c: revision 1.264 sys/dev/usb/xhci.c: revision 1.99 sys/dev/usb/ehci.c: revision 1.265 sys/kern/subr_userconf.c: revision 1.27 sys/dev/usb/ehcivar.h: revision 1.46 sys/dev/usb/ohci.c: revision 1.287 sys/dev/usb/uhci.c: revision 1.284 sys/dev/usb/usbdi.c: revision 1.178 sys/dev/usb/usb.c: revision 1.172 sys/dev/pci/xhci_pci.c: revision 1.14 sys/dev/usb/usb.c: revision 1.173 sys/dev/usb/usb.c: revision 1.174 share/man/man4/usb.4: revision 1.110 sys/ddb/db_command.c: revision 1.159 sys/dev/usb/usb_subr.c: revision 1.227 sys/dev/usb/uhcivar.h: revision 1.56 (all via patch)
consolidate the handling of polling across HC drivers, and generic USB: - don't take mutexes if polling - normalise the code across all drivers - add some not yet code to block discovery to/from polling - minor CSE - adjust comment for usbd_set_polling() to reality now i properly understand what it is used for and why.
this, with a hack to make RB_ASKNAME to wait 5 seconds allows boot -a work with USB keyboards. there are still multiple issues remaining: - discovery and polling need to be mutually exclusive - attachment of ukbd and wskbd is not handled by config_pending, and the 5 second delay isn't going to always be enough.
call cnpollc(1) and cnpollc(0) around cngetc(). (christos has a good idea to add a function that does all 3, and we should switch all the callers in this sequence to use it (and fix the MD ones missing it still). not all can, as eg, line-grabbing functions can use cngetsn(), which only calls cnpollc() twice.)
When this file is used when not building the kernel (eg: /usr/sbin/crash) make cnpollc() go away.
reorder some struct members to remove holes.
add config_pending usage to uhub and general USB device attachment. - call config_pending_incr() and config_pending_decr() around attaching devices against "usbdevif" attribute.
uhub: - convert sc_explorepending and sc_running to bool. add new sc_first_explore. - call config_pending_incr() at the start of uhub_attach(). dropped in uhub_explore(), if this is the first explore.
implement a gross hack to fix "boot -a" on systems with usb keyboards on systems with ehci handover to uhci (and maybe ohci), and fix a similar problem for "boot -s".
there is effort to ensure that all devices attached via USB are probed before RB_ASKNAME or RB_SINGLE attempts to ask any questions on the console, and largely this works, often by chance, today, for USB disks and root. i've recently pushed this more into uhub and general USB device attachment as well, and kept a config_pending reference across the first explore of a bus. these fix many issues with directly attached hubs.
however, on systems where devices connected to ehci ports are handed over to a companion uhci or ohci port, it may not be the first, or even second, bus explore that finds the device finally before attachment, and at this point all config_pending references are dropped.
there is no direct communication between drivers, the potentials are looked up but their device_t is only used for generic things like the name, so informing the correct companion to expect a device and deal with the config_pending references is not possible without some fairly ugly layer violations or multi-level callbacks (eg, we have "ehci0", and usually an the relevant companion, eg, "uhci2", but it is the uhub that uhci2 has attached that will deal with the device attachment.)
with the above fixes to generic USB code, the disown happens during the first explore. the hack works by, at this point, checking if (a) root is not mounted, (b) single user or ask name are set, and (c) if the hack as not been triggered already. if all 3 conditions are true, then a config_pending_incr() is called and a callback is triggered for (default) 5 seconds to call config_pending_decr(). ehci detach pauses waiting for this callback if scheduled.
this allows enough time for the uhub and the ukbd/wskbd to attach before the RK_ASKROOT prompts appear. testing shows it takes between 1.5 and 2 seconds for the keyboard to appear after the disown occurs.
Index: dev/usb/ehcivar.c - new sc_compcallout, sc_compcallout, sc_complock, and a state for th handover hack.
Index: dev/usb/ehci.c ehci_init(): - use aprint_normal_dev() instead of manual device_xname(). - initialise sc_compcallout, sc_compcallout, sc_complock, and sc_comp_state. ehci_detach(): - if there are companion controllers, tear own the above, including waiting if there is a callback scheduled. ehci_disown_callback(): - new callout to call config_pending_decr() in the the future. schedule this ca ehci_disown_sched_callback(): - if booting to single user or asking names, call config_pending_incr() and schedule the callout above, default 5 second delay. ehci_disown(): - if disowning a port call ehci_disown_sched_callback(). deal with partial attach failures in usb_attach vs usb_detach aka PR 53598. - make sure xhci's sc->sc_ios is NULL if failure happens. - rearrange usb_attach() / usb_doattach() to make it simpler to clean up. - move usb_async_intr softint into usb_once_init(). previously, each USB controller would start a new one, and leave the old one leaked. - handle controller interrupts without a bus attached
remove usb(4)'s "flags 1" code. it has been dead for a while, as it runs during the interrupts part of configuration now, and all the devices try attach as early as possible, including any root or boot required disk or keyboard device, which is what this flag was for.
|
1.275.2.4 |
| 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.275.2.3 |
| 23-Nov-2017 |
martin | Pull up following revision(s) (requested by skrll in ticket #385): sys/dev/usb/xhci.c: revision 1.77 sys/external/bsd/dwc2/dwc2.c: revision 1.47 sys/dev/usb/motg.c: revision 1.19 sys/dev/usb/ehci.c: revision 1.257 sys/dev/usb/ohci.c: revision 1.276 sys/dev/usb/uhci.c: revision 1.279
s/PR_NOWAIT/PR_WAITOK/ in HCD allocx (allocate xfer) method
|
1.275.2.2 |
| 02-Nov-2017 |
snj | Pull up following revision(s) (requested by pgoyette in ticket #335): share/man/man9/kernhist.9: 1.5-1.8 sys/arch/acorn26/acorn26/pmap.c: 1.39 sys/arch/arm/arm32/fault.c: 1.105 via patch sys/arch/arm/arm32/pmap.c: 1.350, 1.359 sys/arch/arm/broadcom/bcm2835_bsc.c: 1.7 sys/arch/arm/omap/if_cpsw.c: 1.20 sys/arch/arm/omap/tiotg.c: 1.7 sys/arch/evbarm/conf/RPI2_INSTALL: 1.3 sys/dev/ic/sl811hs.c: 1.98 sys/dev/usb/ehci.c: 1.256 sys/dev/usb/if_axe.c: 1.83 sys/dev/usb/motg.c: 1.18 sys/dev/usb/ohci.c: 1.274 sys/dev/usb/ucom.c: 1.119 sys/dev/usb/uhci.c: 1.277 sys/dev/usb/uhub.c: 1.137 sys/dev/usb/umass.c: 1.160-1.162 sys/dev/usb/umass_quirks.c: 1.100 sys/dev/usb/umass_scsipi.c: 1.55 sys/dev/usb/usb.c: 1.168 sys/dev/usb/usb_mem.c: 1.70 sys/dev/usb/usb_subr.c: 1.221 sys/dev/usb/usbdi.c: 1.175 sys/dev/usb/usbdi_util.c: 1.67-1.70 sys/dev/usb/usbroothub.c: 1.3 sys/dev/usb/xhci.c: 1.75 sys/external/bsd/drm2/dist/drm/i915/i915_gem.c: 1.34 sys/kern/kern_history.c: 1.15 sys/kern/kern_xxx.c: 1.74 sys/kern/vfs_bio.c: 1.275-1.276 sys/miscfs/genfs/genfs_io.c: 1.71 sys/sys/kernhist.h: 1.21 sys/ufs/ffs/ffs_balloc.c: 1.63 sys/ufs/lfs/lfs_vfsops.c: 1.361 sys/ufs/lfs/ulfs_inode.c: 1.21 sys/ufs/lfs/ulfs_vnops.c: 1.52 sys/ufs/ufs/ufs_inode.c: 1.102 sys/ufs/ufs/ufs_vnops.c: 1.239 sys/uvm/pmap/pmap.c: 1.37-1.39 sys/uvm/pmap/pmap_tlb.c: 1.22 sys/uvm/uvm_amap.c: 1.108 sys/uvm/uvm_anon.c: 1.64 sys/uvm/uvm_aobj.c: 1.126 sys/uvm/uvm_bio.c: 1.91 sys/uvm/uvm_device.c: 1.66 sys/uvm/uvm_fault.c: 1.201 sys/uvm/uvm_km.c: 1.144 sys/uvm/uvm_loan.c: 1.85 sys/uvm/uvm_map.c: 1.353 sys/uvm/uvm_page.c: 1.194 sys/uvm/uvm_pager.c: 1.111 sys/uvm/uvm_pdaemon.c: 1.109 sys/uvm/uvm_swap.c: 1.175 sys/uvm/uvm_vnode.c: 1.103 usr.bin/vmstat/vmstat.c: 1.219 Reorder to test for null before null deref in debug code -- Reorder to test for null before null deref in debug code -- KNF -- No need for '\n' in UVMHIST_LOG -- normalise a BIOHIST log message -- Update the kernhist(9) kernel history code to address issues identified in PR kern/52639, as well as some general cleaning-up... (As proposed on tech-kern@ with additional changes and enhancements.) Details of changes: * All history arguments are now stored as uintmax_t values[1], both in the kernel and in the structures used for exporting the history data to userland via sysctl(9). This avoids problems on some architectures where passing a 64-bit (or larger) value to printf(3) can cause it to process the value as multiple arguments. (This can be particularly problematic when printf()'s format string is not a literal, since in that case the compiler cannot know how large each argument should be.) * Update the data structures used for exporting kernel history data to include a version number as well as the length of history arguments. * All [2] existing users of kernhist(9) have had their format strings updated. Each format specifier now includes an explicit length modifier 'j' to refer to numeric values of the size of uintmax_t. * All [2] existing users of kernhist(9) have had their format strings updated to replace uses of "%p" with "%#jx", and the pointer arguments are now cast to (uintptr_t) before being subsequently cast to (uintmax_t). This is needed to avoid compiler warnings about casting "pointer to integer of a different size." * All [2] existing users of kernhist(9) have had instances of "%s" or "%c" format strings replaced with numeric formats; several instances of mis-match between format string and argument list have been fixed. * vmstat(1) has been modified to handle the new size of arguments in the history data as exported by sysctl(9). * vmstat(1) now provides a warning message if the history requested with the -u option does not exist (previously, this condition was silently ignored, with only a single blank line being printed). * vmstat(1) now checks the version and argument length included in the data exported via sysctl(9) and exits if they do not match the values with which vmstat was built. * The kernhist(9) man-page has been updated to note the additional requirements imposed on the format strings, along with several other minor changes and enhancements. [1] It would have been possible to use an explicit length (for example, uint64_t) for the history arguments. But that would require another "rototill" of all the users in the future when we add support for an architecture that supports a larger size. Also, the printf(3) format specifiers for explicitly-sized values, such as "%"PRIu64, are much more verbose (and less aesthetically appealing, IMHO) than simply using "%ju". [2] I've tried very hard to find "all [the] existing users of kernhist(9)" but it is possible that I've missed some of them. I would be glad to update any stragglers that anyone identifies. -- For some reason this single kernel seems to have outgrown its declared size as a result of the kernhist(9) changes. Bump the size. XXX The amount of increase may be excessive - anyone with more detailed XXX knowledge please feel free to further adjust the value appropriately. -- Misssed one cast of pointer --> uintptr_t in previous kernhist(9) commit -- And yet another one. :( -- Use correct mark-up for NetBSD version. -- More improvements in grammar and readability. -- Remove a stray '"' (obvious typo) and add a couple of casts that are probably needed. -- And replace an instance of "%p" conversion with "%#jx" -- Whitespace fix. Give Bl tag table a width. Fix Xr.
|
1.275.2.1 |
| 25-Jul-2017 |
snj | Pull up following revision(s) (requested by skrll in ticket #136): sys/dev/usb/uhci.c: revision 1.276 Only call uhci_free_stds if there are TDs to free. In uhci_alloc_std_chain ensure we fill the TD array correctly and note the number of allocated TDs so that uhci_free_stds will do the right thing Fixes a problem seen by anon
|
1.279.2.3 |
| 30-Sep-2018 |
pgoyette | Ssync with HEAD
|
1.279.2.2 |
| 06-Sep-2018 |
pgoyette | Sync with HEAD
Resolve a couple of conflicts (result of the uimin/uimax changes)
|
1.279.2.1 |
| 16-Apr-2018 |
pgoyette | Sync with HEAD, resolve some conflicts
|
1.280.2.2 |
| 08-Apr-2020 |
martin | Merge changes from current as of 20200406
|
1.280.2.1 |
| 10-Jun-2019 |
christos | Sync with HEAD
|
1.288.6.1 |
| 29-Feb-2020 |
ad | Sync with head.
|
1.288.4.3 |
| 23-Dec-2020 |
martin | Pull up following revision(s) (requested by riastradh in ticket #1159):
sys/dev/usb/ohci.c: revision 1.314 sys/external/bsd/dwc2/dwc2.c: revision 1.75 sys/dev/usb/ehci.c: revision 1.284 sys/dev/usb/uhci.c: revision 1.305 sys/dev/usb/xhci.c: revision 1.136
usb: Omit bogus assertions about struct usbd_pipe::up_intrxfer.
These assertions were only valid for pipes at UE_IN_DIR, UE_INTERRUPT endpoints created with usbd_open_pipe_intr, which uses up_intrxfer to pass the struct usbd_xfer object to usbd_close_pipe to free later.
In contrast, for pipes at UE_OUT_DIR, UE_INTERRUPT endpoints, up_intrxfer is never initialized, so the assertion cannot be right. In principle we might even have more than one outstanding interrupt transfer at a time, rendering the point of the assertion moot anyway.
Found by interrupting a uhidev write to a u2f device.
ok nick
|
1.288.4.2 |
| 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.288.4.1 |
| 25-Feb-2020 |
martin | Pull up following revision(s) (requested by skrll in ticket #718):
sys/dev/usb/ohci.c: revision 1.296 sys/dev/usb/uhci.c: revision 1.294 sys/external/bsd/dwc2/dwc2.c: revision 1.72 sys/arch/mips/adm5120/dev/ahci.c: revision 1.21 sys/dev/usb/ehci.c: revision 1.274
Fix a memory leak. Spotted by nat@
|
1.304.2.2 |
| 03-Apr-2021 |
thorpej | Sync with HEAD.
|
1.304.2.1 |
| 03-Jan-2021 |
thorpej | Sync w/ HEAD.
|