Changeset 4db49344 in mainline for uspace/drv/bus/usb/xhci/device.c


Ignore:
Timestamp:
2018-01-23T21:52:28Z (6 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3dd80f8
Parents:
a6afb4c
git-author:
Ondřej Hlavatý <aearsis@…> (2018-01-23 20:49:35)
git-committer:
Ondřej Hlavatý <aearsis@…> (2018-01-23 21:52:28)
Message:

usb: fix wrong design of transfer aborting

Apparently, we didn't do a good job in thinking through the problem.
In older HCs, it was done just wrong - the UHCI implementation commited
a batch that could have been already aborted, and EHCI+OHCI might miss
an interrupt because they commited the batch sooner than they added it
to their checked list.

This commit takes everything from the other end, which is probably the
only right one. Instead of an endpoint having an extra mutex, it
inherits a mutex from the outside. It never locks it though, it just
checks if the mutex is locked and uses it for waiting on condition
variables.

This mutex is supposed to be the one which the HC driver uses for
locking its structures in scheduling. This way, we avoid the ABBA
deadlock completely, while preserving the synchronization on an
endpoint.

The good thing is that this implementation is much easier to extend with
multiple active batches per endpoint.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/xhci/device.c

    ra6afb4c r4db49344  
    8181        usb_log_debug("Obtained slot ID: %u.", dev->slot_id);
    8282
    83         /* Create and configure control endpoint. */
    84         endpoint_t *ep0_base = xhci_endpoint_create(&dev->base, &ep0_initial_desc);
    85         if (!ep0_base)
     83        endpoint_t *ep0_base;
     84        if ((err = bus_endpoint_add(&dev->base, &ep0_initial_desc, &ep0_base)))
    8685                goto err_slot;
    87 
    88         /* Bus reference */
    89         endpoint_add_ref(ep0_base);
    90         dev->base.endpoints[0] = ep0_base;
    9186
    9287        usb_log_debug("Looking up new device initial MPS: %s",
Note: See TracChangeset for help on using the changeset viewer.