From nobody Tue Nov 26 18:26:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+47849+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+47849+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1569239324; cv=none; d=zoho.com; s=zohoarc; b=HuHVPhBeLOWl4tw568q8rOtN7SRA66pVdzwgsWQtv04rkHFDNHPljBMb8PDMRqYCjvZD/0FrnvNffxEpBgjT+JQrZFn13MDDsnXDbN0cErtMCV7pnAkqi9anTStHIirx7ojbIVpmPdOPJfeXSgYz38niABOop6i3sWrdxpm+h6w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569239324; h=Cc:Date:From:List-Id:List-Unsubscribe:Message-ID:Reply-To:Sender:Subject:To:ARC-Authentication-Results; bh=Azf6lQLjLXPK3JSWH0FFOIpB2C8g2hGd9Or4ehBy0js=; b=PG9uSQEpWtBDFfoaxlWsuzJ4CBxKTUABKjH7fuZzSDnw8gl8dWn6n9YSDgzSn/3wS/Y+zNN8T6r1yhwnwd03Fsrqa1QNpxDLDqasbIu+MbxucG/mr/UY44qN18EzbfW1xuO/y+E7iaE6ToNvDZG9yS2KU8pt+AA8oSlkoot6rbU= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+47849+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1569239324882473.0534288280828; Mon, 23 Sep 2019 04:48:44 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id SDseYY1788612xU9RgxfHcFu; Mon, 23 Sep 2019 04:48:44 -0700 X-Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by groups.io with SMTP; Mon, 23 Sep 2019 04:48:44 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Sep 2019 04:48:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,539,1559545200"; d="scan'208";a="339690570" X-Received: from sagraw2-desk1.amr.corp.intel.com ([134.134.154.163]) by orsmga004.jf.intel.com with ESMTP; 23 Sep 2019 04:48:43 -0700 From: "Agrawal, Sachin" To: devel@edk2.groups.io Cc: "Agrawal, Sachin" , Hao A Wu , Ray Ni Subject: [edk2-devel] [PATCH] MdeModulePkg/UfsPassThru : Fix UFS flag read from Query Resp UPIU Date: Mon, 23 Sep 2019 04:48:17 -0700 Message-Id: <74c3980e787f85e769890c2677b4a0b1ae1e85a8.1569238938.git.sachin.agrawal@intel.com> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,sachin.agrawal@intel.com X-Gm-Message-State: Li4WI6UtGzeFO33yVANDDGNjx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1569239324; bh=VyHjbbaatoilY1eD+3UDg9x/dDZfyj7GoJZ8IOQQJ/k=; h=Cc:Date:From:Reply-To:Subject:To; b=WY3AeylltQl33JFNZS4Q/bj4/eG17IscyPCOFBNZfhAC8o3YlVxTxxnWsXST0irpqSW wT4pvNbjU4Bhl7RbmMXMrV3EQR9IUfhp+j0o0xYZTI5XRK/hWk4cWml/2M+SqOa9cnAnO rPaGQmA3ZGQU7V26sXpwa5hw7mncprALkug= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=3D2208 Test: Verified the Fix by sending command to set fPowerOnWPEn flag and then reading it to verify the set value. Cc: Hao A Wu Cc: Ray Ni Signed-off-by: Sachin Agrawal Reviewed-by: Hao A Wu --- 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 ( } =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.Value + // + *Value =3D *((UINT8*)&(QueryResp->Tsf.Value) + 3); } else { Status =3D EFI_DEVICE_ERROR; } diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c b/MdeModu= lePkg/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)) =3D *((UINT8*)&(QueryResp->Tsf.Value= ) + 3); break; case UtpQueryFuncOpcodeRdAttr: case UtpQueryFuncOpcodeWrAttr: --=20 2.14.3.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#47849): https://edk2.groups.io/g/devel/message/47849 Mute This Topic: https://groups.io/mt/34263041/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-