Skip to contentSkip to conversation

Fix remainder field for TR_SETUP completion event

PATCH In review Hans Petter Selasky 2 participants 2 messages Aug 23, 2016 – Sep 7, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix remainder field for TR_SETUP completion event

Hi,

Patch is also attached.

--HPS

Quoted 29 lines

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.

---
 hw/usb/hcd-xhci.c | 5 +++++
 1 file changed, 5 insertions(+)
hw/usb/hcd-xhci.c +5 -1
index 188f954..d996d7e 100644
@@ -1753,6 +1753,11 @@ 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:
--

2.8.1

Quoted 1 line

From 4771b0788a6f055a8830cb3b6f7bf922574bfe0d Mon Sep 17 00:00:00 2001

From: Hans Petter Selasky <[email protected]>
Date: Tue, 23 Aug 2016 13:39:49 +0200
Subject: [PATCH] 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.

---
 hw/usb/hcd-xhci.c | 5 +++++
 1 file changed, 5 insertions(+)
hw/usb/hcd-xhci.c +5 -0
index 188f954..d996d7e 100644
@@ -1753,6 +1753,11 @@ 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:
Signature · 1 line
2.8.1
#1 lore raw
Quoted 12 lines · Hans Petter Selasky

Hi,

Patch is also attached.

--HPS

Quoted 6 lines

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.

Fixed up codestyle (please use scripts/checkpatch.pl next time). Added to usb queue.

thanks,
Gerd