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


Ignore:
Timestamp:
2017-07-31T19:58:08Z (7 years ago)
Author:
Jaroslav Jindrak <dzejrou@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7428b92
Parents:
c9bec1c
Message:

DCBAA now correctly holds physical addresses of the device contexts, a secondary array called dcbaa_virt was added that is used for deallocation.

File:
1 edited

Legend:

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

    rc9bec1c r73e5b62  
    198198        int err;
    199199
    200         hc->dcbaa = malloc32((1 + hc->max_slots) * sizeof(xhci_device_ctx_t*));
     200        hc->dcbaa = malloc32((1 + hc->max_slots) * sizeof(uint64_t));
    201201        if (!hc->dcbaa)
    202202                return ENOMEM;
    203203
     204        hc->dcbaa_virt = malloc32((1 + hc->max_slots) * sizeof(xhci_device_ctx_t*));
     205        if (!hc->dcbaa_virt) {
     206                err = ENOMEM;
     207                goto err_dcbaa;
     208        }
     209
    204210        if ((err = xhci_trb_ring_init(&hc->command_ring, hc)))
    205                 goto err_dcbaa;
     211                goto err_dcbaa_virt;
    206212
    207213        if ((err = xhci_event_ring_init(&hc->event_ring, hc)))
     
    220226err_cmd_ring:
    221227        xhci_trb_ring_fini(&hc->command_ring);
     228err_dcbaa_virt:
     229        free32(hc->dcbaa_virt);
    222230err_dcbaa:
    223231        free32(hc->dcbaa);
     
    468476        /* Idx 0 already deallocated by xhci_scratchpad_free. */
    469477        for (unsigned i = 1; i < hc->max_slots + 1; ++i) {
    470                 if (hc->dcbaa[i] != NULL) {
    471                         free32(hc->dcbaa[i]);
    472                         hc->dcbaa[i] = NULL;
     478                if (hc->dcbaa_virt[i] != NULL) {
     479                        free32(hc->dcbaa_virt[i]);
     480                        hc->dcbaa_virt[i] = NULL;
    473481                }
    474482        }
    475483
    476484        free32(hc->dcbaa);
     485        free32(hc->dcbaa_virt);
    477486}
    478487
Note: See TracChangeset for help on using the changeset viewer.