From nobody Thu Aug 27 01:03:34 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+113829+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+113829+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1705334395; cv=none; d=zohomail.com; s=zohoarc; b=KmZ4siVweS94xYcMVl1o+VbglVc4zFNwBCfXUUbHfMNmoZqmFFxRAwi0JOCmdvMgE47aS4c25yclHT8L/AW1DDTfbwAZipH/9Gd7uFAnpwwLZDW9NXxNcIkE/SMTd27byHDeQy4w9NAEzhBTYFff2j0fxLYRf8OiTOX9mCHiacQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1705334395; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=C5kJNWnXEczedaaaVd1yi2wNu7YfHWm6TGnbFRpnAtk=; b=gsJYZsltuIZOPsLVzk3Z3xTNHWjQ5FgUj5ByM0yDiJjPPY2crFnlY8x/DxrDoLJ49qbNy59aTGpLjKiAWpMJMVmHaCiELtTLmyuoEphg0UyFpqCuAvjd6fJcoTLVE2tLotfGMdh5/JGX5QeVWnQo8I83z4P0Az+V/cLS9eCcGSY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+113829+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1705334395695355.5960546868969; Mon, 15 Jan 2024 07:59:55 -0800 (PST) Return-Path: DKIM-Signature: a=rsa-sha256; bh=jxTWsDLdT/5j9FhUlm5lCD51AAo/3/kZaLcvsRB4Sc0=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding:Content-Type; s=20140610; t=1705334395; v=1; b=S+Nf51WPSOJ0z8gFDnBpqe59XMZEj3JHo40V98xq4R49Ad/JE3szOsOHrv7pKPq2/UGl+QzJ jORxXx3OeXtyE5wLpJVYdckyuVkrU+k/rTHPcB6DpQWs4QDeZNO0Y8VC4xeB0NiA3nnQWSLbgzB cnCFr0vYy9K+zaXpOWJj//So= X-Received: by 127.0.0.2 with SMTP id vPmBYY1788612xHbD4gSgGFg; Mon, 15 Jan 2024 07:59:55 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web10.85165.1705334394654893281 for ; Mon, 15 Jan 2024 07:59:54 -0800 X-Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-677-78nU2lN9ObaJIBeNYKt3mQ-1; Mon, 15 Jan 2024 10:59:52 -0500 X-MC-Unique: 78nU2lN9ObaJIBeNYKt3mQ-1 X-Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5394A3813F22 for ; Mon, 15 Jan 2024 15:59:52 +0000 (UTC) X-Received: from dobby.home.kraxel.org (unknown [10.39.193.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 257BF1121306; Mon, 15 Jan 2024 15:59:52 +0000 (UTC) X-Received: by dobby.home.kraxel.org (Postfix, from userid 1000) id D4FFAAC988; Mon, 15 Jan 2024 16:59:48 +0100 (CET) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: oliver@redhat.com, Gerd Hoffmann Subject: [edk2-devel] [PATCH v2 3/6] OvmfPkg/VirtNorFlashDxe: add a loop for NorFlashWriteBuffer calls. Date: Mon, 15 Jan 2024 16:59:45 +0100 Message-ID: <20240115155948.136499-4-kraxel@redhat.com> In-Reply-To: <20240115155948.136499-1-kraxel@redhat.com> References: <20240115155948.136499-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Subscribe: List-Help: 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,kraxel@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: dNtVMy91qgrA7D6xR8ElB9nXx1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1705334397818100013 Content-Type: text/plain; charset="utf-8"; x-default="true" Replace the two NorFlashWriteBuffer() calls with a loop containing a single NorFlashWriteBuffer() call. With the changes in place the code is able to handle updates larger than two P30_MAX_BUFFER_SIZE_IN_BYTES blocks, even though the patch does not actually change the size limit. Signed-off-by: Gerd Hoffmann Reviewed-by: Laszlo Ersek --- OvmfPkg/VirtNorFlashDxe/VirtNorFlash.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/OvmfPkg/VirtNorFlashDxe/VirtNorFlash.c b/OvmfPkg/VirtNorFlashD= xe/VirtNorFlash.c index 54251633d0ee..67610d6920f7 100644 --- a/OvmfPkg/VirtNorFlashDxe/VirtNorFlash.c +++ b/OvmfPkg/VirtNorFlashDxe/VirtNorFlash.c @@ -521,6 +521,7 @@ NorFlashWriteSingleBlock ( UINTN BlockAddress; UINT8 *OrigData; UINTN Start, End; + UINT32 Index, Count; =20 DEBUG ((DEBUG_BLKIO, "NorFlashWriteSingleBlock(Parameters: Lba=3D%ld, Of= fset=3D0x%x, *NumBytes=3D0x%x, Buffer @ 0x%08x)\n", Lba, Offset, *NumBytes,= Buffer)); =20 @@ -620,23 +621,17 @@ NorFlashWriteSingleBlock ( goto Exit; } =20 - Status =3D NorFlashWriteBuffer ( - Instance, - BlockAddress + Start, - P30_MAX_BUFFER_SIZE_IN_BYTES, - Instance->ShadowBuffer - ); - if (EFI_ERROR (Status)) { - goto Exit; - } - - if ((End - Start) > P30_MAX_BUFFER_SIZE_IN_BYTES) { + Count =3D (End - Start) / P30_MAX_BUFFER_SIZE_IN_BYTES; + for (Index =3D 0; Index < Count; Index++) { Status =3D NorFlashWriteBuffer ( Instance, - BlockAddress + Start + P30_MAX_BUFFER_SIZE_IN_BYTES, + BlockAddress + Start + Index * P30_MAX_BUFFER_SIZE_IN_BYT= ES, P30_MAX_BUFFER_SIZE_IN_BYTES, - Instance->ShadowBuffer + P30_MAX_BUFFER_SIZE_IN_BYTES + Instance->ShadowBuffer + Index * P30_MAX_BUFFER_SIZE_IN_B= YTES ); + if (EFI_ERROR (Status)) { + goto Exit; + } } =20 Exit: --=20 2.43.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 (#113829): https://edk2.groups.io/g/devel/message/113829 Mute This Topic: https://groups.io/mt/103741663/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-