From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web11.38925.1622425473246385495 for ; Sun, 30 May 2021 18:44:33 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=rQHbuPQ8; spf=pass (domain: intel.com, ip: 134.134.136.65, mailfrom: hao.a.wu@intel.com) IronPort-SDR: 3t1zRS2z+smn6nC7jNOVmYnT2WXOur+NDbvZQwkavExOa/Zk4hNGFbCIt8Xk6cXbE4++X8MJzL CG3nyzt+yAZQ== X-IronPort-AV: E=McAfee;i="6200,9189,10000"; a="203308397" X-IronPort-AV: E=Sophos;i="5.83,236,1616482800"; d="scan'208";a="203308397" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 May 2021 18:44:32 -0700 IronPort-SDR: DbG0fMJbyP3H9Q4e3wV9LhslPItRq+n+ecNQf+alPo2rEhVoKEM0wNE89nq3w/gID1OZNaCxwn 0jY4q7PGPGmw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,236,1616482800"; d="scan'208";a="478710428" Received: from fmsmsx606.amr.corp.intel.com ([10.18.126.86]) by orsmga001.jf.intel.com with ESMTP; 30 May 2021 18:44:32 -0700 Received: from fmsmsx602.amr.corp.intel.com (10.18.126.82) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Sun, 30 May 2021 18:44:31 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4 via Frontend Transport; Sun, 30 May 2021 18:44:31 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.103) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.4; Sun, 30 May 2021 18:44:31 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dm4Go9LUSQU93lhBVB5qovS/P/qNfxM1d7L5s6n1mJdNOBgLh7s3e3nKhDcLsJ8gQtn0nPgIZ1Xk7/99oNGlIt+OaVJUyrFrRHJM4iCPqHD4hXg2qTyh/517+WJnR/YBWF0XXS+Qsb8opfybnX8XstTllGLBia9JunigKCdkBp/fxOfG2vhza/X1L8OX2GzQbLpqLE77C1mUNJYT7rMkdroU5y1FUNGLsV/lx6luQSKwRew2XoLPYk9ycvHIDtxd4lLML2Mk6kQGkw7YpwzAO8Vk1A4X6+lUjWGXDC9efrNJ9FfjatKgYvNZ83ZAcyGuJO9KJ6vogzoh412nF93ZGw== 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-SenderADCheck; bh=XOySFakYHVbmpwb1UlCy9pYc6+PvRdoUcHYVBRvSjUU=; b=my4mMy/Ig6JZzWk4PP7KunHO7jyhjeaKYwPiZt8e1V7jEwm2B2nL/TD2m4IENeZOLhTTgJRXQ5YmSmlC0FmDzKnVLWkv0tFjyowEYltcKGnR76oBLUnCM7yswKfIavS7fdB04Ubbm1/ZQbMm1BRGjKXX8Q4B04Czejf4Vg5W8JZSrs+BQygy70S4Mfc6RxIMoD1F/fYhAzk9Z1fyZ4Drs0FOxqOSycuV2+SXy2Tn4w2WgzGkgN7jEX8AjoxgLa1CpMarfrCT36Rt8fQWGgES1MKh/lX7pTKIhlU3SHBTZt+jgw2Z6XF54MsZgo91tRRGM8rq8LNmVocKsKh5imlA1g== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XOySFakYHVbmpwb1UlCy9pYc6+PvRdoUcHYVBRvSjUU=; b=rQHbuPQ8Sa3/nORqt46g8BTXNXRo1yWXBTgvhryqO7ymVihewIAUKvH/7n4ST/6DyefyUuSEBptlSpDCRGlHrZQEgjx2Lx2IQOYym+3+p3KrYOD+2+WHflaUk+ZJlkeU8YsoPKvJu1Qq8oZyKuQaf9NXIn7+Lb6Fk4v7spONDnE= Received: from BN8PR11MB3666.namprd11.prod.outlook.com (2603:10b6:408:8c::19) by BN6PR11MB1283.namprd11.prod.outlook.com (2603:10b6:404:48::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4173.20; Mon, 31 May 2021 01:44:30 +0000 Received: from BN8PR11MB3666.namprd11.prod.outlook.com ([fe80::b9d0:5694:1b70:c031]) by BN8PR11MB3666.namprd11.prod.outlook.com ([fe80::b9d0:5694:1b70:c031%4]) with mapi id 15.20.4173.030; Mon, 31 May 2021 01:44:30 +0000 From: "Wu, Hao A" To: Wenyi Xie , "devel@edk2.groups.io" , "Wang, Jian J" , "Ni, Ray" CC: "songdongkuang@huawei.com" Subject: Re: [PATCH EDK2 v1 1/1] MdeModulePkg/Xhci: Fix TRT when data length is 0 Thread-Topic: [PATCH EDK2 v1 1/1] MdeModulePkg/Xhci: Fix TRT when data length is 0 Thread-Index: AQHXUvEFBM6ET99vgE6OauQ51x3T0ar81pow Date: Mon, 31 May 2021 01:44:30 +0000 Message-ID: References: <1622117066-67642-1-git-send-email-xiewenyi2@huawei.com> <1622117066-67642-2-git-send-email-xiewenyi2@huawei.com> In-Reply-To: <1622117066-67642-2-git-send-email-xiewenyi2@huawei.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.5.1.3 authentication-results: huawei.com; dkim=none (message not signed) header.d=none;huawei.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.198.142.16] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 4ee1c4c1-d512-4182-0fbd-08d923d5a221 x-ms-traffictypediagnostic: BN6PR11MB1283: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7691; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: dKm2GUvjqk53Nma5E+6GaAyMBOqzAnF8iDtygUqlqK0apojw6b/LQA9eKLCzaJpfwuWvMmC3IXu7jiWuAxxEtXWgfhiono3K3PFmTyHgun1lsD40TpTUEHbd7l7fAkyK9kLyThv251sEdfENwpsyQ+O9dvXuhh2eouw7roI1TWcTHgSBtGqLRcHOxrt6NC1U01BUDBzrNYdD+5rCRfPpEkUedVPNWK7UTc0bEy/RjQOjLjzfg0UTVoNnpB2s3owzkNFI69hENgGw+ZpTqwVDMPohZLDUYc/lau9K2Ajp8KPYEU7cCRmKxXcJh4HzL3tYtE7I66U0tH08L+Gq9Upvo4iOwj/7YLhMX3gUS1oinBKFYPILkMFTWbGh7R4i0AVxRkAmjEuPkqY7iN56JTlJX73Efc3dFPV2sfiShsj+aaQtMCfy0/sq3kgJbBa4BHny7o1DLw3DKgxLFBl0iiaOt/PAH/HPpj+qiIxKeqXKbfG0h0HvUNYpLxWbk8TSN5/6Cvcx+ihSL+efSzfCuh6RgIjml55rBRI9kAqGM5JI04MdRB8EjqobattkcYh6sPpVqor8QC33ab6864w7LixbWybLG4ESx07xXoUS4fT9RWtFzJWpPQW+OUFjh8YFtcB/ycFsJ08uaAxGO/fZnxQGflaCa+N6rf7wzu5KEwpNg1hDX9B/gEfvjs3FNdDsEINuC9Ns6INWki0sxydJYf66WDIBvLQwtfFQfUv+kgF+AuY= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR11MB3666.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(39860400002)(376002)(136003)(346002)(396003)(4326008)(26005)(6506007)(53546011)(52536014)(478600001)(966005)(7696005)(5660300002)(66946007)(66446008)(64756008)(66556008)(66476007)(2906002)(76116006)(9686003)(6636002)(122000001)(38100700002)(8936002)(83380400001)(86362001)(8676002)(71200400001)(186003)(55016002)(110136005)(33656002)(316002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?26CZkwfzoXuLDDHUaKyt8RgKzW/ro6ZdLU5y+vHAengUAzcP1eI0b+engIfQ?= =?us-ascii?Q?YzH8pY1s+IRy2IFOlKFBq68oWivudSSeUx20rKbqp8OvPX4BBaL+C0jkoEgK?= =?us-ascii?Q?UzceMu/hWAZdGnElR604ACEmmHUcw88SL44+NuXUg1TItSG8q8U6GPa+2yA+?= =?us-ascii?Q?bMIW+/+c19Gaty0MLQKa8XIdrnMfW4AZJNkVwGJ9TlFzfiTlXF3Nj4xV471u?= =?us-ascii?Q?OXmq5jjh3ueX7JZLRP4PUqdoNh6sxmB90Oa/gStWZHVCxt0C6CmAb2RsF5E5?= =?us-ascii?Q?84U1dZzKb5mGKkPSZXsEHGFLbbKb14bq4syDlxM/0D/s6BPn8kz6IMIvoS5t?= =?us-ascii?Q?AX40nsY21Qhs4o4bSGtWQ6A4vmkQsyG0m44JTvkQSSY2Xkvh4wcwjki6aysC?= =?us-ascii?Q?KKi9Cozpubq4vLZj2wdBA0K7spVvFkB7skrYmwPWkvAMz/n+cUOCg+8c0Z45?= =?us-ascii?Q?pMGE2vQvkEimB3zvZXTZA0HuFFIOp5Aiym/r9YQ08ZeMyZWm2Dn2X8j2qiOB?= =?us-ascii?Q?Ee5SFD2K1zItn8fPkST/PLLI4rr3SAuDi0PfOFYRrd6N9e8OvfBRQO3YTHet?= =?us-ascii?Q?nfRfqggfBKMyRSAp0xCge2+Z2e2TL9qg4Dr/VevRA4wGVpF1Cq9HTVFvDXuw?= =?us-ascii?Q?hWlNeQIw+3HttCasfTH+2E6E9PWz1AjCX0IU5NCDFzB+sKFNFQeXJ3S45zpj?= =?us-ascii?Q?b+s3zoF8gCAYsE1nwh+CYnSc/Z6qx1zCxWObD0QPUta4iC4WjAMQiiLXWrVx?= =?us-ascii?Q?v6ttxl9m7xAahoyKSLyImgO+KT+xJ0eYfS/m4XM7h3fi3SPLCJ/G37bgVtmJ?= =?us-ascii?Q?EzogLQ6evssSdjoN4D0ClDODY7yFgT0Pp0Bgs6zi61TgJW7BHSev0MEM6N6G?= =?us-ascii?Q?tQBvnl3Ddi7g2Kz8EIZTFttpsq9s9k5FflP/JaEVpS/p4IAPidkJcV+CpLD2?= =?us-ascii?Q?ipAK0H+T9uW14bXGL1RBq7aZxJCb31PQ9fYT40o53q3ZKveZHfnZCIYIb0Jx?= =?us-ascii?Q?h0liR1WaLbrGt5SBesw7iXQvp23JO165rCF4Zlwp4Hl5r7vY3jw9IGQYKzmR?= =?us-ascii?Q?biEIw8043sbkCDe8KI+0dV3C1umzIG5GYw+MSOXm5h4p9RY+BR6T/G922dLb?= =?us-ascii?Q?ES/VM1JU+ZoLbb/CwXoS2hWrNm2nYoV4o4it55O1mqfYAr/PiCFDIBj+acvd?= =?us-ascii?Q?/pvcGKvKToi0dc8VOp5rlv8QI0Fv7Xed8JpGLit597qAolyADt04GD6bxg/q?= =?us-ascii?Q?AZn3r5AZltU+Kak8QSlKDkvemNGecAOEGlah9j6LG/v7/ruHc7nnV8mMRId+?= =?us-ascii?Q?v9/+0Hvz3FiCBTkMargk1Y2U?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN8PR11MB3666.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4ee1c4c1-d512-4182-0fbd-08d923d5a221 X-MS-Exchange-CrossTenant-originalarrivaltime: 31 May 2021 01:44:30.2998 (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: TPOLqHz5lwPZOT5FFatwhmYFYmEn7hslzCUu/Cb+eaplNWn6EvXxm98gvwhJtc+uFUZS2nz2QExa7fj/PrpKHA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR11MB1283 Return-Path: hao.a.wu@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > -----Original Message----- > From: Wenyi Xie > Sent: Thursday, May 27, 2021 8:04 PM > To: devel@edk2.groups.io; Wang, Jian J ; Wu, Hao A > ; Ni, Ray > Cc: songdongkuang@huawei.com; xiewenyi2@huawei.com > Subject: [PATCH EDK2 v1 1/1] MdeModulePkg/Xhci: Fix TRT when data length > is 0 >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3418 >=20 > According to xhci spec, at USB packet level, a Control Transfer consists = of > multiple transactions partitioned into stages: a setup stage, an optional= data > stage, and a terminating status stage. If Data Stage does not exist, the > Transfer Type flag(TRT) should be No Data Stage. > So if data length equals to 0, TRT is set to 0. Thanks for the patch, the changes are good to me. Could you help to provide the information on what kind of test has been per= formed for this patch? Best Regards, Hao Wu >=20 > Cc: Jian J Wang > Cc: Hao A Wu > Cc: Ray Ni > Signed-off-by: Wenyi Xie > --- > MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 13 +++++++++---- > MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c | 13 +++++++++---- > 2 files changed, 18 insertions(+), 8 deletions(-) >=20 > diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c > b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c > index dc36945962a0..7cbc9a8502ea 100644 > --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c > +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c > @@ -298,10 +298,15 @@ XhcCreateTransferTrb ( > TrbStart->TrbCtrSetup.IOC =3D 1; > TrbStart->TrbCtrSetup.IDT =3D 1; > TrbStart->TrbCtrSetup.Type =3D TRB_TYPE_SETUP_STAGE; > - if (Urb->Ep.Direction =3D=3D EfiUsbDataIn) { > - TrbStart->TrbCtrSetup.TRT =3D 3; > - } else if (Urb->Ep.Direction =3D=3D EfiUsbDataOut) { > - TrbStart->TrbCtrSetup.TRT =3D 2; > + if (Urb->DataLen > 0) { > + if (Urb->Ep.Direction =3D=3D EfiUsbDataIn) { > + TrbStart->TrbCtrSetup.TRT =3D 3; > + } else if (Urb->Ep.Direction =3D=3D EfiUsbDataOut) { > + TrbStart->TrbCtrSetup.TRT =3D 2; > + } else { > + DEBUG ((DEBUG_ERROR, "XhcCreateTransferTrb: Direction sholud b= e > IN or OUT when Data exists!\n")); > + ASSERT (FALSE); > + } > } else { > TrbStart->TrbCtrSetup.TRT =3D 0; > } > diff --git a/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c > b/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c > index 32d72ef03c2d..5b9892a1cbbb 100644 > --- a/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c > +++ b/MdeModulePkg/Bus/Pci/XhciPei/XhciSched.c > @@ -291,10 +291,15 @@ XhcPeiCreateTransferTrb ( > TrbStart->TrbCtrSetup.IOC =3D 1; > TrbStart->TrbCtrSetup.IDT =3D 1; > TrbStart->TrbCtrSetup.Type =3D TRB_TYPE_SETUP_STAGE; > - if (Urb->Ep.Direction =3D=3D EfiUsbDataIn) { > - TrbStart->TrbCtrSetup.TRT =3D 3; > - } else if (Urb->Ep.Direction =3D=3D EfiUsbDataOut) { > - TrbStart->TrbCtrSetup.TRT =3D 2; > + if (Urb->DataLen > 0) { > + if (Urb->Ep.Direction =3D=3D EfiUsbDataIn) { > + TrbStart->TrbCtrSetup.TRT =3D 3; > + } else if (Urb->Ep.Direction =3D=3D EfiUsbDataOut) { > + TrbStart->TrbCtrSetup.TRT =3D 2; > + } else { > + DEBUG ((DEBUG_ERROR, "XhcPeiCreateTransferTrb: Direction sholu= d > be IN or OUT when Data exists!\n")); > + ASSERT (FALSE); > + } > } else { > TrbStart->TrbCtrSetup.TRT =3D 0; > } > -- > 2.20.1.windows.1