Re: [edk2] [patch 3/3] MdeModulePkg/XhciDxe: fix a bug on TRB check in async int transfer

2016-07-11 Thread Zeng, Star
Reviewed-by: Star Zeng 

-Original Message-
From: Tian, Feng 
Sent: Monday, July 11, 2016 11:22 AM
To: Zeng, Star 
Cc: edk2-devel@lists.01.org
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 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng Tian 
---
 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
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [patch 3/3] MdeModulePkg/XhciDxe: fix a bug on TRB check in async int transfer

2016-07-10 Thread Feng Tian
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 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng Tian 
---
 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
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel