Changeset 45457265 in mainline for uspace/drv/bus/usb/xhci/commands.c
- Timestamp:
- 2018-02-03T02:14:26Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- eb862fd
- Parents:
- 961a5ee
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/xhci/commands.c
r961a5ee r45457265 72 72 * reset before starting. 73 73 */ 74 int xhci_init_commands(xhci_hc_t *hc)74 errno_t xhci_init_commands(xhci_hc_t *hc) 75 75 { 76 76 xhci_cmd_ring_t *cr = get_cmd_ring(hc); 77 int err;77 errno_t err; 78 78 79 79 if ((err = xhci_trb_ring_init(&cr->trb_ring, 0))) … … 172 172 } 173 173 174 static int wait_for_ring_open(xhci_cmd_ring_t *cr)174 static errno_t wait_for_ring_open(xhci_cmd_ring_t *cr) 175 175 { 176 176 assert(fibril_mutex_is_locked(&cr->guard)); … … 194 194 * Register the command as waiting for completion inside the command list. 195 195 */ 196 static inline int enqueue_command(xhci_hc_t *hc, xhci_cmd_t *cmd)196 static inline errno_t enqueue_command(xhci_hc_t *hc, xhci_cmd_t *cmd) 197 197 { 198 198 xhci_cmd_ring_t *cr = get_cmd_ring(hc); … … 210 210 list_append(&cmd->_header.link, &cr->cmd_list); 211 211 212 int err = EOK;212 errno_t err = EOK; 213 213 while (err == EOK) { 214 214 err = xhci_trb_ring_enqueue(&cr->trb_ring, … … 343 343 * @param trb The COMMAND_COMPLETION TRB found in event ring. 344 344 */ 345 int xhci_handle_command_completion(xhci_hc_t *hc, xhci_trb_t *trb)345 errno_t xhci_handle_command_completion(xhci_hc_t *hc, xhci_trb_t *trb) 346 346 { 347 347 xhci_cmd_ring_t *cr = get_cmd_ring(hc); … … 416 416 /* Command-issuing functions */ 417 417 418 static int no_op_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)418 static errno_t no_op_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd) 419 419 { 420 420 assert(hc); … … 427 427 } 428 428 429 static int enable_slot_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)429 static errno_t enable_slot_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd) 430 430 { 431 431 assert(hc); … … 440 440 } 441 441 442 static int disable_slot_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)442 static errno_t disable_slot_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd) 443 443 { 444 444 assert(hc); … … 453 453 } 454 454 455 static int address_device_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)455 static errno_t address_device_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd) 456 456 { 457 457 assert(hc); … … 483 483 } 484 484 485 static int configure_endpoint_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)485 static errno_t configure_endpoint_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd) 486 486 { 487 487 assert(hc); … … 504 504 } 505 505 506 static int evaluate_context_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)506 static errno_t evaluate_context_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd) 507 507 { 508 508 assert(hc); … … 526 526 } 527 527 528 static int reset_endpoint_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)528 static errno_t reset_endpoint_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd) 529 529 { 530 530 assert(hc); … … 541 541 } 542 542 543 static int stop_endpoint_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)543 static errno_t stop_endpoint_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd) 544 544 { 545 545 assert(hc); … … 556 556 } 557 557 558 static int set_tr_dequeue_pointer_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)558 static errno_t set_tr_dequeue_pointer_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd) 559 559 { 560 560 assert(hc); … … 572 572 } 573 573 574 static int reset_device_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)574 static errno_t reset_device_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd) 575 575 { 576 576 assert(hc); … … 585 585 } 586 586 587 static int get_port_bandwidth_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)587 static errno_t get_port_bandwidth_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd) 588 588 { 589 589 assert(hc); … … 603 603 /* The table of command-issuing functions. */ 604 604 605 typedef int (*cmd_handler) (xhci_hc_t *hc, xhci_cmd_t *cmd);605 typedef errno_t (*cmd_handler) (xhci_hc_t *hc, xhci_cmd_t *cmd); 606 606 607 607 static cmd_handler cmd_handlers [] = { … … 635 635 * COMMAND_ABORTED event. 636 636 */ 637 static int try_abort_current_command(xhci_hc_t *hc)637 static errno_t try_abort_current_command(xhci_hc_t *hc) 638 638 { 639 639 xhci_cmd_ring_t *cr = get_cmd_ring(hc); … … 694 694 * until COMMAND_COMPLETION event arrives. 695 695 */ 696 static int wait_for_cmd_completion(xhci_hc_t *hc, xhci_cmd_t *cmd)697 { 698 int rv = EOK;696 static errno_t wait_for_cmd_completion(xhci_hc_t *hc, xhci_cmd_t *cmd) 697 { 698 errno_t rv = EOK; 699 699 700 700 if (fibril_get_id() == hc->event_handler) { … … 731 731 * expires. Nothing is deallocated. Caller should always execute `xhci_cmd_fini`. 732 732 */ 733 int xhci_cmd_sync(xhci_hc_t *hc, xhci_cmd_t *cmd)734 { 735 assert(hc); 736 assert(cmd); 737 738 int err;733 errno_t xhci_cmd_sync(xhci_hc_t *hc, xhci_cmd_t *cmd) 734 { 735 assert(hc); 736 assert(cmd); 737 738 errno_t err; 739 739 740 740 if (!cmd_handlers[cmd->_header.cmd]) { … … 773 773 * is a useful shorthand for issuing commands without out parameters. 774 774 */ 775 int xhci_cmd_sync_fini(xhci_hc_t *hc, xhci_cmd_t *cmd)776 { 777 const int err = xhci_cmd_sync(hc, cmd);775 errno_t xhci_cmd_sync_fini(xhci_hc_t *hc, xhci_cmd_t *cmd) 776 { 777 const errno_t err = xhci_cmd_sync(hc, cmd); 778 778 xhci_cmd_fini(cmd); 779 779 … … 785 785 * fibril. The command is copied to stack memory and `fini` is called upon its completion. 786 786 */ 787 int xhci_cmd_async_fini(xhci_hc_t *hc, xhci_cmd_t *stack_cmd)787 errno_t xhci_cmd_async_fini(xhci_hc_t *hc, xhci_cmd_t *stack_cmd) 788 788 { 789 789 assert(hc); … … 801 801 802 802 /* Issue the command. */ 803 int err;803 errno_t err; 804 804 805 805 if (!cmd_handlers[heap_cmd->_header.cmd]) {
Note:
See TracChangeset
for help on using the changeset viewer.