History log of /fuchsia/zircon/system/dev/usb/xhci/xdc.c
Revision Date Author Comments
# 79c8b30e 26-Sep-2018 Ruchira Ravoori <ravoorir@google.com>

[zircon][usb-request-cleanup]Remove bti_handle from usb-request

The bti_handle is used only during the physmap which is used only at the
usb infrastructure level and not by the client drivers. This change removes
the bti handle from usb_request_t, and also removes the need for it beeing needed
during the usb_request_alloc. In a later changeset, clients will be using
the usb_request_alloc directly from the usb-request library and not via
the protocol op. This changeset is in preparation for that to work.

Test: Full build. Netbooting on vim2. Plugged in a usb-mass-storage
device and verified lsusb works as expected.

Change-Id: I158917a9cfec1c3b0f2b9ec905c17dbfcc6ecbc7


# 11f67f26 25-Sep-2018 Jocelyn Dang <jocelyndang@google.com>

[dev][xdc] Fix write bug.

Forgot to set write_complete callback for write transfers.
The transfers weren't being added back to the pool on
completion and causing many allocs.

TEST= ran xdc-server and xdc-test app

Change-Id: I682592d94e6de2012a07836e224728ae82a5cb16


# 6d3095d3 25-Sep-2018 Jocelyn Dang <jocelyndang@google.com>

[dev][xdc] Tweak some constants.

TEST= patched in usb handler changes and ran a xdc transfer

Change-Id: I6ef632f3b729d1ee7ca93c1a8628a5f9e65328b5


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

[sync] Apply C API rubric to libsync

Test: No behavior change
Change-Id: I30a413f7fb5d3f4e741e5204532b82e73595c086


# 34dd17ec 17-Jul-2018 Jocelyn Dang <jocelyndang@google.com>

[dev][xdc] Add missing list init.

TEST= ran with debugging cable

Change-Id: I018fdd358a2ad744930297babf112f175845ee1f


# 47cff597 26-Jun-2018 George Kulakowski <kulakowski@google.com>

[clock] zx_clock_get(ZX_CLOCK_MONOTONIC) -> zx_clock_get_monotonic()

Test: no functional change

Change-Id: Iaa513c521d96b178458acc707be3646067971701


# 7eb23399 19-Jun-2018 Jocelyn Dang <jocelyndang@google.com>

[dev][xdc] Track what host streams are online.

We check if the corresponding host stream is online when creating a new
instance.
If it's not online, we will wait for the host notify stream control message before
allowing the instance to write.

TEST= fx shell xdc-test -f [file]

Change-Id: I606ba2ab18660a7cd76165f2c0e8117391c549c0


# 1061b812 18-Jun-2018 Jocelyn Dang <jocelyndang@google.com>

[dev][xdc] Send host msg if stream goes on/offline.

When a xdc instance registers a stream id, we send a msg to the host
to let it know it can start writing to that stream id (transfers
to non registered stream ids are dropped).

The opposite happens when we close an instance.

Change-Id: If0cd1d62c724219c345c2298beea42173c0b84a0


# bbc88819 13-Jun-2018 Jocelyn Dang <jocelyndang@google.com>

[dev][xdc] Only poll if an xdc instance is open.

ZX-2252 #done

Change-Id: I6ad2f3a89e6d486aba6185ee40fbd4457bf5caf7


# 903a8282 12-Jun-2018 Jocelyn Dang <jocelyndang@google.com>

[dev][xdc] Move packet related code to library.

Will be used by the host side xdc server. Since the host side
will have libusb transfer buffers instead of usb requests,
xdc_update_packet_state takes in a void* buffer instead.

Change-Id: I6ddc6e692c9190f3dac3ec03982a50bc99ac0697


# e939b708 01-Jun-2018 Jocelyn Dang <jocelyndang@google.com>

[dev][xdc] Allow reads of any size in xdc_read_instance.

It tries to read as much as requested, or until we've run out of
completed reads.

Change-Id: Ie070674014178271ea09c05c1b4900bb272e4442


# 2122d730 01-Jun-2018 Jocelyn Dang <jocelyndang@google.com>

[dev][xdc] Add xdc_poll_state struct, which the poll thread uses
to track whether the debug capability registers have changed,
and to store completed requests.

The poll thread acquires the main xdc lock only when necessary,
such as changes in configuration state / halted EPs
(not expected to happen often), or when requests complete.

The POLL_INTERVAL delay was making transfers too slow, but acquiring
the xdc->lock constantly was causing high lock contention.

Change-Id: I90f771f2040c08298e92a2f2e6c963c1db0ff1e3


# 0a4aff65 29-May-2018 Jocelyn Dang <jocelyndang@google.com>

[dev][xdc] Once a read completes, pass it to the stream instance
contained in the packet header.

When read is called on an instance, it will check its list of
completed reads, copy it into the buffer and requeue the read request.

Also rename xdc_transfer_header to xdc_packet_header.

Each packet can span over several read requests, so we keep track
of the current packet via the xdc_packet_state struct, which
tracks how many bytes have been received for the current packet.

Change-Id: I95123c1c3ec8415db0eb860b357e4e23c90051fb


