Haojian,

The bit 5 is Flags.U of RESPONSE UPIU, which means the Target has less data 
bytes to transfer than the Initiator requested.

That's why we use "Packet->InTransferLength -= ResTranCount;" to return actual 
transfer data length.

It's not related data direction checking.

The bit 6 is Flags.O, which means the Target has more data bytes to transfer 
than the Initiator requested. It's not designated for your below intention.

Thanks
Feng

-----Original Message-----
From: edk2-devel [mailto:[email protected]] On Behalf Of Haojian 
Zhuang
Sent: Friday, January 6, 2017 2:52 PM
To: Tian, Feng <[email protected]>; [email protected]; 
[email protected]; [email protected]
Cc: Haojian Zhuang <[email protected]>
Subject: [edk2] [PATCH 1/9] Ufs: fix data direction checking

BIT6 is used in read operation, and BIT5 is used in write operation.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Haojian Zhuang <[email protected]>
---
 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..9b77a89 100644
--- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
+++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
@@ -1564,7 +1564,7 @@ UfsExecScsiCmds (
 
   if (TransReq->Trd->Ocs == 0) {
     if (Packet->DataDirection == EFI_EXT_SCSI_DATA_DIRECTION_READ) {
-      if ((Response->Flags & BIT5) == BIT5) {
+      if ((Response->Flags & BIT6) == BIT6) {
         ResTranCount = Response->ResTranCount;
         SwapLittleEndianToBigEndian ((UINT8*)&ResTranCount, sizeof (UINT32));
         Packet->InTransferLength -= ResTranCount; @@ -2321,7 +2321,7 @@ 
ProcessAsyncTaskList (
 
         if (TransReq->Trd->Ocs == 0) {
           if (Packet->DataDirection == EFI_EXT_SCSI_DATA_DIRECTION_READ) {
-            if ((Response->Flags & BIT5) == BIT5) {
+            if ((Response->Flags & BIT6) == BIT6) {
               ResTranCount = Response->ResTranCount;
               SwapLittleEndianToBigEndian ((UINT8*)&ResTranCount, sizeof 
(UINT32));
               Packet->InTransferLength -= ResTranCount;
--
2.7.4

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to