History log of /fuchsia/zircon/system/dev/usb/xhci/xhci-device-manager.c
Revision Date Author Comments
# 42000010 27-Sep-2018 David Stevens <stevensd@google.com>

[xhci] Prevent crash from transfers after stopping

xhci_stop_endpoint releases the transfer ring, so make sure we don't
try to access it in xhci_handle_transfer_event. Stopping an endpoint
completes any queued/pending requests, so skipping them when handling
transfer events is fine.

Test: Repeatedly stop/start video_display w/a usb video capture device.
Change-Id: I0460759fa0373c749fcac91f1d773dbfc71ced5c


# babe1cf5 25-Jul-2018 Adam Barth <abarth@chromium.org>

[sync] Apply C API rubric to libsync

Test: No behavior change
Change-Id: I30a413f7fb5d3f4e741e5204532b82e73595c086


# 5dfad365 07-May-2018 Mike Voydanoff <voydanoff@google.com>

[dev][usb][xhci] Make the "set address" loop more persistent

Continue trying if errors occur within the for loop.

Change-Id: I3b93608e4f2d5ea42b8a4f0355b78d1ecbca6f17


# 7837c25b 19-Apr-2018 Ruchira Ravoori <ravoorir@rodete-desktop-imager.corp.google.com>

[zircon][xhci] Initialize TT fields for all the low/full speed devices

The transaction translator fields should be set for all the low/full
speed devices. Currently our code only sets it if the parent is a high
speed hub and does not pass on the TT fields to children of a full speed
or a low speed hub which is connected to a high speed hub. Without this,
the xhc generates errors for the SET_ADDRESS command and the device does
not initialize properly. This changeset does the following:
1. Passes on the TT fields as required.
2. Add a sleep between Address Device and Get Descriptor commands.
Without this, the Get Descriptor command fails on Razer Megalogon headset.
3. Provides error handling for legacy devices that might expect Get
Descriptor request before SET_ADDRESS request.
ZX-1933 #done ZX-1975 #done

Change-Id: I80045a2569ba108f697034dd8c85229a8960bea9


# aa213037 18-Apr-2018 Jocelyn Dang <jocelyndang@google.com>

[dev][usb-xhci] Extract data stage of usb transfer to
xhci-transfer-common.

Also moves print_trb and the xhci_transfer_state struct.

We need almost the same code for the debug cap bulk transfers
so figured it would be nice not to duplicate.

Change-Id: If62b0ec10c2ec84f5a8f75c8f3633b256d7fe091


# af71cbda 06-Apr-2018 Mike Voydanoff <voydanoff@google.com>

[dev][usb] Add support for automatic zero length packets

Set send_zlp flag on usb_request_t if you want zero length packets
sent automatically when transfer length is a multiple of max packet size.

ZX-1952 #done

Change-Id: I78e1cf3231179ec77b20b1ca95e5b765e7ed5dac


# d14bfadf 20-Mar-2018 Todd Eisenberger <teisenbe@google.com>

[ddk][io-buffer] Rename callsites of io_buffer_init*_with_bti

ZX-1804 #comment Move all zircon callsites to final name

Change-Id: Ie35de5654841e84653582126dc1f976664c0f49d


# 54dc7146 26-Mar-2018 Ruchira Ravoori <ravoorir@rodete-desktop-imager.corp.google.com>

[zircon][xhci][usb-cdc]Add a delay between requests when TRB Error occurs

When downloading files from the target using some of the usb-c ethernet adapters that use
usb-cdc-ecm driver, the scp loses connection intermittently and will not work until a reboot.
The underlying reason is that the device is not able to match the pace of the requests from
client driver. When this happens, the xhc controller converts the NRDY packets on the bus to
TRB Error. There is no way we can further know what the reason for TRB Error and it can be
other things too. So we do the normal reset deque ptr when we see a TRB Error, but we also
introduce a delay between the requests to slow down the I/O. There is a likely chance that
we might need to increase the delays as the situation arises.
NET-97 #done

Change-Id: Id06022e5a7b0129419b2768e37ec61daaa2df368


# 2516534d 23-Mar-2018 Jocelyn Dang <jocelyndang@google.com>

[dev][usb][xhci] Modify transfer ring and event ring init
to take the ring pointer and bti handle rather than xhci struct.

Would like to reuse these components for xhci debug capability,
but don't want to share the same xhci structure.

Change-Id: I440036a24483855e6618e9477682ec45100f4650


# 397ed1f0 13-Mar-2018 Mike Voydanoff <voydanoff@google.com>

[dev][usb][xhci] Switch to io_buffer_init_with_bti()

Change-Id: I8aeaafe864c003689760c4233072db4fb4b82108