# 591d994f 22-May-2018 Jocelyn Dang <jocelyndang@google.com>

[dev][xdc] Require a different stream id for different xdc device
instances.

Added a lock around the instance stream id and dead flag.

Change-Id: If1d298a5f58d9cc635972cfc80ca18e8480a919f


# 7eb7492a 22-May-2018 Jocelyn Dang <jocelyndang@google.com>

[dev][xdc] Only update write signal if it has changed.

Change-Id: I61ea106a930aa6b464c7efe8d82207b8da7a2985


# 64ceaed0 22-May-2018 Jocelyn Dang <jocelyndang@google.com>

[dev][xdc] Fix wrong order, complete requests starting from head of list.

Change-Id: Iea610676625587902478dc592b4ec91b314c1b84


# f4bc2653 23-May-2018 Jocelyn Dang <jocelyndang@google.com>

[uapp][xdc-test] Simple test app for writing a file via the XHCI debug
capability, from debug device to host.

Will add reading in a future CL.

Change-Id: I8acc91c903677a58867692cd6ae37086e69acd32


# 735e9d0b 17-May-2018 Jocelyn Dang <jocelyndang@google.com>

[dev][xdc] Create a new child instance in xdc_open.

The client can then set a stream to read / write to.

Currently only xdc_write_instance is implemented, read in future CL.

Change-Id: I869b0ac0ddfbc8510c04b27e827ef0a2bbbe8227


# 45f4bb62 10-May-2018 Jocelyn Dang <jocelyndang@google.com>

[dev][xdc] Allow larger write requests.

Allocate a new usb request if we don't have any matching ones in the
pool.

We now set the device as writable if there are free trbs left on the
transfer ring, rather than if we have usb requests left.

Change-Id: I4e5902445a40e206c132feca5f324337cf7a8fe4


# e8f5ba35 09-May-2018 Jocelyn Dang <jocelyndang@google.com>

[dev][xdc] Initial write and read implementation.

Currently only handling small transfers and no multiplexing.

Change-Id: I62ce2a5d57f7fbdfa69682ad3760577bba352272


# a7b32a67 07-May-2018 Jocelyn Dang <jocelyndang@google.com>

[dev][xdc] Handle event ring transfer events.

If we get an error, we set the transfer ring as halted (if not already),
and try to requeue and restart the transfers.

Also renamed xdc_update_configuration_state_locked to xdc_update_state_locked.
It also calls xdc_handle_events now, as this may change an EP's state,
and we need to do this before queueing a new transfer.

Change-Id: I4bec4e8af054bed05a2f4e261d7a7d88693987b0


# f0b943bd 05-May-2018 Mike Voydanoff <voydanoff@google.com>

[dev][usb][xhci] Disable xdc_bind error message when not on x64

Change-Id: Ic6e5e2c28cf1b3c855a671c2c8ed32e89f2e1a0d


# 8aa3f559 04-May-2018 Jocelyn Dang <jocelyndang@google.com>

[dev][xdc] Replace configured_mutex and EP locks with a single lock.

We will need to process the event ring before queueing
new transfers. Since the event ring has both events
for the IN and OUT EPS, we would need to acquire
all three locks anyway.

This is as we may miss the halt register for the IN / OUT
EP being set if it is cleared before our poll loop gets to it,
so we should check the event ring to see if there were any TRBs
that had an error code which indicates a halt occurred.

Change-Id: I777a6c25bd45f870470e65dbf2738c9b005978b5


# 06d4c87a 30-Apr-2018 Jocelyn Dang <jocelyndang@google.com>

[dev][xdc] Add xdc EP states, and handle change in halt bit.

Change-Id: If8a3d8ce2c42aeb7163d3a6f69e180ffa052c1e0


# b7d3b861 19-Apr-2018 Jocelyn Dang <jocelyndang@google.com>

[dev][xdc] Adds xdc_queue_transfer.

Actual usage and handling of transfer events in future CL.

Change-Id: I23a412217a1efd2e0550684802fbd5e07488914e


# acbc299c 25-Apr-2018 Jocelyn Dang <jocelyndang@google.com>

[dev][xdc] Move xdc struct to header file.

xdc.c is pretty big now, would like to add transfer related logic
in separate file, which will need that struct.

Change-Id: Ia4e7bce4e33436dd96c29e54d211d0b57d507f63


# b34705e3 20-Apr-2018 Jocelyn Dang <jocelyndang@google.com>

[dev][xdc] Basic poll loop to track connected and configured state
of the debug capability.

Change-Id: If32ba246d2762f972e454a7caab02335a808289d


# e8ef5fcb 17-Apr-2018 Jocelyn Dang <jocelyndang@google.com>

[dev][xdc] Disable on arm, as crashing imx8.

Change-Id: Id0cd0c37b64b03f2a8518e0be0e6353b982d78fd


# 684b9dd5 11-Apr-2018 Jocelyn Dang <jocelyndang@google.com>

[dev][xdc] Beginnings of XHCI Debug Capability.

Polling / transfers left to future CL.

Change-Id: Ic8ab93d1fa4449781356237468d17f09468fba52