Changeset decfc8d1 in mainline for uspace/drv/bus/usb/xhci/hc.c


Ignore:
Timestamp:
2017-08-20T18:52:03Z (8 years ago)
Author:
Jaroslav Jindrak <dzejrou@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3d8a3bd
Parents:
8b415cc
Message:

Dcbaa_virt now contains the virtual device contexts instead of just containing pointers to them, this eases its use a lot while wasting a negligale amount of memory.

File:
1 edited

Legend:

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

    r8b415cc rdecfc8d1  
    202202                return ENOMEM;
    203203
    204         hc->dcbaa_virt = malloc32((1 + hc->max_slots) * sizeof(xhci_device_ctx_t*));
     204        hc->dcbaa_virt = malloc32((1 + hc->max_slots) * sizeof(xhci_virt_device_ctx_t));
    205205        if (!hc->dcbaa_virt) {
    206206                err = ENOMEM;
     
    507507        /* Idx 0 already deallocated by xhci_scratchpad_free. */
    508508        for (unsigned i = 1; i < hc->max_slots + 1; ++i) {
    509                 if (hc->dcbaa_virt[i]) {
    510                         if (hc->dcbaa_virt[i]->dev_ctx)
    511                                 free32(hc->dcbaa_virt[i]->dev_ctx);
    512 
    513                         for (unsigned i = 0; i < XHCI_EP_COUNT; ++i) {
    514                                 trb_ring = hc->dcbaa_virt[i]->trs[i];
    515                                 if (trb_ring) {
    516                                         xhci_trb_ring_fini(trb_ring);
    517                                         free32(trb_ring);
    518                                 }
     509                if (hc->dcbaa_virt[i].dev_ctx) {
     510                        free32(hc->dcbaa_virt[i].dev_ctx);
     511                        hc->dcbaa_virt[i].dev_ctx = NULL;
     512                }
     513
     514                for (unsigned i = 0; i < XHCI_EP_COUNT; ++i) {
     515                        trb_ring = hc->dcbaa_virt[i].trs[i];
     516                        if (trb_ring) {
     517                                hc->dcbaa_virt[i].trs[i] = NULL;
     518                                xhci_trb_ring_fini(trb_ring);
     519                                free32(trb_ring);
    519520                        }
    520 
    521                         free32(hc->dcbaa_virt[i]);
    522                         hc->dcbaa_virt[i] = NULL;
    523521                }
    524522        }
Note: See TracChangeset for help on using the changeset viewer.