public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Feng Tian <feng.tian@intel.com>
To: hao.a.wu@intel.com
Cc: edk2-devel@lists.01.org
Subject: [patch] MdeModulePkg/Ufs: ensure the DBC field of UTP PRDT is dword-aligned
Date: Tue, 18 Oct 2016 13:18:43 +0800	[thread overview]
Message-ID: <0fd6e31790f23ea8ad162df1fbc7ceb325770dcf.1476767885.git.feng.tian@intel.com> (raw)

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



             reply	other threads:[~2016-10-18  5:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-18  5:18 Feng Tian [this message]
2016-10-18  6:30 ` [patch] MdeModulePkg/Ufs: ensure the DBC field of UTP PRDT is dword-aligned Wu, Hao A

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0fd6e31790f23ea8ad162df1fbc7ceb325770dcf.1476767885.git.feng.tian@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox