summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason1 Lin <jason1.lin@intel.com>2024-07-27 18:38:13 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-07-30 20:55:09 +0000
commitf8f34edd9db82882fd70f14cb97ab28e9bb0b9a3 (patch)
tree894b300ecd76b55d50db723a12c9c64c9bc93d46
parent5289ad177d4f2d587a47185e0567b9d7e579e4e8 (diff)
downloadedk2-f8f34edd9db82882fd70f14cb97ab28e9bb0b9a3.tar.gz
edk2-f8f34edd9db82882fd70f14cb97ab28e9bb0b9a3.tar.bz2
edk2-f8f34edd9db82882fd70f14cb97ab28e9bb0b9a3.zip
MdeModulePkg/UfsPassThruDxe: Migrate UFS Initial Completion Timeout to PCD
- Remove the hardcoded definition (UFS_INIT_COMPLETION_TIMEOUT) - Migrate the UFS initial completion timeout into PCD value Signed-off-by: Jason1 Lin <jason1.lin@intel.com>
-rw-r--r--MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c5
-rw-r--r--MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.h6
-rw-r--r--MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruDxe.inf4
3 files changed, 8 insertions, 7 deletions
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 <Library/MemoryAllocationLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/DevicePathLib.h>
+#include <Library/PcdLib.h>
#include <Library/TimerLib.h>
#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