From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id C529A1A1E3C for ; Mon, 17 Oct 2016 23:30:23 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP; 17 Oct 2016 23:30:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,508,1473145200"; d="scan'208";a="891073611" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga003.jf.intel.com with ESMTP; 17 Oct 2016 23:30:24 -0700 Received: from fmsmsx116.amr.corp.intel.com (10.18.116.20) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 17 Oct 2016 23:30:22 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx116.amr.corp.intel.com (10.18.116.20) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 17 Oct 2016 23:30:22 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.209]) by shsmsx102.ccr.corp.intel.com ([169.254.2.206]) with mapi id 14.03.0248.002; Tue, 18 Oct 2016 14:30:19 +0800 From: "Wu, Hao A" To: "Tian, Feng" CC: "edk2-devel@lists.01.org" Thread-Topic: [patch] MdeModulePkg/Ufs: ensure the DBC field of UTP PRDT is dword-aligned Thread-Index: AQHSKP9UwQD7qtgyJESoqNg0VEw3S6Ctv8gw Date: Tue, 18 Oct 2016 06:30:18 +0000 Message-ID: References: <0fd6e31790f23ea8ad162df1fbc7ceb325770dcf.1476767885.git.feng.tian@intel.com> In-Reply-To: <0fd6e31790f23ea8ad162df1fbc7ceb325770dcf.1476767885.git.feng.tian@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 Subject: Re: [patch] MdeModulePkg/Ufs: ensure the DBC field of UTP PRDT is dword-aligned X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Oct 2016 06:30:23 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable The patch is good to me. Please update the copyright info before checkin. Reviewed-by: Hao Wu Best Regards, Hao Wu > -----Original Message----- > From: Tian, Feng > Sent: Tuesday, October 18, 2016 1:19 PM > To: Wu, Hao A > Cc: edk2-devel@lists.01.org > Subject: [patch] MdeModulePkg/Ufs: ensure the DBC field of UTP PRDT is > dword-aligned >=20 > According to UFS Host Controller Spec(JESD223), the bits 1:0 of this > DataByteCount field shall be 11b to indicate Dword granularity. >=20 > But the size of UFS Request Sense Data Response defined in UFS Spec > (JESD220C) is 18 which is not Dword aligned, we would have to round > down to the multiple of 4 to fill the DBC field to avoid bring issue > on some UFS HCs. >=20 > Cc: Hao Wu > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Feng Tian > --- > MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c | 5 +++++ > 1 file changed, 5 insertions(+) >=20 > diff --git a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c > b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c > index 26986cb..a854264 100644 > --- a/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c > +++ b/MdeModulePkg/Bus/Ufs/UfsPassThruDxe/UfsPassThruHci.c > @@ -399,6 +399,11 @@ UfsInitUtpPrdt ( > UINT32 RemainingLen; > UINT8 *Remaining; > UINTN PrdtNumber; > + > + if ((BufferSize & (BIT0 | BIT1)) !=3D 0) { > + BufferSize &=3D ~(BIT0 | BIT1); > + DEBUG ((EFI_D_WARN, "UfsInitUtpPrdt: The BufferSize [%d] is not dwor= d- > aligned!\n", BufferSize)); > + } >=20 > if (BufferSize =3D=3D 0) { > return EFI_SUCCESS; > -- > 2.7.1.windows.2