public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] MdeModulePkg Xhci: Also RecoverHaltedEndpoint for BABBLE_ERROR
@ 2017-07-25  3:26 Star Zeng
  2017-07-25  3:28 ` Ni, Ruiyu
  0 siblings, 1 reply; 2+ messages in thread
From: Star Zeng @ 2017-07-25  3:26 UTC (permalink / raw)
  To: edk2-devel; +Cc: Star Zeng, Vladimir Olovyannikov, Ruiyu Ni

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=644

According to XHCI spec:
4.10.2.1 Stall Error

4.10.2.4 Babble Detected Error
When a device transmits more data on the USB than the host controller
is expecting for a transaction, it is defined to be babbling.
In general, this is called a Babble Error. When a device sends more
data than the TD Transfer Size bytes (TD Babble), unexpected activity
that persists beyond a specified point in a (micro)frame (Frame Babble),
or a packet greater than Max Packet Size (Packet Babble), the host
controller shall set the Babble Detected Error in the Completion Code
field of the TRB, generate an Error Event, and halt the endpoint
(refer to Section 4.10.2.1).

This patch is to also check for EFI_USB_ERR_BABBLE error returned as
a TransferResult and then proceed to XhcRecoverhaltedEndPoint.

Cc: Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
---
 MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c    | 2 +-
 MdeModulePkg/Bus/Pci/XhciPei/XhcPeim.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
index 20ad3f161197..c884f4c3146c 100644
--- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
+++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
@@ -801,7 +801,7 @@ XhcTransfer (
   *TransferResult = Urb->Result;
   *DataLength     = Urb->Completed;
 
-  if (*TransferResult == EFI_USB_ERR_STALL) {
+  if ((*TransferResult == EFI_USB_ERR_STALL) || (*TransferResult == EFI_USB_ERR_BABBLE)) {
     ASSERT (Status == EFI_DEVICE_ERROR);
     RecoveryStatus = XhcRecoverHaltedEndpoint(Xhc, Urb);
     if (EFI_ERROR (RecoveryStatus)) {
diff --git a/MdeModulePkg/Bus/Pci/XhciPei/XhcPeim.c b/MdeModulePkg/Bus/Pci/XhciPei/XhcPeim.c
index 57e70701e826..38f0d2184cff 100644
--- a/MdeModulePkg/Bus/Pci/XhciPei/XhcPeim.c
+++ b/MdeModulePkg/Bus/Pci/XhciPei/XhcPeim.c
@@ -2,7 +2,7 @@
 PEIM to produce gPeiUsb2HostControllerPpiGuid based on gPeiUsbControllerPpiGuid
 which is used to enable recovery function from USB Drivers.
 
-Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2014 - 2017, Intel Corporation. All rights reserved.<BR>
 
 This program and the accompanying materials
 are licensed and made available under the terms and conditions
@@ -666,7 +666,7 @@ XhcPeiControlTransfer (
   } else {
     if (*TransferResult == EFI_USB_NOERROR) {
       Status = EFI_SUCCESS;
-    } else if (*TransferResult == EFI_USB_ERR_STALL) {
+    } else if ((*TransferResult == EFI_USB_ERR_STALL) || (*TransferResult == EFI_USB_ERR_BABBLE)) {
       RecoveryStatus = XhcPeiRecoverHaltedEndpoint(Xhc, Urb);
       if (EFI_ERROR (RecoveryStatus)) {
         DEBUG ((EFI_D_ERROR, "XhcPeiControlTransfer: XhcPeiRecoverHaltedEndpoint failed\n"));
@@ -988,7 +988,7 @@ XhcPeiBulkTransfer (
   } else {
     if (*TransferResult == EFI_USB_NOERROR) {
       Status = EFI_SUCCESS;
-    } else if (*TransferResult == EFI_USB_ERR_STALL) {
+    } else if ((*TransferResult == EFI_USB_ERR_STALL) || (*TransferResult == EFI_USB_ERR_BABBLE)) {
       RecoveryStatus = XhcPeiRecoverHaltedEndpoint(Xhc, Urb);
       if (EFI_ERROR (RecoveryStatus)) {
         DEBUG ((EFI_D_ERROR, "XhcPeiBulkTransfer: XhcPeiRecoverHaltedEndpoint failed\n"));
-- 
2.7.0.windows.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] MdeModulePkg Xhci: Also RecoverHaltedEndpoint for BABBLE_ERROR
  2017-07-25  3:26 [PATCH] MdeModulePkg Xhci: Also RecoverHaltedEndpoint for BABBLE_ERROR Star Zeng
@ 2017-07-25  3:28 ` Ni, Ruiyu
  0 siblings, 0 replies; 2+ messages in thread
From: Ni, Ruiyu @ 2017-07-25  3:28 UTC (permalink / raw)
  To: Zeng, Star, edk2-devel@lists.01.org; +Cc: Vladimir Olovyannikov

Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>

Thanks/Ray

