Changeset f3baab1 in mainline
- Timestamp:
- 2018-01-11T21:41:36Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 49e62998
- Parents:
- 665368c
- git-author:
- Ondřej Hlavatý <aearsis@…> (2018-01-11 21:41:34)
- git-committer:
- Ondřej Hlavatý <aearsis@…> (2018-01-11 21:41:36)
- Location:
- uspace/drv/bus/usb/xhci
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/xhci/commands.c
r665368c rf3baab1 666 666 int rv = EOK; 667 667 668 if (fibril_get_id() == hc->event_handler) { 669 usb_log_error("Deadlock detected in waiting for command."); 670 abort(); 671 } 672 668 673 fibril_mutex_lock(&cmd->_header.completed_mtx); 669 674 while (!cmd->_header.completed) { -
uspace/drv/bus/usb/xhci/hc.c
r665368c rf3baab1 511 511 { 512 512 int err; 513 ssize_t size = 16; 514 xhci_trb_t *queue = malloc(sizeof(xhci_trb_t) * size); 515 if (!queue) { 516 usb_log_error("Not enough memory to run the event ring."); 517 return; 518 } 519 520 xhci_trb_t *head = queue; 521 522 while ((err = xhci_event_ring_dequeue(event_ring, head)) != ENOENT) { 523 if (err != EOK) { 524 usb_log_warning("Error while accessing event ring: %s", str_error(err)); 525 break; 526 } 527 528 usb_log_debug2("Dequeued trb from event ring: %s", xhci_trb_str_type(TRB_TYPE(*head))); 529 head++; 530 531 /* Expand the array if needed. */ 532 if (head - queue >= size) { 533 size *= 2; 534 xhci_trb_t *new_queue = realloc(queue, size); 535 if (new_queue == NULL) 536 break; /* Will process only those TRBs we have memory for. */ 537 538 head = new_queue + (head - queue); 513 514 xhci_trb_t trb; 515 hc->event_handler = fibril_get_id(); 516 517 while ((err = xhci_event_ring_dequeue(event_ring, &trb)) != ENOENT) { 518 if ((err = hc_handle_event(hc, &trb, intr)) != EOK) { 519 usb_log_error("Failed to handle event: %s", str_error(err)); 539 520 } 540 521 … … 543 524 XHCI_REG_WR(intr, XHCI_INTR_ERDP_HI, UPPER32(erdp)); 544 525 } 526 527 hc->event_handler = 0; 545 528 546 529 /* Update the ERDP to make room in the ring. */ … … 551 534 XHCI_REG_WR(intr, XHCI_INTR_ERDP_HI, UPPER32(erdp)); 552 535 553 /* Handle all of the collected events if possible. */554 if (head == queue)555 usb_log_warning("No events to be handled!");556 557 for (xhci_trb_t *tail = queue; tail != head; tail++) {558 if ((err = hc_handle_event(hc, tail, intr)) != EOK) {559 usb_log_error("Failed to handle event: %s", str_error(err));560 }561 }562 563 free(queue);564 536 usb_log_debug2("Event ring run finished."); 565 537 } -
uspace/drv/bus/usb/xhci/hc.h
r665368c rf3baab1 81 81 xhci_bus_t bus; 82 82 83 /* Fibril that is currently hanling events */ 84 fid_t event_handler; 85 83 86 /* Cached capabilities */ 84 87 unsigned max_slots;
Note:
See TracChangeset
for help on using the changeset viewer.