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>
This commit is contained in:
Albecki, Mateusz
2019-08-09 22:36:20 +08:00
committed by Hao A Wu
parent a71272ed7a
commit ecc32c90ee
4 changed files with 112 additions and 3 deletions

View File

@@ -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"));