diff mbox

[edk2,1/9] Ufs: fix data direction checking

Message ID 1483685538-11058-2-git-send-email-haojian.zhuang@linaro.org
State New
Headers show

Commit Message

Haojian Zhuang Jan. 6, 2017, 6:52 a.m. UTC
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 <haojian.zhuang@linaro.org>

---
 MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.7.4

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Comments

Haojian Zhuang Jan. 6, 2017, 8:33 a.m. UTC | #1
Hi Feng,

Yes, it's a different flag. My fix is wrong.

Best Regards
Haojian

On 6 January 2017 at 15:08, Tian, Feng <feng.tian@intel.com> wrote:
> 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:edk2-devel-bounces@lists.01.org] On Behalf Of Haojian Zhuang

> Sent: Friday, January 6, 2017 2:52 PM

> To: Tian, Feng <feng.tian@intel.com>; leif.lindholm@linaro.org; ard.biesheuvel@linaro.org; edk2-devel@lists.01.org

> Cc: Haojian Zhuang <haojian.zhuang@linaro.org>

> 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 <haojian.zhuang@linaro.org>

> ---

>  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

> edk2-devel@lists.01.org

> https://lists.01.org/mailman/listinfo/edk2-devel

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
diff mbox

Patch

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;