Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 73e5b62 in mainline


Ignore:
Timestamp:
2017-07-31T19:58:08Z (3 years ago)
Author:
Jaroslav Jindrak <dzejrou@…>
Branches:
master
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.

Location:
uspace/drv/bus/usb/xhci
Files:
3 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
  • uspace/drv/bus/usb/xhci/hc.h

    rc9bec1c r73e5b62  
    6666        xhci_trb_ring_t command_ring;
    6767        xhci_event_ring_t event_ring;
    68         xhci_device_ctx_t **dcbaa;
     68        uint64_t *dcbaa;
     69        xhci_device_ctx_t **dcbaa_virt;
    6970        xhci_scratchpad_t *scratchpad;
    7071
  • uspace/drv/bus/usb/xhci/scratchpad.c

    rc9bec1c r73e5b62  
    9292        bufs->phys_bck = (uint64_t) phys_array;
    9393
    94         hc->dcbaa[0] = (xhci_device_ctx_t *) bufs->phys_ptr;
     94        hc->dcbaa[0] = bufs->phys_ptr;
    9595        hc->scratchpad = bufs;
    9696
     
    131131        free32((void *) scratchpad->phys_bck);
    132132
    133         hc->dcbaa[0] = NULL;
     133        hc->dcbaa[0] = 0;
     134        hc->dcbaa_virt[0] = NULL;
    134135        return;
    135136}
Note: See TracChangeset for help on using the changeset viewer.