struct xhci_slot *slot;
struct xhci_endpoint *endpoint;
struct io_buffer *iobuf;
+ uint32_t cmplt;
+ unsigned int code;
int rc;
/* Profile transfer events */
/* Unmap I/O buffer */
iob_unmap ( iobuf );
+ /* Parse completion */
+ cmplt = le32_to_cpu ( trb->cmplt );
+ code = XHCI_CMPLT_CODE ( cmplt );
+
/* Check for errors */
- if ( ! ( ( trb->code == XHCI_CMPLT_SUCCESS ) ||
- ( trb->code == XHCI_CMPLT_SHORT ) ) ) {
+ if ( ! ( ( code == XHCI_CMPLT_SUCCESS ) ||
+ ( code == XHCI_CMPLT_SHORT ) ) ) {
/* Construct error */
- rc = -ECODE ( trb->code );
+ rc = -ECODE ( code );
DBGC ( xhci, "XHCI %s slot %d ctx %d failed (code %d): %s\n",
- xhci->name, slot->id, endpoint->ctx, trb->code,
+ xhci->name, slot->id, endpoint->ctx, code,
strerror ( rc ) );
DBGC_HDA ( xhci, 0, trb, sizeof ( *trb ) );
}
/* Record actual transfer size */
- iob_unput ( iobuf, le16_to_cpu ( trb->residual ) );
+ iob_unput ( iobuf, XHCI_CMPLT_RESIDUAL ( cmplt ) );
/* Sanity check (for successful completions only) */
assert ( xhci_ring_consumed ( &endpoint->ring ) ==
struct xhci_trb_transfer {
/** Transfer TRB pointer */
uint64_t transfer;
- /** Residual transfer length */
- uint16_t residual;
- /** Reserved */
- uint8_t reserved;
- /** Completion code */
- uint8_t code;
+ /** Completion status */
+ uint32_t cmplt;
/** Flags */
uint8_t flags;
/** Type */
/** A transfer event transfer request block */
#define XHCI_TRB_TRANSFER XHCI_TRB_TYPE ( 32 )
+/** Completion code */
+#define XHCI_CMPLT_CODE( cmplt ) ( (cmplt) >> 24 )
+
+/** Residual bytes not transferred */
+#define XHCI_CMPLT_RESIDUAL( cmplt ) ( (cmplt) & 0xffffff )
+
/** A command completion event transfer request block */
struct xhci_trb_complete {
/** Command TRB pointer */