From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 7AE219415B2 for ; Tue, 16 Jan 2024 12:56:23 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=FjYt/EZihlWQzy5AE5Hww/MfFAT7tu6uD+URk2/SF74=; c=relaxed/simple; d=groups.io; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1705409782; v=1; b=BfvjJQdWfIyZbrjPg907prHATqkhqlWg8ufy5PDKim43ChQLSzla5XMgkj7FtzmhBrwdtSHK WCrRa/QR9L+kgO953bohjzdxMlE2TtRkTc3CCLTnQUYo6VHzRzOtLVJJwQvI9/vPq+T9tgWrkim 39Tqd4WGTS67XJIKoKgRtSCE= X-Received: by 127.0.0.2 with SMTP id KQzRYY7687511xAESfMweDjX; Tue, 16 Jan 2024 04:56:22 -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.web11.12806.1705409781519179488 for ; Tue, 16 Jan 2024 04:56:21 -0800 X-Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-561-ziRAnje5Mr62Jqyj_bY1qg-1; Tue, 16 Jan 2024 07:56:19 -0500 X-MC-Unique: ziRAnje5Mr62Jqyj_bY1qg-1 X-Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (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 15554102587F for ; Tue, 16 Jan 2024 12:56:19 +0000 (UTC) X-Received: from [10.39.194.248] (unknown [10.39.194.248]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 750592166B33; Tue, 16 Jan 2024 12:56:18 +0000 (UTC) Message-ID: Date: Tue, 16 Jan 2024 13:56:17 +0100 MIME-Version: 1.0 Subject: Re: [edk2-devel] [PATCH v2 3/6] OvmfPkg/VirtNorFlashDxe: add a loop for NorFlashWriteBuffer calls. To: devel@edk2.groups.io, kraxel@redhat.com Cc: oliver@redhat.com References: <20240115155948.136499-1-kraxel@redhat.com> <20240115155948.136499-4-kraxel@redhat.com> From: "Laszlo Ersek" In-Reply-To: <20240115155948.136499-4-kraxel@redhat.com> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 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,lersek@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: tLacdpyXWeB6TyUiZe5kuOsix7686176AA= Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=BfvjJQdW; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=redhat.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io On 1/15/24 16:59, Gerd Hoffmann wrote: > Replace the two NorFlashWriteBuffer() calls with a loop containing a > single NorFlashWriteBuffer() call. >=20 > 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. >=20 > Signed-off-by: Gerd Hoffmann > --- > OvmfPkg/VirtNorFlashDxe/VirtNorFlash.c | 21 ++++++++------------- > 1 file changed, 8 insertions(+), 13 deletions(-) >=20 > diff --git a/OvmfPkg/VirtNorFlashDxe/VirtNorFlash.c b/OvmfPkg/VirtNorFlas= hDxe/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, = Offset=3D0x%x, *NumBytes=3D0x%x, Buffer @ 0x%08x)\n", Lba, Offset, *NumByte= s, 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_B= YTES, > P30_MAX_BUFFER_SIZE_IN_BYTES, > - Instance->ShadowBuffer + P30_MAX_BUFFER_SIZE_IN_BYTES > + Instance->ShadowBuffer + Index * P30_MAX_BUFFER_SIZE_IN= _BYTES > ); > + if (EFI_ERROR (Status)) { > + goto Exit; > + } > } > =20 > Exit: Reviewed-by: Laszlo Ersek -=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 (#113894): https://edk2.groups.io/g/devel/message/113894 Mute This Topic: https://groups.io/mt/103741663/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/19134562= 12/xyzzy [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-