Changeset feabe163 in mainline


Ignore:
Timestamp:
2018-01-17T17:05:04Z (7 years ago)
Author:
Salmelu <salmelu@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ed8575f
Parents:
4cc0c2e0
Message:

xhci: common transfer errors detected and logged

Location:
uspace/drv/bus/usb/xhci
Files:
4 edited

Legend:

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

    r4cc0c2e0 rfeabe163  
    746746        case XHCI_TRBC_USB_TRANSACTION_ERROR:
    747747                return ESTALL;
     748        case XHCI_TRBC_RESOURCE_ERROR:
     749        case XHCI_TRBC_BANDWIDTH_ERROR:
     750        case XHCI_TRBC_NO_SLOTS_ERROR:
     751                return ELIMIT;
     752        case XHCI_TRBC_SLOT_NOT_ENABLED_ERROR:
     753                return ENOENT;
    748754        default:
    749755                return EINVAL;
  • uspace/drv/bus/usb/xhci/hc.c

    r4cc0c2e0 rfeabe163  
    893893int hc_stop_endpoint(xhci_hc_t *hc, uint32_t slot_id, uint8_t ep_idx)
    894894{
    895 
    896895        return xhci_cmd_sync_inline(hc, STOP_ENDPOINT, .slot_id = slot_id, .endpoint_id = ep_idx);
    897896}
    898897
    899898/**
     899 * Instruct xHC to reset halted endpoint.
     900 *
     901 * @param slot_id Slot ID assigned to the device.
     902 * @param ep_idx Endpoint index (number + direction) in question
     903 */
     904int hc_reset_endpoint(xhci_hc_t *hc, uint32_t slot_id, uint8_t ep_idx)
     905{
     906        return xhci_cmd_sync_inline(hc, RESET_ENDPOINT, .slot_id = slot_id, .endpoint_id = ep_idx);
     907}
     908
     909/**
    900910 * @}
    901911 */
  • uspace/drv/bus/usb/xhci/hc.h

    r4cc0c2e0 rfeabe163  
    120120int hc_update_endpoint(xhci_hc_t *, uint32_t, uint8_t, xhci_ep_ctx_t *);
    121121int hc_stop_endpoint(xhci_hc_t *, uint32_t , uint8_t);
     122int hc_reset_endpoint(xhci_hc_t *, uint32_t , uint8_t);
    122123
    123124int hc_status(bus_t *, uint32_t *);
  • uspace/drv/bus/usb/xhci/transfers.c

    r4cc0c2e0 rfeabe163  
    351351                        break;
    352352
     353                case XHCI_TRBC_DATA_BUFFER_ERROR:
     354                        usb_log_warning("Transfer ended with data buffer error.");
     355                        batch->error = EAGAIN;
     356                        batch->transfered_size = 0;
     357                        break;
     358
     359                case XHCI_TRBC_BABBLE_DETECTED_ERROR:
     360                        usb_log_warning("Babble detected during the transfer. Resetting endpoint.");
     361                        batch->error = EAGAIN;
     362                        batch->transfered_size = 0;
     363                        hc_reset_endpoint(hc, slot_id, ep_dci);
     364                        break;
     365
     366                case XHCI_TRBC_USB_TRANSACTION_ERROR:
     367                        usb_log_warning("USB Transaction error. Resetting endpoint.");
     368                        batch->error = ESTALL;
     369                        batch->transfered_size = 0;
     370                        hc_reset_endpoint(hc, slot_id, ep_dci);
     371                        break;
     372
     373                case XHCI_TRBC_TRB_ERROR:
     374                        usb_log_error("Invalid transfer parameters.");
     375                        batch->error = EINVAL;
     376                        batch->transfered_size = 0;
     377                        break;
     378
     379                case XHCI_TRBC_STALL_ERROR:
     380                        usb_log_warning("Stall condition detected.");
     381                        batch->error = ESTALL;
     382                        batch->transfered_size = 0;
     383                        break;
     384
     385                case XHCI_TRBC_SPLIT_TRANSACTION_ERROR:
     386                        usb_log_error("Split transcation error detected.");
     387                        batch->error = EAGAIN;
     388                        batch->transfered_size = 0;
     389                        break;
     390
    353391                default:
    354392                        usb_log_warning("Transfer not successfull: %u", completion_code);
Note: See TracChangeset for help on using the changeset viewer.