# d76f2897 10-Mar-2018 Mike Voydanoff <voydanoff@google.com>

[dev][usb][xhci] Always use cached buffers on x86

ZX-1816

Change-Id: I239271271230fa6b4c36f62c269e7d9ef942c61e


# 5806fbc8 07-Mar-2018 Mike Voydanoff <voydanoff@google.com>

[dev][usb][xhci] Use uncached io_buffers and eliminate cache flushing/invalidating

Now we only need a memory barrier before ringing the doorbell
after queueing new requests in the command ring.

Change-Id: Ie7e2a6c8761fc624c2c5e143636ffc71cec25aad


# 948ea7da 04-Jan-2018 Jocelyn Dang <jocelyndang@google.com>

[dev][usb-xhci] Initialize max burst size in EP ctx,
to fix issue with multiple transactions per microframe.

Change-Id: I06366163fce10ec5974b6894d81b45d064673bce


# ac25dd9e 13-Dec-2017 Mike Voydanoff <voydanoff@google.com>

[dev][usb][xhci] Two DMA cache management fixes:

- Invalidate device context buffer after allocating it so the VM system's
zeroing of the buffer does not interfere with the controller writing to it

- Add two missing xhci_cache_flush() in xhci_handle-enumerate_device()

Fixes USB breakage on ARM that was introduced by
https://fuchsia-review.googlesource.com/c/zircon/+/103016

Change-Id: Id50cfe9a4dcd3927b2f7d695662963290206319d


# c92e74a1 16-Nov-2017 Mike Voydanoff <voydanoff@google.com>

[dev][usb][xhci] Use zx_cache_flush instead of zx_vmo_op_range for cache management

Change-Id: I261246de12f4c915b485dfb15830d084658e9ffc


# ef7fccd1 02-Nov-2017 Jocelyn Dang <jocelyndang@google.com>

[dev][usb-xhci] Fix deadlock when disabling an endpoint in
xhci_enable_endpoint

Change-Id: I45cb1b3ff6f0aea73573909af05222551457bd20


# f4b2ff04 23-Oct-2017 Brian Swetland <swetland@google.com>

[ddk] rename dprintf() to zxlogf() to avoid conflicts

dprintf is still defined by ddk/debug.h but with a deprecation warning

Change-Id: I00b34803571c468007e069c1da6a292feba2bc3c


# 7ca7be57 04-Oct-2017 Jocelyn Dang <jocelyndang@google.com>

[dev][usb] Migrate xhci to usb_request.

Change-Id: Ifd0ceb3f033d530e70c88fc80321cf9fc0be8f40


# 47214ee6 04-Oct-2017 Sean Klein <smklein@google.com>

[usb][xhci] Clean up checking of equal expressions

Change-Id: I600642c3528b0fb5bea60bea39bd1c61f42cc6e2


# 5df8e9e6 17-Sep-2017 Mike Voydanoff <voydanoff@google.com>

[dev][usb-xhci] Fix xhci driver unbind path

This is needed for shutting down xhci when switching from host
to peripheral role.

Change-Id: I83b154060374ef9c94fee4c994e5919f382f2679


# a18aea8b 15-Sep-2017 Mike Voydanoff <voydanoff@google.com>

[dev][usb][xhci] Clean and invalidate caches as necessary on non-x86 platforms

Also made VMOs for event rings and device contexts read-only

Change-Id: I1aee51c7ba4515523219826fc0b013d6771e514b


# 0bdd813f 14-Sep-2017 Mike Voydanoff <voydanoff@google.com>

[ddk][io-buffer] Add support for creating non-contiguous IO buffers

IO buffers are now non-contiguous by default.
Buffers are allocated contiguously if the IO_BUFFER_CONTIG flag is passed
and the buffer size is greater than one page.

Change-Id: I5d069b80df3bcbe9b148639c6c2b60f2442109a9


# d37d37b5 14-Sep-2017 Mike Voydanoff <voydanoff@google.com>

[dev][usb][xhci] Set initial ep0 max packet size based on speed

Fixes incompatibility with dwc3 xhci implementation

Change-Id: Ia53d28efb2e29273e8ef548cbd53a5be972dc2ec


# f3e2126c 12-Sep-2017 Roland McGrath <mcgrathr@google.com>

[zx] Magenta -> Zircon

The Great Renaming is here!

Change-Id: I3229bdeb2a3d0e40fb4db6fec8ca7d971fbffb94


# bc6afa00 07-Sep-2017 Mike Voydanoff <voydanoff@google.com>

[dev][xhci] Switch to new DDK dprintf() logging calls

