public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v2 0/5] fix UFS driver
@ 2017-01-16 12:22 Haojian Zhuang
  2017-01-16 12:22 ` [PATCH v2 1/5] MdeModuelPkg/UfsPassThruDxe: fix to identify 32 bits address mode Haojian Zhuang
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Haojian Zhuang @ 2017-01-16 12:22 UTC (permalink / raw)
  To: feng.tian, leif.lindholm, ard.biesheuvel, edk2-devel; +Cc: Haojian Zhuang

v2:
  1. Drop unnecessary patches.
  2. Append fixes on UfsBlockIoPei driver.

v1:
  1. Fix issues in UFS driver.
  2. Add PhyInit in UFS driver.
  3. Add retry in ScsiDisk for UFS device.

Haojian Zhuang (5):
  MdeModuelPkg/UfsPassThruDxe: fix to identify 32 bits address mode
  MdeModulePkg/UfsPassThruDxe: fix the bit in UFS_HC_UTRLDBR_OFFSET reg
  MdeModulePkg/UfsBlockIoPei: fix the bit in UFS_HC_UTRLDBR_OFFSET reg
  MdeModulePkg/UfsPassThruDxe: fix initialize OCS value to 0x0F
  MdeModulePkg/UfsBlockIoPei: fix initialize OCS value to 0x0F

 MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c          | 12 +++++++-----
 MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c | 16 +++++++++-------
 2 files changed, 16 insertions(+), 12 deletions(-)

-- 
2.7.4



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

* [PATCH v2 1/5] MdeModuelPkg/UfsPassThruDxe: fix to identify 32 bits address mode
  2017-01-16 12:22 [PATCH v2 0/5] fix UFS driver Haojian Zhuang
@ 2017-01-16 12:22 ` Haojian Zhuang
  2017-01-16 12:22 ` [PATCH v2 2/5] MdeModulePkg/UfsPassThruDxe: fix the bit in UFS_HC_UTRLDBR_OFFSET reg Haojian Zhuang
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Haojian Zhuang @ 2017-01-16 12:22 UTC (permalink / raw)
  To: feng.tian, leif.lindholm, ard.biesheuvel, edk2-devel; +Cc: Haojian Zhuang

When UFS_HC_CAP_64ADDR bit is set, it means 64-bit address,
not 32-bit address.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
Reviewed-by: Feng Tian <feng.tian@intel.com>
---
 MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
index 3bd6dad..2b95f80 100644
--- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
+++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
@@ -1749,9 +1749,9 @@ UfsAllocateAlignCommonBuffer (
   EDKII_UFS_HOST_CONTROLLER_PROTOCOL   *UfsHc;
 
   if ((Private->Capabilities & UFS_HC_CAP_64ADDR) == UFS_HC_CAP_64ADDR) {
-    Is32BitAddr = TRUE;
-  } else {
     Is32BitAddr = FALSE;
+  } else {
+    Is32BitAddr = TRUE;
   }
 
   UfsHc  = Private->UfsHostController;
-- 
2.7.4



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

* [PATCH v2 2/5] MdeModulePkg/UfsPassThruDxe: fix the bit in UFS_HC_UTRLDBR_OFFSET reg
  2017-01-16 12:22 [PATCH v2 0/5] fix UFS driver Haojian Zhuang
  2017-01-16 12:22 ` [PATCH v2 1/5] MdeModuelPkg/UfsPassThruDxe: fix to identify 32 bits address mode Haojian Zhuang
@ 2017-01-16 12:22 ` Haojian Zhuang
  2017-01-16 12:22 ` [PATCH v2 3/5] MdeModulePkg/UfsBlockIoPei: " Haojian Zhuang
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Haojian Zhuang @ 2017-01-16 12:22 UTC (permalink / raw)
  To: feng.tian, leif.lindholm, ard.biesheuvel, edk2-devel; +Cc: Haojian Zhuang

When UPIU packet is sent, (BIT0 << Slot) should be set according
to context.  But BIT0 is used without Slot when UfsWaitMemSet ()
is invoked.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
Reviewed-by: Feng Tian <feng.tian@intel.com>
---
 MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
