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>
This commit is contained in:
Agrawal, Sachin 2019-09-23 19:48:17 +08:00 committed by Hao A Wu
parent 4d05a4b709
commit cd70b1a71d
2 changed files with 8 additions and 2 deletions

View File

@ -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;
}

View File

@ -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: