* [PATCH] MdeModulePkg/UfsPassThru : Fix UFS flag read from Query Resp UPIU
@ 2019-09-23 11:48 sachin.agrawal
2019-09-26 1:40 ` [edk2-devel] " Wu, Hao A
0 siblings, 1 reply; 3+ messages in thread
From: sachin.agrawal @ 2019-09-23 11:48 UTC (permalink / raw)
To: devel; +Cc: Agrawal, Sachin, Hao A Wu, Ray Ni
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: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Sachin Agrawal <sachin.agrawal@intel.com>
---
MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c | 5 ++++-
MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c | 5 ++++-
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:
--
2.14.3.windows.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [edk2-devel] [PATCH] MdeModulePkg/UfsPassThru : Fix UFS flag read from Query Resp UPIU
2019-09-23 11:48 [PATCH] MdeModulePkg/UfsPassThru : Fix UFS flag read from Query Resp UPIU sachin.agrawal
@ 2019-09-26 1:40 ` Wu, Hao A
2019-10-15 1:56 ` Wu, Hao A
0 siblings, 1 reply; 3+ messages in thread
From: Wu, Hao A @ 2019-09-26 1:40 UTC (permalink / raw)
To: devel@edk2.groups.io, Agrawal, Sachin; +Cc: Ni, Ray
> -----Original Message-----
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Agrawal, Sachin
> Sent: Monday, September 23, 2019 7:48 PM
> To: devel@edk2.groups.io
> Cc: Agrawal, Sachin; Wu, Hao A; Ni, Ray
> Subject: [edk2-devel] [PATCH] MdeModulePkg/UfsPassThru : Fix UFS flag
> read from Query Resp UPIU
When pushing the patch, I will change the subject a little bit to:
MdeModulePkg/Ufs : Fix UFS flag read from Query Resp UPIU
Other than this, the patch looks good to me:
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Best Regards,
Hao Wu
>
> 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: Hao A Wu <hao.a.wu@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
>
> Signed-off-by: Sachin Agrawal <sachin.agrawal@intel.com>
> ---
> MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c | 5 ++++-
> MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c | 5 ++++-
> 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:
> --
> 2.14.3.windows.1
>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [edk2-devel] [PATCH] MdeModulePkg/UfsPassThru : Fix UFS flag read from Query Resp UPIU
2019-09-26 1:40 ` [edk2-devel] " Wu, Hao A
@ 2019-10-15 1:56 ` Wu, Hao A
0 siblings, 0 replies; 3+ messages in thread
From: Wu, Hao A @ 2019-10-15 1:56 UTC (permalink / raw)
To: devel@edk2.groups.io, Wu, Hao A, Agrawal, Sachin; +Cc: Ni, Ray
> -----Original Message-----
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Wu, Hao A
> Sent: Thursday, September 26, 2019 9:40 AM
> To: devel@edk2.groups.io; Agrawal, Sachin
> Cc: Ni, Ray
> Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/UfsPassThru : Fix UFS
> flag read from Query Resp UPIU
>
> > -----Original Message-----
> > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> > Agrawal, Sachin
> > Sent: Monday, September 23, 2019 7:48 PM
> > To: devel@edk2.groups.io
> > Cc: Agrawal, Sachin; Wu, Hao A; Ni, Ray
> > Subject: [edk2-devel] [PATCH] MdeModulePkg/UfsPassThru : Fix UFS flag
> > read from Query Resp UPIU
>
>
> When pushing the patch, I will change the subject a little bit to:
> MdeModulePkg/Ufs : Fix UFS flag read from Query Resp UPIU
>
> Other than this, the patch looks good to me:
> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Patch pushed via commit cd70b1a71d.
Best Regards,
Hao Wu
>
> Best Regards,
> Hao Wu
>
>
> >
> > 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: Hao A Wu <hao.a.wu@intel.com>
> > Cc: Ray Ni <ray.ni@intel.com>
> >
> > Signed-off-by: Sachin Agrawal <sachin.agrawal@intel.com>
> > ---
> > MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c | 5 ++++-
> > MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c | 5 ++++-
> > 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:
> > --
> > 2.14.3.windows.1
> >
> >
> >
>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-10-15 1:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-23 11:48 [PATCH] MdeModulePkg/UfsPassThru : Fix UFS flag read from Query Resp UPIU sachin.agrawal
2019-09-26 1:40 ` [edk2-devel] " Wu, Hao A
2019-10-15 1:56 ` Wu, Hao A
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox