From nobody Sat Feb 7 06:54:58 2026 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+41415+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+41415+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1558949521; cv=none; d=zoho.com; s=zohoarc; b=jy34Dto3OcF0dn8PKKeeQj4T8pTSVEvT+yOw8J2UirmnFafSYP44uQDLKRi7ElRTIlw4rSEnPe3u/hft8DMN8duc+hCKDr/+em6bNE2Ih8tfNZ3Wpxk0Y8Tp875PA1RGgHmEiPlYYEWES0r/0LNI11WK3Kb4ZQ2/ldPcAf7uuxA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558949521; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=RnAPDG/dDllqL8/UPpozbU73sX3njpaueST+teeLwNI=; b=MOMZmLzkXiZjtPtQYhOpnUqB03w7pQ2f4Db9txZYdK971v+F5issWU2iaBqgnmKBMEQo0mk/qnA8dI+oIjw1FbYwdHU82/BPEHNbnhO6luh6iGvpf9s4m1U+vEartZ1SoClX8ChP8d5014LMPMj3LNbHPMUlvTxeR4OpJLew7yU= 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+41415+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 1558949521681534.4078074014162; Mon, 27 May 2019 02:32:01 -0700 (PDT) Return-Path: X-Received: from mga02.intel.com (mga02.intel.com []) by groups.io with SMTP; Mon, 27 May 2019 02:32:01 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 May 2019 02:32:00 -0700 X-ExtLoop1: 1 X-Received: from pg-nx11.altera.com ([10.104.4.26]) by orsmga008.jf.intel.com with ESMTP; 27 May 2019 02:31:59 -0700 From: "Loh, Tien Hock" To: devel@edk2.groups.io, thloh85@gmail.com Cc: "Tien Hock, Loh" , Leif Lindholm , Ard Biesheuvel Subject: [edk2-devel] [PATCH v2 7/7] EmbeddedPkg: Fix DwEmmc read/write size in preparing DMA size Date: Mon, 27 May 2019 17:30:28 +0800 Message-Id: <1558949428-190715-8-git-send-email-tien.hock.loh@intel.com> In-Reply-To: <1558949428-190715-1-git-send-email-tien.hock.loh@intel.com> References: <1558949428-190715-1-git-send-email-tien.hock.loh@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,tien.hock.loh@intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1558949521; bh=9M3KDKoAW9414lOYDi1jasR9/K8gGYValwKghA9NYGo=; h=Cc:Date:From:Reply-To:Subject:To; b=Z+KVhaOY9+wpgOPaqJse4RqQbJVpYtkPvzIkjhqtzV7vlgtXwHmDkpx3VFezUpVSiQS RZp8ufQSYcdurEOO+EBJLXZ676vbUQU8EA4jOZekGGk7mwWPXqMH70h6Lt62Pu8fR+69Q 5A2BNIUQ0HjU7NBI8P4uu/uAfu0zEs/k/yY= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 -- v2: - Fix white space issue --- EmbeddedPkg/Drivers/DwEmmcDxe/DwEmmcDxe.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/EmbeddedPkg/Drivers/DwEmmcDxe/DwEmmcDxe.c b/EmbeddedPkg/Driver= s/DwEmmcDxe/DwEmmcDxe.c index b57833458f..ec2fa7923b 100644 --- a/EmbeddedPkg/Drivers/DwEmmcDxe/DwEmmcDxe.c +++ b/EmbeddedPkg/Drivers/DwEmmcDxe/DwEmmcDxe.c @@ -493,7 +493,10 @@ PrepareDmaData ( =20 Cnt =3D (Length + DWEMMC_DMA_BUF_SIZE - 1) / DWEMMC_DMA_BUF_SIZE; Blks =3D (Length + DWEMMC_BLOCK_SIZE - 1) / DWEMMC_BLOCK_SIZE; - Length =3D DWEMMC_BLOCK_SIZE * Blks; + + if(Length >=3D DWEMMC_BLOCK_SIZE) { + Length =3D DWEMMC_BLOCK_SIZE * Blks; + } =20 for (Idx =3D 0; Idx < Cnt; Idx++) { (IdmacDesc + Idx)->Des0 =3D DWEMMC_IDMAC_DES0_OWN | DWEMMC_IDMAC_DES0_= CH | @@ -534,8 +537,14 @@ StartDma ( Data |=3D DWEMMC_IDMAC_ENABLE | DWEMMC_IDMAC_FB; MmioWrite32 (DWEMMC_BMOD, Data); =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); + } } =20 EFI_STATUS --=20 2.19.0 -=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 (#41415): https://edk2.groups.io/g/devel/message/41415 Mute This Topic: https://groups.io/mt/31807966/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-