/** @file\r
\r
- Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.<BR>\r
+ Copyright (c) 2014 - 2021, Intel Corporation. All rights reserved.<BR>\r
SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
UFS_PEIM_HC_PRIVATE_DATA *Private;\r
EDKII_UFS_HOST_CONTROLLER_PPI *UfsHcPpi;\r
UINT32 Index;\r
- UFS_CONFIG_DESC Config;\r
UINTN MmioBase;\r
UINT8 Controller;\r
+ UFS_UNIT_DESC UnitDescriptor;\r
\r
//\r
// Shadow this PEIM to run from memory\r
}\r
\r
//\r
- // Get Ufs Device's Lun Info by reading Configuration Descriptor.\r
+ // Check if 8 common luns are active and set corresponding bit mask.\r
//\r
- Status = UfsRwDeviceDesc (Private, TRUE, UfsConfigDesc, 0, 0, &Config, sizeof (UFS_CONFIG_DESC));\r
- if (EFI_ERROR (Status)) {\r
- DEBUG ((DEBUG_ERROR, "Ufs Get Configuration Descriptor Error, Status = %r\n", Status));\r
- Controller++;\r
- continue;\r
- }\r
-\r
for (Index = 0; Index < UFS_PEIM_MAX_LUNS; Index++) {\r
- if (Config.UnitDescConfParams[Index].LunEn != 0) {\r
- Private->Luns.BitMask |= (BIT0 << Index);\r
+ Status = UfsRwDeviceDesc (Private, TRUE, UfsUnitDesc, (UINT8)Index, 0, &UnitDescriptor, sizeof (UFS_UNIT_DESC));\r
+ if (EFI_ERROR (Status)) {\r
+ DEBUG ((DEBUG_ERROR, "Fail to read UFS Unit Descriptor, Index = %X, Status = %r\n", Index, Status));\r
+ continue;\r
+ }\r
+\r
+ if (UnitDescriptor.LunEn == 0x1) {\r
DEBUG ((DEBUG_INFO, "Ufs %d Lun %d is enabled\n", Controller, Index));\r
+ Private->Luns.BitMask |= (BIT0 << Index);\r
}\r
}\r
\r