From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail04.groups.io (mail04.groups.io [45.79.224.9]) by spool.mail.gandi.net (Postfix) with ESMTPS id A35A3AC09DF for ; Mon, 15 Apr 2024 06:54:49 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=8sMxYYUBW3FPriQlpsY21hxv7VT4eLIJPDaQHTKLFes=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20240206; t=1713164088; v=1; b=gv5s1hC6bdKekra4MRlZtigTENCKT3BOsiBHqLgstaGTmqgUwo76TY1xS8lGzpWmqYcL4RCB ObVpUoTC6Sf85aGLJ31MF2dH8kZ5yk7SP30WteXwo43p8lJihwiMGzq3EZLf7Etd1r4onDC2615 ZbKYZBsMnPB14nl+YqLkhfDtjAJCIg0F37tQLNCe9+0SAyhmZNJSGNTs7Onwv7/Kkw9KLOj8FW0 TDM80j0QtM7LTFPGRZ47oY931u/5yOMA3vI0s4wYt3cKimap9HFFLnMDQD0I8aw7HPwNABoaz3j qCYDVH/y0vHXOQgGXOC97DcSML+/lUwgNgbFKA06oiRjQ== X-Received: by 127.0.0.2 with SMTP id npzWYY7687511xbrxmfukpGj; Sun, 14 Apr 2024 23:54:48 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) by mx.groups.io with SMTP id smtpd.web11.15238.1713164082081056027 for ; Sun, 14 Apr 2024 23:54:42 -0700 X-CSE-ConnectionGUID: DBCfdO9TR7yhbaHDiAPS3w== X-CSE-MsgGUID: u9XrFFdZSJm/NNukK0DgMA== X-IronPort-AV: E=McAfee;i="6600,9927,11044"; a="19135368" X-IronPort-AV: E=Sophos;i="6.07,202,1708416000"; d="scan'208";a="19135368" X-Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2024 23:54:42 -0700 X-CSE-ConnectionGUID: DZgU0W2KRPOKEMaeg4+rsw== X-CSE-MsgGUID: xEGCBG5VTG++FTo+WAdN2w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,202,1708416000"; d="scan'208";a="45087871" X-Received: from unknown (HELO shclientbuild02.ccr.corp.intel.com) ([10.239.133.21]) by fmviesa002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Apr 2024 23:54:40 -0700 From: "Xianglei Cai" To: devel@edk2.groups.io Cc: Xianglei Cai , Ray Ni , Liming Gao , Krzysztof Lewandowski , Jenny Huang , More Shih Subject: [edk2-devel] [PATCH V2 1/1] MdeModulePkg/XhciDxe: Reset endpoint while USB Transaction error Date: Mon, 15 Apr 2024 14:54:30 +0800 Message-ID: <23b74af38dddeff43d19da4e6de82ed1ae7b4ed8.1713164057.git.xianglei.cai@intel.com> In-Reply-To: References: MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Sun, 14 Apr 2024 23:54:42 -0700 Resent-From: xianglei.cai@intel.com Reply-To: devel@edk2.groups.io,xianglei.cai@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: JtS6IqVHvnp9eeHqcZcGdNaZx7686176AA= Content-Transfer-Encoding: 8bit X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=gv5s1hC6; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.9 as permitted sender) smtp.mailfrom=bounce@groups.io 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. Add the error code for USB Transaction error since UEFI spec don't have the related definition. Cc: Ray Ni Cc: Liming Gao Cc: Krzysztof Lewandowski Cc: Jenny Huang Cc: More Shih Signed-off-by: Xianglei Cai Reviewed-by: Krzysztof Lewandowski --- MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c | 5 ++++- MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 5 ++++- MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.h | 7 +++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c index f4e61d223c1b..cf6b32959e68 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c +++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c @@ -825,7 +825,10 @@ XhcTransfer ( *TransferResult = Urb->Result; *DataLength = Urb->Completed; - if ((*TransferResult == EFI_USB_ERR_STALL) || (*TransferResult == EFI_USB_ERR_BABBLE)) { + // + // Based on XHCI spec 4.8.3, software should do the reset endpoint while USB Transaction occur. + // + if ((*TransferResult == EFI_USB_ERR_STALL) || (*TransferResult == EFI_USB_ERR_BABBLE) || (*TransferResult == EDKII_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 5d735008ba31..a97ed44dbfc3 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c @@ -1192,8 +1192,11 @@ XhcCheckUrbResult ( DEBUG ((DEBUG_ERROR, "XhcCheckUrbResult: ERR_BUFFER! Completecode = %x\n", EvtTrb->Completecode)); goto EXIT; + // + // Based on XHCI spec 4.8.3, software should do the reset endpoint while USB Transaction occur. + // case TRB_COMPLETION_USB_TRANSACTION_ERROR: - CheckedUrb->Result |= EFI_USB_ERR_TIMEOUT; + CheckedUrb->Result |= EDKII_USB_ERR_TRANSACTION; CheckedUrb->Finished = TRUE; DEBUG ((DEBUG_ERROR, "XhcCheckUrbResult: TRANSACTION_ERROR! Completecode = %x\n", EvtTrb->Completecode)); goto EXIT; diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.h b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.h index 7c85f7993b5c..e606e212a1d3 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.h +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.h @@ -78,6 +78,13 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #define TRB_COMPLETION_STOPPED 26 #define TRB_COMPLETION_STOPPED_LENGTH_INVALID 27 +// +// USB Transfer Results Internal Definition +// Based on XHCI spec 4.8.3, software should do the reset endpoint while USB Transaction occur. +// Add the error code for USB Transaction error since UEFI spec don't have the related definition. +// +#define EDKII_USB_ERR_TRANSACTION 0x200 + // // The topology string used to present usb device location // -- 2.42.0.windows.2 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#117761): https://edk2.groups.io/g/devel/message/117761 Mute This Topic: https://groups.io/mt/105531494/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-