* [edk2-devel] [PATCH 1/1] MdeModulePkg/XhciDxe: Reset endpoint while USB Transaction error [not found] <cover.1710220024.git.xianglei.cai@intel.com> @ 2024-03-12 5:13 ` Xianglei Cai 2024-03-20 8:22 ` Xianglei Cai 2024-04-11 13:44 ` Lewandowski, Krzysztof 0 siblings, 2 replies; 8+ messages in thread From: Xianglei Cai @ 2024-03-12 5:13 UTC (permalink / raw) To: devel; +Cc: Xianglei Cai, Hao A Wu, Ray Ni, Liming Gao, Jenny Huang, More Shih https://bugzilla.tianocore.org/show_bug.cgi?id=4556 Based on XHCI spec 4.8.3, software should do the reset endpoint while USB Transaction occur. Also add the error code for USB Transaction error since UEFI spec don't have the related definition. Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Jenny Huang <jenny.huang@intel.com> Cc: More Shih <more.shih@intel.com> Signed-off-by: Xianglei Cai <xianglei.cai@intel.com> --- MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c | 2 +- MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 2 +- MdePkg/Include/Protocol/UsbIo.h | 21 +++++++++++---------- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c index f4e61d223c1b..63cc29b26536 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c +++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c @@ -825,7 +825,7 @@ XhcTransfer ( *TransferResult = Urb->Result; *DataLength = Urb->Completed; - if ((*TransferResult == EFI_USB_ERR_STALL) || (*TransferResult == EFI_USB_ERR_BABBLE)) { + if ((*TransferResult == EFI_USB_ERR_STALL) || (*TransferResult == EFI_USB_ERR_BABBLE) || (*TransferResult == EFI_USB_ERR_TRANSACTION)) { ASSERT (Status == EFI_DEVICE_ERROR); RecoveryStatus = XhcRecoverHaltedEndpoint (Xhc, Urb); if (EFI_ERROR (RecoveryStatus)) { diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c index 05528a478baf..e77852f62f10 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c @@ -1193,7 +1193,7 @@ XhcCheckUrbResult ( goto EXIT; case TRB_COMPLETION_USB_TRANSACTION_ERROR: - CheckedUrb->Result |= EFI_USB_ERR_TIMEOUT; + CheckedUrb->Result |= EFI_USB_ERR_TRANSACTION; CheckedUrb->Finished = TRUE; DEBUG ((DEBUG_ERROR, "XhcCheckUrbResult: TRANSACTION_ERROR! Completecode = %x\n", EvtTrb->Completecode)); goto EXIT; diff --git a/MdePkg/Include/Protocol/UsbIo.h b/MdePkg/Include/Protocol/UsbIo.h index a780b4e07b44..211ef0c94156 100644 --- a/MdePkg/Include/Protocol/UsbIo.h +++ b/MdePkg/Include/Protocol/UsbIo.h @@ -50,16 +50,17 @@ typedef enum { // // USB Transfer Results // -#define EFI_USB_NOERROR 0x00 -#define EFI_USB_ERR_NOTEXECUTE 0x01 -#define EFI_USB_ERR_STALL 0x02 -#define EFI_USB_ERR_BUFFER 0x04 -#define EFI_USB_ERR_BABBLE 0x08 -#define EFI_USB_ERR_NAK 0x10 -#define EFI_USB_ERR_CRC 0x20 -#define EFI_USB_ERR_TIMEOUT 0x40 -#define EFI_USB_ERR_BITSTUFF 0x80 -#define EFI_USB_ERR_SYSTEM 0x100 +#define EFI_USB_NOERROR 0x00 +#define EFI_USB_ERR_NOTEXECUTE 0x01 +#define EFI_USB_ERR_STALL 0x02 +#define EFI_USB_ERR_BUFFER 0x04 +#define EFI_USB_ERR_BABBLE 0x08 +#define EFI_USB_ERR_NAK 0x10 +#define EFI_USB_ERR_CRC 0x20 +#define EFI_USB_ERR_TIMEOUT 0x40 +#define EFI_USB_ERR_BITSTUFF 0x80 +#define EFI_USB_ERR_SYSTEM 0x100 +#define EFI_USB_ERR_TRANSACTION 0x200 /** Async USB transfer callback routine. -- 2.42.0.windows.2 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#116666): https://edk2.groups.io/g/devel/message/116666 Mute This Topic: https://groups.io/mt/104879589/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [edk2-devel] [PATCH 1/1] MdeModulePkg/XhciDxe: Reset endpoint while USB Transaction error 2024-03-12 5:13 ` [edk2-devel] [PATCH 1/1] MdeModulePkg/XhciDxe: Reset endpoint while USB Transaction error Xianglei Cai @ 2024-03-20 8:22 ` Xianglei Cai 2024-04-11 13:44 ` Lewandowski, Krzysztof 1 sibling, 0 replies; 8+ messages in thread From: Xianglei Cai @ 2024-03-20 8:22 UTC (permalink / raw) To: devel@edk2.groups.io Cc: Wu, Hao A, Ni, Ray, Liming Gao, Huang, Jenny, Shih, More Hi All, Could you help review this change? Very Appreciate. Best regards, Xianglei -----Original Message----- From: Cai, Xianglei <xianglei.cai@intel.com> Sent: Tuesday, March 12, 2024 1:13 PM To: devel@edk2.groups.io Cc: Cai, Xianglei <xianglei.cai@intel.com>; Wu, Hao A <hao.a.wu@intel.com>; Ni, Ray <ray.ni@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Huang, Jenny <jenny.huang@intel.com>; Shih, More <more.shih@intel.com> Subject: [PATCH 1/1] MdeModulePkg/XhciDxe: Reset endpoint while USB Transaction error https://bugzilla.tianocore.org/show_bug.cgi?id=4556 Based on XHCI spec 4.8.3, software should do the reset endpoint while USB Transaction occur. Also add the error code for USB Transaction error since UEFI spec don't have the related definition. Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Jenny Huang <jenny.huang@intel.com> Cc: More Shih <more.shih@intel.com> Signed-off-by: Xianglei Cai <xianglei.cai@intel.com> --- MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c | 2 +- MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 2 +- MdePkg/Include/Protocol/UsbIo.h | 21 +++++++++++---------- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c index f4e61d223c1b..63cc29b26536 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c +++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c @@ -825,7 +825,7 @@ XhcTransfer ( *TransferResult = Urb->Result; *DataLength = Urb->Completed; - if ((*TransferResult == EFI_USB_ERR_STALL) || (*TransferResult == EFI_USB_ERR_BABBLE)) { + if ((*TransferResult == EFI_USB_ERR_STALL) || (*TransferResult == + EFI_USB_ERR_BABBLE) || (*TransferResult == EFI_USB_ERR_TRANSACTION)) { ASSERT (Status == EFI_DEVICE_ERROR); RecoveryStatus = XhcRecoverHaltedEndpoint (Xhc, Urb); if (EFI_ERROR (RecoveryStatus)) { diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c index 05528a478baf..e77852f62f10 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c @@ -1193,7 +1193,7 @@ XhcCheckUrbResult ( goto EXIT; case TRB_COMPLETION_USB_TRANSACTION_ERROR: - CheckedUrb->Result |= EFI_USB_ERR_TIMEOUT; + CheckedUrb->Result |= EFI_USB_ERR_TRANSACTION; CheckedUrb->Finished = TRUE; DEBUG ((DEBUG_ERROR, "XhcCheckUrbResult: TRANSACTION_ERROR! Completecode = %x\n", EvtTrb->Completecode)); goto EXIT; diff --git a/MdePkg/Include/Protocol/UsbIo.h b/MdePkg/Include/Protocol/UsbIo.h index a780b4e07b44..211ef0c94156 100644 --- a/MdePkg/Include/Protocol/UsbIo.h +++ b/MdePkg/Include/Protocol/UsbIo.h @@ -50,16 +50,17 @@ typedef enum { // // USB Transfer Results // -#define EFI_USB_NOERROR 0x00 -#define EFI_USB_ERR_NOTEXECUTE 0x01 -#define EFI_USB_ERR_STALL 0x02 -#define EFI_USB_ERR_BUFFER 0x04 -#define EFI_USB_ERR_BABBLE 0x08 -#define EFI_USB_ERR_NAK 0x10 -#define EFI_USB_ERR_CRC 0x20 -#define EFI_USB_ERR_TIMEOUT 0x40 -#define EFI_USB_ERR_BITSTUFF 0x80 -#define EFI_USB_ERR_SYSTEM 0x100 +#define EFI_USB_NOERROR 0x00 +#define EFI_USB_ERR_NOTEXECUTE 0x01 +#define EFI_USB_ERR_STALL 0x02 +#define EFI_USB_ERR_BUFFER 0x04 +#define EFI_USB_ERR_BABBLE 0x08 +#define EFI_USB_ERR_NAK 0x10 +#define EFI_USB_ERR_CRC 0x20 +#define EFI_USB_ERR_TIMEOUT 0x40 +#define EFI_USB_ERR_BITSTUFF 0x80 +#define EFI_USB_ERR_SYSTEM 0x100 +#define EFI_USB_ERR_TRANSACTION 0x200 /** Async USB transfer callback routine. -- 2.42.0.windows.2 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#116914): https://edk2.groups.io/g/devel/message/116914 Mute This Topic: https://groups.io/mt/104879589/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [edk2-devel] [PATCH 1/1] MdeModulePkg/XhciDxe: Reset endpoint while USB Transaction error 2024-03-12 5:13 ` [edk2-devel] [PATCH 1/1] MdeModulePkg/XhciDxe: Reset endpoint while USB Transaction error Xianglei Cai 2024-03-20 8:22 ` Xianglei Cai @ 2024-04-11 13:44 ` Lewandowski, Krzysztof 2024-04-12 1:53 ` Xianglei Cai 1 sibling, 1 reply; 8+ messages in thread From: Lewandowski, Krzysztof @ 2024-04-11 13:44 UTC (permalink / raw) To: devel@edk2.groups.io Cc: Ni, Ray, Liming Gao, Huang, Jenny, Shih, More, Cai, Xianglei [-- Attachment #1: Type: text/plain, Size: 5359 bytes --] Looks good to me. Reviewed-by: Krzysztof Lewandowski <krzysztof.lewandowski@intel.com> ________________________________ From: Cai, Xianglei <xianglei.cai@intel.com> Sent: Wednesday, April 10, 2024 09:02 To: devel@edk2.groups.io <devel@edk2.groups.io> Cc: Cai, Xianglei <xianglei.cai@intel.com>; Ni, Ray <ray.ni@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Lewandowski, Krzysztof <krzysztof.lewandowski@intel.com>; Huang, Jenny <jenny.huang@intel.com>; Shih, More <more.shih@intel.com> Subject: [PATCH 1/1] MdeModulePkg/XhciDxe: Reset endpoint while USB Transaction error https://bugzilla.tianocore.org/show_bug.cgi?id=4556 Based on XHCI spec 4.8.3, software should do the reset endpoint while USB Transaction occur. Also add the error code for USB Transaction error since UEFI spec don't have the related definition. Cc: Ray Ni <ray.ni@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Krzysztof Lewandowski <krzysztof.lewandowski@intel.com> Cc: Jenny Huang <jenny.huang@intel.com> Cc: More Shih <more.shih@intel.com> Signed-off-by: Xianglei Cai <xianglei.cai@intel.com> --- MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c | 2 +- MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 2 +- MdePkg/Include/Protocol/UsbIo.h | 21 +++++++++++---------- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c index f4e61d223c1b..63cc29b26536 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c +++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c @@ -825,7 +825,7 @@ XhcTransfer ( *TransferResult = Urb->Result; *DataLength = Urb->Completed; - if ((*TransferResult == EFI_USB_ERR_STALL) || (*TransferResult == EFI_USB_ERR_BABBLE)) { + if ((*TransferResult == EFI_USB_ERR_STALL) || (*TransferResult == EFI_USB_ERR_BABBLE) || (*TransferResult == EFI_USB_ERR_TRANSACTION)) { ASSERT (Status == EFI_DEVICE_ERROR); RecoveryStatus = XhcRecoverHaltedEndpoint (Xhc, Urb); if (EFI_ERROR (RecoveryStatus)) { diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c index 05528a478baf..e77852f62f10 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c @@ -1193,7 +1193,7 @@ XhcCheckUrbResult ( goto EXIT; case TRB_COMPLETION_USB_TRANSACTION_ERROR: - CheckedUrb->Result |= EFI_USB_ERR_TIMEOUT; + CheckedUrb->Result |= EFI_USB_ERR_TRANSACTION; CheckedUrb->Finished = TRUE; DEBUG ((DEBUG_ERROR, "XhcCheckUrbResult: TRANSACTION_ERROR! Completecode = %x\n", EvtTrb->Completecode)); goto EXIT; diff --git a/MdePkg/Include/Protocol/UsbIo.h b/MdePkg/Include/Protocol/UsbIo.h index a780b4e07b44..211ef0c94156 100644 --- a/MdePkg/Include/Protocol/UsbIo.h +++ b/MdePkg/Include/Protocol/UsbIo.h @@ -50,16 +50,17 @@ typedef enum { // // USB Transfer Results // -#define EFI_USB_NOERROR 0x00 -#define EFI_USB_ERR_NOTEXECUTE 0x01 -#define EFI_USB_ERR_STALL 0x02 -#define EFI_USB_ERR_BUFFER 0x04 -#define EFI_USB_ERR_BABBLE 0x08 -#define EFI_USB_ERR_NAK 0x10 -#define EFI_USB_ERR_CRC 0x20 -#define EFI_USB_ERR_TIMEOUT 0x40 -#define EFI_USB_ERR_BITSTUFF 0x80 -#define EFI_USB_ERR_SYSTEM 0x100 +#define EFI_USB_NOERROR 0x00 +#define EFI_USB_ERR_NOTEXECUTE 0x01 +#define EFI_USB_ERR_STALL 0x02 +#define EFI_USB_ERR_BUFFER 0x04 +#define EFI_USB_ERR_BABBLE 0x08 +#define EFI_USB_ERR_NAK 0x10 +#define EFI_USB_ERR_CRC 0x20 +#define EFI_USB_ERR_TIMEOUT 0x40 +#define EFI_USB_ERR_BITSTUFF 0x80 +#define EFI_USB_ERR_SYSTEM 0x100 +#define EFI_USB_ERR_TRANSACTION 0x200 /** Async USB transfer callback routine. -- 2.42.0.windows.2 --------------------------------------------------------------------- Intel Technology Poland sp. z o.o. ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN. Spolka oswiadcza, ze posiada status duzego przedsiebiorcy w rozumieniu ustawy z dnia 8 marca 2013 r. o przeciwdzialaniu nadmiernym opoznieniom w transakcjach handlowych. Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek przegladanie lub rozpowszechnianie jest zabronione. This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited. -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#117635): https://edk2.groups.io/g/devel/message/117635 Mute This Topic: https://groups.io/mt/104879589/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- [-- Attachment #2: Type: text/html, Size: 9577 bytes --] ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [edk2-devel] [PATCH 1/1] MdeModulePkg/XhciDxe: Reset endpoint while USB Transaction error 2024-04-11 13:44 ` Lewandowski, Krzysztof @ 2024-04-12 1:53 ` Xianglei Cai 2024-04-15 2:16 ` Ni, Ray 0 siblings, 1 reply; 8+ messages in thread From: Xianglei Cai @ 2024-04-12 1:53 UTC (permalink / raw) To: Lewandowski, Krzysztof, devel@edk2.groups.io, Ni, Ray, Liming Gao Cc: Huang, Jenny, Shih, More [-- Attachment #1: Type: text/plain, Size: 5401 bytes --] @Ni, Ray<mailto:ray.ni@intel.com> @Liming Gao<mailto:gaoliming@byosoft.com.cn>Would you like to merge the patch to upstream? Thanks, Xianglei From: Lewandowski, Krzysztof <krzysztof.lewandowski@intel.com> Sent: Thursday, April 11, 2024 9:45 PM To: devel@edk2.groups.io Cc: Ni, Ray <ray.ni@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Huang, Jenny <jenny.huang@intel.com>; Shih, More <more.shih@intel.com>; Cai, Xianglei <xianglei.cai@intel.com> Subject: Re: [PATCH 1/1] MdeModulePkg/XhciDxe: Reset endpoint while USB Transaction error Looks good to me. Reviewed-by: Krzysztof Lewandowski <krzysztof.lewandowski@intel.com<mailto:krzysztof.lewandowski@intel.com>> ________________________________ From: Cai, Xianglei <xianglei.cai@intel.com<mailto:xianglei.cai@intel.com>> Sent: Wednesday, April 10, 2024 09:02 To: devel@edk2.groups.io<mailto:devel@edk2.groups.io> <devel@edk2.groups.io<mailto:devel@edk2.groups.io>> Cc: Cai, Xianglei <xianglei.cai@intel.com<mailto:xianglei.cai@intel.com>>; Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>; Liming Gao <gaoliming@byosoft.com.cn<mailto:gaoliming@byosoft.com.cn>>; Lewandowski, Krzysztof <krzysztof.lewandowski@intel.com<mailto:krzysztof.lewandowski@intel.com>>; Huang, Jenny <jenny.huang@intel.com<mailto:jenny.huang@intel.com>>; Shih, More <more.shih@intel.com<mailto:more.shih@intel.com>> Subject: [PATCH 1/1] MdeModulePkg/XhciDxe: Reset endpoint while USB Transaction error https://bugzilla.tianocore.org/show_bug.cgi?id=4556 Based on XHCI spec 4.8.3, software should do the reset endpoint while USB Transaction occur. Also add the error code for USB Transaction error since UEFI spec don't have the related definition. Cc: Ray Ni <ray.ni@intel.com<mailto:ray.ni@intel.com>> Cc: Liming Gao <gaoliming@byosoft.com.cn<mailto:gaoliming@byosoft.com.cn>> Cc: Krzysztof Lewandowski <krzysztof.lewandowski@intel.com<mailto:krzysztof.lewandowski@intel.com>> Cc: Jenny Huang <jenny.huang@intel.com<mailto:jenny.huang@intel.com>> Cc: More Shih <more.shih@intel.com<mailto:more.shih@intel.com>> Signed-off-by: Xianglei Cai <xianglei.cai@intel.com<mailto:xianglei.cai@intel.com>> --- MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c | 2 +- MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 2 +- MdePkg/Include/Protocol/UsbIo.h | 21 +++++++++++---------- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c index f4e61d223c1b..63cc29b26536 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c +++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c @@ -825,7 +825,7 @@ XhcTransfer ( *TransferResult = Urb->Result; *DataLength = Urb->Completed; - if ((*TransferResult == EFI_USB_ERR_STALL) || (*TransferResult == EFI_USB_ERR_BABBLE)) { + if ((*TransferResult == EFI_USB_ERR_STALL) || (*TransferResult == EFI_USB_ERR_BABBLE) || (*TransferResult == EFI_USB_ERR_TRANSACTION)) { ASSERT (Status == EFI_DEVICE_ERROR); RecoveryStatus = XhcRecoverHaltedEndpoint (Xhc, Urb); if (EFI_ERROR (RecoveryStatus)) { diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c index 05528a478baf..e77852f62f10 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c @@ -1193,7 +1193,7 @@ XhcCheckUrbResult ( goto EXIT; case TRB_COMPLETION_USB_TRANSACTION_ERROR: - CheckedUrb->Result |= EFI_USB_ERR_TIMEOUT; + CheckedUrb->Result |= EFI_USB_ERR_TRANSACTION; CheckedUrb->Finished = TRUE; DEBUG ((DEBUG_ERROR, "XhcCheckUrbResult: TRANSACTION_ERROR! Completecode = %x\n", EvtTrb->Completecode)); goto EXIT; diff --git a/MdePkg/Include/Protocol/UsbIo.h b/MdePkg/Include/Protocol/UsbIo.h index a780b4e07b44..211ef0c94156 100644 --- a/MdePkg/Include/Protocol/UsbIo.h +++ b/MdePkg/Include/Protocol/UsbIo.h @@ -50,16 +50,17 @@ typedef enum { // // USB Transfer Results // -#define EFI_USB_NOERROR 0x00 -#define EFI_USB_ERR_NOTEXECUTE 0x01 -#define EFI_USB_ERR_STALL 0x02 -#define EFI_USB_ERR_BUFFER 0x04 -#define EFI_USB_ERR_BABBLE 0x08 -#define EFI_USB_ERR_NAK 0x10 -#define EFI_USB_ERR_CRC 0x20 -#define EFI_USB_ERR_TIMEOUT 0x40 -#define EFI_USB_ERR_BITSTUFF 0x80 -#define EFI_USB_ERR_SYSTEM 0x100 +#define EFI_USB_NOERROR 0x00 +#define EFI_USB_ERR_NOTEXECUTE 0x01 +#define EFI_USB_ERR_STALL 0x02 +#define EFI_USB_ERR_BUFFER 0x04 +#define EFI_USB_ERR_BABBLE 0x08 +#define EFI_USB_ERR_NAK 0x10 +#define EFI_USB_ERR_CRC 0x20 +#define EFI_USB_ERR_TIMEOUT 0x40 +#define EFI_USB_ERR_BITSTUFF 0x80 +#define EFI_USB_ERR_SYSTEM 0x100 +#define EFI_USB_ERR_TRANSACTION 0x200 /** Async USB transfer callback routine. -- 2.42.0.windows.2 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#117637): https://edk2.groups.io/g/devel/message/117637 Mute This Topic: https://groups.io/mt/104879589/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- [-- Attachment #2: Type: text/html, Size: 11391 bytes --] ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [edk2-devel] [PATCH 1/1] MdeModulePkg/XhciDxe: Reset endpoint while USB Transaction error 2024-04-12 1:53 ` Xianglei Cai @ 2024-04-15 2:16 ` Ni, Ray 2024-04-15 5:23 ` [edk2-devel] 回复: " gaoliming via groups.io 0 siblings, 1 reply; 8+ messages in thread From: Ni, Ray @ 2024-04-15 2:16 UTC (permalink / raw) To: Liming Gao Cc: Huang, Jenny, Shih, More, devel@edk2.groups.io, Lewandowski, Krzysztof, Cai, Xianglei, Lewandowski, Krzysztof [-- Attachment #1: Type: text/plain, Size: 5929 bytes --] Liming, Can you give a R-B? Thanks, Ray ________________________________ From: Cai, Xianglei <xianglei.cai@intel.com> Sent: Friday, April 12, 2024 9:53 To: Lewandowski, Krzysztof <krzysztof.lewandowski@intel.com>; devel@edk2.groups.io <devel@edk2.groups.io>; Ni, Ray <ray.ni@intel.com>; Liming Gao <gaoliming@byosoft.com.cn> Cc: Huang, Jenny <jenny.huang@intel.com>; Shih, More <more.shih@intel.com> Subject: RE: [PATCH 1/1] MdeModulePkg/XhciDxe: Reset endpoint while USB Transaction error @Ni, Ray<mailto:ray.ni@intel.com> @Liming Gao<mailto:gaoliming@byosoft.com.cn>Would you like to merge the patch to upstream? Thanks, Xianglei From: Lewandowski, Krzysztof <krzysztof.lewandowski@intel.com> Sent: Thursday, April 11, 2024 9:45 PM To: devel@edk2.groups.io Cc: Ni, Ray <ray.ni@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Huang, Jenny <jenny.huang@intel.com>; Shih, More <more.shih@intel.com>; Cai, Xianglei <xianglei.cai@intel.com> Subject: Re: [PATCH 1/1] MdeModulePkg/XhciDxe: Reset endpoint while USB Transaction error Looks good to me. Reviewed-by: Krzysztof Lewandowski <krzysztof.lewandowski@intel.com<mailto:krzysztof.lewandowski@intel.com>> ________________________________ From: Cai, Xianglei <xianglei.cai@intel.com<mailto:xianglei.cai@intel.com>> Sent: Wednesday, April 10, 2024 09:02 To: devel@edk2.groups.io<mailto:devel@edk2.groups.io> <devel@edk2.groups.io<mailto:devel@edk2.groups.io>> Cc: Cai, Xianglei <xianglei.cai@intel.com<mailto:xianglei.cai@intel.com>>; Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>; Liming Gao <gaoliming@byosoft.com.cn<mailto:gaoliming@byosoft.com.cn>>; Lewandowski, Krzysztof <krzysztof.lewandowski@intel.com<mailto:krzysztof.lewandowski@intel.com>>; Huang, Jenny <jenny.huang@intel.com<mailto:jenny.huang@intel.com>>; Shih, More <more.shih@intel.com<mailto:more.shih@intel.com>> Subject: [PATCH 1/1] MdeModulePkg/XhciDxe: Reset endpoint while USB Transaction error https://bugzilla.tianocore.org/show_bug.cgi?id=4556 Based on XHCI spec 4.8.3, software should do the reset endpoint while USB Transaction occur. Also add the error code for USB Transaction error since UEFI spec don't have the related definition. Cc: Ray Ni <ray.ni@intel.com<mailto:ray.ni@intel.com>> Cc: Liming Gao <gaoliming@byosoft.com.cn<mailto:gaoliming@byosoft.com.cn>> Cc: Krzysztof Lewandowski <krzysztof.lewandowski@intel.com<mailto:krzysztof.lewandowski@intel.com>> Cc: Jenny Huang <jenny.huang@intel.com<mailto:jenny.huang@intel.com>> Cc: More Shih <more.shih@intel.com<mailto:more.shih@intel.com>> Signed-off-by: Xianglei Cai <xianglei.cai@intel.com<mailto:xianglei.cai@intel.com>> --- MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c | 2 +- MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 2 +- MdePkg/Include/Protocol/UsbIo.h | 21 +++++++++++---------- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c index f4e61d223c1b..63cc29b26536 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c +++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c @@ -825,7 +825,7 @@ XhcTransfer ( *TransferResult = Urb->Result; *DataLength = Urb->Completed; - if ((*TransferResult == EFI_USB_ERR_STALL) || (*TransferResult == EFI_USB_ERR_BABBLE)) { + if ((*TransferResult == EFI_USB_ERR_STALL) || (*TransferResult == EFI_USB_ERR_BABBLE) || (*TransferResult == EFI_USB_ERR_TRANSACTION)) { ASSERT (Status == EFI_DEVICE_ERROR); RecoveryStatus = XhcRecoverHaltedEndpoint (Xhc, Urb); if (EFI_ERROR (RecoveryStatus)) { diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c index 05528a478baf..e77852f62f10 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c @@ -1193,7 +1193,7 @@ XhcCheckUrbResult ( goto EXIT; case TRB_COMPLETION_USB_TRANSACTION_ERROR: - CheckedUrb->Result |= EFI_USB_ERR_TIMEOUT; + CheckedUrb->Result |= EFI_USB_ERR_TRANSACTION; CheckedUrb->Finished = TRUE; DEBUG ((DEBUG_ERROR, "XhcCheckUrbResult: TRANSACTION_ERROR! Completecode = %x\n", EvtTrb->Completecode)); goto EXIT; diff --git a/MdePkg/Include/Protocol/UsbIo.h b/MdePkg/Include/Protocol/UsbIo.h index a780b4e07b44..211ef0c94156 100644 --- a/MdePkg/Include/Protocol/UsbIo.h +++ b/MdePkg/Include/Protocol/UsbIo.h @@ -50,16 +50,17 @@ typedef enum { // // USB Transfer Results // -#define EFI_USB_NOERROR 0x00 -#define EFI_USB_ERR_NOTEXECUTE 0x01 -#define EFI_USB_ERR_STALL 0x02 -#define EFI_USB_ERR_BUFFER 0x04 -#define EFI_USB_ERR_BABBLE 0x08 -#define EFI_USB_ERR_NAK 0x10 -#define EFI_USB_ERR_CRC 0x20 -#define EFI_USB_ERR_TIMEOUT 0x40 -#define EFI_USB_ERR_BITSTUFF 0x80 -#define EFI_USB_ERR_SYSTEM 0x100 +#define EFI_USB_NOERROR 0x00 +#define EFI_USB_ERR_NOTEXECUTE 0x01 +#define EFI_USB_ERR_STALL 0x02 +#define EFI_USB_ERR_BUFFER 0x04 +#define EFI_USB_ERR_BABBLE 0x08 +#define EFI_USB_ERR_NAK 0x10 +#define EFI_USB_ERR_CRC 0x20 +#define EFI_USB_ERR_TIMEOUT 0x40 +#define EFI_USB_ERR_BITSTUFF 0x80 +#define EFI_USB_ERR_SYSTEM 0x100 +#define EFI_USB_ERR_TRANSACTION 0x200 /** Async USB transfer callback routine. -- 2.42.0.windows.2 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#117745): https://edk2.groups.io/g/devel/message/117745 Mute This Topic: https://groups.io/mt/104879589/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- [-- Attachment #2: Type: text/html, Size: 12018 bytes --] ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [edk2-devel] 回复: [PATCH 1/1] MdeModulePkg/XhciDxe: Reset endpoint while USB Transaction error 2024-04-15 2:16 ` Ni, Ray @ 2024-04-15 5:23 ` gaoliming via groups.io 2024-04-15 5:27 ` [edk2-devel] " Xianglei Cai 0 siblings, 1 reply; 8+ messages in thread From: gaoliming via groups.io @ 2024-04-15 5:23 UTC (permalink / raw) To: 'Ni, Ray' Cc: 'Huang, Jenny', 'Shih, More', devel, 'Lewandowski, Krzysztof', 'Cai, Xianglei', 'Lewandowski, Krzysztof' [-- Attachment #1: Type: text/plain, Size: 7238 bytes --] Xianglei: Now, UEFI spec doesn’t define EFI_USB_ERR_TRANSACTION. So, we can’t update UsbIo.h now. EFI_USB_ERR_TRANSACTION is only used in XhciDxe for error condition check. I suggest to add comments for current code, don’t need code update. Thanks Liming 发件人: Ni, Ray <ray.ni@intel.com> 发送时间: 2024年4月15日 10:17 收件人: Liming Gao <gaoliming@byosoft.com.cn> 抄送: Huang, Jenny <jenny.huang@intel.com>; Shih, More <more.shih@intel.com>; devel@edk2.groups.io; Lewandowski, Krzysztof <krzysztof.lewandowski@intel.com>; Cai, Xianglei <xianglei.cai@intel.com>; Lewandowski, Krzysztof <krzysztof.lewandowski@intel.com> 主题: Re: [PATCH 1/1] MdeModulePkg/XhciDxe: Reset endpoint while USB Transaction error Liming, Can you give a R-B? Thanks, Ray _____ From: Cai, Xianglei <xianglei.cai@intel.com <mailto:xianglei.cai@intel.com> > Sent: Friday, April 12, 2024 9:53 To: Lewandowski, Krzysztof <krzysztof.lewandowski@intel.com <mailto:krzysztof.lewandowski@intel.com> >; devel@edk2.groups.io <mailto:devel@edk2.groups.io> <devel@edk2.groups.io <mailto:devel@edk2.groups.io> >; Ni, Ray <ray.ni@intel.com <mailto:ray.ni@intel.com> >; Liming Gao <gaoliming@byosoft.com.cn <mailto:gaoliming@byosoft.com.cn> > Cc: Huang, Jenny <jenny.huang@intel.com <mailto:jenny.huang@intel.com> >; Shih, More <more.shih@intel.com <mailto:more.shih@intel.com> > Subject: RE: [PATCH 1/1] MdeModulePkg/XhciDxe: Reset endpoint while USB Transaction error <mailto:ray.ni@intel.com> @Ni, Ray <mailto:gaoliming@byosoft.com.cn> @Liming GaoWould you like to merge the patch to upstream? Thanks, Xianglei From: Lewandowski, Krzysztof <krzysztof.lewandowski@intel.com <mailto:krzysztof.lewandowski@intel.com> > Sent: Thursday, April 11, 2024 9:45 PM To: devel@edk2.groups.io <mailto:devel@edk2.groups.io> Cc: Ni, Ray <ray.ni@intel.com <mailto:ray.ni@intel.com> >; Liming Gao <gaoliming@byosoft.com.cn <mailto:gaoliming@byosoft.com.cn> >; Huang, Jenny <jenny.huang@intel.com <mailto:jenny.huang@intel.com> >; Shih, More <more.shih@intel.com <mailto:more.shih@intel.com> >; Cai, Xianglei <xianglei.cai@intel.com <mailto:xianglei.cai@intel.com> > Subject: Re: [PATCH 1/1] MdeModulePkg/XhciDxe: Reset endpoint while USB Transaction error Looks good to me. Reviewed-by: Krzysztof Lewandowski <krzysztof.lewandowski@intel.com <mailto:krzysztof.lewandowski@intel.com> > _____ From: Cai, Xianglei <xianglei.cai@intel.com <mailto:xianglei.cai@intel.com> > Sent: Wednesday, April 10, 2024 09:02 To: devel@edk2.groups.io <mailto:devel@edk2.groups.io> <devel@edk2.groups.io <mailto:devel@edk2.groups.io> > Cc: Cai, Xianglei <xianglei.cai@intel.com <mailto:xianglei.cai@intel.com> >; Ni, Ray <ray.ni@intel.com <mailto:ray.ni@intel.com> >; Liming Gao <gaoliming@byosoft.com.cn <mailto:gaoliming@byosoft.com.cn> >; Lewandowski, Krzysztof <krzysztof.lewandowski@intel.com <mailto:krzysztof.lewandowski@intel.com> >; Huang, Jenny <jenny.huang@intel. com <mailto:jenny.huang@intel.com> >; Shih, More <more.shih@intel.com <mailto:more.shih@intel.com> > Subject: [PATCH 1/1] MdeModulePkg/XhciDxe: Reset endpoint while USB Transaction error https://bugzilla.tianocore.org/show_bug.cgi?id=4556 Based on XHCI spec 4.8.3, software should do the reset endpoint while USB Transaction occur. Also add the error code for USB Transaction error since UEFI spec don't have the related definition. Cc: Ray Ni <ray.ni@intel.com <mailto:ray.ni@intel.com> > Cc: Liming Gao <gaoliming@byosoft.com.cn <mailto:gaoliming@byosoft.com.cn> > Cc: Krzysztof Lewandowski <krzysztof.lewandowski@intel.com <mailto:krzysztof.lewandowski@intel.com> > Cc: Jenny Huang <jenny.huang@intel.com <mailto:jenny.huang@intel.com> > Cc: More Shih <more.shih@intel.com <mailto:more. shih@intel.com> > Signed-off-by: Xianglei Cai <xianglei.cai@intel.com <mailto:xianglei.cai@intel.com> > --- MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c | 2 +- MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 2 +- MdePkg/Include/Protocol/UsbIo.h | 21 +++++++++++---------- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c index f4e61d223c1b..63cc29b26536 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c +++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c @@ -825,7 +825,7 @@ XhcTransfer ( *TransferResult = Urb->Result; *DataLength = Urb->Completed; - if ((*TransferResult == EFI_USB_ERR_STALL) || (*TransferResult == EFI_USB_ERR_BABBLE)) { + if ((*TransferResult == EFI_USB_ERR_STALL) || (*TransferResult == EFI_USB_ERR_BABBLE) || (*TransferResult == EFI_USB_ERR_TRANSACTION)) { ASSERT (Status == EFI_DEVICE_ERROR); RecoveryStatus = XhcRecoverHaltedEndpoint (Xhc, Urb); if (EFI_ERROR (RecoveryStatus)) { diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c index 05528a478baf..e77852f62f10 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c @@ -1193,7 +1193,7 @@ XhcCheckUrbResult ( goto EXIT; case TRB_COMPLETION_USB_TRANSACTION_ERROR: - CheckedUrb->Result |= EFI_USB_ERR_TIMEOUT; + CheckedUrb->Result |= EFI_USB_ERR_TRANSACTION; CheckedUrb->Finished = TRUE; DEBUG ((DEBUG_ERROR, "XhcCheckUrbResult: TRANSACTION_ERROR! Completecode = %x\n", EvtTrb->Completecode)); goto EXIT; diff --git a/MdePkg/Include/Protocol/UsbIo.h b/MdePkg/Include/Protocol/UsbIo.h index a780b4e07b44..211ef0c94156 100644 --- a/MdePkg/Include/Protocol/UsbIo.h +++ b/MdePkg/Include/Protocol/UsbIo.h @@ -50,16 +50,17 @@ typedef enum { // // USB Transfer Results // -#define EFI_USB_NOERROR 0x00 -#define EFI_USB_ERR_NOTEXECUTE 0x01 -#define EFI_USB_ERR_STALL 0x02 -#define EFI_USB_ERR_BUFFER 0x04 -#define EFI_USB_ERR_BABBLE 0x08 -#define EFI_USB_ERR_NAK 0x10 -#define EFI_USB_ERR_CRC 0x20 -#define EFI_USB_ERR_TIMEOUT 0x40 -#define EFI_USB_ERR_BITSTUFF 0x80 -#define EFI_USB_ERR_SYSTEM 0x100 +#define EFI_USB_NOERROR 0x00 +#define EFI_USB_ERR_NOTEXECUTE 0x01 +#define EFI_USB_ERR_STALL 0x02 +#define EFI_USB_ERR_BUFFER 0x04 +#define EFI_USB_ERR_BABBLE 0x08 +#define EFI_USB_ERR_NAK 0x10 +#define EFI_USB_ERR_CRC 0x20 +#define EFI_USB_ERR_TIMEOUT 0x40 +#define EFI_USB_ERR_BITSTUFF 0x80 +#define EFI_USB_ERR_SYSTEM 0x100 +#define EFI_USB_ERR_TRANSACTION 0x200 /** Async USB transfer callback routine. -- 2.42.0.windows.2 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#117749): https://edk2.groups.io/g/devel/message/117749 Mute This Topic: https://groups.io/mt/105530298/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- [-- Attachment #2: Type: text/html, Size: 16243 bytes --] ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [edk2-devel] [PATCH 1/1] MdeModulePkg/XhciDxe: Reset endpoint while USB Transaction error 2024-04-15 5:23 ` [edk2-devel] 回复: " gaoliming via groups.io @ 2024-04-15 5:27 ` Xianglei Cai 2024-04-15 6:35 ` [edk2-devel] 回复: " gaoliming via groups.io 0 siblings, 1 reply; 8+ messages in thread From: Xianglei Cai @ 2024-04-15 5:27 UTC (permalink / raw) To: gaoliming, Ni, Ray Cc: Huang, Jenny, Shih, More, devel@edk2.groups.io, Lewandowski, Krzysztof, Lewandowski, Krzysztof [-- Attachment #1: Type: text/plain, Size: 8085 bytes --] Hi Liming, But we met some issues that system will stuck for 5-7 minutes because of USB transaction error with some USB device. And check the XHCI spec, it shows need reset endpoint when USB transaction. Thanks, Xianglei From: gaoliming <gaoliming@byosoft.com.cn> Sent: Monday, April 15, 2024 1:23 PM To: Ni, Ray <ray.ni@intel.com> Cc: Huang, Jenny <jenny.huang@intel.com>; Shih, More <more.shih@intel.com>; devel@edk2.groups.io; Lewandowski, Krzysztof <krzysztof.lewandowski@intel.com>; Cai, Xianglei <xianglei.cai@intel.com>; Lewandowski, Krzysztof <krzysztof.lewandowski@intel.com> Subject: 回复: [PATCH 1/1] MdeModulePkg/XhciDxe: Reset endpoint while USB Transaction error Xianglei: Now, UEFI spec doesn’t define EFI_USB_ERR_TRANSACTION. So, we can’t update UsbIo.h now. EFI_USB_ERR_TRANSACTION is only used in XhciDxe for error condition check. I suggest to add comments for current code, don’t need code update. Thanks Liming 发件人: Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>> 发送时间: 2024年4月15日 10:17 收件人: Liming Gao <gaoliming@byosoft.com.cn<mailto:gaoliming@byosoft.com.cn>> 抄送: Huang, Jenny <jenny.huang@intel.com<mailto:jenny.huang@intel.com>>; Shih, More <more.shih@intel.com<mailto:more.shih@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>; Lewandowski, Krzysztof <krzysztof.lewandowski@intel.com<mailto:krzysztof.lewandowski@intel.com>>; Cai, Xianglei <xianglei.cai@intel.com<mailto:xianglei.cai@intel.com>>; Lewandowski, Krzysztof <krzysztof.lewandowski@intel.com<mailto:krzysztof.lewandowski@intel.com>> 主题: Re: [PATCH 1/1] MdeModulePkg/XhciDxe: Reset endpoint while USB Transaction error Liming, Can you give a R-B? Thanks, Ray ________________________________ From: Cai, Xianglei <xianglei.cai@intel.com<mailto:xianglei.cai@intel.com>> Sent: Friday, April 12, 2024 9:53 To: Lewandowski, Krzysztof <krzysztof.lewandowski@intel.com<mailto:krzysztof.lewandowski@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io> <devel@edk2.groups.io<mailto:devel@edk2.groups.io>>; Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>; Liming Gao <gaoliming@byosoft.com.cn<mailto:gaoliming@byosoft.com.cn>> Cc: Huang, Jenny <jenny.huang@intel.com<mailto:jenny.huang@intel.com>>; Shih, More <more.shih@intel.com<mailto:more.shih@intel.com>> Subject: RE: [PATCH 1/1] MdeModulePkg/XhciDxe: Reset endpoint while USB Transaction error @Ni, Ray<mailto:ray.ni@intel.com> @Liming Gao<mailto:gaoliming@byosoft.com.cn>Would you like to merge the patch to upstream? Thanks, Xianglei From: Lewandowski, Krzysztof <krzysztof.lewandowski@intel.com<mailto:krzysztof.lewandowski@intel.com>> Sent: Thursday, April 11, 2024 9:45 PM To: devel@edk2.groups.io<mailto:devel@edk2.groups.io> Cc: Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>; Liming Gao <gaoliming@byosoft.com.cn<mailto:gaoliming@byosoft.com.cn>>; Huang, Jenny <jenny.huang@intel.com<mailto:jenny.huang@intel.com>>; Shih, More <more.shih@intel.com<mailto:more.shih@intel.com>>; Cai, Xianglei <xianglei.cai@intel.com<mailto:xianglei.cai@intel.com>> Subject: Re: [PATCH 1/1] MdeModulePkg/XhciDxe: Reset endpoint while USB Transaction error Looks good to me. Reviewed-by: Krzysztof Lewandowski <krzysztof.lewandowski@intel.com<mailto:krzysztof.lewandowski@intel.com>> ________________________________ From: Cai, Xianglei <xianglei.cai@intel.com<mailto:xianglei.cai@intel.com>> Sent: Wednesday, April 10, 2024 09:02 To: devel@edk2.groups.io<mailto:devel@edk2.groups.io> <devel@edk2.groups.io<mailto:devel@edk2.groups.io>> Cc: Cai, Xianglei <xianglei.cai@intel.com<mailto:xianglei.cai@intel.com>>; Ni, Ray <ray.ni@intel.com<mailto:ray.ni@intel.com>>; Liming Gao <gaoliming@byosoft.com.cn<mailto:gaoliming@byosoft.com.cn>>; Lewandowski, Krzysztof <krzysztof.lewandowski@intel.com<mailto:krzysztof.lewandowski@intel.com>>; Huang, Jenny <jenny.huang@intel.com<mailto:jenny.huang@intel.com>>; Shih, More <more.shih@intel.com<mailto:more.shih@intel.com>> Subject: [PATCH 1/1] MdeModulePkg/XhciDxe: Reset endpoint while USB Transaction error https://bugzilla.tianocore.org/show_bug.cgi?id=4556 Based on XHCI spec 4.8.3, software should do the reset endpoint while USB Transaction occur. Also add the error code for USB Transaction error since UEFI spec don't have the related definition. Cc: Ray Ni <ray.ni@intel.com<mailto:ray.ni@intel.com>> Cc: Liming Gao <gaoliming@byosoft.com.cn<mailto:gaoliming@byosoft.com.cn>> Cc: Krzysztof Lewandowski <krzysztof.lewandowski@intel.com<mailto:krzysztof.lewandowski@intel.com>> Cc: Jenny Huang <jenny.huang@intel.com<mailto:jenny.huang@intel.com>> Cc: More Shih <more.shih@intel.com<mailto:more.shih@intel.com>> Signed-off-by: Xianglei Cai <xianglei.cai@intel.com<mailto:xianglei.cai@intel.com>> --- MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c | 2 +- MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 2 +- MdePkg/Include/Protocol/UsbIo.h | 21 +++++++++++---------- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c index f4e61d223c1b..63cc29b26536 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c +++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c @@ -825,7 +825,7 @@ XhcTransfer ( *TransferResult = Urb->Result; *DataLength = Urb->Completed; - if ((*TransferResult == EFI_USB_ERR_STALL) || (*TransferResult == EFI_USB_ERR_BABBLE)) { + if ((*TransferResult == EFI_USB_ERR_STALL) || (*TransferResult == EFI_USB_ERR_BABBLE) || (*TransferResult == EFI_USB_ERR_TRANSACTION)) { ASSERT (Status == EFI_DEVICE_ERROR); RecoveryStatus = XhcRecoverHaltedEndpoint (Xhc, Urb); if (EFI_ERROR (RecoveryStatus)) { diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c index 05528a478baf..e77852f62f10 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c @@ -1193,7 +1193,7 @@ XhcCheckUrbResult ( goto EXIT; case TRB_COMPLETION_USB_TRANSACTION_ERROR: - CheckedUrb->Result |= EFI_USB_ERR_TIMEOUT; + CheckedUrb->Result |= EFI_USB_ERR_TRANSACTION; CheckedUrb->Finished = TRUE; DEBUG ((DEBUG_ERROR, "XhcCheckUrbResult: TRANSACTION_ERROR! Completecode = %x\n", EvtTrb->Completecode)); goto EXIT; diff --git a/MdePkg/Include/Protocol/UsbIo.h b/MdePkg/Include/Protocol/UsbIo.h index a780b4e07b44..211ef0c94156 100644 --- a/MdePkg/Include/Protocol/UsbIo.h +++ b/MdePkg/Include/Protocol/UsbIo.h @@ -50,16 +50,17 @@ typedef enum { // // USB Transfer Results // -#define EFI_USB_NOERROR 0x00 -#define EFI_USB_ERR_NOTEXECUTE 0x01 -#define EFI_USB_ERR_STALL 0x02 -#define EFI_USB_ERR_BUFFER 0x04 -#define EFI_USB_ERR_BABBLE 0x08 -#define EFI_USB_ERR_NAK 0x10 -#define EFI_USB_ERR_CRC 0x20 -#define EFI_USB_ERR_TIMEOUT 0x40 -#define EFI_USB_ERR_BITSTUFF 0x80 -#define EFI_USB_ERR_SYSTEM 0x100 +#define EFI_USB_NOERROR 0x00 +#define EFI_USB_ERR_NOTEXECUTE 0x01 +#define EFI_USB_ERR_STALL 0x02 +#define EFI_USB_ERR_BUFFER 0x04 +#define EFI_USB_ERR_BABBLE 0x08 +#define EFI_USB_ERR_NAK 0x10 +#define EFI_USB_ERR_CRC 0x20 +#define EFI_USB_ERR_TIMEOUT 0x40 +#define EFI_USB_ERR_BITSTUFF 0x80 +#define EFI_USB_ERR_SYSTEM 0x100 +#define EFI_USB_ERR_TRANSACTION 0x200 /** Async USB transfer callback routine. -- 2.42.0.windows.2 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#117751): https://edk2.groups.io/g/devel/message/117751 Mute This Topic: https://groups.io/mt/105530326/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- [-- Attachment #2: Type: text/html, Size: 17554 bytes --] ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [edk2-devel] 回复: [PATCH 1/1] MdeModulePkg/XhciDxe: Reset endpoint while USB Transaction error 2024-04-15 5:27 ` [edk2-devel] " Xianglei Cai @ 2024-04-15 6:35 ` gaoliming via groups.io 0 siblings, 0 replies; 8+ messages in thread From: gaoliming via groups.io @ 2024-04-15 6:35 UTC (permalink / raw) To: 'Cai, Xianglei', 'Ni, Ray' Cc: 'Huang, Jenny', 'Shih, More', devel, 'Lewandowski, Krzysztof', 'Lewandowski, Krzysztof' [-- Attachment #1: Type: text/plain, Size: 9204 bytes --] Xianglei: I understand this issue now. I suggest to add the internal definition in XhciDxe module for transaction error type, such as EDKII_USB_ERR_TRANSACTION. It can avoid the change in UEFI UsbIo protocol. Thanks Liming 发件人: Cai, Xianglei <xianglei.cai@intel.com> 发送时间: 2024年4月15日 13:27 收件人: gaoliming <gaoliming@byosoft.com.cn>; Ni, Ray <ray.ni@intel.com> 抄送: Huang, Jenny <jenny.huang@intel.com>; Shih, More <more.shih@intel.com>; devel@edk2.groups.io; Lewandowski, Krzysztof <krzysztof.lewandowski@intel.com>; Lewandowski, Krzysztof <krzysztof.lewandowski@intel.com> 主题: RE: [PATCH 1/1] MdeModulePkg/XhciDxe: Reset endpoint while USB Transaction error Hi Liming, But we met some issues that system will stuck for 5-7 minutes because of USB transaction error with some USB device. And check the XHCI spec, it shows need reset endpoint when USB transaction. Thanks, Xianglei From: gaoliming <gaoliming@byosoft.com.cn <mailto:gaoliming@byosoft.com.cn> > Sent: Monday, April 15, 2024 1:23 PM To: Ni, Ray <ray.ni@intel.com <mailto:ray.ni@intel.com> > Cc: Huang, Jenny <jenny.huang@intel.com <mailto:jenny.huang@intel.com> >; Shih, More <more.shih@intel.com <mailto:more.shih@intel.com> >; devel@edk2.groups.io <mailto:devel@edk2.groups.io> ; Lewandowski, Krzysztof <krzysztof.lewandowski@intel.com <mailto:krzysztof.lewandowski@intel.com> >; Cai, Xianglei <xianglei.cai@intel.com <mailto:xianglei.cai@intel.com> >; Lewandowski, Krzysztof <krzysztof.lewandowski@intel.com <mailto:krzysztof.lewandowski@intel.com> > Subject: 回复: [PATCH 1/1] MdeModulePkg/XhciDxe: Reset endpoint while USB Transaction error Xianglei: Now, UEFI spec doesn’t define EFI_USB_ERR_TRANSACTION. So, we can’t update UsbIo.h now. EFI_USB_ERR_TRANSACTION is only used in XhciDxe for error condition check. I suggest to add comments for current code, don’t need code update. Thanks Liming 发件人: Ni, Ray <ray.ni@intel.com <mailto:ray.ni@intel.com> > 发送时间: 2024年4月15日 10:17 收件人: Liming Gao <gaoliming@byosoft.com.cn <mailto:gaoliming@byosoft.com.cn> > 抄送: Huang, Jenny <jenny.huang@intel.com <mailto:jenny.huang@intel.com> >; Shih, More <more.shih@intel.com <mailto:more.shih@intel.com> >; devel@edk2.groups.io <mailto:devel@edk2.groups.io> ; Lewandowski, Krzysztof <krzysztof.lewandowski@intel.com <mailto:krzysztof.lewandowski@intel.com> >; Cai, Xianglei <xianglei.cai@intel.com <mailto:xianglei.cai@intel.com> >; Lewandowski, Krzysztof <krzysztof.lewandowski@intel.com <mailto:krzysztof.lewandowski@intel.com> > 主题: Re: [PATCH 1/1] MdeModulePkg/XhciDxe: Reset endpoint while USB Transaction error Liming, Can you give a R-B? Thanks, Ray _____ From: Cai, Xianglei <xianglei.cai@intel.com <mailto:xianglei.cai@intel.com> > Sent: Friday, April 12, 2024 9:53 To: Lewandowski, Krzysztof <krzysztof.lewandowski@intel.com <mailto:krzysztof.lewandowski@intel.com> >; devel@edk2.groups.io <mailto:devel@edk2.groups.io> <devel@edk2.groups.io <mailto:devel@edk2.groups.io> >; Ni, Ray <ray.ni@intel.com <mailto:ray.ni@intel.com> >; Liming Gao <gaoliming@byosoft.com.cn <mailto:gaoliming@byosoft.com.cn> > Cc: Huang, Jenny <jenny.huang@intel.com <mailto:jenny.huang@intel.com> >; Shih, More <more.shih@intel.com <mailto:more.shih@intel.com> > Subject: RE: [PATCH 1/1] MdeModulePkg/XhciDxe: Reset endpoint while USB Transaction error <mailto:ray.ni@intel.com> @Ni, Ray <mailto:gaoliming@byosoft.com.cn> @Liming GaoWould you like to merge the patch to upstream? Thanks, Xianglei From: Lewandowski, Krzysztof <krzysztof.lewandowski@intel.com <mailto:krzysztof.lewandowski@intel.com> > Sent: Thursday, April 11, 2024 9:45 PM To: devel@edk2.groups.io <mailto:devel@edk2.groups.io> Cc: Ni, Ray <ray.ni@intel.com <mailto:ray.ni@intel.com> >; Liming Gao <gaoliming@byosoft.com.cn <mailto:gaoliming@byosoft.com.cn> >; Huang, Jenny <jenny.huang@intel.com <mailto:jenny.huang@intel.com> >; Shih, More <more.shih@intel.com <mailto:more.shih@intel.com> >; Cai, Xianglei <xianglei.cai@intel.com <mailto:xianglei.cai@intel.com> > Subject: Re: [PATCH 1/1] MdeModulePkg/XhciDxe: Reset endpoint while USB Transaction error Looks good to me. Reviewed-by: Krzysztof Lewandowski <krzysztof.lewandowski@intel.com <mailto:krzysztof.lewandowski@intel.com> > _____ From: Cai, Xianglei <xianglei.cai@intel.com <mailto:xianglei.cai@intel.com> > Sent: Wednesday, April 10, 2024 09:02 To: devel@edk2.groups.io <mailto:devel@edk2.groups.io> <devel@edk2.groups.io <mailto:devel@edk2.groups.io> > Cc: Cai, Xianglei <xianglei.cai@intel.com <mailto:xianglei.cai@intel.com> >; Ni, Ray <ray.ni@intel.com <mailto:ray.ni@intel.com> >; Liming Gao <gaoliming@byosoft.com.cn <mailto:gaoliming@byosoft.com.cn> >; Lewandowski, Krzysztof <krzysztof.lewandowski@intel.com <mailto:krzysztof.lewandowski@intel.com> >; Huang, Jenny <jenny.huang@intel.com <mailto:jenny.huang@intel.com> >; Shih, More <more.shih@intel.com <mailto:more.shih@intel.com> > Subject: [PATCH 1/1] MdeModulePkg/XhciDxe: Reset endpoint while USB Transaction error https://bugzilla.tianocore.org/show_bug.cgi?id=4556 Based on XHCI spec 4.8.3, software should do the reset endpoint while USB Transaction occur. Also add the error code for USB Transaction error since UEFI spec don't have the related definition. Cc: Ray Ni <ray.ni@intel.com <mailto:ray.ni@intel.com> > Cc: Liming Gao <gaoliming@byosoft.com.cn <mailto:gaoliming@byosoft.com.cn> > Cc: Krzysztof Lewandowski <krzysztof.lewandowski@intel.com <mailto:krzysztof.lewandowski@intel.com> > Cc: Jenny Huang <jenny.huang@intel.com <mailto:jenny.huang@intel.com> > Cc: More Shih <more.shih@intel.com <mailto:more.shih@intel.com> > Signed-off-by: Xianglei Cai <xianglei.cai@intel.com <mailto:xianglei.cai@intel.com> > --- MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c | 2 +- MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 2 +- MdePkg/Include/Protocol/UsbIo.h | 21 +++++++++++---------- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c index f4e61d223c1b..63cc29b26536 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c +++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c @@ -825,7 +825,7 @@ XhcTransfer ( *TransferResult = Urb->Result; *DataLength = Urb->Completed; - if ((*TransferResult == EFI_USB_ERR_STALL) || (*TransferResult == EFI_USB_ERR_BABBLE)) { + if ((*TransferResult == EFI_USB_ERR_STALL) || (*TransferResult == EFI_USB_ERR_BABBLE) || (*TransferResult == EFI_USB_ERR_TRANSACTION)) { ASSERT (Status == EFI_DEVICE_ERROR); RecoveryStatus = XhcRecoverHaltedEndpoint (Xhc, Urb); if (EFI_ERROR (RecoveryStatus)) { diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c index 05528a478baf..e77852f62f10 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c @@ -1193,7 +1193,7 @@ XhcCheckUrbResult ( goto EXIT; case TRB_COMPLETION_USB_TRANSACTION_ERROR: - CheckedUrb->Result |= EFI_USB_ERR_TIMEOUT; + CheckedUrb->Result |= EFI_USB_ERR_TRANSACTION; CheckedUrb->Finished = TRUE; DEBUG ((DEBUG_ERROR, "XhcCheckUrbResult: TRANSACTION_ERROR! Completecode = %x\n", EvtTrb->Completecode)); goto EXIT; diff --git a/MdePkg/Include/Protocol/UsbIo.h b/MdePkg/Include/Protocol/UsbIo.h index a780b4e07b44..211ef0c94156 100644 --- a/MdePkg/Include/Protocol/UsbIo.h +++ b/MdePkg/Include/Protocol/UsbIo.h @@ -50,16 +50,17 @@ typedef enum { // // USB Transfer Results // -#define EFI_USB_NOERROR 0x00 -#define EFI_USB_ERR_NOTEXECUTE 0x01 -#define EFI_USB_ERR_STALL 0x02 -#define EFI_USB_ERR_BUFFER 0x04 -#define EFI_USB_ERR_BABBLE 0x08 -#define EFI_USB_ERR_NAK 0x10 -#define EFI_USB_ERR_CRC 0x20 -#define EFI_USB_ERR_TIMEOUT 0x40 -#define EFI_USB_ERR_BITSTUFF 0x80 -#define EFI_USB_ERR_SYSTEM 0x100 +#define EFI_USB_NOERROR 0x00 +#define EFI_USB_ERR_NOTEXECUTE 0x01 +#define EFI_USB_ERR_STALL 0x02 +#define EFI_USB_ERR_BUFFER 0x04 +#define EFI_USB_ERR_BABBLE 0x08 +#define EFI_USB_ERR_NAK 0x10 +#define EFI_USB_ERR_CRC 0x20 +#define EFI_USB_ERR_TIMEOUT 0x40 +#define EFI_USB_ERR_BITSTUFF 0x80 +#define EFI_USB_ERR_SYSTEM 0x100 +#define EFI_USB_ERR_TRANSACTION 0x200 /** Async USB transfer callback routine. -- 2.42.0.windows.2 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#117759): https://edk2.groups.io/g/devel/message/117759 Mute This Topic: https://groups.io/mt/105531088/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=- [-- Attachment #2: Type: text/html, Size: 20921 bytes --] ^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2024-04-15 6:35 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <cover.1710220024.git.xianglei.cai@intel.com> 2024-03-12 5:13 ` [edk2-devel] [PATCH 1/1] MdeModulePkg/XhciDxe: Reset endpoint while USB Transaction error Xianglei Cai 2024-03-20 8:22 ` Xianglei Cai 2024-04-11 13:44 ` Lewandowski, Krzysztof 2024-04-12 1:53 ` Xianglei Cai 2024-04-15 2:16 ` Ni, Ray 2024-04-15 5:23 ` [edk2-devel] 回复: " gaoliming via groups.io 2024-04-15 5:27 ` [edk2-devel] " Xianglei Cai 2024-04-15 6:35 ` [edk2-devel] 回复: " gaoliming via groups.io
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox