From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 4C4AE1A1E24 for ; Sun, 9 Oct 2016 05:32:28 -0700 (PDT) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga102.fm.intel.com with ESMTP; 09 Oct 2016 05:32:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,466,1473145200"; d="scan'208";a="17733176" Received: from jyao1-mobl.ccr.corp.intel.com ([10.254.214.127]) by fmsmga006.fm.intel.com with ESMTP; 09 Oct 2016 05:32:26 -0700 From: Jiewen Yao To: edk2-devel@lists.01.org Cc: Michael D Kinney , Kelly Steele , Feng Tian , Star Zeng , Liming Gao , Chao Zhang Date: Sun, 9 Oct 2016 20:32:21 +0800 Message-Id: <1476016341-8884-1-git-send-email-jiewen.yao@intel.com> X-Mailer: git-send-email 2.7.4.windows.1 Subject: [PATCH] QuarkPlatformPkg/PlatformFlashAccessLib: Skip the update if content is same. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Oct 2016 12:32:28 -0000 This is enhancement for PlatformFlashAccessLib to skip flash write if the content is same in new image. Cc: Michael D Kinney Cc: Kelly Steele Cc: Feng Tian Cc: Star Zeng Cc: Liming Gao Cc: Chao Zhang Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiewen Yao --- 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