/** @file\r
\r
- Copyright (c) 2014 - 2017, Intel Corporation. All rights reserved.<BR>\r
- This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+ Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.<BR>\r
+ SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
\r
//\r
UFS_PASS_THRU_PRIVATE_DATA gUfsPassThruTemplate = {\r
UFS_PASS_THRU_SIG, // Signature\r
- NULL, // Handle \r
+ NULL, // Handle\r
{ // ExtScsiPassThruMode\r
0xFFFFFFFF,\r
EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_PHYSICAL | EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL | EFI_EXT_SCSI_PASS_THRU_ATTRIBUTES_NONBLOCKIO,\r
UfsPassThruResetTargetLun,\r
UfsPassThruGetNextTarget\r
},\r
+ { // UfsDevConfig\r
+ UfsRwUfsDescriptor,\r
+ UfsRwUfsFlag,\r
+ UfsRwUfsAttribute\r
+ },\r
0, // UfsHostController\r
0, // UfsHcBase\r
0, // Capabilities\r
if ((Private->Luns.BitMask & (BIT0 << Index)) == 0) {\r
continue;\r
}\r
- \r
+\r
if (Private->Luns.Lun[Index] == UfsLun) {\r
break;\r
}\r
if ((Private->Luns.BitMask & (BIT0 << Index)) == 0) {\r
continue;\r
}\r
- \r
+\r
if (Private->Luns.Lun[Index] == UfsLun) {\r
break;\r
}\r
if ((Private->Luns.BitMask & (BIT0 << Index)) == 0) {\r
continue;\r
}\r
- \r
+\r
if (Private->Luns.Lun[Index] == UfsLun) {\r
break;\r
}\r
This->DriverBindingHandle,\r
Controller\r
);\r
- \r
+\r
return EFI_SUCCESS;\r
}\r
\r
UINTN UfsHcBase;\r
UINT32 Index;\r
UFS_UNIT_DESC UnitDescriptor;\r
+ UINT32 UnitDescriptorSize;\r
\r
Status = EFI_SUCCESS;\r
UfsHc = NULL;\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
- // the host shall send a NOP OUT UPIU to verify that the device UTP Layer is ready. \r
+ // At the end of the UFS Interconnect Layer initialization on both host and device side,\r
+ // the host shall send a NOP OUT UPIU to verify that the device UTP Layer is ready.\r
//\r
Status = UfsExecNopCmds (Private);\r
if (EFI_ERROR (Status)) {\r
// Check if 8 common luns are active and set corresponding bit mask.\r
// TODO: Parse device descriptor to decide if exposing RPMB LUN to upper layer for authentication access.\r
//\r
+ UnitDescriptorSize = sizeof (UFS_UNIT_DESC);\r
for (Index = 0; Index < 8; Index++) {\r
- Status = UfsRwDeviceDesc (Private, TRUE, UfsUnitDesc, (UINT8) Index, 0, &UnitDescriptor, sizeof (UFS_UNIT_DESC));\r
+ Status = UfsRwDeviceDesc (Private, TRUE, UfsUnitDesc, (UINT8) Index, 0, &UnitDescriptor, &UnitDescriptorSize);\r
if (EFI_ERROR (Status)) {\r
DEBUG ((DEBUG_ERROR, "Failed to read unit descriptor, index = %X, status = %r\n", Index, Status));\r
continue;\r
goto Error;\r
}\r
\r
- Status = gBS->InstallProtocolInterface (\r
+ Status = gBS->InstallMultipleProtocolInterfaces (\r
&Controller,\r
&gEfiExtScsiPassThruProtocolGuid,\r
- EFI_NATIVE_INTERFACE,\r
- &(Private->ExtScsiPassThru)\r
+ &(Private->ExtScsiPassThru),\r
+ &gEfiUfsDeviceConfigProtocolGuid,\r
+ &(Private->UfsDevConfig),\r
+ NULL\r
);\r
ASSERT_EFI_ERROR (Status);\r
\r
Error:\r
if (Private != NULL) {\r
if (Private->TmrlMapping != NULL) {\r
- UfsHc->Unmap (UfsHc, Private->TmrlMapping); \r
+ UfsHc->Unmap (UfsHc, Private->TmrlMapping);\r
}\r
if (Private->UtpTmrlBase != NULL) {\r
UfsHc->FreeBuffer (UfsHc, EFI_SIZE_TO_PAGES (Private->Nutmrs * sizeof (UTP_TMRD)), Private->UtpTmrlBase);\r
}\r
}\r
\r
- Status = gBS->UninstallProtocolInterface (\r
+ Status = gBS->UninstallMultipleProtocolInterfaces (\r
Controller,\r
&gEfiExtScsiPassThruProtocolGuid,\r
- &(Private->ExtScsiPassThru)\r
+ &(Private->ExtScsiPassThru),\r
+ &gEfiUfsDeviceConfigProtocolGuid,\r
+ &(Private->UfsDevConfig),\r
+ NULL\r
);\r
\r
if (EFI_ERROR (Status)) {\r