diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c index 880e7d8511..816532d20e 100644 --- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c +++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c @@ -759,6 +759,7 @@ UfsFinishDeviceInitialization ( UINT32 Timeout; DeviceInitStatus = 0xFF; + Timeout = PcdGet32 (PcdUfsInitialCompletionTimeout); // // The host enables the device initialization completion by setting fDeviceInit flag. @@ -768,10 +769,6 @@ UfsFinishDeviceInitialization ( return Status; } - // - // There are cards that can take upto 600ms to clear fDeviceInit flag. - // - Timeout = UFS_INIT_COMPLETION_TIMEOUT; do { Status = UfsReadFlag (Private, UfsFlagDevInit, &DeviceInitStatus); if (EFI_ERROR (Status)) { diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h index bc1139da6e..d380650319 100644 --- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h +++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h @@ -24,6 +24,7 @@ #include #include #include +#include #include #include "UfsPassThruHci.h" @@ -38,9 +39,8 @@ // Lun 10: BOOT // Lun 11: RPMB // -#define UFS_MAX_LUNS 12 -#define UFS_WLUN_PREFIX 0xC1 -#define UFS_INIT_COMPLETION_TIMEOUT 600000 +#define UFS_MAX_LUNS 12 +#define UFS_WLUN_PREFIX 0xC1 typedef struct { UINT8 Lun[UFS_MAX_LUNS]; diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruDxe.inf b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruDxe.inf index 92dc25714b..0e12b7a8b4 100644 --- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruDxe.inf +++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruDxe.inf @@ -48,6 +48,7 @@ UefiDriverEntryPoint DebugLib DevicePathLib + PcdLib TimerLib [Protocols] @@ -56,5 +57,8 @@ gEdkiiUfsHostControllerProtocolGuid ## TO_START gEdkiiUfsHcPlatformProtocolGuid ## SOMETIMES_CONSUMES +[Pcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdUfsInitialCompletionTimeout ## CONSUMES + [UserExtensions.TianoCore."ExtraFiles"] UfsPassThruExtra.uni