]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[xhci] Ensure that zero-length packets are not part of a TRB chain
authorMichael Brown <mcb30@ipxe.org>
Mon, 7 Dec 2015 22:30:27 +0000 (22:30 +0000)
committerMichael Brown <mcb30@ipxe.org>
Mon, 7 Dec 2015 22:40:47 +0000 (22:40 +0000)
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>
src/drivers/usb/xhci.c

index 67de0a83250e9902837a71c5e984eee76390f1ee..48ac6a30721de38202c43dc3e0631bc1d521b71e 100644 (file)
@@ -2606,6 +2606,12 @@ static int xhci_endpoint_stream ( struct usb_endpoint *ep,
                len -= trb_len;
                trb++;
        }
+
+       /* Mark zero-length packet (if present) as a separate transfer */
+       if ( zlp && ( count > 1 ) )
+               trb[-2].normal.flags = 0;
+
+       /* Generate completion for final TRB */
        trb[-1].normal.flags = XHCI_TRB_IOC;
 
        /* Enqueue TRBs */