index 2b95f80..3793c6a 100644
--- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
+++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
@@ -954,7 +954,7 @@ UfsRwDeviceDesc (
   //
   // Wait for the completion of the transfer request.
   //  
-  Status = UfsWaitMemSet (Private, UFS_HC_UTRLDBR_OFFSET, BIT0, 0, Packet.Timeout);
+  Status = UfsWaitMemSet (Private, UFS_HC_UTRLDBR_OFFSET, BIT0 << Slot, 0, Packet.Timeout);
   if (EFI_ERROR (Status)) {
     goto Exit;
   }
@@ -1077,7 +1077,7 @@ UfsRwAttributes (
   //
   // Wait for the completion of the transfer request.
   //  
-  Status = UfsWaitMemSet (Private, UFS_HC_UTRLDBR_OFFSET, BIT0, 0, Packet.Timeout);
+  Status = UfsWaitMemSet (Private, UFS_HC_UTRLDBR_OFFSET, BIT0 << Slot, 0, Packet.Timeout);
   if (EFI_ERROR (Status)) {
     goto Exit;
   }
@@ -1201,7 +1201,7 @@ UfsRwFlags (
   //
   // Wait for the completion of the transfer request.
   //  
-  Status = UfsWaitMemSet (Private, UFS_HC_UTRLDBR_OFFSET, BIT0, 0, Packet.Timeout);
+  Status = UfsWaitMemSet (Private, UFS_HC_UTRLDBR_OFFSET, BIT0 << Slot, 0, Packet.Timeout);
   if (EFI_ERROR (Status)) {
     goto Exit;
   }
@@ -1368,7 +1368,7 @@ UfsExecNopCmds (
   //
   // Wait for the completion of the transfer request.
   //  
-  Status = UfsWaitMemSet (Private, UFS_HC_UTRLDBR_OFFSET, BIT0, 0, UFS_TIMEOUT);
+  Status = UfsWaitMemSet (Private, UFS_HC_UTRLDBR_OFFSET, BIT0 << Slot, 0, UFS_TIMEOUT);
   if (EFI_ERROR (Status)) {
     goto Exit;
   }
@@ -1534,7 +1534,7 @@ UfsExecScsiCmds (
   //
   // Wait for the completion of the transfer request.
   // 
-  Status = UfsWaitMemSet (Private, UFS_HC_UTRLDBR_OFFSET, BIT0, 0, Packet->Timeout);
+  Status = UfsWaitMemSet (Private, UFS_HC_UTRLDBR_OFFSET, BIT0 << TransReq->Slot, 0, Packet->Timeout);
   if (EFI_ERROR (Status)) {
     goto Exit;
   }
-- 
2.7.4



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

* [PATCH v2 3/5] MdeModulePkg/UfsBlockIoPei: fix the bit in UFS_HC_UTRLDBR_OFFSET reg
  2017-01-16 12:22 [PATCH v2 0/5] fix UFS driver Haojian Zhuang
  2017-01-16 12:22 ` [PATCH v2 1/5] MdeModuelPkg/UfsPassThruDxe: fix to identify 32 bits address mode Haojian Zhuang
  2017-01-16 12:22 ` [PATCH v2 2/5] MdeModulePkg/UfsPassThruDxe: fix the bit in UFS_HC_UTRLDBR_OFFSET reg Haojian Zhuang
@ 2017-01-16 12:22 ` Haojian Zhuang
  2017-01-16 12:22 ` [PATCH v2 4/5] MdeModulePkg/UfsPassThruDxe: fix initialize OCS value to 0x0F Haojian Zhuang
  2017-01-16 12:22 ` [PATCH v2 5/5] MdeModulePkg/UfsBlockIoPei: " Haojian Zhuang
  4 siblings, 0 replies; 9+ messages in thread
From: Haojian Zhuang @ 2017-01-16 12:22 UTC (permalink / raw)
  To: feng.tian, leif.lindholm, ard.biesheuvel, edk2-devel; +Cc: Haojian Zhuang

When UPIU packet is sent, (BIT0 << Slot) should be set according
to context.  But BIT0 is used without Slot when UfsWaitMemSet ()
is invoked.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
---
 MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c
index 7e90ecf..cccacce 100644
--- a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c
+++ b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c
@@ -842,7 +842,7 @@ UfsRwDeviceDesc (
   // Wait for the completion of the transfer request.
   //  
   Address = Private->UfsHcBase + UFS_HC_UTRLDBR_OFFSET;  
-  Status = UfsWaitMemSet (Address, BIT0, 0, Packet.Timeout);
+  Status = UfsWaitMemSet (Address, BIT0 << Slot, 0, Packet.Timeout);
   if (EFI_ERROR (Status)) {
     goto Exit;
   }
@@ -956,7 +956,7 @@ UfsRwAttributes (
   // Wait for the completion of the transfer request.
   //  
   Address = Private->UfsHcBase + UFS_HC_UTRLDBR_OFFSET;  
-  Status = UfsWaitMemSet (Address, BIT0, 0, Packet.Timeout);
+  Status = UfsWaitMemSet (Address, BIT0 << Slot, 0, Packet.Timeout);
   if (EFI_ERROR (Status)) {
     goto Exit;
   }
@@ -1070,7 +1070,7 @@ UfsRwFlags (
   // Wait for the completion of the transfer request.
   //  
   Address = Private->UfsHcBase + UFS_HC_UTRLDBR_OFFSET;  
-  Status = UfsWaitMemSet (Address, BIT0, 0, Packet.Timeout);
+  Status = UfsWaitMemSet (Address, BIT0 << Slot, 0, Packet.Timeout);
   if (EFI_ERROR (Status)) {
     goto Exit;
   }
@@ -1228,7 +1228,7 @@ UfsExecNopCmds (
   // Wait for the completion of the transfer request.
   //  
   Address = Private->UfsHcBase + UFS_HC_UTRLDBR_OFFSET;  
-  Status = UfsWaitMemSet (Address, BIT0, 0, UFS_TIMEOUT);
+  Status = UfsWaitMemSet (Address, BIT0 << Slot, 0, UFS_TIMEOUT);
   if (EFI_ERROR (Status)) {
     goto Exit;
   }
@@ -1312,7 +1312,7 @@ UfsExecScsiCmds (
   // Wait for the completion of the transfer request.
   //  
   Address = Private->UfsHcBase + UFS_HC_UTRLDBR_OFFSET;  
-  Status = UfsWaitMemSet (Address, BIT0, 0, Packet->Timeout);
+  Status = UfsWaitMemSet (Address, BIT0 << Slot, 0, Packet->Timeout);
   if (EFI_ERROR (Status)) {
     goto Exit;
   }
-- 
2.7.4



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

* [PATCH v2 4/5] MdeModulePkg/UfsPassThruDxe: fix initialize OCS value to 0x0F
  2017-01-16 12:22 [PATCH v2 0/5] fix UFS driver Haojian Zhuang
                   ` (2 preceding siblings ...)
  2017-01-16 12:22 ` [PATCH v2 3/5] MdeModulePkg/UfsBlockIoPei: " Haojian Zhuang
@ 2017-01-16 12:22 ` Haojian Zhuang
  2017-01-16 12:22 ` [PATCH v2 5/5] MdeModulePkg/UfsBlockIoPei: " Haojian Zhuang
  4 siblings, 0 replies; 9+ messages in thread
From: Haojian Zhuang @ 2017-01-16 12:22 UTC (permalink / raw)
  To: feng.tian, leif.lindholm, ard.biesheuvel, edk2-devel; +Cc: Haojian Zhuang

The OCS value should be initiliazed as 0x0F according to UFS spec.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
Reviewed-by: Feng Tian <feng.tian@intel.com>
---
 MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
index 3793c6a..9432c63 100644
--- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
+++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
@@ -551,6 +551,7 @@ UfsCreateScsiCommandDesc (
   Trd->Int    = UFS_INTERRUPT_COMMAND;
   Trd->Dd     = DataDirection;
   Trd->Ct     = UFS_STORAGE_COMMAND_TYPE;
+  Trd->Ocs    = 0x0F;
   Trd->UcdBa  = (UINT32)RShiftU64 ((UINT64)CmdDescPhyAddr, 7);
   Trd->UcdBaU = (UINT32)RShiftU64 ((UINT64)CmdDescPhyAddr, 32);
   Trd->RuL    = (UINT16)DivU64x32 ((UINT64)ROUNDUP8 (sizeof (UTP_RESPONSE_UPIU)), sizeof (UINT32));
@@ -719,6 +720,7 @@ UfsCreateNopCommandDesc (
   Trd->Int    = UFS_INTERRUPT_COMMAND;
   Trd->Dd     = 0x00;
   Trd->Ct     = UFS_STORAGE_COMMAND_TYPE;
+  Trd->Ocs    = 0x0F;
   Trd->UcdBa  = (UINT32)RShiftU64 ((UINT64)CmdDescPhyAddr, 7);
   Trd->UcdBaU = (UINT32)RShiftU64 ((UINT64)CmdDescPhyAddr, 32);
   Trd->RuL    = (UINT16)DivU64x32 ((UINT64)ROUNDUP8 (sizeof (UTP_NOP_IN_UPIU)), sizeof (UINT32));
-- 
2.7.4



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

* [PATCH v2 5/5] MdeModulePkg/UfsBlockIoPei: fix initialize OCS value to 0x0F
  2017-01-16 12:22 [PATCH v2 0/5] fix UFS driver Haojian Zhuang
                   ` (3 preceding siblings ...)
  2017-01-16 12:22 ` [PATCH v2 4/5] MdeModulePkg/UfsPassThruDxe: fix initialize OCS value to 0x0F Haojian Zhuang
@ 2017-01-16 12:22 ` Haojian Zhuang
  2017-01-16 16:02   ` Leif Lindholm
  4 siblings, 1 reply; 9+ messages in thread
From: Haojian Zhuang @ 2017-01-16 12:22 UTC (permalink / raw)
  To: feng.tian, leif.lindholm, ard.biesheuvel, edk2-devel; +Cc: Haojian Zhuang

The OCS value should be initiliazed as 0x0F according to UFS spec.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
---
 MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c
index cccacce..67042b7 100644
--- a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c
+++ b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c
@@ -480,6 +480,7 @@ UfsCreateScsiCommandDesc (
   Trd->Int    = UFS_INTERRUPT_COMMAND;
   Trd->Dd     = DataDirection;
   Trd->Ct     = UFS_STORAGE_COMMAND_TYPE;
+  Trd->Ocs    = 0x0F;
   Trd->UcdBa  = (UINT32)RShiftU64 ((UINT64)(UINTN)CommandUpiu, 7);
   Trd->UcdBaU = (UINT32)RShiftU64 ((UINT64)(UINTN)CommandUpiu, 32);
   Trd->RuL    = (UINT16)DivU64x32 ((UINT64)ROUNDUP8 (sizeof (UTP_RESPONSE_UPIU)), sizeof (UINT32));
@@ -637,6 +638,7 @@ UfsCreateNopCommandDesc (
   Trd->Int    = UFS_INTERRUPT_COMMAND;
   Trd->Dd     = 0x00;
   Trd->Ct     = UFS_STORAGE_COMMAND_TYPE;
+  Trd->Ocs    = 0x0F;
   Trd->UcdBa  = (UINT32)RShiftU64 ((UINT64)(UINTN)NopOutUpiu, 7);
   Trd->UcdBaU = (UINT32)RShiftU64 ((UINT64)(UINTN)NopOutUpiu, 32);
   Trd->RuL    = (UINT16)DivU64x32 ((UINT64)ROUNDUP8 (sizeof (UTP_NOP_IN_UPIU)), sizeof (UINT32));
-- 
2.7.4



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

* Re: [PATCH v2 5/5] MdeModulePkg/UfsBlockIoPei: fix initialize OCS value to 0x0F
  2017-01-16 12:22 ` [PATCH v2 5/5] MdeModulePkg/UfsBlockIoPei: " Haojian Zhuang
@ 2017-01-16 16:02   ` Leif Lindholm
  2017-01-17  2:06     ` Tian, Feng
  0 siblings, 1 reply; 9+ messages in thread
From: Leif Lindholm @ 2017-01-16 16:02 UTC (permalink / raw)
  To: Haojian Zhuang; +Cc: feng.tian, ard.biesheuvel, edk2-devel

On Mon, Jan 16, 2017 at 08:22:58PM +0800, Haojian Zhuang wrote:
> The OCS value should be initiliazed as 0x0F according to UFS spec.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
> ---
>  MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c
> index cccacce..67042b7 100644
> --- a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c
> +++ b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c
> @@ -480,6 +480,7 @@ UfsCreateScsiCommandDesc (
>    Trd->Int    = UFS_INTERRUPT_COMMAND;
>    Trd->Dd     = DataDirection;
>    Trd->Ct     = UFS_STORAGE_COMMAND_TYPE;
> +  Trd->Ocs    = 0x0F;

Could these be given some #define in UfsHci.h rather than inline magic
numbers?

Regards,

Leif

>    Trd->UcdBa  = (UINT32)RShiftU64 ((UINT64)(UINTN)CommandUpiu, 7);
>    Trd->UcdBaU = (UINT32)RShiftU64 ((UINT64)(UINTN)CommandUpiu, 32);
>    Trd->RuL    = (UINT16)DivU64x32 ((UINT64)ROUNDUP8 (sizeof (UTP_RESPONSE_UPIU)), sizeof (UINT32));
> @@ -637,6 +638,7 @@ UfsCreateNopCommandDesc (
>    Trd->Int    = UFS_INTERRUPT_COMMAND;
>    Trd->Dd     = 0x00;
>    Trd->Ct     = UFS_STORAGE_COMMAND_TYPE;
> +  Trd->Ocs    = 0x0F;
>    Trd->UcdBa  = (UINT32)RShiftU64 ((UINT64)(UINTN)NopOutUpiu, 7);
>    Trd->UcdBaU = (UINT32)RShiftU64 ((UINT64)(UINTN)NopOutUpiu, 32);
>    Trd->RuL    = (UINT16)DivU64x32 ((UINT64)ROUNDUP8 (sizeof (UTP_NOP_IN_UPIU)), sizeof (UINT32));
> -- 
> 2.7.4
> 


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

* Re: [PATCH v2 5/5] MdeModulePkg/UfsBlockIoPei: fix initialize OCS value to 0x0F
  2017-01-16 16:02   ` Leif Lindholm
@ 2017-01-17  2:06     ` Tian, Feng
  2017-01-17 10:56       ` Leif Lindholm
  0 siblings, 1 reply; 9+ messages in thread
From: Tian, Feng @ 2017-01-17  2:06 UTC (permalink / raw)
  To: Leif Lindholm, Haojian Zhuang
  Cc: ard.biesheuvel@linaro.org, edk2-devel@lists.01.org, Tian, Feng

Agree.

How about naming it as UFS_TRD_OCS_INIT_VALUE?

If there is no objection, I will help make this change and push these patches into EDKII trunk.

Series reviewed-by: Feng Tian <feng.tian@intel.com>

Thanks
Feng

-----Original Message-----
From: Leif Lindholm [mailto:leif.lindholm@linaro.org] 
Sent: Tuesday, January 17, 2017 12:03 AM
To: Haojian Zhuang <haojian.zhuang@linaro.org>
Cc: Tian, Feng <feng.tian@intel.com>; ard.biesheuvel@linaro.org; edk2-devel@lists.01.org
Subject: Re: [PATCH v2 5/5] MdeModulePkg/UfsBlockIoPei: fix initialize OCS value to 0x0F

On Mon, Jan 16, 2017 at 08:22:58PM +0800, Haojian Zhuang wrote:
> The OCS value should be initiliazed as 0x0F according to UFS spec.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
> ---
>  MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c 
> b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c
> index cccacce..67042b7 100644
> --- a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c
> +++ b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c
> @@ -480,6 +480,7 @@ UfsCreateScsiCommandDesc (
>    Trd->Int    = UFS_INTERRUPT_COMMAND;
>    Trd->Dd     = DataDirection;
>    Trd->Ct     = UFS_STORAGE_COMMAND_TYPE;
> +  Trd->Ocs    = 0x0F;

Could these be given some #define in UfsHci.h rather than inline magic numbers?

Regards,

Leif

>    Trd->UcdBa  = (UINT32)RShiftU64 ((UINT64)(UINTN)CommandUpiu, 7);
>    Trd->UcdBaU = (UINT32)RShiftU64 ((UINT64)(UINTN)CommandUpiu, 32);
>    Trd->RuL    = (UINT16)DivU64x32 ((UINT64)ROUNDUP8 (sizeof (UTP_RESPONSE_UPIU)), sizeof (UINT32));
> @@ -637,6 +638,7 @@ UfsCreateNopCommandDesc (
>    Trd->Int    = UFS_INTERRUPT_COMMAND;
>    Trd->Dd     = 0x00;
>    Trd->Ct     = UFS_STORAGE_COMMAND_TYPE;
> +  Trd->Ocs    = 0x0F;
>    Trd->UcdBa  = (UINT32)RShiftU64 ((UINT64)(UINTN)NopOutUpiu, 7);
>    Trd->UcdBaU = (UINT32)RShiftU64 ((UINT64)(UINTN)NopOutUpiu, 32);
>    Trd->RuL    = (UINT16)DivU64x32 ((UINT64)ROUNDUP8 (sizeof (UTP_NOP_IN_UPIU)), sizeof (UINT32));
> --
> 2.7.4
> 


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

* Re: [PATCH v2 5/5] MdeModulePkg/UfsBlockIoPei: fix initialize OCS value to 0x0F
  2017-01-17  2:06     ` Tian, Feng
@ 2017-01-17 10:56       ` Leif Lindholm
  0 siblings, 0 replies; 9+ messages in thread
From: Leif Lindholm @ 2017-01-17 10:56 UTC (permalink / raw)
  To: Tian, Feng
  Cc: Haojian Zhuang, ard.biesheuvel@linaro.org,
	edk2-devel@lists.01.org

On Tue, Jan 17, 2017 at 02:06:51AM +0000, Tian, Feng wrote:
> Agree.
> 
> How about naming it as UFS_TRD_OCS_INIT_VALUE?
> 
> If there is no objection, I will help make this change and push
> these patches into EDKII trunk.

That sounds excellent to me, thanks!

/
    Leif

> Series reviewed-by: Feng Tian <feng.tian@intel.com>
> 
> Thanks
> Feng
> 
> -----Original Message-----
> From: Leif Lindholm [mailto:leif.lindholm@linaro.org] 
> Sent: Tuesday, January 17, 2017 12:03 AM
> To: Haojian Zhuang <haojian.zhuang@linaro.org>
> Cc: Tian, Feng <feng.tian@intel.com>; ard.biesheuvel@linaro.org; edk2-devel@lists.01.org
> Subject: Re: [PATCH v2 5/5] MdeModulePkg/UfsBlockIoPei: fix initialize OCS value to 0x0F
> 
> On Mon, Jan 16, 2017 at 08:22:58PM +0800, Haojian Zhuang wrote:
> > The OCS value should be initiliazed as 0x0F according to UFS spec.
> > 
> > Contributed-under: TianoCore Contribution Agreement 1.0
> > Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
> > ---
> >  MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c 
> > b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c
> > index cccacce..67042b7 100644
> > --- a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c
> > +++ b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c
> > @@ -480,6 +480,7 @@ UfsCreateScsiCommandDesc (
> >    Trd->Int    = UFS_INTERRUPT_COMMAND;
> >    Trd->Dd     = DataDirection;
> >    Trd->Ct     = UFS_STORAGE_COMMAND_TYPE;
> > +  Trd->Ocs    = 0x0F;
> 
> Could these be given some #define in UfsHci.h rather than inline magic numbers?
> 
> Regards,
> 
> Leif
> 
> >    Trd->UcdBa  = (UINT32)RShiftU64 ((UINT64)(UINTN)CommandUpiu, 7);
> >    Trd->UcdBaU = (UINT32)RShiftU64 ((UINT64)(UINTN)CommandUpiu, 32);
> >    Trd->RuL    = (UINT16)DivU64x32 ((UINT64)ROUNDUP8 (sizeof (UTP_RESPONSE_UPIU)), sizeof (UINT32));
> > @@ -637,6 +638,7 @@ UfsCreateNopCommandDesc (
> >    Trd->Int    = UFS_INTERRUPT_COMMAND;
> >    Trd->Dd     = 0x00;
> >    Trd->Ct     = UFS_STORAGE_COMMAND_TYPE;
> > +  Trd->Ocs    = 0x0F;
> >    Trd->UcdBa  = (UINT32)RShiftU64 ((UINT64)(UINTN)NopOutUpiu, 7);
> >    Trd->UcdBaU = (UINT32)RShiftU64 ((UINT64)(UINTN)NopOutUpiu, 32);
> >    Trd->RuL    = (UINT16)DivU64x32 ((UINT64)ROUNDUP8 (sizeof (UTP_NOP_IN_UPIU)), sizeof (UINT32));
> > --
> > 2.7.4
> > 


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

end of thread, other threads:[~2017-01-17 10:56 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-16 12:22 [PATCH v2 0/5] fix UFS driver Haojian Zhuang
2017-01-16 12:22 ` [PATCH v2 1/5] MdeModuelPkg/UfsPassThruDxe: fix to identify 32 bits address mode Haojian Zhuang
2017-01-16 12:22 ` [PATCH v2 2/5] MdeModulePkg/UfsPassThruDxe: fix the bit in UFS_HC_UTRLDBR_OFFSET reg Haojian Zhuang
2017-01-16 12:22 ` [PATCH v2 3/5] MdeModulePkg/UfsBlockIoPei: " Haojian Zhuang
2017-01-16 12:22 ` [PATCH v2 4/5] MdeModulePkg/UfsPassThruDxe: fix initialize OCS value to 0x0F Haojian Zhuang
2017-01-16 12:22 ` [PATCH v2 5/5] MdeModulePkg/UfsBlockIoPei: " Haojian Zhuang
2017-01-16 16:02   ` Leif Lindholm
2017-01-17  2:06     ` Tian, Feng
2017-01-17 10:56       ` Leif Lindholm

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