public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] QuarkPlatformPkg/PlatformFlashAccessLib: Skip the update if content is same.
@ 2016-10-09 12:32 Jiewen Yao
  2016-10-11  0:37 ` Kinney, Michael D
  0 siblings, 1 reply; 3+ messages in thread
From: Jiewen Yao @ 2016-10-09 12:32 UTC (permalink / raw)
  To: edk2-devel
  Cc: Michael D Kinney, Kelly Steele, Feng Tian, Star Zeng, Liming Gao,
	Chao Zhang

This is enhancement for PlatformFlashAccessLib to skip flash write
if the content is same in new image.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Kelly Steele <kelly.steele@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
---
 QuarkPlatformPkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccessLibDxe.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/QuarkPlatformPkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccessLibDxe.c b/QuarkPlatformPkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccessLibDxe.c
index 3ad30b1..aeafb1b 100644
--- a/QuarkPlatformPkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccessLibDxe.c
+++ b/QuarkPlatformPkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccessLibDxe.c
@@ -153,6 +153,15 @@ PerformFlashWrite(
   //
   SectorNum = Length / SPI_ERASE_SECTOR_SIZE;
   for (Index = 0; Index < SectorNum; Index++){
+    if (CompareMem(
+          (UINT8 *)(UINTN)(FlashAddress + mInternalFdAddress) + Index * SPI_ERASE_SECTOR_SIZE,
+          (UINT8 *)Buffer + Index * SPI_ERASE_SECTOR_SIZE,
+          SPI_ERASE_SECTOR_SIZE) == 0) {
+      DEBUG((EFI_D_INFO, "Sector - 0x%x - skip\n", Index));
+      continue;
+    }
+    DEBUG((EFI_D_INFO, "Sector - 0x%x - update...\n", Index));
+
     Status = FlashFdErase (
                (UINTN)FlashAddress + Index * SPI_ERASE_SECTOR_SIZE
                );
-- 
2.7.4.windows.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-10-11  0:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-09 12:32 [PATCH] QuarkPlatformPkg/PlatformFlashAccessLib: Skip the update if content is same Jiewen Yao
2016-10-11  0:37 ` Kinney, Michael D
2016-10-11  0:39   ` Yao, Jiewen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox