Changeset 9620a54 in mainline for uspace/drv/bus/usb/xhci/endpoint.c


Ignore:
Timestamp:
2017-10-29T10:51:59Z (6 years ago)
Author:
Petr Manek <petr.manek@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d33dc780
Parents:
62f8025
Message:

Small changes. Temporarily fixed no device problem for endpoint logging. Added similar macro for device logging. Changed log messages to adopt these macros. TRB rings can be freed again. Made ring finalizers noexcept. Upon detach, the entire slot is disabled prior to unregistering endpoints in order to prevent invalid HC commands. Removed active endpoints count from XHCI device. Device context is freed in HC, so DCBAA is not touched from anywhere else.

File:
1 edited

Legend:

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

    r62f8025 r9620a54  
    188188int xhci_endpoint_alloc_transfer_ds(xhci_endpoint_t *xhci_ep)
    189189{
    190 
    191         usb_log_debug2("Allocating main transfer ring for endpoint %u", xhci_ep->base.endpoint);
     190        /* Can't use XHCI_EP_FMT because the endpoint may not have device. */
     191        usb_log_debug2("Allocating main transfer ring for endpoint " XHCI_EP_FMT, XHCI_EP_ARGS(*xhci_ep));
    192192
    193193        xhci_ep->primary_stream_ctx_array = NULL;
     
    201201}
    202202
    203 int xhci_endpoint_free_transfer_ds(xhci_endpoint_t *xhci_ep)
    204 {
    205         /* FIXME: For some reason (possibly memory corruption), this crashes. */
    206         return EOK;
    207 
     203void xhci_endpoint_free_transfer_ds(xhci_endpoint_t *xhci_ep)
     204{
    208205        if (endpoint_using_streams(xhci_ep)) {
    209                 usb_log_debug2("Freeing primary stream context array for endpoint " XHCI_EP_FMT, XHCI_EP_ARGS(*xhci_ep));
     206                usb_log_debug2("Freeing primary stream context array of endpoint " XHCI_EP_FMT, XHCI_EP_ARGS(*xhci_ep));
    210207
    211208                // maybe check if LSA, then skip?
     
    223220                free32(xhci_ep->primary_stream_ctx_array);
    224221        } else {
    225                 usb_log_debug2("Freeing main transfer ring for endpoint " XHCI_EP_FMT, XHCI_EP_ARGS(*xhci_ep));
    226 
    227                 int err;
    228                 if ((err = xhci_trb_ring_fini(&xhci_ep->ring))) {
    229                         return err;
    230                 }
    231         }
    232 
    233         return EOK;
     222                usb_log_debug2("Freeing main transfer ring of endpoint " XHCI_EP_FMT, XHCI_EP_ARGS(*xhci_ep));
     223
     224                xhci_trb_ring_fini(&xhci_ep->ring);
     225        }
    234226}
    235227
     
    344336        endpoint_add_ref(&ep->base);
    345337        ep->base.device = &dev->base;
    346 
    347338        dev->endpoints[ep_num] = ep;
    348         ++dev->active_endpoint_count;
    349339
    350340        return EOK;
     
    357347
    358348        assert(dev->endpoints[ep->base.endpoint]);
    359 
    360349        dev->endpoints[ep->base.endpoint] = NULL;
    361         --dev->active_endpoint_count;
    362350        ep->base.device = NULL;
    363351
Note: See TracChangeset for help on using the changeset viewer.