Changeset 2b61945 in mainline for uspace/drv/bus/usb/xhci/hc.c
- Timestamp:
- 2017-10-22T03:47:41Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2e5aea1
- Parents:
- 766043c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/xhci/hc.c
r766043c r2b61945 196 196 return ENOMEM; 197 197 198 hc->dcbaa_virt = malloc((1 + hc->max_slots) * sizeof(xhci_virt_device_ctx_t)); 199 if (!hc->dcbaa_virt) { 200 err = ENOMEM; 198 if ((err = xhci_trb_ring_init(&hc->command_ring))) 201 199 goto err_dcbaa; 202 }203 204 if ((err = xhci_trb_ring_init(&hc->command_ring)))205 goto err_dcbaa_virt;206 200 207 201 if ((err = xhci_event_ring_init(&hc->event_ring))) … … 214 208 goto err_scratch; 215 209 216 if ((err = xhci_ init_transfers(hc)))210 if ((err = xhci_rh_init(&hc->rh, hc, device))) 217 211 goto err_cmd; 218 212 219 if ((err = xhci_rh_init(&hc->rh, hc, device))) 220 goto err_transfers; 221 222 if ((err = xhci_bus_init(&hc->bus))) 213 if ((err = xhci_bus_init(&hc->bus, hc))) 223 214 goto err_rh; 224 215 … … 228 219 err_rh: 229 220 xhci_rh_fini(&hc->rh); 230 err_transfers:231 xhci_fini_transfers(hc);232 221 err_cmd: 233 222 xhci_fini_commands(hc); … … 238 227 err_cmd_ring: 239 228 xhci_trb_ring_fini(&hc->command_ring); 240 err_dcbaa_virt:241 free32(hc->dcbaa_virt);242 229 err_dcbaa: 243 230 free32(hc->dcbaa); … … 527 514 /* Update the ERDP to make room in the ring. */ 528 515 usb_log_debug2("Copying from ring finished, updating ERDP."); 529 hc->event_ring.dequeue_ptr = host2xhci(64, addr_to_phys(hc->event_ring.dequeue_trb));530 516 uint64_t erdp = hc->event_ring.dequeue_ptr; 531 517 XHCI_REG_WR(intr, XHCI_INTR_ERDP_LO, LOWER32(erdp)); … … 580 566 static void hc_dcbaa_fini(xhci_hc_t *hc) 581 567 { 582 xhci_trb_ring_t* trb_ring;583 568 xhci_scratchpad_free(hc); 584 585 /* Idx 0 already deallocated by xhci_scratchpad_free. */586 for (unsigned i = 1; i < hc->max_slots + 1; ++i) {587 if (hc->dcbaa_virt[i].dev_ctx) {588 free32(hc->dcbaa_virt[i].dev_ctx);589 hc->dcbaa_virt[i].dev_ctx = NULL;590 }591 592 for (unsigned i = 0; i < XHCI_EP_COUNT; ++i) {593 trb_ring = hc->dcbaa_virt[i].trs[i];594 if (trb_ring) {595 hc->dcbaa_virt[i].trs[i] = NULL;596 xhci_trb_ring_fini(trb_ring);597 free32(trb_ring);598 }599 }600 }601 602 569 free32(hc->dcbaa); 603 free32(hc->dcbaa_virt);604 570 } 605 571 … … 610 576 xhci_event_ring_fini(&hc->event_ring); 611 577 hc_dcbaa_fini(hc); 612 xhci_fini_transfers(hc);613 578 xhci_fini_commands(hc); 614 579 xhci_rh_fini(&hc->rh);
Note:
See TracChangeset
for help on using the changeset viewer.