> -----Original Message-----
> From: Zeng, Star
> Sent: Tuesday, July 25, 2017 11:27 AM
> To: edk2-devel@lists.01.org
> Cc: Zeng, Star <star.zeng@intel.com>; Vladimir Olovyannikov
> <vladimir.olovyannikov@broadcom.com>; Ni, Ruiyu <ruiyu.ni@intel.com>
> Subject: [PATCH] MdeModulePkg Xhci: Also RecoverHaltedEndpoint for
> BABBLE_ERROR
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=644
> 
> According to XHCI spec:
> 4.10.2.1 Stall Error
> 
> 4.10.2.4 Babble Detected Error
> When a device transmits more data on the USB than the host controller is
> expecting for a transaction, it is defined to be babbling.
> In general, this is called a Babble Error. When a device sends more data than
> the TD Transfer Size bytes (TD Babble), unexpected activity that persists
> beyond a specified point in a (micro)frame (Frame Babble), or a packet
> greater than Max Packet Size (Packet Babble), the host controller shall set
> the Babble Detected Error in the Completion Code field of the TRB, generate
> an Error Event, and halt the endpoint (refer to Section 4.10.2.1).
> 
> This patch is to also check for EFI_USB_ERR_BABBLE error returned as a
> TransferResult and then proceed to XhcRecoverhaltedEndPoint.
> 
> Cc: Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>
> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Star Zeng <star.zeng@intel.com>
> ---
>  MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c    | 2 +-
>  MdeModulePkg/Bus/Pci/XhciPei/XhcPeim.c | 6 +++---
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
> b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
> index 20ad3f161197..c884f4c3146c 100644
> --- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
> +++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c
> @@ -801,7 +801,7 @@ XhcTransfer (
>    *TransferResult = Urb->Result;
>    *DataLength     = Urb->Completed;
> 
> -  if (*TransferResult == EFI_USB_ERR_STALL) {
> +  if ((*TransferResult == EFI_USB_ERR_STALL) || (*TransferResult ==
> + EFI_USB_ERR_BABBLE)) {
>      ASSERT (Status == EFI_DEVICE_ERROR);
>      RecoveryStatus = XhcRecoverHaltedEndpoint(Xhc, Urb);
>      if (EFI_ERROR (RecoveryStatus)) {
> diff --git a/MdeModulePkg/Bus/Pci/XhciPei/XhcPeim.c
> b/MdeModulePkg/Bus/Pci/XhciPei/XhcPeim.c
> index 57e70701e826..38f0d2184cff 100644
> --- a/MdeModulePkg/Bus/Pci/XhciPei/XhcPeim.c
> +++ b/MdeModulePkg/Bus/Pci/XhciPei/XhcPeim.c
> @@ -2,7 +2,7 @@
>  PEIM to produce gPeiUsb2HostControllerPpiGuid based on
> gPeiUsbControllerPpiGuid  which is used to enable recovery function from
> USB Drivers.
> 
> -Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.<BR>
> +Copyright (c) 2014 - 2017, Intel Corporation. All rights reserved.<BR>
> 
>  This program and the accompanying materials  are licensed and made
> available under the terms and conditions @@ -666,7 +666,7 @@
> XhcPeiControlTransfer (
>    } else {
>      if (*TransferResult == EFI_USB_NOERROR) {
>        Status = EFI_SUCCESS;
> -    } else if (*TransferResult == EFI_USB_ERR_STALL) {
> +    } else if ((*TransferResult == EFI_USB_ERR_STALL) ||
> + (*TransferResult == EFI_USB_ERR_BABBLE)) {
>        RecoveryStatus = XhcPeiRecoverHaltedEndpoint(Xhc, Urb);
>        if (EFI_ERROR (RecoveryStatus)) {
>          DEBUG ((EFI_D_ERROR, "XhcPeiControlTransfer:
> XhcPeiRecoverHaltedEndpoint failed\n")); @@ -988,7 +988,7 @@
> XhcPeiBulkTransfer (
>    } else {
>      if (*TransferResult == EFI_USB_NOERROR) {
>        Status = EFI_SUCCESS;
> -    } else if (*TransferResult == EFI_USB_ERR_STALL) {
> +    } else if ((*TransferResult == EFI_USB_ERR_STALL) ||
> + (*TransferResult == EFI_USB_ERR_BABBLE)) {
>        RecoveryStatus = XhcPeiRecoverHaltedEndpoint(Xhc, Urb);
>        if (EFI_ERROR (RecoveryStatus)) {
>          DEBUG ((EFI_D_ERROR, "XhcPeiBulkTransfer:
> XhcPeiRecoverHaltedEndpoint failed\n"));
> --
> 2.7.0.windows.1



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-07-25  3:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-25  3:26 [PATCH] MdeModulePkg Xhci: Also RecoverHaltedEndpoint for BABBLE_ERROR Star Zeng
2017-07-25  3:28 ` Ni, Ruiyu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox