From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga05.intel.com (mga05.intel.com []) by mx.groups.io with SMTP id smtpd.web09.38428.1614013384259809165 for ; Mon, 22 Feb 2021 09:03:05 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=fail (domain: intel.com, ip: , mailfrom: purna.chandra.rao.bandaru@intel.com) IronPort-SDR: wOgB8MhV2xFFJpgGAcmn/Ty5STvHXNphaYVQ3p1YFJLTg3FLC94AGX30R+9u03dKU1boMvfv7Z Xo16ZOtz47vQ== X-IronPort-AV: E=McAfee;i="6000,8403,9903"; a="269452492" X-IronPort-AV: E=Sophos;i="5.81,197,1610438400"; d="scan'208";a="269452492" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Feb 2021 09:03:00 -0800 IronPort-SDR: g1JRrFWYbbAk9jV574UuYm3DpbSAI+Wxi4uFyeHeGZDJokScjqxaSWV1Oep59pnEXTpthXngUI b+ybLsejyg9g== X-IronPort-AV: E=Sophos;i="5.81,197,1610438400"; d="scan'208";a="432152843" Received: from pbandaru-mobl1.gar.corp.intel.com ([10.213.95.147]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Feb 2021 09:02:58 -0800 From: Purna Chandra Rao Bandaru To: devel@edk2.groups.io Cc: Purna Chandra Rao Bandaru , Mateusz Albecki , Ray Ni , Hao A Wu Subject: [PATCH 3/3] MdeModulePkg/UfsPassThruDxe: Improve UFS device Readiness check. Date: Mon, 22 Feb 2021 22:32:36 +0530 Message-Id: <20210222170236.6312-3-purna.chandra.rao.bandaru@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: <20210222170236.6312-1-purna.chandra.rao.bandaru@intel.com> References: <20210222170236.6312-1-purna.chandra.rao.bandaru@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit https://bugzilla.tianocore.org/show_bug.cgi?id=3217 Retry sending NOP OUT command upto 10 times. This to give extra time for UFS device to respond if was busy. Signed-off-by: Bandaru Cc: Mateusz Albecki Cc: Ray Ni Cc: Hao A Wu Change-Id: I46054ea9ee34ad295fce58dff1756241fd22e17c --- MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c index 8859578af3..c4c2b03e46 100644 --- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c +++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c @@ -911,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. // - Status = UfsExecNopCmds (Private); - if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "Ufs Sending NOP IN command Error, Status = %r\n", Status)); + for (Index = 10; Index > 0; Index--) { + Status = UfsExecNopCmds (Private); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "Ufs Sending NOP IN command Error, Index = %x Status = %r\n", Index, Status)); + MicroSecondDelay (100); //100 us + continue; + } else { + DEBUG ((DEBUG_INFO, "Ufs Sent NOP OUT successfully and received NOP IN, Status = %r\n", Status)); + break; + } + } + if (!Index) { + DEBUG ((DEBUG_INFO, "NOP OUT failed all the 10 times Status = %r\n", Status)); goto Error; } -- 2.16.2.windows.1