Age | Commit message (Collapse) | Author |
|
from the bus, probably because of hot(un)plugging it). This makes sure
that we still ack interrupts that arrive while the controller is "dying"
(when we go down into suspend or if an unrecoverable hardware error
occurs). Fixes an interrupt storm when we suspend on Amlogic arm64 boards.
ok deraadt@
|
|
ok mglocker@
|
|
feedback and ok tb@ jmc@ ok ratchov@
|
|
* USB device drivers use M_USBDEV instead of M_DEVBUF.
* USB HC drivers use M_USBHC instead of M_DEVBUF.
In a vanilla setup, this enlarges the USB memory pool.
ok anton@
|
|
shows gains up to 50%) by skipping attach of irrelevant devices, which are
tagged CD_SKIPHIBERNATE in the per-driver cfdriver. In particular, usb devices
are not attached, so they don't need to detach during the suspend-unpack-resume.
New bootblocks are required (which tell the kernel it's job is unhibernate
before configure runs)
tested by various
|
|
ok mpi@
|
|
of zero length TDs can cause our free TRBs to run out, causing xhci(4)
to return USBD_NOMEM to the USB stack.
The issue was reported by
Jonathon Fletcher <jonathon.fletcher () gmail ! com> -- Thanks!
Reviewed/suggestions by patrick@.
ok mpi@
|
|
in-progress before we do check for the pipe being halted.
This fixes some kind of race condition for isoc devices during device
close when xp->halted gets set while usbd_start_next() still tries to
dequeue in-progress transfers which will report 'usbd_start_next:
error=13' (USBD_IOERROR).
ok mpi@
|
|
since the enum isn't tied to the type (because want smaller storage)
is better to use #define
ok kettenis mglocker
|
|
constellations resulting in bogus frame sizes being returned by xhci(4).
E.g. for uvideo(4) devices erroneous video streams were reported.
The problem occurs when multi-trb TDs are queued and being processed
as a zero-length or short transfer. Those cases were not handled in
the current isochronous code path, which this patch is adding.
Feedback and testing done by many on tech@. Thanks!
ok mpi@
|
|
the completion interrupt may already be pending while aborting.
Hence, in xhci_event_command() ignore events from a TRB that is not
the expected one. And don't let xhci_abort_command() yield the CPU.
ok mpi@
|
|
On powerdown (halt -p), sd(4)'s suspend function tries to powerdown
a USB mass storage using a STOP command. In that case we are already
cold and splhigh(), so that the xhci is supposed to run in polling-
mode.
usb_schedsoftintr() behaves differently when running in polling-mode.
Instead of scheduling a soft interrupt, it immediately dequeues from
the event queue. But dequeueing means touching the xhci registers.
Apparently we need to acknowledge the interrupts before touching those
registers, the hardware doesn't like it otherwise and we will never get
an interrupt status for the second transfer.
ok gerhard@
|
|
stack into the USB controller driver, since not all of the xfers
actually use DMA and some invalidations might even be harmful.
The important part is to sync before handing the buffer to the
controller, and to sync on a successful transfer before handing
it back to the USB stack. For isoc transfers it's easier to sync
the complete length of the transfer, since the buffer to flush is
not filled in a contiguous fashion.
For dwc2 there's a common point which takes care of the start
of transfers from or to devices, where we can make sure that our
buffers are synced. On completion, there's a common point before
handing it off to the USB stack.
For ehci there are three places which take care of the start
of transfers from or to devices, where one already does the sync,
while the two other places still need the sync. There are two
completion handler (isoc and non-isoc), where one already has a
comment asking for the need of a sync. The done handler for intr
xfers does a sync that is not needed anymore after adding the sync
in the completion handler.
For ohci there are three places which take care of the start
of transfers from or to devices, where all of them were still in
need of the sync. For completion, there is one place for isoc
xfers and two places for handling successful generic xfers.
For uhci there are two places which take care of the start
of transfers from or to device, where all of them were still in
need of the sync. For completion, there is one handler for both
isoc and non-isoc xfers where syncs need to occur.
For xhci there are three places which take care of the start
of transfers from or to device, where all of them were still in
need of the sync. For completion, there is one handler for isoc
and one for non-isoc xfers where syncs need to occur.
With this we can revert the workaround that implicitly allocated
buffers are COHERENT, since now control transfers fulfilled by the
driver code (instead of the controller doing DMA) are not flushed
into oblivion anymore.
Tested by Janne Johansson with dwc2 (octeon)
Tested by kettenis@ with xhci(4) (octeon)
Tested by patrick@ with ehci(4) on a Cubox-i (armv7)
Tested by patrick@ with xhci(4) on an i.MX8MQ (arm64)
Tested by tobhe@ with dwc2 on a rPi 3b (arm64)
ok kettenis@
|
|
This corrects computation of xfer->actlen, allowing xhci(4) to work
again on octeon and other big endian architectures.
Reported by Allen Smith
OK patrick@
|
|
ok mpi@
|
|
original TD, when a transfer is a multiple of the max packet size. The
zero length TD will have a NULL xfer pointer.
As a result "NULL xfer pointer" situations become perfectly normal. So
change the log_warnx() that issues that verbiage to a log_debug().
Note that the original transfer will complete and report its result up
the USB stack before the zero length transfer is executed.
Fixes (at least) urtwn(4) interfaces.
Feeback, cluebats, fixes and ok patrick@
|
|
the highest active endpoint context.
Don't zap other fields when setting XHCI_SCTX_DCI().
Fixes (at least) Etron EJ168 USB 3.0 Host Controllers vs USB 2
devices.
Inspired by hselasky FreeBSD revision 243780.
Feedback from kn@, ok beck@ (previous iteration) patrick@
|
|
One on the TRB that went short, and one for the last TRB in a TD.
We already set actlen only once so that the last TRB in a TD does
not override it, but some controllers throw another short event
instead of a success event, so we have to add the same check there
as well.
ok gerhard@ mglocker@
|
|
This makes udl(4) on xhci(4) work fine.
Help and ok patrick@
|
|
we have subtracted the remaining length from the total transfer
length, which essentially means that we assume that all TRBs have
successfully been transferred apart from the remainder. Actually
we might get a short completion in the middle of a chain of TRBs,
which means that all TRBs until this TRB have completed successfully
apart from a remainder. Thus we have to count the length of all
TRBs until and including the one that we went short on, and remove
the remainder. All following TRBs in the same transfer must be
ignored.
Found by and fixed with gerhard@
ok mglocker@
|
|
ok visa@, kn@
|
|
Analysed by and ok claudio@
|
|
ok ratchov@
|
|
ok mpi
|
|
After each MSE, ensuire usbd_complete_transfer() is called for each
missed transfer, for which there's no transfer completion event. Fixes
crashes and deadlocks in upper layers caused by the missing
completion.
ok deraadt, patrick; help from mpi, patrick, gmlocker
|
|
code in xhci_event_xfer() to the generic handler function.
suggested and ok mpi@
|
|
functions for isoc and !isoc xfers.
Suggested by mpi@.
ok patrick@, stsp@
|
|
|
|
to one single function.
ok mpi@
|
|
frame has to be enqueued as Transfer Descriptor. This means each frame
starts with an isoch TRB and may also contain further normal TRBs. The
TDs each throw at least one interrupt for a successful completion or
possibly more in case of a short xfer. We have to account the amount
of data transfered for each frame using the completion of the matching
TD and its TRBs.
Thanks to stsp@ for initiating this, and many more thanks to mglocker@
for reworking and cleaning up my initial diff. Further improvements
can happen in-tree now.
Tested by mglocker@, phessler@ and stsp@
ok mglocker@, stsp@
|
|
as in: Since there's always one transfer, 0 means 1. Thus we have
to add 1 (not OR) to get to the desired number.
ok mglocker@ mpi@ stsp@
|
|
ok mpi@
|
|
|
|
we know that the last non-link TRB has been written and we can look at
the flags to set the chain bit in the link TRB. Since we will now toggle
the cycle bit on the first TRB of a ring, set it on the ring reset.
Tested by jcs@, jsg@ and visa@
"commit it" jcs@
|
|
needs the Chain Bit set or not instead of using the last parameter,
which is used to mark the last TRB in a USB transfer, not in a TD.
To make that work we need to setup the recently acquired TRB before
calling xhci_xfer_get_trb() the next time. Thus setting up the
initial TRB has to happen right away. To kick the transfer off we
simply flip the toggle bit on the first TRB right at the end.
Fixes regression for jcs@, dhill@ and stsp@
Initially discussed with mpi@
ok stsp@
|
|
thus have the Link TRB inbetween must have the Chain Bit set in the
Link TRB. Otherwise xHCI controllers might think that the transfer
ends at that point.
Fixes an issue that was most prominently seen as Invalid CSW error
when using umass0 on octeon and i.MX8M.
Tested by visa@
ok mpi@
|
|
|
|
the device is gone and give back the descriptor to the stack.
Without this usbd_abort_pipe() could end up in an infinite loop.
Issue reported by Tom Murphy.
|
|
Prevent triggering an assert if two drivers try to submit a command
at the same time.
Issue reported by Tom Murphy.
|
|
|
|
flip before the rest of the TRB is updated.
OK dlg@, pirofti@, mpi@
|
|
ok patrick@, kettenis@
|
|
|
|
|
|
Use this helper to calculate the Transfer Burst Count (TBC) and Transfer
Last Burst Packet Count (TLBPC) required for isochronous support.
Note that SS companion descriptors are still not read.
While here print the ETE and IST values in debug mode.
|
|
|
|
While here use UE_GET_SIZE() coherently.
ok pirofti@, stsp@, visa@
|
|
ok stsp@
|
|
ok stsp@
|
|
This is just a step forward which allows further progress to happen in-tree.
The isochronous code path remains disabled for now. Playing audio over
xhci(4) does not work properly yet, and I haven't even tested video input.
Based on a work-in-progress diff by mpi@ from 2015.
ok mpi@
|