| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
| |
which finally makes umb(4) fail, since ugen(4) attaches to one of the
umb(4) interfaces, fails, and marks the whole device dying. Therefore
make usbd_device2interface_handle() backwards compatible again.
Problem reported by Mikolaj Kucharski.
ok edd@
|
|
|
|
|
|
|
|
|
| |
bInterfaceNumber and bAlternateSetting as following:
ifaceidx -> ifaceno
altidx -> altno
Suggested and ok mpi@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When obtaining an interface handle, we currently rely on the device being
properly USB compliant, and thus the interface being at the correct index in
the interfaces array.
However, some devices present their indices incorrectly. For example, the
following audio device exposes interfaces 0, 1 and 3, in that order (skipping
interface 2 entirely):
uaudio2 at uhub4 port 4 configuration 1 interface 3 "E+ Corp. DAC Audio" rev 1.10/0.01 addr 2
uaudio2: class v1, full-speed, async, channels: 2 play, 0 rec, 3 ctls
This means that that the audio stream interface (number 3) is not found at the
expected index of 2, and this causes looking up the handle to fail.
This change makes usbd_device2interface_handle() search for the right
interface, instead of assuming it will be at the right index. Although this is
a little slower, note that this routine not very frequently called and there
are typically not hundreds of interfaces on a typical USB device.
This fixes the above E+ Corp device, and one other uaudio device reported
broken by a user.
With input from, tested by, and OK ratchov@, mglocker@ and kettenis@.
Many thanks!
|
|
|
|
|
|
| |
available device interfaces is called 'bNumInterfaces'.
ok phessler@, thfr@ (who provided the man page diff)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
devices we have proper DMA transfers, so that the DMA syncs before and
after transfers are necessary. For the root hub, we seem to fulfill
those requests ourselves, e.g. by using memcpy. The POSTREAD DMA sync
on a read will invalidate the caches for the buffer, and unless our root
hub code explicitly flushed the data to memory, it's possible that our
memcpy got removed from history.
Until a better solution is implemented, like moving the DMA syncs from
the USB subsystem into the controller driver, allocate all buffers that
are not explicitly allocated using USB_DMA_COHERENT. The IO buffers
continue to be allocated as non-coherent.
Regression found by jsg@
ok kettenis@
|
|
|
|
|
|
|
| |
filled by the callee, change the usb_allocmem() API to take another
argument for the flags.
ok mpi@
|
|
|
|
| |
ok mpi@
|
|
|
|
|
|
| |
Prevent an infinite loop when aborting ulpt(4)'s pipe after an I/O error.
Found by and ok stsp@
|
|
|
|
| |
ok visa@, kn@, cheloha@
|
| |
|
|
|
|
| |
ok okan@, tedu@, visa@
|
|
|
|
| |
ok pirofti@, visa@
|
|
|
|
| |
ok deraadt@, dlg@
|
|
|
|
|
|
|
|
|
|
|
| |
This assert triggers because of the floor check on amd64/sparc64
when ohci(4) processes its root-hub status change transfers at
IPL_BIO.
Previous to the removal of IPL_SOFTNET, the SPLUSBCHECK macro didn't
do anything, so it is safe to disable this check.
Issue reported by espie@ and krw@
|
|
|
|
| |
USB is the last real user of IPL_SOFTNET.
|
|
|
|
|
|
|
|
|
|
|
| |
might free it.
Prevent a use-after-free in various aynchronous cases. Found while
looking at another user-after-free pointed out by ehrhardt@.
Committing now to find if other drivers rely on this use-after-free.
tb@ confirmed ubcmtp(4) is now fixed.
|
|
|
|
|
|
|
|
|
|
| |
noop and prevent us from fixing real use-after-free.
Since xfer->status is reset by *_device_intr_done(), checking for
USBD_IOERROR cannot be true.
Problem reported by tb@ because ubcmtp(4) triggers some I/O errors
when multiple fingers are used.
|
|
|
|
| |
mpi says a transfer can't exist without a pipe. ok mpi@
|
|
|
|
|
| |
Errors will result in nice clean panic messages so we know what's wrong.
Reviewed by dhill visa natano jsg.
|
|
|
|
|
|
|
|
|
| |
certainly doing the same.
So revert r1.85 for the moment, we're too close from the release and
these bugs have been there for years.
Regression reported by tb@ on bugs@
|
|
|
|
|
|
|
|
|
|
|
| |
*_root_ctrl_start() routines are synchronous and all end up calling
usb_transfer_complete() in the non-error case. After calling this
function it is unsafe to dereference ``xfer'' since the transfer
callback has been called. So returning USBD_IN_PROGRESS is wrong in
this case since transfers are always completed at this point.
So return USBD_NORMAL_COMPLETION or the corresponding error code if
something wrong happen.
|
|
|
|
|
|
|
|
|
| |
This code contains a use-after-free which be addressed in an upcoming
diff.
This fix xhci(4) polling mode.
ok kettenis@
|
|
|
|
| |
From Christian Ludwig.
|
|
|
|
|
|
|
| |
might free it.
Prevent a use-after-free in various aynchronous cases. Found while
looking at another user-after-free pointed out by ehrhardt@.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
in HC drivers.
Only ehci(4) was performing pre & post synchronization completly. Now
pre-synchronization is done in usbd_transfer() and post-synchronization
in usbd_transfer_complete(). This will allow us to remove the partial
synchronization primitives from the pipe handlers.
This is similar to what FreeBSD did in r158998, r164519 and r176203.
From Marius Strobl.
ok kettenis@
|
|
|
|
|
|
|
| |
of dev->dying. With this we also can use them on device closing, not just
detaching.
ok mpi
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
This reduces differences between non-isoch and isoch transfers submissions,
makes the generic DMA buffer overrun check work with isoch transfers and
will allow some code simplifications in HC drivers.
Since short-transfers were never checked for isoch transfers, we now need to
pass the USBD_SHORT_XFER_OK flag to not change this behavior. This might be
revisited later.
ok ratchov@
|
|
|
|
|
|
|
| |
have any direct symbols used. Tested for indirect use by compiling
amd64/i386/sparc64 kernels.
ok tedu@ deraadt@
|
| |
|
|
|
|
|
|
|
| |
in the report functions instead of letting the stack do it magically for
us.
Reviewed and tested by David Higgs, thanks!
|
|
|
|
|
|
| |
transfers, so skip the check for such xfers for the moment.
Issue reported by Ingo Feinerer and fix confirmed by Jan Stary.
|
| |
|
|
|
|
|
|
|
| |
with some tweaks.
Nothing use it for the moment, but upcoming upd(4) improvements need
it.
|
| |
|
|
|
|
| |
Prodded by a comment from stsp@.
|
|
|
|
| |
ok blambert@ doug@
|
|
|
|
| |
in every HC driver.
|
|
|
|
| |
after discussions with beck deraadt kettenis.
|
|
|
|
|
| |
so merge them into usbd_str() to not introduce other copies with
the upcoming HC drivers.
|
|
|
|
|
| |
it in various drivers, mainly HC, instead of always rerolling our
own.
|
|
|
|
| |
because upcoming xhci(4) driver won't use it.
|
|
|
|
|
|
|
| |
This function never fails. So change it's return type to void and
adjust the copy-pasted callers that were checking the return.
"If it compiles, ok" mpi@
|
|
|
|
|
|
|
|
|
| |
The controllers are linked through device->bus so the iface is redundant.
So fixing usbd_dopoll() to take the device as argument and making
usbd_interface2device_handle() private (for now) inside usbdi_util.
Tested and okay mpi@
|
|
|
|
| |
OK mpi@
|
|
|
|
|
|
|
|
|
|
| |
starting with usbd_endpoint_count and usbd_interface_count. usbd_status
should only be used to indicate the status of a USB transfer, it should
not be used for generic error codes.
Idea from and much hand-holding by mpi@
OK mpi@
|
|
|
|
| |
No functional change.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
pipe to stop enquening the next transfer before the done() function
has been called.
This should fix the hangs seen when unplugging a USB keyboard attached
to uhci(4).
Problem reported by dcoppa@ and Peter Kane
|