* [patch] MdeModulePkg/Ufs: ensure the DBC field of UTP PRDT is dword-aligned
@ 2016-10-18 5:18 Feng Tian
2016-10-18 6:30 ` Wu, Hao A
0 siblings, 1 reply; 2+ messages in thread
From: Feng Tian @ 2016-10-18 5:18 UTC (permalink / raw)
To: hao.a.wu; +Cc: edk2-devel
According to UFS Host Controller Spec(JESD223), the bits 1:0 of this
DataByteCount field shall be 11b to indicate Dword granularity.
But the size of UFS Request Sense Data Response defined in UFS Spec
(JESD220C) is 18 which is not Dword aligned, we would have to round
down to the multiple of 4 to fill the DBC field to avoid bring issue
on some UFS HCs.
Cc: Hao Wu <hao.a.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng Tian <feng.tian@intel.com>
---
MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
index 26986cb..a854264 100644
--- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
+++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
@@ -399,6 +399,11 @@ UfsInitUtpPrdt (
UINT32 RemainingLen;
UINT8 *Remaining;
UINTN PrdtNumber;
+
+ if ((BufferSize & (BIT0 | BIT1)) != 0) {
+ BufferSize &= ~(BIT0 | BIT1);
+ DEBUG ((EFI_D_WARN, "UfsInitUtpPrdt: The BufferSize [%d] is not dword-aligned!\n", BufferSize));
+ }
if (BufferSize == 0) {
return EFI_SUCCESS;
--
2.7.1.windows.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [patch] MdeModulePkg/Ufs: ensure the DBC field of UTP PRDT is dword-aligned
2016-10-18 5:18 [patch] MdeModulePkg/Ufs: ensure the DBC field of UTP PRDT is dword-aligned Feng Tian
@ 2016-10-18 6:30 ` Wu, Hao A
0 siblings, 0 replies; 2+ messages in thread
From: Wu, Hao A @ 2016-10-18 6:30 UTC (permalink / raw)
To: Tian, Feng; +Cc: edk2-devel@lists.01.org
The patch is good to me. Please update the copyright info before checkin.
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
Best Regards,
Hao Wu
> -----Original Message-----
> From: Tian, Feng
> Sent: Tuesday, October 18, 2016 1:19 PM
> To: Wu, Hao A
> Cc: edk2-devel@lists.01.org
> Subject: [patch] MdeModulePkg/Ufs: ensure the DBC field of UTP PRDT is
> dword-aligned
>
> According to UFS Host Controller Spec(JESD223), the bits 1:0 of this
> DataByteCount field shall be 11b to indicate Dword granularity.
>
> But the size of UFS Request Sense Data Response defined in UFS Spec
> (JESD220C) is 18 which is not Dword aligned, we would have to round
> down to the multiple of 4 to fill the DBC field to avoid bring issue
> on some UFS HCs.
>
> Cc: Hao Wu <hao.a.wu@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Feng Tian <feng.tian@intel.com>
> ---
> MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
> b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
> index 26986cb..a854264 100644
> --- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
> +++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
> @@ -399,6 +399,11 @@ UfsInitUtpPrdt (
> UINT32 RemainingLen;
> UINT8 *Remaining;
> UINTN PrdtNumber;
> +
> + if ((BufferSize & (BIT0 | BIT1)) != 0) {
> + BufferSize &= ~(BIT0 | BIT1);
> + DEBUG ((EFI_D_WARN, "UfsInitUtpPrdt: The BufferSize [%d] is not dword-
> aligned!\n", BufferSize));
> + }
>
> if (BufferSize == 0) {
> return EFI_SUCCESS;
> --
> 2.7.1.windows.2
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-10-18 6:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-18 5:18 [patch] MdeModulePkg/Ufs: ensure the DBC field of UTP PRDT is dword-aligned Feng Tian
2016-10-18 6:30 ` 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