Change-Id: I629e2b486de24749fb217e63d4ca40cb39b14390


# d07baedb 30-Jun-2017 Mike Voydanoff <voydanoff@google.com>

[usb] add support for canceling and timing out transactions

Added usb_cancel_all() to the USB protocol, which cancels all
pending iotxns on an endpoint.

The "timeout" parameter to usb_control() is now being honored.

Also replaced the "enabled", "halted" and endpoint flags with
a new xhci_ep_state_t enum.

To avoid confusion, the endpoint state in the hardware's endpoint context
has been renamed from EP_STATE_* to EP_CTX_STATE_* and the accessor
has been renamed to xhci_get_ep_ctx_state()

Change-Id: Id4daafc88c4767e8723deeed373b5321440469b9


# a5f1bef5 29-Jun-2017 Mike Voydanoff <voydanoff@google.com>

[usb] Revert changes related to canceling USB transactions

These changes introduced a number of bugs and need more work.

Squashed commit of:

Revert "[usb] add support for canceling and timing out transactions"

This reverts commit b986f57f0d5776585086d1eb6a99d65cdcff2486.

Revert "[dev][usb-xhci] Endpoint state cleanup work"

This reverts commit 5d8c3e1594c0f8161c1e2ca8e80533d0e83f5c8e.

Revert "[dev][usb-xhci] Cleanup completing transactions when stopping an endpoint"

This reverts commit cdbc4364957bc9c3067caba54adfb73fae887f03.

Change-Id: I1ab9ba1fbc06ba9e992ec71bb41ecf2465e72e29


# 5d8c3e15 28-Jun-2017 Mike Voydanoff <voydanoff@google.com>

[dev][usb-xhci] Endpoint state cleanup work

Replace the "enabled", "halted" and "stopped_reason" endpoint flags with
a new xhci_ep_state_t enum.

To avoid confusion, the endpoint state in the hardware's endpoint context
has been renamed from EP_STATE_* to EP_CTX_STATE_* and the accessor
has been renamed to xhci_get_ep_ctx_state()

Change-Id: I195d688948d4ca65db395205e35f52145893d400


# cdbc4364 28-Jun-2017 Mike Voydanoff <voydanoff@google.com>

[dev][usb-xhci] Cleanup completing transactions when stopping an endpoint

The XHCI "stop endpoint" command will complete all pending transfers
before the command completes. We now take advantage of that by allowing
them to complete normally rather than completing them xhci_stop_endpoint()
and ignoring the transfer events in xhci_handle_transfer_event().

This is prep work for adding support for cancelling transfers.

Change-Id: Ibc5858ec291c65b0cdd580c17a22bcb66424e1c0


# 82c01fd2 26-Jun-2017 Mike Voydanoff <voydanoff@google.com>

[udev][usb-xhci] Add support for timing out controller commands

In particular, we now time out and retry "address device" commands
during initial device setup.
This fixes problems enumerating devices that do not respond to the
first SET_ADDRESS control request.

Change-Id: Ic0d7c8804bdeed8e90c7338f9dfc061fbe16940f


# 245474ee 22-Jun-2017 Mike Voydanoff <voydanoff@google.com>

[udev][usb-xhci] Recover from stalls during device enumeration

The asix-88179 based Plugable USB ethernet/hub combo has an intermittent problem
where the initial get device descriptor command will fail, resulting in the
USB 2.0 side of the hub not to enumerate.
Catching this and clearing the stall allows us to recover.

Also added accessor for reading endpoint state from the endpoint context.

Change-Id: I33a1f78513c55fd2d16d44d8dfaac979ccfc2b23


# 83087d19 21-Jun-2017 Mike Voydanoff <voydanoff@google.com>

[udev][usb] Clean up error code usage

Previously most USB errors were being reported as MX_ERR_PEER_CLOSED.
We now return MX_ERR_IO_NOT_PRESENT to indicate that the USB device is no longer attached.
Other possibly recoverable errors are now reported as MX_ERR_IO.
Attempting to use a disabled endpoint now returns MX_ERR_BAD_STATE.
We continue to use MX_ERR_IO_REFUSED to report stalled endpoints.

Change-Id: I254a1e5ee7c6ae34c70d36a9a2d40deaa2f3d781


# b2d14526 09-Jun-2017 Tim Kilbourn <tkilbourn@google.com>

[dev][usb] Use new magenta error names

Change-Id: Ie4901fe957ee96cf7c7d425a948c1b66a0d3a0f3


# 9f5cd55f 07-Jun-2017 Brian Swetland <swetland@google.com>

[udev][usb-xhci] rename

Change-Id: I9301fac7ba04cb881cbc84cc4d34f9a3061ed848