[edk2-devel] [PATCH 3/3] MdeModulePkg/UfsPassThruDxe: Improve UFS device Readiness check.

Purna Chandra Rao Bandaru purna.chandra.rao.bandaru at intel.com
Mon Feb 22 17:02:36 UTC 2021


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 <purna.chandra.rao.bandaru at intel.com>
Cc: Mateusz Albecki <mateusz.albecki at intel.com>
Cc: Ray Ni <ray.ni at intel.com>
Cc: Hao A Wu <hao.a.wu at intel.com>

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



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#72010): https://edk2.groups.io/g/devel/message/72010
Mute This Topic: https://groups.io/mt/80841261/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list