From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.31, mailfrom: hao.a.wu@intel.com) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by groups.io with SMTP; Wed, 25 Sep 2019 18:41:18 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Sep 2019 18:41:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,549,1559545200"; d="scan'208";a="219197379" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga002.fm.intel.com with ESMTP; 25 Sep 2019 18:41:17 -0700 Received: from fmsmsx602.amr.corp.intel.com (10.18.126.82) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 25 Sep 2019 18:41:16 -0700 Received: from fmsmsx602.amr.corp.intel.com (10.18.126.82) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 25 Sep 2019 18:40:27 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Wed, 25 Sep 2019 18:40:27 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.32]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.132]) with mapi id 14.03.0439.000; Thu, 26 Sep 2019 09:40:22 +0800 From: "Wu, Hao A" 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 Thread-Topic: [edk2-devel] [PATCH] MdeModulePkg/UfsPassThru : Fix UFS flag read from Query Resp UPIU Thread-Index: AQHVcgTd/yaOFny/skmuk4n5T0uRBqc5OYSw Date: Thu, 26 Sep 2019 01:40:22 +0000 Message-ID: References: <74c3980e787f85e769890c2677b4a0b1ae1e85a8.1569238938.git.sachin.agrawal@intel.com> In-Reply-To: <74c3980e787f85e769890c2677b4a0b1ae1e85a8.1569238938.git.sachin.agrawal@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: hao.a.wu@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > -----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 Best Regards, Hao Wu >=20 > As per UFS spec, flag value is stored in the 'last byte' of value > field. Existing code is attempting to read first byte. >=20 > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2208 >=20 > Test: Verified the Fix by sending command to set fPowerOnWPEn flag > and then reading it to verify the set value. >=20 > Cc: Hao A Wu > Cc: Ray Ni >=20 > Signed-off-by: Sachin Agrawal > --- > MdeModulePkg/Bus/Ufs/UfsBlockIoPei/UfsHci.c | 5 ++++- > MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c | 5 ++++- > 2 files changed, 8 insertions(+), 2 deletions(-) >=20 > 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 ( > } >=20 > if (Trd->Ocs =3D=3D 0) { > - *Value =3D (UINT8)QueryResp->Tsf.Value; > + // > + // The 'FLAG VALUE' field is at byte offset 3 of QueryResp->Tsf.Val= ue > + // > + *Value =3D *((UINT8*)&(QueryResp->Tsf.Value) + 3); > } else { > Status =3D 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.V= alue > + // > + *((UINT8*)(Packet->DataBuffer)) =3D *((UINT8*)&(QueryResp->Tsf.Va= lue) > + 3); > break; > case UtpQueryFuncOpcodeRdAttr: > case UtpQueryFuncOpcodeWrAttr: > -- > 2.14.3.windows.1 >=20 >=20 >=20