/** @file\r
\r
- Copyright (c) 2014 - 2021, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2014 - 2022, Intel Corporation. All rights reserved.<BR>\r
Copyright (c) Microsoft Corporation.<BR>\r
SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
)\r
{\r
- EFI_STATUS Status;\r
- EDKII_UFS_HOST_CONTROLLER_PROTOCOL *UfsHc;\r
- UFS_PASS_THRU_PRIVATE_DATA *Private;\r
- UINTN UfsHcBase;\r
- UINT32 Index;\r
- UFS_UNIT_DESC UnitDescriptor;\r
- UFS_DEV_DESC DeviceDescriptor;\r
- UINT32 UnitDescriptorSize;\r
- UINT32 DeviceDescriptorSize;\r
+ EFI_STATUS Status;\r
+ EDKII_UFS_HOST_CONTROLLER_PROTOCOL *UfsHc;\r
+ UFS_PASS_THRU_PRIVATE_DATA *Private;\r
+ UINTN UfsHcBase;\r
+ UINT32 Index;\r
+ UFS_UNIT_DESC UnitDescriptor;\r
+ UFS_DEV_DESC DeviceDescriptor;\r
+ UINT32 UnitDescriptorSize;\r
+ UINT32 DeviceDescriptorSize;\r
+ EDKII_UFS_CARD_REF_CLK_FREQ_ATTRIBUTE Attributes;\r
+ UINT8 RefClkAttr;\r
\r
Status = EFI_SUCCESS;\r
UfsHc = NULL;\r
goto Error;\r
}\r
\r
+ if ((mUfsHcPlatform != NULL) &&\r
+ ((mUfsHcPlatform->RefClkFreq == EdkiiUfsCardRefClkFreq19p2Mhz) ||\r
+ (mUfsHcPlatform->RefClkFreq == EdkiiUfsCardRefClkFreq26Mhz) ||\r
+ (mUfsHcPlatform->RefClkFreq == EdkiiUfsCardRefClkFreq38p4Mhz)))\r
+ {\r
+ RefClkAttr = UfsAttrRefClkFreq;\r
+ Attributes = EdkiiUfsCardRefClkFreqObsolete;\r
+ Status = UfsRwAttributes (Private, TRUE, RefClkAttr, 0, 0, (UINT32 *)&Attributes);\r
+ if (!EFI_ERROR (Status)) {\r
+ if (Attributes != mUfsHcPlatform->RefClkFreq) {\r
+ Attributes = mUfsHcPlatform->RefClkFreq;\r
+ DEBUG (\r
+ (DEBUG_INFO,\r
+ "Setting bRefClkFreq attribute(%x) to %x\n 0 -> 19.2 Mhz\n 1 -> 26 Mhz\n 2 -> 38.4 Mhz\n 3 -> Obsolete\n",\r
+ RefClkAttr,\r
+ Attributes)\r
+ );\r
+ Status = UfsRwAttributes (Private, FALSE, RefClkAttr, 0, 0, (UINT32 *)&Attributes);\r
+ if (EFI_ERROR (Status)) {\r
+ DEBUG (\r
+ (DEBUG_ERROR,\r
+ "Failed to Change Reference Clock Attribute to %d, Status = %r \n",\r
+ mUfsHcPlatform->RefClkFreq,\r
+ Status)\r
+ );\r
+ }\r
+ }\r
+ } else {\r
+ DEBUG (\r
+ (DEBUG_ERROR,\r
+ "Failed to Read Reference Clock Attribute, Status = %r \n",\r
+ Status)\r
+ );\r
+ }\r
+ }\r
+\r
+ if ((mUfsHcPlatform != NULL) && (mUfsHcPlatform->Callback != NULL)) {\r
+ Status = mUfsHcPlatform->Callback (Private->Handle, EdkiiUfsHcPostLinkStartup, &Private->UfsHcDriverInterface);\r
+ if (EFI_ERROR (Status)) {\r
+ DEBUG (\r
+ (DEBUG_ERROR,\r
+ "Failure from platform driver during EdkiiUfsHcPostLinkStartup, Status = %r\n",\r
+ Status)\r
+ );\r
+ return Status;\r
+ }\r
+ }\r
+\r
//\r
// UFS 2.0 spec Section 13.1.3.3:\r
// At the end of the UFS Interconnect Layer initialization on both host and device side,\r
UfsPassThruDxe driver is used to produce EFI_EXT_SCSI_PASS_THRU protocol interface\r
for upper layer application to execute UFS-supported SCSI cmds.\r
\r
- Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2014 - 2022, Intel Corporation. All rights reserved.<BR>\r
Copyright (c) Microsoft Corporation.<BR>\r
SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
return EFI_DEVICE_ERROR;\r
}\r
} else {\r
- if ((mUfsHcPlatform != NULL) && (mUfsHcPlatform->Callback != NULL)) {\r
- Status = mUfsHcPlatform->Callback (Private->Handle, EdkiiUfsHcPostLinkStartup, &Private->UfsHcDriverInterface);\r
- if (EFI_ERROR (Status)) {\r
- DEBUG ((DEBUG_ERROR, "Failure from platform driver during EdkiiUfsHcPostLinkStartup, Status = %r\n", Status));\r
- return Status;\r
- }\r
- }\r
-\r
return EFI_SUCCESS;\r
}\r
}\r
/** @file\r
EDKII_UFS_HC_PLATFORM_PROTOCOL definition.\r
\r
-Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2019 - 2022, Intel Corporation. All rights reserved.<BR>\r
SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
\r
#include <Protocol/UfsHostController.h>\r
\r
-#define EDKII_UFS_HC_PLATFORM_PROTOCOL_VERSION 1\r
+#define EDKII_UFS_HC_PLATFORM_PROTOCOL_VERSION 2\r
\r
extern EFI_GUID gEdkiiUfsHcPlatformProtocolGuid;\r
\r
EdkiiUfsHcPostLinkStartup\r
} EDKII_UFS_HC_PLATFORM_CALLBACK_PHASE;\r
\r
+typedef enum {\r
+ EdkiiUfsCardRefClkFreq19p2Mhz,\r
+ EdkiiUfsCardRefClkFreq26Mhz,\r
+ EdkiiUfsCardRefClkFreq38p4Mhz,\r
+ EdkiiUfsCardRefClkFreqObsolete\r
+} EDKII_UFS_CARD_REF_CLK_FREQ_ATTRIBUTE;\r
+\r
/**\r
Callback function for platform driver.\r
\r
/// for host controller.\r
///\r
EDKII_UFS_HC_PLATFORM_CALLBACK Callback;\r
+ ///\r
+ /// Reference Clock Frequency Ufs Card Attribute that need to be set in this Ufs Host Environment.\r
+ ///\r
+ EDKII_UFS_CARD_REF_CLK_FREQ_ATTRIBUTE RefClkFreq;\r
};\r
\r
#endif\r