summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c
diff options
context:
space:
mode:
authorAlbecki, Mateusz <mateusz.albecki@intel.com>2019-08-09 22:36:20 +0800
committerHao A Wu <hao.a.wu@intel.com>2019-08-13 10:54:35 +0800
commitecc32c90ee4ad557205cb2725619a3cc2f45ebd0 (patch)
tree56a6917b1edd6525cda7e80131b93c4b787d8114 /MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c
parenta71272ed7a37e6f6bc1d32f3e72addc63196d933 (diff)
downloadedk2-ecc32c90ee4ad557205cb2725619a3cc2f45ebd0.tar.gz
edk2-ecc32c90ee4ad557205cb2725619a3cc2f45ebd0.tar.bz2
edk2-ecc32c90ee4ad557205cb2725619a3cc2f45ebd0.zip
MdeModulePkg/UfsPassThruDxe: Implement EDKII_UFS_HC_PLATFORM_PROTOCOL
https://bugzilla.tianocore.org/show_bug.cgi?id=1343 This commit adds EDKII_UFS_HC_PLATFORM_PROTOCOL implementation in UfsPassThruDxe driver in version 1. Driver assumes that at most one instance of the protocol exists in the system. Presence of the protocol is not mandatory. Signed-off-by: Mateusz Albecki <mateusz.albecki@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Diffstat (limited to 'MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c')
-rw-r--r--MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c
index 7dce217d49..b12404aacb 100644
--- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c
+++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c
@@ -36,6 +36,7 @@ UFS_PASS_THRU_PRIVATE_DATA gUfsPassThruTemplate = {
0, // UfsHostController
0, // UfsHcBase
{0, 0}, // UfsHcInfo
+ {NULL, NULL}, // UfsHcDriverInterface
0, // TaskTag
0, // UtpTrlBase
0, // Nutrs
@@ -92,6 +93,8 @@ UFS_DEVICE_PATH mUfsDevicePathTemplate = {
UINT8 mUfsTargetId[TARGET_MAX_BYTES];
+GLOBAL_REMOVE_IF_UNREFERENCED EDKII_UFS_HC_PLATFORM_PROTOCOL *mUfsHcPlatform;
+
/**
Sends a SCSI Request Packet to a SCSI device that is attached to the SCSI channel. This function
supports both blocking I/O and nonblocking I/O. The blocking I/O functionality is required, and the
@@ -864,7 +867,21 @@ UfsPassThruDriverBindingStart (
Private->ExtScsiPassThru.Mode = &Private->ExtScsiPassThruMode;
Private->UfsHostController = UfsHc;
Private->UfsHcBase = UfsHcBase;
+ Private->Handle = Controller;
+ Private->UfsHcDriverInterface.UfsHcProtocol = UfsHc;
+ Private->UfsHcDriverInterface.UfsExecUicCommand = UfsHcDriverInterfaceExecUicCommand;
InitializeListHead (&Private->Queue);
+
+ //
+ // This has to be done before initializing UfsHcInfo or calling the UfsControllerInit
+ //
+ if (mUfsHcPlatform == NULL) {
+ Status = gBS->LocateProtocol (&gEdkiiUfsHcPlatformProtocolGuid, NULL, (VOID**)&mUfsHcPlatform);
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_INFO, "No UfsHcPlatformProtocol present\n"));
+ }
+ }
+
Status = GetUfsHcInfo (Private);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "Failed to initialize UfsHcInfo\n"));