Browse Source

[xhci] Ensure that zero-length packets are not part of a TRB chain

Some xHCI controllers (such as qemu's emulated xHCI controller) do not
correctly handle zero-length packets that are part of a TRB chain.
The zero-length TRB ends up being squashed and does not result in a
zero-length packet as seen by the device.

Work around this problem by marking the zero-length packet as
belonging to a separate transfer descriptor.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 8 years ago
parent
commit
ee8388ec69
1 changed files with 6 additions and 0 deletions
  1. 6
    0
      src/drivers/usb/xhci.c

+ 6
- 0
src/drivers/usb/xhci.c View File

@@ -2606,6 +2606,12 @@ static int xhci_endpoint_stream ( struct usb_endpoint *ep,
2606 2606
 		len -= trb_len;
2607 2607
 		trb++;
2608 2608
 	}
2609
+
2610
+	/* Mark zero-length packet (if present) as a separate transfer */
2611
+	if ( zlp && ( count > 1 ) )
2612
+		trb[-2].normal.flags = 0;
2613
+
2614
+	/* Generate completion for final TRB */
2609 2615
 	trb[-1].normal.flags = XHCI_TRB_IOC;
2610 2616
 
2611 2617
 	/* Enqueue TRBs */

Loading…
Cancel
Save