From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mx.groups.io with SMTP id smtpd.web10.786.1614129051394891666 for ; Tue, 23 Feb 2021 17:10:51 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=JRNQpy+K; spf=pass (domain: intel.com, ip: 134.134.136.20, mailfrom: hao.a.wu@intel.com) IronPort-SDR: u0KBzSayK9K9OEdhOxBba+OOCYfFmjWhTaHp6lsDIRfOOSS1hHcd7TQ6YK2vBD2Hkd6XOLZkHT byRxoBC0qCLg== X-IronPort-AV: E=McAfee;i="6000,8403,9904"; a="172142464" X-IronPort-AV: E=Sophos;i="5.81,201,1610438400"; d="scan'208";a="172142464" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Feb 2021 17:10:50 -0800 IronPort-SDR: 8YDPKPqOqOzwuJNfVmSCe2z2cTzQo09ZOXAP8Up2Eu9h8q4br4r6paK05vaHX4T6QCVIOe1Sla k1q5IGfEOavA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,201,1610438400"; d="scan'208";a="391329948" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by fmsmga008.fm.intel.com with ESMTP; 23 Feb 2021 17:10:50 -0800 Received: from fmsmsx601.amr.corp.intel.com (10.18.126.81) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Tue, 23 Feb 2021 17:10:49 -0800 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2 via Frontend Transport; Tue, 23 Feb 2021 17:10:49 -0800 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.100) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2106.2; Tue, 23 Feb 2021 17:10:32 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hnopjapljU2+oltz2odRMJV39qRDRgVVM5AkTJzq1zMPwK8UojPlKpPX2pwCsDhs4KcNI/RJHOQ/5NlOyfKpIU3qLS0e2MKb2FvPpKUcboh+k+iOQNdK05CgwZgo8pXVL/DXF1Mxegq2kzdIT36/zAibawPNcPwfNSreeeN/X0p3uyziOCGg02FW14RmF1WVj+sxm5aHBk9Y2xfWqSFcnhnlDApZlO6keeyzNA01EWs/6i4njAL0WgtxfnC/ajy5qBLbv26Yc3Vtf5Gpru0bCcTyOvcFJcpM4QocqRuWzVe/NhFz8wiTht+eCb3PlQRYDIGPablQhLpAFnXXG9Cxdg== 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=w2HPrImIQmn6Eb2XxZn4xhBLFUVxS9DyWekXoyQV5EY=; b=ezPdybeqRIbiggfvAEfELEChWx+7Oa1MM9RK2j3w6kNtNfJmcFTsKK228CKxK2sDDJJPMv5HsJMsRQA+ZsgdnXdB+ezic2etZyU2+tsyaRJ1MG59XUreECbPGvf2DzD7qErhaf+3QIGEkMeUQoUHPlxEvMLg1kscvj9tGhGPSgSuXQBhIPlu/wsQP3PSpb8EQqzLnZeDBIaxAhA77xAptRUstebpDPK/JWuxD9Th6F8iK3Yctnn9e67hZlizd46G6hTboB/+ZRD8MxpDqgW4hUrWalCo7MUIn9V220jGNTEVrtTsY0H6/E5UDrKmyMxRjjgY5yPJ8rub0x6py5A6XQ== 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=w2HPrImIQmn6Eb2XxZn4xhBLFUVxS9DyWekXoyQV5EY=; b=JRNQpy+KIleBnew9kHoyZzMblnKbvatQ2WxpUZG+7xSHFgK+iMZw4RXO2QHqeABdlUOZzg9/7lmsBA5IFsVZL6UDKvaQYHHB6c56yyEkn+B2FWaV6f57YwQ8KrGtZz/HH0SwfgVXjPmMjLF6f/r4jAzF1nKOU2JLnU6pveJYBZo= Received: from BN8PR11MB3666.namprd11.prod.outlook.com (2603:10b6:408:8c::19) by BN8PR11MB3779.namprd11.prod.outlook.com (2603:10b6:408:8a::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.33; Wed, 24 Feb 2021 01:10:31 +0000 Received: from BN8PR11MB3666.namprd11.prod.outlook.com ([fe80::9d91:6348:53a9:cb20]) by BN8PR11MB3666.namprd11.prod.outlook.com ([fe80::9d91:6348:53a9:cb20%7]) with mapi id 15.20.3868.032; Wed, 24 Feb 2021 01:10:31 +0000 From: "Wu, Hao A" To: "Bandaru, Purna Chandra Rao" , "devel@edk2.groups.io" CC: "Albecki, Mateusz" , "Ni, Ray" , gaoliming Subject: Re: [PATCH] MdeModulePkg/UfsPassThruDxe: Improve Device initialization polling Loop Thread-Topic: [PATCH] MdeModulePkg/UfsPassThruDxe: Improve Device initialization polling Loop Thread-Index: AQHXCfDB0qCf4p0BUka8Q/Bf2zbf+apmfxLA Date: Wed, 24 Feb 2021 01:10:31 +0000 Message-ID: References: <20210223143215.26752-1-purna.chandra.rao.bandaru@intel.com> In-Reply-To: <20210223143215.26752-1-purna.chandra.rao.bandaru@intel.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: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.198.147.218] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: f20f9df3-0445-48d5-68a5-08d8d860fb3b x-ms-traffictypediagnostic: BN8PR11MB3779: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: +cfdBsHL/1OZ8534ctWkXuqpTncAr3ry+0wY2Dh6A0s6CVuBel1CLurjosaF+vrKWup2rI4cMaMyw4t+Ec6v/8F9FdZJprxXyR9d2uR1UPCXRXUnChB8e4ImecuuoAVacvLIL4aKwNbwQdRLzDf2BCNHILEos7fOxxtQej67R91li76LUdrUGpr6OZBtyMj2frKdVoOn/+mdyRjQQ8N9MH5Yu9jSpbl58P2vqrXUPxkSmaBczPk3vAriAQ+lOsn3NqCOd6HvdFQsV4qL+ugtOC7sSPLTxCErfRMoXWzlVbDOJJkcwo5faudel3rmpNHZEiNroixCogCqeHmZgYSiw0AT7VNnH2Zmpu/ZefX/vbQgbaF4PEwY8WDsuMjIYlIwP1Lxo7+fF8QMxp06pxnAGrQy8LKyPUlk+dsnpPJNk5uSH24CufcbTYSO/CVfILLvNnFeixsahm1ZVQgzlCSvWgMGxBilcXcGfqFU+Kq1WdFCSl/EBTvi/VIPPL6OfEKwyVpNelIWRVNOtrts+BziiMj1egnrR2rk3j6vqdWevGDLCr++XYhJWyRHRBE88jKHPomYZuGILjNIn2eQ+qKSPNLi32zgvUyQHaTXb48wLXk= 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:(376002)(39860400002)(396003)(136003)(366004)(346002)(71200400001)(66446008)(2906002)(66476007)(66556008)(64756008)(66946007)(76116006)(5660300002)(316002)(52536014)(9686003)(8936002)(8676002)(186003)(26005)(6506007)(33656002)(110136005)(7696005)(45080400002)(478600001)(86362001)(53546011)(966005)(83380400001)(55016002)(4326008)(54906003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?pb2L3Dq0pobDtixieumiONKWJ6Q5MsM53QandrdQMqY+m+NUwLsdWclkLG+Q?= =?us-ascii?Q?anlQQmA5TO13XEahm9qfOFWnnenOJlkGbmXPW7AB2/6Bfvg63As2ylClXxsH?= =?us-ascii?Q?3WtWk9wgnpMM7IPAzpPZWe2Z3pDt2b66pGfhDMOLQ1NXFq0hbySRVQXatxs7?= =?us-ascii?Q?3J87DPf41smAQOW+35JDFfjuXN01ZVPxF8EQfeIrW72JNKvGolA6Dh/7bfeq?= =?us-ascii?Q?dkCCAB66kvXoKN5x/PqPibXT1jjVYglAfl0NgJab2cJAZYnLf4lC+Jes6LrX?= =?us-ascii?Q?UAuZ7ZMz4zLTpl1Fr55Xt8b2i4HvviDDbtnAIiFDOf3M8+PuuOY+VZs7xxlu?= =?us-ascii?Q?ZdZg/mDULUUTRJ1tmHAbD6cJfR4bcH2TjI4hb2mh8kcwmgMMwUh0m6ryWJGJ?= =?us-ascii?Q?sZfNBb2gxn3IX5JYBvlW2t7rdteOiN3B0hHk15ZAEf/d0JUo+F2CviRt8yLo?= =?us-ascii?Q?uEBuASLJi9DHtXTg1DGlcy7VPaPqj5GorxC63l/QdlDZwc7TQ2rX063yq2V7?= =?us-ascii?Q?k+JviTTiVnXR0kpz8TWzK7QWSFYiNCWBrIrA6v9VQVrd820oUT6RH0Z6aQ8Y?= =?us-ascii?Q?W8lWK3yteeGp3+MdqspFLeYGELYZ2VQqVmgyoT7q5xZZXaES3HsZFcmQxwDK?= =?us-ascii?Q?qhgw8J1F+EzRsvl1UZptBsX65AxBMpoH7s+uVjIXUiXPIxseSKL3jAZdmwPF?= =?us-ascii?Q?XDBOlu94eEZyjwyiRi87MJ5StrB27z94MLynNKtwY7+Lvc7fEYnKQkfcJjPT?= =?us-ascii?Q?IpOSecNqHOuLLti/6aP9XHATqwCXY0PKYScLhv1+NRnEpK51hEJhJBKpTVOw?= =?us-ascii?Q?EqkA6pX5YqB0glNNFxuoNKmbK1Kc0j0pygqHUDwX1KGTnxd5im6VWTmOBHEo?= =?us-ascii?Q?wueC36DyLBpfVEaXEIUdL0Vrqv5F5gzdMCSEWodVlw3BKNoCH5AgjSPI9Eyj?= =?us-ascii?Q?5TrsuLKfwX+lUkUkgqv5Y4FTqjYJHVzOHUmCPIlObvs0M3ZQgcg3MW/swAT1?= =?us-ascii?Q?01OGJWURBGSQyOtWe+nM1h1cEW4HdTn7cuwwc3PZwjn9t0MB5ZTV61zfxctb?= =?us-ascii?Q?+5i7s46epWGd7JDZk328kZjLj1sDToDySoq6bvg04eoUfIyvrJMIDHCqf420?= =?us-ascii?Q?TKBC/UG7CSbGs1uMgfX36nqwc4kUdpnm7lpyJtBo/wq6Y/meU5qnkPfyAD6F?= =?us-ascii?Q?zhM3uSIeTsGaPx9FNNHihFQ7HDcX2SaEHssNw4YTUxaqGge2vKR+1l+DCXD6?= =?us-ascii?Q?ruQi20wE1B90zg7D/JOs2cL6q5yMxRbfHIQoYgeIVwlUZh0xkiLEu1X6/w5l?= =?us-ascii?Q?cYq+/SttxrIBo7esruUIxZtO?= 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: f20f9df3-0445-48d5-68a5-08d8d860fb3b X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Feb 2021 01:10:31.5090 (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: q3EpalFKbsSYTzsX9RcSaLrNcWOMLCpg8D2v74NGJp8/b5lwxOFZvv9Xup5wOdvGFXy78WEOQL2sxHd/LlGoBQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR11MB3779 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: Bandaru, Purna Chandra Rao > Sent: Tuesday, February 23, 2021 10:32 PM > To: devel@edk2.groups.io > Cc: Bandaru, Purna Chandra Rao ; > Albecki, Mateusz ; Ni, Ray ; > Wu, Hao A > Subject: [PATCH] MdeModulePkg/UfsPassThruDxe: Improve Device > initialization polling Loop >=20 > https://bugzilla.tianocore.org/show_bug.cgi?id=3D3217 >=20 > Current Ufs Pass thru driver polls for 5us and return success even when t= he > timeout occurs. > There are cards that can take upto 600ms for Init and hence increased the > time out for fDeviceInit polling loop. >=20 > Signed-off-by: Bandaru > Cc: Mateusz Albecki > Cc: Ray Ni > Cc: Hao A Wu >=20 > Change-Id: I6cb063b43bdf37790db8e60c3919153cd2f3c086 > --- > MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c | 17 > +++++++++++++---- > MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h | 3 ++- > 2 files changed, 15 insertions(+), 5 deletions(-) >=20 > diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c > b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c > index 9768c2e6fb..92ff958f16 100644 > --- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c > +++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c > @@ -1,6 +1,6 @@ > /** @file >=20 > - Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.
> + Copyright (c) 2014 - 2021, Intel Corporation. All rights > + reserved.
> Copyright (c) Microsoft Corporation.
> SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > @@ -749,7 +749,7 @@ UfsFinishDeviceInitialization ( { > EFI_STATUS Status; > UINT8 DeviceInitStatus; > - UINT8 Timeout; > + UINT32 Timeout; >=20 > DeviceInitStatus =3D 0xFF; >=20 > @@ -761,7 +761,10 @@ UfsFinishDeviceInitialization ( > return Status; > } >=20 > - Timeout =3D 5; > + // > + // There are cards that can take upto 600ms to clear fDeviceInit flag. > + // > + Timeout =3D UFS_INIT_COMPLETION_TIMEOUT; > do { > Status =3D UfsReadFlag (Private, UfsFlagDevInit, &DeviceInitStatus); > if (EFI_ERROR (Status)) { > @@ -771,7 +774,13 @@ UfsFinishDeviceInitialization ( > Timeout--; > } while (DeviceInitStatus !=3D 0 && Timeout !=3D 0); >=20 > - return EFI_SUCCESS; > + if (Timeout =3D=3D 0) { > + DEBUG ((DEBUG_ERROR, "UfsFinishDeviceInitialization > DeviceInitStatus=3D%x EFI_TIMEOUT \n", DeviceInitStatus)); > + return EFI_TIMEOUT; > + } else { > + DEBUG ((DEBUG_INFO, "UfsFinishDeviceInitialization Timeout left=3D%x > EFI_SUCCESS \n", Timeout)); > + return EFI_SUCCESS; > + } > } >=20 > /** > diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h > b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h > index ef33250c89..275351cf8e 100644 > --- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h > +++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h > @@ -1,6 +1,6 @@ > /** @file >=20 > - Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.
> + Copyright (c) 2014 - 2021, Intel Corporation. All rights > + reserved.
> Copyright (c) Microsoft Corporation.
> SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > @@ -40,6 +40,7 @@ > // > #define UFS_MAX_LUNS 12 > #define UFS_WLUN_PREFIX 0xC1 > +#define UFS_INIT_COMPLETION_TIMEOUT 600000 I will help to remove the tailing space in the above line before pushing th= e patch. (Not sure if the tailing space is generated when I extract the patch from m= y mailing agent.) Anyway, Reviewed-by: Hao A Wu Best Regards, Hao Wu >=20 > typedef struct { > UINT8 Lun[UFS_MAX_LUNS]; > -- > 2.16.2.windows.1