[edk2-devel] [PATCH v3 4/6] [edk2-platforms] Silicon/SynQuacerPlatformFlashAccessLib: Fix the number of erase blocks

Masami Hiramatsu masami.hiramatsu at linaro.org
Fri Dec 10 06:51:04 UTC 2021


Fix the number of erase blocks by rounding up the result.
The erase blocks must include the last block covered by the
length bytes.

Signed-off-by: Masami Hiramatsu <masami.hiramatsu at linaro.org>
Reported-by: Kazuhiko Sakamoto <sakamoto.kazuhiko at socionext.com>
Reviewed-by: Leif Lindholm <leif at nuviainc.com>
---
 .../SynQuacerPlatformFlashAccessLib.c              |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.c b/Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.c
index bded74dc4f..ad4021cf59 100644
--- a/Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.c
+++ b/Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.c
@@ -283,7 +283,7 @@ PerformFlashWriteWithProgress (
   DEBUG ((DEBUG_INFO, "%a: erasing 0x%llx bytes at address %llx (LBA 0x%lx)\n",
     __FUNCTION__, Length, FlashAddress, Lba));
 
-  Status = Fvb->EraseBlocks (Fvb, Lba, Length / BlockSize,
+  Status = Fvb->EraseBlocks (Fvb, Lba, (Length + BlockSize - 1) / BlockSize,
                   EFI_LBA_LIST_TERMINATOR);
   if (EFI_ERROR (Status)) {
     DEBUG ((DEBUG_ERROR, "%a: Fvb->EraseBlocks () failed - %r\n",



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#84624): https://edk2.groups.io/g/devel/message/84624
Mute This Topic: https://groups.io/mt/87631128/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list