From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 3ADC9D801B3 for ; Wed, 20 Sep 2023 03:07:22 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=lTY3YO1FGUnShiPU21JgQ2zGB1Bymj712hXzaVCvSd4=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1695179240; v=1; b=Wume7lGreC04lU/O9v73oZPP7f4b00R6jCw04N/1GFQzZyV1f4Hje9uP/NDYLY959+/yDM99 aWJSCATJ8wUEFW24Ps42LAcM/W+3ixH3bLPG44PDQIK6JYKPvS/2atXs7yFtIWhQ6RF89DPPlc1 G/33OTvtG7K2w/WJaSLlX57I= X-Received: by 127.0.0.2 with SMTP id yfFHYY7687511xfZxLiZepU6; Tue, 19 Sep 2023 20:07:20 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.151]) by mx.groups.io with SMTP id smtpd.web11.29094.1695179240122819305 for ; Tue, 19 Sep 2023 20:07:20 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10838"; a="360365939" X-IronPort-AV: E=Sophos;i="6.02,160,1688454000"; d="scan'208";a="360365939" X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Sep 2023 20:07:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10838"; a="775806851" X-IronPort-AV: E=Sophos;i="6.02,160,1688454000"; d="scan'208";a="775806851" X-Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orsmga008.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 19 Sep 2023 20:07:14 -0700 X-Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Tue, 19 Sep 2023 20:07:14 -0700 X-Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32 via Frontend Transport; Tue, 19 Sep 2023 20:07:14 -0700 X-Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.101) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.32; Tue, 19 Sep 2023 20:07:13 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H0WQhOUyxI9fU28Y4LM7TlpNDf+sDcwxp6Myj6EETESh8hwqzABt8DdnDinwAgTdOXaqhrcuJGumwgsgpnONXigLubZrJpHOcLWnMxoU7xUmYf32vBfZP5RsRUnz4OT2FJGy1F2bjAafN/Fv8oK0ve1fwHVVXACAB3NiT14TroLeY8qtFdw9gXtWggVQh4AQAcuhuXkOCq2mUStaihUct6svPXBflh3mUl+iaoA7AzRAbnQu4OUjp1RSPYMYsUe/5u/3nciX8zt1DuZ8Mv+hcpol+7hOUCUthMOOu4eoF1HytouivUYP4KHZ65rGw5ghGCZWySenSABFr7jjFKXeTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=yQGi5QwbPINU+E/J+U6Xle6eOV7/bwSh48N9860r4vw=; b=FSyqleGZ5aDsg3I7vZtNMQ7KRK8aQFK3UO7r6KethYQsEzEt+pvfpjQZex7D9HAkvKx6wLAZIW46CYVbed9zdWcmFzaRjdTZsvA+Iuxk6I0avyLB17AH4uh5BXWaGtDck1VryWwyPATVbMn5cJDTEAjyF1CVBnBIBvS7OSqkzmWbv2GNAIdk2K6UQ0RvxrjaTFZwfGLJaBiCzLszi3cEgfEjqzcEC/Sma0YP54IW/R0edddLgWFGXIC4N6u0KZP2sSk8dG87FUu0q0hX/Ei45mu7RyjWt9dWJtwmpGcIF961BZ11zHcNI6bISZ697Rdl4sy0pKihX7swlFYwzz1mHQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none X-Received: from MN0PR11MB6034.namprd11.prod.outlook.com (2603:10b6:208:375::17) by CY8PR11MB7745.namprd11.prod.outlook.com (2603:10b6:930:90::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.26; Wed, 20 Sep 2023 03:07:10 +0000 X-Received: from MN0PR11MB6034.namprd11.prod.outlook.com ([fe80::abec:335f:270f:8993]) by MN0PR11MB6034.namprd11.prod.outlook.com ([fe80::abec:335f:270f:8993%4]) with mapi id 15.20.6792.026; Wed, 20 Sep 2023 03:07:10 +0000 From: "Xianglei Cai" To: "devel@edk2.groups.io" , "Cai, Xianglei" CC: "Wu, Hao A" , "Ni, Ray" , "Wang, Jian J" , "Gao, Liming" , "Shih, More" Subject: Re: [edk2-devel] [PATCH 1/1] MdeModulePkg\XhciDxe: Command Abort when times out Thread-Topic: [edk2-devel] [PATCH 1/1] MdeModulePkg\XhciDxe: Command Abort when times out Thread-Index: AQHZ6rQNF8QVVGk+3EaG6JnRZHWZnbAjCTAQ Date: Wed, 20 Sep 2023 03:07:10 +0000 Message-ID: References: <1786073BDD30B479.9824@groups.io> In-Reply-To: <1786073BDD30B479.9824@groups.io> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MN0PR11MB6034:EE_|CY8PR11MB7745:EE_ x-ms-office365-filtering-correlation-id: 42c99f24-23f7-43b9-034d-08dbb986ae6a x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: nDDf5yiFCR7yKXljlQTaQdj/ocriQ3Thw6mesQHwK3T76HqDPZNeD5uvH/+AhMwDNt9iqrivlU3IIjJwhvAZqadAR1vUPMCm293MmEbhh0uRhH8/jV/mesiTpNfG+naklSTy8DEjLWOb2NN67fg0KL5ia2XBHMZQzYZ+Uf+XbC9He7PO+AtqwRrHksUsXAA6mk26j8LPODurBPDSfmlT8RrbJ/lp/67dSRUTERIZVIW3qA6Y18tomayXzZRO/psL7O4+o5AYuSBu67UZwctkhWdWBHoWTDZmTmM6EtpcgHZ0zuG9Wfh8g30QKozr6yan7MXjnznMzP6ulsAbBVqKV7hqZQEs3CZr3yPSip/WbF5W8Ph0NTc0+hBELBVMfJAsqjLSmFWLBjlLRk3d3VWrJalb9FnEVeGZyoU+7Wuoz7CrGqoQ+BYAEyw2m2MdV55iJDw27ujb+unnyjuI7X09oHW4YJTP6quAjSTHYQIqJW2A/1Nh2Y1LQ62t8eADYAmXNV/eBl7vjEvhAVs0mtI5iSBD4znCdWS56MXpuAd3wHpHeOx3JE+OTcPd+gqrzDn13ZHIZ7z+TwVvZc+QciQ4lpl+tiliSTfzAJYfbcnpad77tmzVzF5pJr6wJi7AS/AZY1lvzwB3QlxID9HiqHSSiQ== x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us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XKpb4TC+d+9soShGu2AWCAHbw5LJJj?= =?us-ascii?Q?v/mbrryMiMGv5h8YYp0y2iJY1VpSBkx3QrgnBCDH4trVVq5wDcsxb0cYYKjE?= =?us-ascii?Q?t/XjSf5IYRVmVwNZpKxVqClaQfBGQVkXTGTyg48Op9/ka6CHXCnnegOPxuMI?= =?us-ascii?Q?TP60xqtBhVInIMtwgzyNHrl/FiaLQADM+bbeOpGTGxu2i/lWIzwmCyGBPQBx?= =?us-ascii?Q?lXnUVjYXO34IE9j8g77+Zp6+01ganMIQBAg9eaM99ikNYdDYhw2b5kXqglfw?= =?us-ascii?Q?UPMhfma1Sn3Jor4VvR7rLyy0oWoFPnBTPcO/6yzKXW27/sjKNWCzHqIFdL3j?= =?us-ascii?Q?kANU5/ZPPh2jHBC+nsMSAnF38sqfSzIi84Dm2O6VKLbskDmOui5CXHZ+L6f8?= =?us-ascii?Q?kChrIe5upL2Qr3STn4pwscojqo9Qq+8bhuHHwAQt6aOnbxCZMM+xrLOReK9c?= =?us-ascii?Q?rx/7hTw2a+W3P2vRl++8EOs+Dat+/mcErY2oPr3Cv5qJsoLlDG3l1O2+ALRW?= =?us-ascii?Q?pQYfXcBWwJIOp7ghGSmEIpJ6qkz3ALhmuX6mPoxzZgS7OfNOk/4yS29g/g4b?= =?us-ascii?Q?6AflsGS14IwLqw5wmISsJbX17fsoHfokm8FCIXhpbT1CeP744LKqwiDdJDw0?= =?us-ascii?Q?sm3zGb1z7gNUUrNC0Z0g9Nuyq0RMdqh7Iv4R+6HPjRxoGvEVMSRf2hZPVWpB?= =?us-ascii?Q?ArLMfXimHe9IXAwjKyKtCV1rYJrJXRP3YwDH8fKq?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN0PR11MB6034.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 42c99f24-23f7-43b9-034d-08dbb986ae6a X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Sep 2023 03:07:10.6046 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: B0KDde5dm72BGyQkXhOnG28GfDGQmTCKw/vSO/pO/ZtBXyYKD+WEGpOfia4SXwHe0K7yoJtjVLmKCa2YOJOjLw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR11MB7745 X-OriginatorOrg: intel.com 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 Reply-To: devel@edk2.groups.io,xianglei.cai@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: sBVHmnhXiQDYAkeCpgfP5DSHx7686176AA= Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=Wume7lGr; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}") Hi All, Could you please help review this patch. Very appreciated! Thanks, Xianglei -----Original Message----- From: devel@edk2.groups.io On Behalf Of Xianglei Cai Sent: Monday, September 18, 2023 2:57 PM To: devel@edk2.groups.io Cc: Cai, Xianglei ; Wu, Hao A ;= Ni, Ray ; Wang, Jian J ; Gao, Lim= ing ; Shih, More Subject: [edk2-devel] [PATCH 1/1] MdeModulePkg\XhciDxe: Command Abort when = times out https://bugzilla.tianocore.org/show_bug.cgi?id=3D4552 CC: Hao A Wu CC: Ray Ni CC: Jian J Wang CC: Liming Gao CC: More Shih Signed-off-by: Xianglei Cai --- MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 35 ++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c b/MdeModulePkg/Bus/Pc= i/XhciDxe/XhciSched.c index 53421e64a850..5024d5e3acb9 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c @@ -2121,6 +2121,29 @@ RingIntTransferDoorBell ( return EFI_SUCCESS; } =20 +/** + Set Command abort + + @param Xhc The XHCI Instance. + @param SlotId The slot id to be disabled. + + @retval EFI_SUCCESS Successfully disable the device slot. + +**/ +VOID +XhcCmdRingCmdAbort ( + IN USB_XHCI_INSTANCE *Xhc, + IN UINT8 SlotId + ) +{ + // + // Some 3rd party XHCI external cards don't support single 64-bytes=20 +width register access, + // So divide it to two 32-bytes width register access. + // + DEBUG ((DEBUG_INFO, "Command Ring Control set Command Abort, SlotId:=20 +%d!\n", SlotId)); + XhcSetOpRegBit (Xhc, XHC_CRCR_OFFSET, XHC_CRCR_CA); } + /** Assign and initialize the device slot for a new device. =20 @@ -2331,6 +2354,12 @@ XhcInitializeDeviceSlot ( Xhc->UsbDevContext[SlotId].XhciDevAddr =3D DeviceAddress; } else { DEBUG ((DEBUG_ERROR, " Slot %d address not assigned successfully. S= tatus =3D %r\n", SlotId, Status)); + // + // Software need abort the command if a command times out in xHCI spec= 4.6. + // + if (Status =3D=3D EFI_TIMEOUT) { + XhcCmdRingCmdAbort (Xhc, SlotId); + } XhcDisableSlotCmd (Xhc, SlotId); } =20 @@ -2547,6 +2576,12 @@ XhcInitializeDeviceSlot64 ( Xhc->UsbDevContext[SlotId].XhciDevAddr =3D DeviceAddress; } else { DEBUG ((DEBUG_ERROR, " Slot %d address not assigned successfully. S= tatus =3D %r\n", SlotId, Status)); + // + // Software need abort the command if a command times out in xHCI spec= 4.6. + // + if (Status =3D=3D EFI_TIMEOUT) { + XhcCmdRingCmdAbort (Xhc, SlotId); + } XhcDisableSlotCmd64 (Xhc, SlotId); } =20 -- 2.42.0.windows.2 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#108895): https://edk2.groups.io/g/devel/message/108895 Mute This Topic: https://groups.io/mt/101435621/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-