From nobody Wed Feb 11 02:54:29 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1521216824450846.0151954001653; Fri, 16 Mar 2018 09:13:44 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 4DF12223FCF36; Fri, 16 Mar 2018 09:07:13 -0700 (PDT) Received: from mail-wr0-x242.google.com (mail-wr0-x242.google.com [IPv6:2a00:1450:400c:c0c::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 717612202E4AF for ; Fri, 16 Mar 2018 09:07:11 -0700 (PDT) Received: by mail-wr0-x242.google.com with SMTP id o1so12233445wro.10 for ; Fri, 16 Mar 2018 09:13:36 -0700 (PDT) Received: from localhost.localdomain ([105.142.191.63]) by smtp.gmail.com with ESMTPSA id n8sm7876242wrf.12.2018.03.16.09.13.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Mar 2018 09:13:34 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c0c::242; helo=mail-wr0-x242.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=5zWoz4XsfNzYO5i7jXhnZx2hjxS46cJVPJpCOxbm2Gs=; b=KQw8rg5K62YAEiZ11U4NGJJ5GmIsjmgI7kOqdr39mMT99aY7OXxPtcSoNnd+Rs0RyE CLFdA5eW1mRhG9XEQZ6b7ZVLrFOymP1RkEpAuyJD/3B85xWcTZtrv/GO+xebrTFhG2ms 1fGwJXPVUTdGfkooHZywaTZSeX7HX2NLqxui0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=5zWoz4XsfNzYO5i7jXhnZx2hjxS46cJVPJpCOxbm2Gs=; b=rMqFwZa4dxGea+jTC8cYiiPDRI3P7GuJg+Xe4KRb4Ff2VodscYdLcpV5uRWVryty1i OscN4D5icvS/aeYt9yQ7LSzh1VN2Hp9FuxyHbm7SCuCBoQ2fj/jCTL0TA8qN6JqWbKig T+WK5K7Wjw5anPsvWktPAxCJ/mrU9Z/Zh34TnP5vHo0ozpcvybLzPZsASS7hfOVeo7cw 6c3H6hUMfyR9tTwTIQp8ZHeBTYz5QdT/2CnepD9lSUwjfFMR89je+1M+5+VwvhyOPa5r b4hbQCj08mxVPlnbZHJeNguV2tQq3GyTMFr/NYCA7INLKtFp8SEEzNXZH1CGSN86W6wZ 3SUw== X-Gm-Message-State: AElRT7G7hN23NwjUA9807y4XWRsy+cZC3BeqYsvHWsgdh+H+prgK0shL Lg8VIm7Jbw+dxq0BAlfQ0+DaiQ7OoBs= X-Google-Smtp-Source: AG47ELtNWvQwgndmXoRQ2Mxr212Fp71sCXBjxpf2K51ZAiVbu8J+onj5DKsvxx+GZFtsr1FVIlu+9A== X-Received: by 10.223.135.148 with SMTP id b20mr2170826wrb.100.1521216815075; Fri, 16 Mar 2018 09:13:35 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Fri, 16 Mar 2018 16:13:19 +0000 Message-Id: <20180316161322.6756-4-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180316161322.6756-1-ard.biesheuvel@linaro.org> References: <20180316161322.6756-1-ard.biesheuvel@linaro.org> Subject: [edk2] [RFC PATCH edk2-platforms 3/6] Silicon/SynQuacerPlatformFlashAccessLib: skip empty blocks X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: leif.lindholm@linaro.org, Ard Biesheuvel MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Before adding more payload to the capsule which may be only partially occupied, add some logic to skip writing these blocks after erasing them. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQua= cerPlatformFlashAccessLib.c | 41 +++++++++++++++++--- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAcce= ssLib/SynQuacerPlatformFlashAccessLib.c b/Silicon/Socionext/SynQuacer/Libra= ry/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.c index 82fe3f74aa7f..0131e33a4fe7 100644 --- a/Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/S= ynQuacerPlatformFlashAccessLib.c +++ b/Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/S= ynQuacerPlatformFlashAccessLib.c @@ -115,6 +115,35 @@ GetFvbByAddress ( return Status; } =20 +/** + Check whether a buffer has any data in it, i.e., bytes with value !=3D 0= xff + + @param[in] Buffer Address of the buffer + @param[in] Length Size of the buffer + + @retval TRUE A non-0xff byte was found + @retval FALSE Buffer has 0xff bytes only + +**/ +STATIC +BOOLEAN +BufferHasData ( + IN VOID *Buffer, + IN UINTN Length + ) +{ + UINT8 *Data; + UINTN Index; + + Data =3D Buffer; + for (Index =3D 0; Index < Length; Index++) { + if (Data[Index] !=3D 0xff) { + return TRUE; + } + } + return FALSE; +} + /** Perform flash write operation. =20 @@ -257,11 +286,13 @@ PerformFlashWrite ( __FUNCTION__, BlockSize, Lba)); =20 NumBytes =3D BlockSize; - Status =3D Fvb->Write (Fvb, Lba, 0, &NumBytes, Buffer); - if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, - "%a: write of LBA 0x%lx failed - %r (NumBytes =3D=3D 0x%lx)\n", - __FUNCTION__, Lba, Status, NumBytes)); + if (BufferHasData (Buffer, NumBytes)) { + Status =3D Fvb->Write (Fvb, Lba, 0, &NumBytes, Buffer); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, + "%a: write of LBA 0x%lx failed - %r (NumBytes =3D=3D 0x%lx)\n", + __FUNCTION__, Lba, Status, NumBytes)); + } } =20 if (HaveBootGraphics) { --=20 2.15.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel