#
08ccf0ed |
| 13-Mar-2022 |
riastradh <riastradh@NetBSD.org> |
ehci(4): Serialize access to portsc registers.
Both ehci_roothub_ctrl and ehci_suspend/resume do r/m/w on them, so use a mutex to serialize access to avoid stomping on each other.
|
#
cb61661b |
| 13-Mar-2022 |
riastradh <riastradh@NetBSD.org> |
ehci(4): Fix doorbell synchronization.
ehci_sync_hc was previously subject to spurious wakeup, in which case the CPU might proceed from aborting and recycle a DMA buffer before the hardware was done
ehci(4): Fix doorbell synchronization.
ehci_sync_hc was previously subject to spurious wakeup, in which case the CPU might proceed from aborting and recycle a DMA buffer before the hardware was done writing to it. Now the code is not subject to spurious wakeup -- it waits (up to the 1sec timeout) for the relevant interrupt to be delivered, not for anything else.
show more ...
|
#
a7080a7f |
| 22-Dec-2021 |
skrll <skrll@NetBSD.org> |
Three fixes
- pass the 64bit DMA tag if the HCCPARAMS says ehci supports it and the 64bit DMA tag is available/valid. This should help with the "cannot create xfer" error on 64bit systems.
- r
Three fixes
- pass the 64bit DMA tag if the HCCPARAMS says ehci supports it and the 64bit DMA tag is available/valid. This should help with the "cannot create xfer" error on 64bit systems.
- restrict the control structure memory allocation to the low 4GB (CTRLDSSEGMENT was always set to zero anyway)
- if ehci_init fails then tidyup before returning the error.
show more ...
|
#
1ee58945 |
| 15-Mar-2020 |
skrll <skrll@NetBSD.org> |
Use roundup. NFCI.
|
#
9582072e |
| 04-Mar-2020 |
skrll <skrll@NetBSD.org> |
Consistency in use of #define names. No functional change as values of before and after defines are the same.
|
#
b3b4cfe8 |
| 18-Sep-2018 |
mrg <mrg@NetBSD.org> |
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
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().
show more ...
|
#
e312a862 |
| 09-Aug-2018 |
mrg <mrg@NetBSD.org> |
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.
am
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.
show more ...
|
#
254b7185 |
| 09-Apr-2018 |
jakllsch <jakllsch@NetBSD.org> |
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
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.
show more ...
|
#
71112a2e |
| 23-Apr-2016 |
skrll <skrll@NetBSD.org> |
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 debu
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
show more ...
|
#
f47567be |
| 02-Feb-2013 |
matt <matt@NetBSD.org> |
Use CACHE_LINE_SIZE for EHCI_SQTD_ALIGN to make sure the sqtd fully consume a cacheline.
|
#
48cb8ffb |
| 29-Jan-2013 |
christos <christos@NetBSD.org> |
use a pool instead of a linked list to avoid synchronization problems.
|
#
c5eb5605 |
| 10-Jun-2012 |
mrg <mrg@NetBSD.org> |
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 somethin
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.
show more ...
|
#
669869a3 |
| 06-Mar-2012 |
mrg <mrg@NetBSD.org> |
pull down from usbmp:
kill the !USE_USE_SOFTINTR code.
|
#
2c27785a |
| 18-Jan-2011 |
matt <matt@NetBSD.org> |
Add preliminary support for Embedded Transaction Translator Function (as found on the MPC8536 and AR9334) which allows low/full devices to be connected to an EHCI root hub.
|
#
992efa8a |
| 16-Oct-2010 |
kiyohara <kiyohara@NetBSD.org> |
Add vendor dependent functions. sc_vendor_init()/sc_vendor_port_status().
|
#
c1b390d4 |
| 24-Feb-2010 |
dyoung <dyoung@NetBSD.org> |
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_
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.
show more ...
|
#
cd6e1fbf |
| 08-Jan-2010 |
dyoung <dyoung@NetBSD.org> |
Expand PMF_FN_* macros.
|
#
786bda7e |
| 04-Sep-2009 |
dyoung <dyoung@NetBSD.org> |
Expand <dev/usb/usb_port.h> definitions, and lightly unifdef(1).
|
#
b8aea819 |
| 14-Oct-2008 |
jmcneill <jmcneill@NetBSD.org> |
kern/39727: race condition in ehci isoc abort xfer path
From Jeremy Morse:
* Serialize access to the ehci intrlist. * Change the ehci intrlist to a tailq so xfers are not queued out of order.
kern/39727: race condition in ehci isoc abort xfer path
From Jeremy Morse:
* Serialize access to the ehci intrlist. * Change the ehci intrlist to a tailq so xfers are not queued out of order. * In ehci_check_itd_intr, don't treat a transfer error as an indication that the xfer is no longer active.
show more ...
|
#
4e6a4581 |
| 02-Aug-2008 |
jmcneill <jmcneill@NetBSD.org> |
High speed isochronous support, from Jeremy Morse as part of Google Summer of Code 2008.
|
#
efe8b350 |
| 28-Jun-2008 |
bouyer <bouyer@NetBSD.org> |
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
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.
show more ...
|
#
ce099b40 |
| 28-Apr-2008 |
martin <martin@NetBSD.org> |
Remove clause 3 and 4 from TNF licenses
|
#
fd0ded75 |
| 28-Mar-2008 |
drochner <drochner@NetBSD.org> |
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
|
#
9a0e417e |
| 07-Mar-2008 |
dyoung <dyoung@NetBSD.org> |
Use device_t and accessors. Setup power management in the PCI front-end (XXX needs to look more alike the Cardbus front-end). Establish the shutdown hook using PMF.
|
#
cd44c43b |
| 22-Feb-2008 |
dyoung <dyoung@NetBSD.org> |
Add a method to detach child.
Cosmetic: use device_t and accessors. Use aprint_*_dev(). Use PMF_FN_{ARGS,CALL,PROTO}.
|