summary refs log tree commit diff stats
path: root/hw/usb/hcd-xhci.c
diff options
context:
space:
mode:
authorHans Petter Selasky <hps@selasky.org>2016-08-23 13:39:49 +0200
committerGerd Hoffmann <kraxel@redhat.com>2016-09-13 09:07:18 +0200
commitb66ad1f1aa4dba4e8e242ad8339dd01f4ee77c5e (patch)
tree485160e66fbdcba8a2fe7bdce44a5aae15f2f883 /hw/usb/hcd-xhci.c
parent7263da78045dc91cc207f350911efe4259e99b3c (diff)
downloadfocaccia-qemu-b66ad1f1aa4dba4e8e242ad8339dd01f4ee77c5e.tar.gz
focaccia-qemu-b66ad1f1aa4dba4e8e242ad8339dd01f4ee77c5e.zip
xhci: Fix remainder field for TR_SETUP completion event.
Previously the code would incorrectly report the remainder as 8 bytes. A
remainder of 0 bytes should be reported when the SETUP packet is
successfully transferred. Found using FreeBSD's XHCI driver.

Signed-off-by: Hans Petter Selasky <hps@selasky.org>

[ kraxel: codestyle fixup ]

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb/hcd-xhci.c')
-rw-r--r--hw/usb/hcd-xhci.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
index 188f95416a..37c14938a7 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -1753,6 +1753,12 @@ static void xhci_xfer_report(XHCITransfer *xfer)
         unsigned int chunk = 0;
 
         switch (TRB_TYPE(*trb)) {
+        case TR_SETUP:
+            chunk = trb->status & 0x1ffff;
+            if (chunk > 8) {
+                chunk = 8;
+            }
+            break;
         case TR_DATA:
         case TR_NORMAL:
         case TR_ISOCH: