summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg
diff options
context:
space:
mode:
authorKe, VincentX <vincentx.ke@intel.com>2021-12-23 15:07:52 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2022-01-04 02:23:14 +0000
commitd463c56ddd2e321c78baff730fd32fe1a177fae0 (patch)
treed93eb1f858db567519bed051f1a11cb363b803c2 /MdeModulePkg
parentc095122d4b5f3152417cd97dabecfe31cc3b6508 (diff)
downloadedk2-d463c56ddd2e321c78baff730fd32fe1a177fae0.tar.gz
edk2-d463c56ddd2e321c78baff730fd32fe1a177fae0.tar.bz2
edk2-d463c56ddd2e321c78baff730fd32fe1a177fae0.zip
MdeModulePkg: Replace with UFS_UNIT_DESC to fix timeout problem
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3714 Replace with UFS_UNIT_DESC to fix response timeout problem. Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Ian Chiu <Ian.chiu@intel.com> Cc: Maggie Chu <maggie.chu@intel.com> Signed-off-by: VincentX Ke <vincentx.ke@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.c b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.c
index b331c0f3e3..b8651ff998 100644
--- a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.c
+++ b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.c
@@ -1,6 +1,6 @@
/** @file
- Copyright (c) 2014 - 2019, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2014 - 2021, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -1037,9 +1037,9 @@ InitializeUfsBlockIoPeim (
UFS_PEIM_HC_PRIVATE_DATA *Private;
EDKII_UFS_HOST_CONTROLLER_PPI *UfsHcPpi;
UINT32 Index;
- UFS_CONFIG_DESC Config;
UINTN MmioBase;
UINT8 Controller;
+ UFS_UNIT_DESC UnitDescriptor;
//
// Shadow this PEIM to run from memory
@@ -1126,19 +1126,18 @@ InitializeUfsBlockIoPeim (
}
//
- // Get Ufs Device's Lun Info by reading Configuration Descriptor.
+ // Check if 8 common luns are active and set corresponding bit mask.
//
- Status = UfsRwDeviceDesc (Private, TRUE, UfsConfigDesc, 0, 0, &Config, sizeof (UFS_CONFIG_DESC));
- if (EFI_ERROR (Status)) {
- DEBUG ((DEBUG_ERROR, "Ufs Get Configuration Descriptor Error, Status = %r\n", Status));
- Controller++;
- continue;
- }
-
for (Index = 0; Index < UFS_PEIM_MAX_LUNS; Index++) {
- if (Config.UnitDescConfParams[Index].LunEn != 0) {
- Private->Luns.BitMask |= (BIT0 << Index);
+ Status = UfsRwDeviceDesc (Private, TRUE, UfsUnitDesc, (UINT8)Index, 0, &UnitDescriptor, sizeof (UFS_UNIT_DESC));
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "Fail to read UFS Unit Descriptor, Index = %X, Status = %r\n", Index, Status));
+ continue;
+ }
+
+ if (UnitDescriptor.LunEn == 0x1) {
DEBUG ((DEBUG_INFO, "Ufs %d Lun %d is enabled\n", Controller, Index));
+ Private->Luns.BitMask |= (BIT0 << Index);
}
}