From: Hao Wu <hao.a.wu@intel.com>
To: edk2-devel@lists.01.org
Cc: Hao Wu <hao.a.wu@intel.com>, Star Zeng <star.zeng@intel.com>
Subject: [PATCH 2/2] MdeModulePkg/Ufs: Set 'Data Segment Length' field for Write Descriptor
Date: Thu, 20 Jul 2017 10:18:35 +0800 [thread overview]
Message-ID: <20170720021835.10808-3-hao.a.wu@intel.com> (raw)
In-Reply-To: <20170720021835.10808-1-hao.a.wu@intel.com>
According to the Universal Flash Storage (UFS) Version 2.1 (JESD220C) spec
Section 10.7.8.5, the DATA SEGMENT LENGTH field of the UPIU shall also be
set to number of descriptor bytes to write.
The origin codes miss the above operation.
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
---
MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c | 3 +++
MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c | 3 +++
2 files changed, 6 insertions(+)
diff --git a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c
index 1ef6c8878b..9c72c1dede 100644
--- a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c
+++ b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c
@@ -407,6 +407,9 @@ UfsInitQueryRequestUpiu (
if (Opcode == UtpQueryFuncOpcodeWrDesc) {
CopyMem (QueryReq + 1, Data, DataSize);
+
+ SwapLittleEndianToBigEndian ((UINT8*)&DataSize, sizeof (UINT16));
+ QueryReq->DataSegLen = (UINT16)DataSize;
}
return EFI_SUCCESS;
diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
index 5fa635523a..4b7df74501 100644
--- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
+++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
@@ -478,6 +478,9 @@ UfsInitQueryRequestUpiu (
if (Opcode == UtpQueryFuncOpcodeWrDesc) {
CopyMem (QueryReq + 1, Data, DataSize);
+
+ SwapLittleEndianToBigEndian ((UINT8*)&DataSize, sizeof (UINT16));
+ QueryReq->DataSegLen = (UINT16)DataSize;
}
return EFI_SUCCESS;
--
2.12.0.windows.1
next prev parent reply other threads:[~2017-07-20 2:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-20 2:18 [PATCH 0/2] Implementation of UFS Device Config Protocol Hao Wu
2017-07-20 2:18 ` [PATCH 1/2] MdeModulePkg/UfsPassThruDxe: Add impl " Hao Wu
2017-07-20 2:18 ` Hao Wu [this message]
2017-08-02 8:08 ` [PATCH 0/2] Implementation " Zeng, Star
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=20170720021835.10808-3-hao.a.wu@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