]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThru.c
MdeModulePkg/UfsPassThruDxe: Implement EDKII_UFS_HC_PLATFORM_PROTOCOL
[mirror_edk2.git] / MdeModulePkg / Bus / Ufs / UfsPassThruDxe / UfsPassThru.c
index 7dce217d49773441fe337d407b6f7b9f7c3a224b..b12404aacb11fefe8a130b35932acf5caf842982 100644 (file)
@@ -36,6 +36,7 @@ UFS_PASS_THRU_PRIVATE_DATA gUfsPassThruTemplate = {
   0,                              // UfsHostController\r
   0,                              // UfsHcBase\r
   {0, 0},                         // UfsHcInfo\r
+  {NULL, NULL},                   // UfsHcDriverInterface\r
   0,                              // TaskTag\r
   0,                              // UtpTrlBase\r
   0,                              // Nutrs\r
@@ -92,6 +93,8 @@ UFS_DEVICE_PATH    mUfsDevicePathTemplate = {
 \r
 UINT8 mUfsTargetId[TARGET_MAX_BYTES];\r
 \r
+GLOBAL_REMOVE_IF_UNREFERENCED EDKII_UFS_HC_PLATFORM_PROTOCOL  *mUfsHcPlatform;\r
+\r
 /**\r
   Sends a SCSI Request Packet to a SCSI device that is attached to the SCSI channel. This function\r
   supports both blocking I/O and nonblocking I/O. The blocking I/O functionality is required, and the\r
@@ -864,7 +867,21 @@ UfsPassThruDriverBindingStart (
   Private->ExtScsiPassThru.Mode = &Private->ExtScsiPassThruMode;\r
   Private->UfsHostController    = UfsHc;\r
   Private->UfsHcBase            = UfsHcBase;\r
+  Private->Handle               = Controller;\r
+  Private->UfsHcDriverInterface.UfsHcProtocol = UfsHc;\r
+  Private->UfsHcDriverInterface.UfsExecUicCommand = UfsHcDriverInterfaceExecUicCommand;\r
   InitializeListHead (&Private->Queue);\r
+\r
+  //\r
+  // This has to be done before initializing UfsHcInfo or calling the UfsControllerInit\r
+  //\r
+  if (mUfsHcPlatform == NULL) {\r
+    Status = gBS->LocateProtocol (&gEdkiiUfsHcPlatformProtocolGuid, NULL, (VOID**)&mUfsHcPlatform);\r
+    if (EFI_ERROR (Status)) {\r
+      DEBUG ((DEBUG_INFO, "No UfsHcPlatformProtocol present\n"));\r
+    }\r
+  }\r
+\r
   Status = GetUfsHcInfo (Private);\r
   if (EFI_ERROR (Status)) {\r
     DEBUG ((DEBUG_ERROR, "Failed to initialize UfsHcInfo\n"));\r