public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v3] MdeModulePkg: Replace with UFS_UNIT_DESC to fix response timeout problem.
@ 2021-12-15  3:23 VincentX Ke
  2021-12-15  5:34 ` Wu, Hao A
  0 siblings, 1 reply; 2+ messages in thread
From: VincentX Ke @ 2021-12-15  3:23 UTC (permalink / raw)
  To: devel; +Cc: VincentX Ke, Hao A Wu, Ray Ni, Ian Chiu, Maggie Chu

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>
---
 .../Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.c     | 20 +++++++++----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.c b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.c
index b331c0f3e3..9ad1e19fe0 100644
--- a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.c
+++ b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.c
@@ -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,17 @@ 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);
       }
     }
 
-- 
2.18.0.windows.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v3] MdeModulePkg: Replace with UFS_UNIT_DESC to fix response timeout problem.
  2021-12-15  3:23 [PATCH v3] MdeModulePkg: Replace with UFS_UNIT_DESC to fix response timeout problem VincentX Ke
@ 2021-12-15  5:34 ` Wu, Hao A
  0 siblings, 0 replies; 2+ messages in thread
From: Wu, Hao A @ 2021-12-15  5:34 UTC (permalink / raw)
  To: Ke, VincentX, devel@edk2.groups.io; +Cc: Ni, Ray, Chiu, Ian, Chu, Maggie

Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Will hold the merge a couple of days to see if comments from other reviewers.

Best Regards,
Hao Wu

> -----Original Message-----
> From: Ke, VincentX <vincentx.ke@intel.com>
> Sent: Wednesday, December 15, 2021 11:23 AM
> To: devel@edk2.groups.io
> Cc: Ke, VincentX <vincentx.ke@intel.com>; Wu, Hao A
> <hao.a.wu@intel.com>; Ni, Ray <ray.ni@intel.com>; Chiu, Ian
> <Ian.chiu@intel.com>; Chu, Maggie <maggie.chu@intel.com>
> Subject: [PATCH v3] MdeModulePkg: Replace with UFS_UNIT_DESC to fix
> response 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>
> ---
>  .../Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.c     | 20 +++++++++----------
>  1 file changed, 9 insertions(+), 11 deletions(-)
> 
> diff --git a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.c
> b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.c
> index b331c0f3e3..9ad1e19fe0 100644
> --- a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.c
> +++ b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsBlockIoPei.c
> @@ -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,17 @@
> 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);
>        }
>      }
> 
> --
> 2.18.0.windows.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-12-15  5:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-15  3:23 [PATCH v3] MdeModulePkg: Replace with UFS_UNIT_DESC to fix response timeout problem VincentX Ke
2021-12-15  5:34 ` Wu, Hao A

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox