summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Bus
diff options
context:
space:
mode:
authorAgrawal, Sachin <sachin.agrawal@intel.com>2019-09-23 19:48:17 +0800
committerHao A Wu <hao.a.wu@intel.com>2019-10-15 09:54:37 +0800
commitcd70b1a71d30d0fff4c549a309682fdf127aaae6 (patch)
treed7a74e631be807a5b2cb72aa93ddb94de5bbd0fd /MdeModulePkg/Bus
parent4d05a4b709ce52d4649698f887a1358246fa4437 (diff)
downloadedk2-cd70b1a71d30d0fff4c549a309682fdf127aaae6.tar.gz
edk2-cd70b1a71d30d0fff4c549a309682fdf127aaae6.tar.bz2
edk2-cd70b1a71d30d0fff4c549a309682fdf127aaae6.zip
MdeModulePkg/Ufs: Fix UFS flag read from Query Resp UPIU
As per UFS spec, flag value is stored in the 'last byte' of value field. Existing code is attempting to read first byte. REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2208 Test: Verified the Fix by sending command to set fPowerOnWPEn flag and then reading it to verify the set value. Cc: Ray Ni <ray.ni@intel.com> Signed-off-by: Sachin Agrawal <sachin.agrawal@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Diffstat (limited to 'MdeModulePkg/Bus')
-rw-r--r--MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c5
-rw-r--r--MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c5
2 files changed, 8 insertions, 2 deletions
diff --git a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c
index e8ef0c2a7a..e450f6f49d 100644
--- a/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c
+++ b/MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c
@@ -977,7 +977,10 @@ UfsRwFlags (
}
if (Trd->Ocs == 0) {
- *Value = (UINT8)QueryResp->Tsf.Value;
+ //
+ // The 'FLAG VALUE' field is at byte offset 3 of QueryResp->Tsf.Value
+ //
+ *Value = *((UINT8*)&(QueryResp->Tsf.Value) + 3);
} else {
Status = EFI_DEVICE_ERROR;
}
diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
index 0b95e7dddd..93ac958f65 100644
--- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
+++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c
@@ -863,7 +863,10 @@ UfsGetReturnDataFromQueryResponse (
case UtpQueryFuncOpcodeSetFlag:
case UtpQueryFuncOpcodeClrFlag:
case UtpQueryFuncOpcodeTogFlag:
- CopyMem (Packet->DataBuffer, &QueryResp->Tsf.Value, sizeof (UINT8));
+ //
+ // The 'FLAG VALUE' field is at byte offset 3 of QueryResp->Tsf.Value
+ //
+ *((UINT8*)(Packet->DataBuffer)) = *((UINT8*)&(QueryResp->Tsf.Value) + 3);
break;
case UtpQueryFuncOpcodeRdAttr:
case UtpQueryFuncOpcodeWrAttr: