From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga09.intel.com (mga09.intel.com []) by mx.groups.io with SMTP id smtpd.web09.974.1614129755890974811 for ; Tue, 23 Feb 2021 17:22:36 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=FZ0qwo4/; spf=fail (domain: intel.com, ip: , mailfrom: hao.a.wu@intel.com) IronPort-SDR: d7rqYmA1Ty+GCWR6EgQ07l8LXpe8Z459wmhEfQt6NFfCEWDuG7hvjuCJ69mQwW318JRfOJnmob BSaHvE3dIutQ== X-IronPort-AV: E=McAfee;i="6000,8403,9904"; a="185120688" X-IronPort-AV: E=Sophos;i="5.81,201,1610438400"; d="scan'208";a="185120688" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Feb 2021 17:22:35 -0800 IronPort-SDR: 1V3RfruNS0jLtz/NK7ZFGibt7rlTBhvmRNiW3jKsQCVlVrvN0+/fnuzht73Fjj2Bo9FpOS2wcX 7V3LsyGDTJJA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,201,1610438400"; d="scan'208";a="593456005" Received: from orsmsx604.amr.corp.intel.com ([10.22.229.17]) by fmsmga006.fm.intel.com with ESMTP; 23 Feb 2021 17:22:34 -0800 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX604.amr.corp.intel.com (10.22.229.17) 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:20:58 -0800 Received: from orsmsx607.amr.corp.intel.com (10.22.229.20) by ORSMSX611.amr.corp.intel.com (10.22.229.24) 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:20:58 -0800 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx607.amr.corp.intel.com (10.22.229.20) 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:20:58 -0800 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.174) by edgegateway.intel.com (134.134.137.102) 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:20:57 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dFQs9zUSRvtDdgksxqcXF2EXw8Nxh8bywIb+RoNCFWRaRt3WLFY6LPZYiqF8oovL4Lp4HB/RFDBKgXrYusiOyVydzVASFZzTfY1voXTISSbjhpPwe9Pf9MDDiF2mz4zW+er8MsMstUh10wx4dHgN/T4Spfnkf14X6zDbnqULSIAg7fcRHrLrIaci4fj6PVr8cA/pqKuo8pKorQK5wQeGjVEGYrnvpgR8vsmmBhhmHRDkaP7T5V/Z0a5ASTxxmyNPTAeULcL28BFfm9sMRahTCLgmr3HyqJmsNBi//qDmHOVetSrYen1iLolPE3o1UIkhzv4uL+hUB6n3Vk84Jvtm6w== 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=WqDlGVTZh8Fkvrx3a1gCe83wZ0bfic1xfnYw3repBVI=; b=n7gx9crooo7LHtqDjBZUqIJYHhAJQ+FGmcJJbWBRKCd61voiOMh+2RrQYVkgJTVAsU1a/cpZz38T5ybx2OoImm+ywmVIzz5Qs45u1nlkFI73AbAQTC9eYkUgmUHnpwkzwjmiOapRVRwMTO8w3BcpIkQgCRUUDrV7GI9OwTPm4s421TyK3tgvINuUVliPINCYQdcssXFBfST2mTHWBb6o3+/VAuwcgCwNRnwEF1uirdR0+Dg5/Uh/ISp6StwN5iPfCIWBqogtSmBo5RyIu7DXiZ0o52UOzQJ7V/1bOFZFccnNLnozWcKyh0pqPQOyYZZ+sWKE5cgqHnMc7o/N/nuvzg== 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=WqDlGVTZh8Fkvrx3a1gCe83wZ0bfic1xfnYw3repBVI=; b=FZ0qwo4/ul8obVnIo9R+EGMqK8MHgEzsiq4oQOS80P/WLfXHl4rgenjeQ6PgrDheKA35cUjmGjsm+1wNabT3dG5d84ZyiU0x8TGKX2CG3+Xxztomj6h7rNoZ3vQof/A0KuAvd5mXj6MHwwWfNO8G9fbEVcgs8LPPsoD8VSBH0Ro= Received: from BN8PR11MB3666.namprd11.prod.outlook.com (2603:10b6:408:8c::19) by BN8PR11MB3666.namprd11.prod.outlook.com (2603:10b6:408:8c::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.31; Wed, 24 Feb 2021 01:20:56 +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:20:56 +0000 From: "Wu, Hao A" To: gaoliming , "Bandaru, Purna Chandra Rao" , "devel@edk2.groups.io" CC: Laszlo Ersek , "Leif Lindholm (Nuvia address)" , "Kinney, Michael D" , "Andrew Fish" Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/UfsPassThruDxe: Improve Error handling of Ufs Pass Thru driver Thread-Topic: [edk2-devel] [PATCH] MdeModulePkg/UfsPassThruDxe: Improve Error handling of Ufs Pass Thru driver Thread-Index: AQHXBQuRLSwBS6euzEiT1FtH3mO6Vqpjs0AggAAu+GCAAI8NgIAAhV7wgADhnoCAALHdkA== Date: Wed, 24 Feb 2021 01:20:56 +0000 Message-ID: References: <20210217090143.20032-1-purna.chandra.rao.bandaru@intel.com> In-Reply-To: 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: byosoft.com.cn; dkim=none (message not signed) header.d=none;byosoft.com.cn; 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: 3c18df41-3b4c-45d9-18e8-08d8d8626fab x-ms-traffictypediagnostic: BN8PR11MB3666: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:10000; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: JgXQpkQCtVBtILcj4jLoDqJ5mymkM5p1Lqm0QwD/Px5EVixHWCfnh7lVfFz1/tLZXg1L8PYE09ScfUQwI4HULBfp0rwR50kdJMPzan4tCwJlxMeTiZAqVDfLU0umzl474sNRA//GIeqWYJcdFkLTYtkVdv5LP9IerCrOS+eJXLZe7JhdIQe37G+O25bx0o2rE+BhTnwCki+WACOnp0gKgtfYsgH1H/gOZkepS8Zs2UmPXR4J7Mataczu4QnT7W11pdg8qSYt04z+TyelLYv+LE+zckdxTFMRkS1DkAp20ouFjKKH4jsQ757oqkcouFkng/CTPTFf0/vjOSnp27+AQjoU77mw1Bq4JG2bPdoyakLKj2VhDY49FQ5x+GNFGIaKSpuFf2Vjp7+2TS+J+BdwcyRxHf5qpn2ccb91cjJJAToKaAp8GsBWHyStmCgdhHmErVo/zwtxGY4YK21XYq9Ulkb8HfOI1hE5Bnk6nhTiraSGi64u5xjmWV6fzS4hxJONLjTUc9Hp+uSfz5iEUrvukWe4DzFPrQS7fBfKjWajsLV9e74iM8HuFXZr+C7oP5YzgJW85fOOGj0tdkRHmhgNosLvn7Gvp6to45D1FWhrU+Y= 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:(396003)(136003)(39860400002)(366004)(346002)(376002)(7696005)(54906003)(30864003)(5660300002)(9686003)(8676002)(71200400001)(66476007)(33656002)(76116006)(53546011)(478600001)(64756008)(55016002)(4326008)(66446008)(66556008)(26005)(8936002)(186003)(2906002)(19627235002)(83380400001)(316002)(45080400002)(110136005)(66946007)(966005)(52536014)(86362001)(6506007);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?XP+JsDu7C7LuszmiIhXv2QKfTbiGEjzXRHO9JnfO9JilsMgjgO+IxlDKsmuO?= =?us-ascii?Q?p/DXOad0xHtL/J/MyFfo0ACsZEIsuDm6sOq0JCkXC98qypONcIGwUVC8VSGh?= =?us-ascii?Q?HiwjTD9L3xVFVXVpC+EHTYO9fdKn5Rttb2/W4kxr3cfXSS409yAZyySHcw+T?= =?us-ascii?Q?P4gnGUGyFCt6ERs0JaLgciMJ8D/L6zV78tRrGTmj1u1etVI1sgnq2dbELFJR?= =?us-ascii?Q?RZBhvBt0BTHiV3BF7EiuUSrpNncGgUpZBj7QssN5lqdnyt6W1kUidMjy04fo?= =?us-ascii?Q?AD/JpFHfDPV+G1H2kcldWBdemcOiJX9wHH+jHhrxG/anSmbvw5LnOqAU2tZn?= =?us-ascii?Q?7t3T7ti7AWOyi+sopuvpAgHU4jgpzTL2Krppw6RyuiQ/CogZEIygdLVZJZux?= =?us-ascii?Q?3CWyRYBt5gmvK7IJALEmWq3l65T47M9FnBCV920xV7pZn0OMOsnzj3W3p8R7?= =?us-ascii?Q?ueA10JBuFrIaay71rVEfC4hhJW24SqYnxyKkZkkNItltkn8SgbF8ttb2Wenl?= =?us-ascii?Q?5ghxwwN7yayh37FjDCdOS5tOOF5tqf9OoET1hFZr97Qoi/SYysIRbxk52wSU?= =?us-ascii?Q?kuVP6uM9IReK+R8bEzj/cL5DC5UD5tVx65niQgtPpNdl74KNqGOdqSoRjFKl?= =?us-ascii?Q?h6geqpfG3/4K7MSrsHQ1G5UYvt2Edw2CUmDuIIR/9DKbeauWBjwBHswqa94Z?= =?us-ascii?Q?VmIOYUgJm1gFd+TK462atPrSyjfSoi7exxK1zhchvZcVbLW+cKhQAMbVPP66?= =?us-ascii?Q?R/xPJ+Tyfwr2d4XRa5K/RfY8zl4dYYyqK/aWRKoDH0Rx0ql6b8aIOxG/CIQt?= =?us-ascii?Q?wJPMPBgTdDbCq4iSkWTBmoQcsBnWe/Tg6q1SozbQSFZnvt4JDU0X6QBCcNgf?= =?us-ascii?Q?l1ep6ugx+E0z1bap+py6jTwwx2vfKnmFBne2tK5O/VP6vZYJJOXj9/aTd7E5?= =?us-ascii?Q?AL/vc6ITo8ouOCmri68m0DpUHyZ/HjqDBvQ6jLTRbo4ZQa6aVngVTc1eVcoT?= =?us-ascii?Q?mQU7SU00xk44ytGN8XT5FMmD+/0KUROzGi4wPv5d32TigMUUZqTkNLFutG1i?= =?us-ascii?Q?FT2j9UbHp3rbkuLkJiokphuQDJTJLjpGJROMb73oTGg9d4QaE4V0dIIf0J2m?= =?us-ascii?Q?wo4jnBNVqvsaeIyYazhFyy5FSUmBvIC2yFS3iuhGM0trACPiTMcB4jv1cHBr?= =?us-ascii?Q?2103WJvbaWgQOn/yuJbZ2/n0Q77JunXOL0v8fA/eJjtfczTbdLUGdgvPpxv2?= =?us-ascii?Q?o0a6Lg9XsvIGNeJhLSWivn/MNYb7vIwCGTT5Rfsdo6JPDK5hgprAlKY1I99e?= =?us-ascii?Q?EOxI6KCwnod5SfxIFhczWqzJ?= 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: 3c18df41-3b4c-45d9-18e8-08d8d8626fab X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Feb 2021 01:20:56.4214 (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: TfSDNdZ7VoJvM38yFf7c5k0Yb0KbdfwDsGlJWqzLAQKYKxc2rjXljOooHRIrnS2keFgWxrQuvpkOAK82F9yygw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR11MB3666 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 Hello Liming, I have a patch that would like to confirm with you that whether it can be = merged into the upcoming edk2-stable202102 tag. This is a feature request: https://bugzilla.tianocore.org/show_bug.cgi?id= =3D3217 In the BZ tracker, there are 3 improvements mentioned for UfsPassThruDxe. According to Purna, he would like to have 1 of the improvements (improveme= nt #3 in BZ-3217) be merged and catch the stable tag. I have given the 'R-b' tag for improvement #3 already (https://edk2.groups= .io/g/devel/message/72121) My thought is that we can break BZ-3217 into multiple feature requests: 1. BZ-3217: Updated its title and description to only cover improvement #3 2. File new BZ feature requests to cover improvement #1 & #2 What is your suggestion for this case? Thanks in advance. Best Regards, Hao Wu > -----Original Message----- > From: Bandaru, Purna Chandra Rao > Sent: Tuesday, February 23, 2021 10:36 PM > To: Wu, Hao A ; devel@edk2.groups.io > Cc: Albecki, Mateusz ; Ni, Ray > > Subject: RE: [edk2-devel] [PATCH] MdeModulePkg/UfsPassThruDxe: > Improve Error handling of Ufs Pass Thru driver >=20 > Hi Wu, Hao A >=20 > I am trying to focus on merging patch#1 for now to unblock boot issues. > March 6th might be too late, May I request you to expedite any other > alternatives like exceptions/overrides? > For the remaining two patches I will get back to you with the plan after > discussing with WSIV and MVE teams on the protocol analyzer tools etc. >=20 > Thanks > ~Purna >=20 > -----Original Message----- > From: Wu, Hao A > Sent: Tuesday, February 23, 2021 6:46 AM > To: Bandaru, Purna Chandra Rao ; > devel@edk2.groups.io > Cc: Albecki, Mateusz ; Ni, Ray > > Subject: RE: [edk2-devel] [PATCH] MdeModulePkg/UfsPassThruDxe: > Improve Error handling of Ufs Pass Thru driver >=20 > > -----Original Message----- > > From: Bandaru, Purna Chandra Rao > > > Sent: Tuesday, February 23, 2021 1:11 AM > > To: Wu, Hao A ; devel@edk2.groups.io > > Cc: Albecki, Mateusz ; Ni, Ray > > > > Subject: RE: [edk2-devel] [PATCH] MdeModulePkg/UfsPassThruDxe: > > Improve Error handling of Ufs Pass Thru driver > > > > Thank you Hai Bu for the response. > > > > I have broken this into three separate patches. There were no specific > > recommendation in the speciation for seen multiple issues on all the > > UFS platforms like LKF, ADP-P and EHK. >=20 >=20 > Hello, >=20 > After quickly going through the new series sent, I do not see my previou= s > inline comments and questions get addressed. > Could you please help to provide your feedbacks and update the patches? >=20 >=20 > > And these changes worked on all the three with various UFS cards. > > Can you please review and help to get this changes at the earliest in > > master as well as Downstream/master. >=20 >=20 > Sorry, since there is an upcoming stable tag approaching, at this moment= , I > prefer to hold this feature after the stable tag (March 6th). >=20 > Best Regards, > Hao Wu >=20 >=20 > > > > Thanks > > ~Purna > > > > -----Original Message----- > > From: Wu, Hao A > > Sent: Monday, February 22, 2021 2:10 PM > > To: devel@edk2.groups.io; Wu, Hao A ; Bandaru, > > Purna Chandra Rao > > Cc: Albecki, Mateusz ; Ni, Ray > > > > Subject: RE: [edk2-devel] [PATCH] MdeModulePkg/UfsPassThruDxe: > > Improve Error handling of Ufs Pass Thru driver > > > > > -----Original Message----- > > > From: devel@edk2.groups.io On Behalf Of Wu, > > Hao > > > A > > > Sent: Monday, February 22, 2021 4:38 PM > > > To: Bandaru, Purna Chandra Rao > > > ; > > > devel@edk2.groups.io > > > Cc: Albecki, Mateusz ; Ni, Ray > > > > > > Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/UfsPassThruDxe: > > > Improve Error handling of Ufs Pass Thru driver > > > > > > > -----Original Message----- > > > > From: Bandaru, Purna Chandra Rao > > > > > > > Sent: Wednesday, February 17, 2021 5:02 PM > > > > To: devel@edk2.groups.io > > > > Cc: Bandaru, Purna Chandra Rao > > > > ; > > > > Albecki, Mateusz ; Ni, Ray > > > > ; Wu, Hao A > > > > Subject: [PATCH] MdeModulePkg/UfsPassThruDxe: Improve Error > > handling > > > > of Ufs Pass Thru driver > > > > > > > > From: Bandaru > > > > > > > > https://bugzilla.tianocore.org/show_bug.cgi?id=3D3217 > > > > > > > > Following is the brief description of the changes > > > > 1) There are cards that can take upto 600ms for Init and hence in= crease > > > > the time out for fDeviceInit polling loop. > > > > 2) Add UFS host conctroller reset in the last retry of Link start= up. > > > > 3) Retry sending NOP OUT command upto 10 times > > > > > > > > > Hello Bandaru, > > > > > > Could you help to break this patch into a 3-patch series in V2? > > > With each patch handling just one of the above 3 improvements > > mentioned. > > > > > > For improvement 2) above, I do not see such UFS host controller > > > re-enabling process being mentioned in UFSHCI 3.0 spec section 7.1.1= . > > > Is this process being documented somewhere else in the spec or > > > suggested by device vender? > > > > > > Sorry for missing one comment. > > Could you help to add the information on what kind of tests have been > > performed for the code changes? > > > > Thanks in advance. > > > > Best Regards, > > Hao Wu > > > > > > > > > > More inline comments below: > > > > > > > > > > > > > > Signed-off-by: Bandaru > > > > Cc: Mateusz Albecki > > > > Cc: Ray Ni > > > > Cc: Hao A Wu > > > > > > > > Change-Id: I6c0dbc1c147487e51f0ed5f2425957ae089b0160 > > > > --- > > > > MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c | 26 > > > > +++++++++++++++++++++----- > > > > MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c | 18 > > > > ++++++++++++------ > > > > 2 files changed, 33 insertions(+), 11 deletions(-) > > > > > > > > diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c > > > > b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c > > > > index 9768c2e6fb..89048745be 100644 > > > > --- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c > > > > +++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c > > > > @@ -1,6 +1,6 @@ > > > > /** @file > > > > > > > > - 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 > > > > > > > > @@ -749,7 +749,7 @@ UfsFinishDeviceInitialization ( { > > > > EFI_STATUS Status; > > > > UINT8 DeviceInitStatus; > > > > - UINT8 Timeout; > > > > + UINT16 Timeout; > > > > > > > > DeviceInitStatus =3D 0xFF; > > > > > > > > @@ -761,17 +761,23 @@ UfsFinishDeviceInitialization ( > > > > return Status; > > > > } > > > > > > > > - Timeout =3D 5; > > > > + Timeout =3D 6000; //There are cards that can take upto 600ms. > > > > > > > > > Please help to add a macro in file UfsPassThru.h: > > > #define UFS_INIT_COMPLETION_TIMEOUT 6000 And use the macro here. > > > > > > Also a minor comment, could you help to use the below comment format= ? > > > // > > > // There are UFS devices that can take up to 600ms to clear the > > > fDeviceInit flag // Timeout =3D UFS_INIT_COMPLETION_TIMEOUT; > > > > > > > > > > do { > > > > + MicroSecondDelay (100); //Give 100 us and then start polling. > > > > > > > > > For the above delay movement, do you observe any side effect for the > > > origin code? > > > If not, I prefer to leave the origin behavior: > > > do { > > > UfsReadFlag(); > > > ... > > > MicroSecondDelay (1); > > > } while (...) > > > since doing so will have the least performance penalty for devices > > > that respond fast. > > > > > > > > > > Status =3D UfsReadFlag (Private, UfsFlagDevInit, &DeviceInitS= tatus); > > > > if (EFI_ERROR (Status)) { > > > > return Status; > > > > } > > > > - MicroSecondDelay (1); > > > > Timeout--; > > > > } while (DeviceInitStatus !=3D 0 && Timeout !=3D 0); > > > > > > > > + 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; > > > > > > > > > Please help to add two spaces for text alignment in the above line. > > > > > > > > > > + } > > > > } > > > > > > > > /** > > > > @@ -905,9 +911,19 @@ UfsPassThruDriverBindingStart ( > > > > // At the end of the UFS Interconnect Layer initialization on > > > > both host and device side, > > > > // the host shall send a NOP OUT UPIU to verify that the device > > > > UTP Layer is ready. > > > > // > > > > > > > > > For the NOP OUT - NOP IN improvement, could you help to provide more > > > information on what is the current issue for some devices? > > > Is it a timeout happened for: > > > Status =3D UfsWaitMemSet (Private, UFS_HC_UTRLDBR_OFFSET, BIT0 << > > > Slot, 0, UFS_TIMEOUT); (If so, have you tried increasing the last > > > parameter like > > > '10*UFS_TIMEOUT'?) Or the case is that NopInUpiu->Resp has a > > > non-zero value? > > > > > > I found that in the UFS 3.0 spec: > > > |> For some implementations, the device UTP layer may not be > > > |> initialized yet, therefore the device may not respond promptly to > > > |> NOP OUT UPIU sending NOP IN UPIU. > > > |> The host waits until it receives the NOP IN UPIU from the device.= .. > > > And there is no mention for the retry scheme. > > > > > > > > > > + for (Index =3D 10; Index > 0; Index--) { > > > > Status =3D UfsExecNopCmds (Private); > > > > if (EFI_ERROR (Status)) { > > > > - DEBUG ((DEBUG_ERROR, "Ufs Sending NOP IN command Error, > Status > > > > =3D %r\n", Status)); > > > > + DEBUG ((DEBUG_ERROR, "Ufs Sending NOP IN command Error, > > Index > > > > =3D %x Status =3D %r\n", Index, Status)); > > > > + MicroSecondDelay (100); //100 us > > > > + continue; > > > > + } else { > > > > + DEBUG ((DEBUG_INFO, "Ufs Sent NOP OUT successfully and > > > > + received > > > > NOP IN, Status =3D %r\n", Status)); > > > > + break; > > > > + } > > > > + } > > > > + if (!Index) { > > > > + DEBUG ((DEBUG_INFO, "NOP OUT failed all the 10 times Status = =3D > > > > + %r\n", Status)); > > > > goto Error; > > > > } > > > > > > > > diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c > > > > b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c > > > > index 0b1030ab47..4fa5689196 100644 > > > > --- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c > > > > +++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c > > > > @@ -2,7 +2,7 @@ > > > > UfsPassThruDxe driver is used to produce EFI_EXT_SCSI_PASS_THRU > > > > protocol interface > > > > for upper layer application to execute UFS-supported SCSI cmds. > > > > > > > > - 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 > > > > > > > > @@ -1929,17 +1929,15 @@ UfsDeviceDetection ( > > > > > > > > // > > > > // Start UFS device detection. > > > > - // Try up to 3 times for establishing data link with device. > > > > + // Try up to 4 times for establishing data link with device. > > > > // > > > > - for (Retry =3D 0; Retry < 3; Retry++) { > > > > + for (Retry =3D 0; Retry < 4; Retry++) { > > > > > > > > > Please introduce a macro in file UfsPassThru.h: > > > #define UFS_LINK_STARTUP_RETRIES 4 > > > And use the macro here. > > > > > > Also, is it necessary to increase the retry number by 1? > > > Or the device can be successfully brought up by adding a host > > > controller re- enabling? > > > > > > > > > > LinkStartupCommand.Opcode =3D UfsUicDmeLinkStartup; > > > > LinkStartupCommand.Arg1 =3D 0; > > > > LinkStartupCommand.Arg2 =3D 0; > > > > LinkStartupCommand.Arg3 =3D 0; > > > > Status =3D UfsExecUicCommands (Private, &LinkStartupCommand); > > > > - if (EFI_ERROR (Status)) { > > > > - return EFI_DEVICE_ERROR; > > > > - } > > > > > > > > > Will the DME_LINKSTARTUP command execution fail at first and then > > > succeed after retry? > > > If not, I prefer to keep the origin code logic to return error statu= s directly. > > > > > > > > > > + if (!EFI_ERROR (Status)) { > > > > > > > > Status =3D UfsMmioRead32 (Private, UFS_HC_STATUS_OFFSET, &Dat= a); > > > > if (EFI_ERROR (Status)) { > > > > @@ -1960,6 +1958,14 @@ UfsDeviceDetection ( > > > > } > > > > } > > > > return EFI_SUCCESS; > > > > + } > > > > + } > > > > + if (Retry =3D=3D 2) { > > > > > > > > > Please help to update to: > > > if (Retry =3D=3D UFS_LINK_STARTUP_RETRIES - 1) { > > > > > > And add comments like: > > > // > > > // Try re-enabling the UFS host controller in the last retry attempt > > > // > > > > > > > > > Best Regards, > > > Hao Wu > > > > > > > > > > + Status =3D UfsEnableHostController (Private); > > > > + if (EFI_ERROR (Status)) { > > > > + DEBUG ((DEBUG_ERROR, "UfsDeviceDetection: Enable Host > > > Controller > > > > Fails, Status =3D %r\n", Status)); > > > > + return Status; > > > > + } > > > > } > > > > } > > > > > > > > -- > > > > 2.16.2.windows.1 > > > > > > > > > > > >=20 > > >