Reviewed-by: Star Zeng <[email protected]>

-----Original Message-----
From: Tian, Feng 
Sent: Monday, July 11, 2016 11:22 AM
To: Zeng, Star <[email protected]>
Cc: [email protected]
Subject: [patch 3/3] MdeModulePkg/XhciDxe: fix a bug on TRB check in async int 
transfer

The last TRB in transfer ring is a LINK type TRB, which shouldn't be accounted 
as a valid item in IsAsyncIntTrb().

Without this fix, the original algo will bring issue on those URBs whose TRBs 
crosses the transfer ring.

Cc: Star Zeng <[email protected]>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng Tian <[email protected]>
---
 MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c 
b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
index 1130b6a..b6078b1 100644
--- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
+++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
@@ -1009,7 +1009,11 @@ IsAsyncIntTrb (
         return TRUE;
       }
       CheckedTrb++;
-      if ((UINTN)CheckedTrb >= ((UINTN) CheckedUrb->Ring->RingSeg0 + sizeof 
(TRB_TEMPLATE) * CheckedUrb->Ring->TrbNumber)) {
+      //
+      // If the checked TRB is the link TRB at the end of the transfer ring,
+      // recircle it to the head of the ring.
+      //
+      if (CheckedTrb->Type == TRB_TYPE_LINK) {
         CheckedTrb = (TRB_TEMPLATE*) CheckedUrb->Ring->RingSeg0;
       }
     }
--
2.7.1.windows.2

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to