From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.115, mailfrom: tien.hock.loh@intel.com) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by groups.io with SMTP; Wed, 08 May 2019 23:54:37 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 May 2019 23:54:37 -0700 X-ExtLoop1: 1 Received: from pgsmsx112-dag.png.intel.com (HELO PGSMSX112.gar.corp.intel.com) ([10.108.55.234]) by fmsmga004.fm.intel.com with ESMTP; 08 May 2019 23:54:36 -0700 Received: from pgsmsx110.gar.corp.intel.com ([169.254.13.159]) by PGSMSX112.gar.corp.intel.com ([169.254.3.40]) with mapi id 14.03.0415.000; Thu, 9 May 2019 14:54:29 +0800 From: "Loh, Tien Hock" To: Leif Lindholm CC: "devel@edk2.groups.io" , "thloh85@gmail.com" , Ard Biesheuvel Subject: Re: [[PATCH v2] 7/7] EmbeddedPkg: Fix DwEmmc driver bugs Thread-Topic: [[PATCH v2] 7/7] EmbeddedPkg: Fix DwEmmc driver bugs Thread-Index: AQHVAWBIr6eEtxAtDUeMQxyW5ImkBKZYy+2AgAmY5QA= Date: Thu, 9 May 2019 06:54:28 +0000 Message-ID: References: <1556854023-5486-1-git-send-email-tien.hock.loh@intel.com> <1556854023-5486-8-git-send-email-tien.hock.loh@intel.com> <20190503121903.4wvqxfx6xucaliwc@bivouac.eciton.net> In-Reply-To: <20190503121903.4wvqxfx6xucaliwc@bivouac.eciton.net> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.600.7 dlp-reaction: no-action x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNWEyYzFiNzAtMmMzMi00YWUwLTliNTctNzRiMTc3MjNlY2VlIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiMm1hZTFDQ1hvc1FGR2RtZkxNeFoyeGZZVDFcL1M4V2VnTml4UW9ESzUyamI2SkZhTFY4bVdHa3ZZTGpmUTdNU2MifQ== x-originating-ip: [172.30.20.206] MIME-Version: 1.0 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > -----Original Message----- > From: Leif Lindholm > Sent: Friday, May 3, 2019 8:19 PM > To: Loh, Tien Hock > Cc: devel@edk2.groups.io; thloh85@gmail.com; Ard Biesheuvel > > Subject: Re: [[PATCH v2] 7/7] EmbeddedPkg: Fix DwEmmc driver bugs >=20 > On Fri, May 03, 2019 at 11:27:03AM +0800, tien.hock.loh@intel.com wrote: > > From: "Tien Hock, Loh" > > > > Add support for reading data that is less than DWEMMC_BLOCK_SIZE, > > otherwise it would read bigger data than requested and cause errors > > > > Signed-off-by: "Tien Hock, Loh" > > Cc: Leif Lindholm > > Cc: Ard Biesheuvel > > --- > > EmbeddedPkg/Drivers/DwEmmcDxe/DwEmmcDxe.c | 16 > +++++++++++++--- > > 1 file changed, 13 insertions(+), 3 deletions(-) > > > > diff --git a/EmbeddedPkg/Drivers/DwEmmcDxe/DwEmmcDxe.c > > b/EmbeddedPkg/Drivers/DwEmmcDxe/DwEmmcDxe.c > > index c38b5a4..4183ad4 100644 > > --- a/EmbeddedPkg/Drivers/DwEmmcDxe/DwEmmcDxe.c > > +++ b/EmbeddedPkg/Drivers/DwEmmcDxe/DwEmmcDxe.c > > @@ -495,7 +495,10 @@ PrepareDmaData ( > > > > Cnt =3D (Length + DWEMMC_DMA_BUF_SIZE - 1) / > DWEMMC_DMA_BUF_SIZE; > > Blks =3D (Length + DWEMMC_BLOCK_SIZE - 1) / DWEMMC_BLOCK_SIZE; >=20 > Could we add a BlockSize variable instead?... Can you clarify further on this? I didn't change anything on DWEMMC_BLOCK_S= IZE. Do you want me to assign DWEMMC_BLOCK_SIZE to a BlockSize variable and= use it?=20 >=20 > > - Length =3D DWEMMC_BLOCK_SIZE * Blks; > > + > > + if(Length >=3D DWEMMC_BLOCK_SIZE) { > > + Length =3D DWEMMC_BLOCK_SIZE * Blks; } > > > > for (Idx =3D 0; Idx < Cnt; Idx++) { > > (IdmacDesc + Idx)->Des0 =3D DWEMMC_IDMAC_DES0_OWN | > > DWEMMC_IDMAC_DES0_CH | @@ -533,11 +536,18 @@ StartDma ( > > Data |=3D DWEMMC_CTRL_INT_EN | DWEMMC_CTRL_DMA_EN | > DWEMMC_CTRL_IDMAC_EN; > > MmioWrite32 (DWEMMC_CTRL, Data); > > Data =3D MmioRead32 (DWEMMC_BMOD); > > + >=20 > Drop unrelated whitespace addition. OK noted. >=20 > > Data |=3D DWEMMC_IDMAC_ENABLE | DWEMMC_IDMAC_FB; > > MmioWrite32 (DWEMMC_BMOD, Data); > > >=20 > And do > if (Length < DWEMMC_BLOCK_SIZE) { > BlockSize =3D Length; > } else { > BlockSize =3D DWEMMC_BLOCK_SIZE; > } >=20 > MmioWrite32 (DWEMMC_BLKSIZ, BlockSize); > MmioWrite32 (DWEMMC_BYTCNT, Length); > instead? >=20 > (I have no comments on the patches I have not responded to at this point, > but I want to see their proper subject lines before giving a R-b:) OK, noted with thanks! >=20 > / > Leif >=20 > > - MmioWrite32 (DWEMMC_BLKSIZ, DWEMMC_BLOCK_SIZE); > > - MmioWrite32 (DWEMMC_BYTCNT, Length); > > + if(Length < DWEMMC_BLOCK_SIZE) { > > + MmioWrite32 (DWEMMC_BLKSIZ, Length); > > + MmioWrite32 (DWEMMC_BYTCNT, Length); } else { > > + MmioWrite32 (DWEMMC_BLKSIZ, DWEMMC_BLOCK_SIZE); > > + MmioWrite32 (DWEMMC_BYTCNT, Length); } > > } > > > > EFI_STATUS > > -- > > 2.2.2 > >