Changeset c4d4fa2 in mainline for uspace/drv/bus/usb/xhci/commands.c


Ignore:
Timestamp:
2017-07-23T19:13:15Z (7 years ago)
Author:
Jaroslav Jindrak <dzejrou@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e50bdd92
Parents:
a06fd64
Message:

Removed unused parameter to command waiting function. Removed redundant code in command completion handler. Added trb copying for later use by the owner of the command. Added deallocation of the aforementioned trb copy when the command that owns it is deallocated.

File:
1 edited

Legend:

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

    ra06fd64 rc4d4fa2  
    5252}
    5353
    54 int xhci_wait_for_command(xhci_hc_t *hc, xhci_cmd_t *cmd, uint32_t timeout)
     54int xhci_wait_for_command(xhci_cmd_t *cmd, uint32_t timeout)
    5555{
    5656        uint32_t time = 0;
     
    8585void xhci_free_command(xhci_cmd_t *cmd)
    8686{
    87         // TODO: If we decide to copy trb, free it here.
    8887        if (cmd->ictx)
    8988                free32(cmd->ictx);
     89        if (cmd->trb)
     90                free32(cmd->trb);
    9091
    9192        free32(cmd);
     
    382383{
    383384        // TODO: Update dequeue ptrs.
    384         // TODO: Possibly clone command trb, as it may get overwritten before
    385         //       it is processed (if somebody polls the command completion).
    386385        assert(hc);
    387386        assert(trb);
     
    393392        xhci_cmd_t *command;
    394393        xhci_trb_t *command_trb;
    395 
    396         code = XHCI_DWORD_EXTRACT(trb->status, 31, 24);
    397         slot_id = XHCI_DWORD_EXTRACT(trb->control, 31, 24);
    398         (void) slot_id;
    399394
    400395        command = get_next_command(hc);
     
    451446        command->completed = true;
    452447
    453         if (!command->has_owner)
     448        if (!command->has_owner) {
    454449                xhci_free_command(command);
     450        } else {
     451                /* Copy the trb for later use so that we can free space on the cmd ring. */
     452                command->trb = malloc32(sizeof(xhci_trb_t));
     453                xhci_trb_copy(command->trb, command_trb);
     454        }
    455455
    456456        return EOK;
Note: See TracChangeset for help on using the changeset viewer.