Changeset 2755a622 in mainline for uspace/drv/bus/usb/uhci/hc.c


Ignore:
Timestamp:
2018-01-17T01:36:46Z (7 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
740dafc
Parents:
3f44312
git-author:
Ondřej Hlavatý <aearsis@…> (2018-01-16 23:24:28)
git-committer:
Ondřej Hlavatý <aearsis@…> (2018-01-17 01:36:46)
Message:

uhci: fix transfer aborting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/uhci/hc.c

    r3f44312 r2755a622  
    329329        uhci_transfer_batch_t *batch = NULL;
    330330
     331        // Check for the roothub, as it does not schedule into lists
     332        if (ep->device->speed == USB_SPEED_MAX) {
     333                // FIXME: We shall check the roothub for active transfer. But
     334                // as it is polling, there is no way to make it stop doing so.
     335                // Return after rewriting uhci rh.
     336                return;
     337        }
     338
     339        transfer_list_t *list = hc->transfers[ep->device->speed][ep->transfer_type];
     340        assert(list);
     341
     342        // To avoid ABBA deadlock, we need to take the list first
     343        fibril_mutex_lock(&list->guard);
    331344        fibril_mutex_lock(&ep->guard);
    332345        if (ep->active_batch) {
    333346                batch = uhci_transfer_batch_get(ep->active_batch);
    334 
    335                 transfer_list_t *list = hc->transfers[ep->device->speed][ep->transfer_type];
    336                 assert(list);
    337 
    338                 fibril_mutex_lock(&list->guard);
     347                endpoint_deactivate_locked(ep);
    339348                transfer_list_remove_batch(list, batch);
    340                 fibril_mutex_unlock(&list->guard);
    341 
     349        }
     350        fibril_mutex_unlock(&ep->guard);
     351        fibril_mutex_unlock(&list->guard);
     352
     353        if (batch) {
     354                // The HW could have been looking at the batch.
     355                // Better wait two frames before we release the buffers.
    342356                endpoint_wait_timeout_locked(ep, 2000);
    343 
    344                 batch = uhci_transfer_batch_get(ep->active_batch);
    345                 if (ep->active_batch) {
    346                         endpoint_deactivate_locked(ep);
    347                 }
    348         }
    349         fibril_mutex_unlock(&ep->guard);
    350 
    351         if (batch) {
    352357                batch->base.error = EINTR;
    353358                batch->base.transfered_size = 0;
Note: See TracChangeset for help on using the changeset viewer.