From nobody Thu May 2 16:13:51 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+72322+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+72322+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1614662317; cv=none; d=zohomail.com; s=zohoarc; b=kSk28T2A0AWrLQZZb6noxVBiN71dAJfxG+1MaEtHvTiu65R4xmtg2wIcnqARvRivCd1T5bYVfZUkws0fjvmXxL/4AYqwZgAshVCH2485wdLxYf2i2hWka9O+2t52sxrj4cLPz2qYn6lFHhMZAEm7kRrIYvegSzO+n6Wgjeatirk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1614662317; h=Content-Transfer-Encoding:Cc:Date:From:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=NfwEdRtODeUWhkRrzjBGKBQ5ylizTIOm6TxD81GHSJA=; b=gZNKEBE05A+arD1cskhwU1cngCHH5fp3xvv2bJ+bQ3OaqQnSQzTi+qxyHcxV4nnY+MTZWGhshh90BJ1yYx8ZZ4Nj5Wcc40VTRMKtXkZ3/o5ILYOHp6bp1AtSYQToYWCaV4Yb7K8Tks/3waMI2a+Iie+mF/qGwk2FqDfcWt7R+Cc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+72322+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1614662317873554.2606398640535; Mon, 1 Mar 2021 21:18:37 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id F7JCYY1788612xK53qFzSYJA; Mon, 01 Mar 2021 21:18:37 -0800 X-Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web10.4583.1614662316376409998 for ; Mon, 01 Mar 2021 21:18:37 -0800 IronPort-SDR: qGfzeGYPBeL3XBrJS63xnB/hhkdpM3/uqydDp9RoVfTNa5QwadHoF0ypIGO609wFc4nTAkMYid fzVME7/BZhUw== X-IronPort-AV: E=McAfee;i="6000,8403,9910"; a="271695263" X-IronPort-AV: E=Sophos;i="5.81,216,1610438400"; d="scan'208";a="271695263" X-Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Mar 2021 21:18:34 -0800 IronPort-SDR: 7HT19/9+Obs2VltwMskv9jd7NeanJzwIfs/gaUI/OP1nKFzVUJ/rMV1sUloiyM1OjGKGD7eBsH 40zaEFY4CjnA== X-IronPort-AV: E=Sophos;i="5.81,216,1610438400"; d="scan'208";a="398072928" X-Received: from ssakre-mobl.gar.corp.intel.com (HELO pbandaru-MOBL1.gar.corp.intel.com) ([10.213.72.171]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Mar 2021 21:18:33 -0800 From: "Bandaru, Purna Chandra Rao" To: devel@edk2.groups.io Cc: Purna Chandra Rao Bandaru , Mateusz Albecki , Ray Ni , Hao A Wu Subject: [edk2-devel] [PATCH v4] MdeModulePkg/UfsPassThruDxe: Improve Device initialization polling Loop Date: Tue, 2 Mar 2021 10:48:24 +0530 Message-Id: <20210302051824.12448-1-purna.chandra.rao.bandaru@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,purna.chandra.rao.bandaru@intel.com X-Gm-Message-State: peksurHKmPkFINnHPRVSGH0Hx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1614662317; bh=YPy5YPg4S0E8ZKrcPwt4nwGCTSVl9JB1hOILFvRIG5Y=; h=Cc:Date:From:Reply-To:Subject:To; b=hRvyPSFldH8X6YOOLz2cOdrRNKs7jOVb5MLbJIJpOgrHRGw91RoXQ5qKuJbxy/2ZA8O U3kSGhTGeicPf9bk03+0AI0Ffi40WsOOscZk3K2z+IRQ7weyUucs7CnaMykclJphHLeYP v1agzYfHAWCbkgUYHnPVK/ElnbkH1xozQhs= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" https://bugzilla.tianocore.org/show_bug.cgi?id=3D3217 Current Ufs Pass thru driver polls for 5us and return success even when the timeout occurs. There are cards that can take upto 600ms for Init and hence increased the time out for fDeviceInit polling loop. Change-Id: I7b38e6f6aa46d93f07621caf29ad7c43f57df021 Signed-off-by: Bandaru Cc: Mateusz Albecki Cc: Ray Ni Cc: Hao A Wu Reviewed-by: Hao A Wu --- MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c | 17 +++++++++++++---- MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h | 3 ++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c b/MdeModuleP= kg/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 E= FI_SUCCESS \n", Timeout)); + return EFI_SUCCESS; + } } =20 /** diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h b/MdeModuleP= kg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h index ef33250c89..79b86f7e6b 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 =20 typedef struct { UINT8 Lun[UFS_MAX_LUNS]; --=20 2.16.2.windows.1 -=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 (#72322): https://edk2.groups.io/g/devel/message/72322 Mute This Topic: https://groups.io/mt/81019242/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-