From: Jiewen Yao <jiewen.yao@intel.com>
To: edk2-devel@lists.01.org
Cc: Michael D Kinney <michael.d.kinney@intel.com>,
Kelly Steele <kelly.steele@intel.com>,
Feng Tian <feng.tian@intel.com>, Star Zeng <star.zeng@intel.com>,
Liming Gao <liming.gao@intel.com>,
Chao Zhang <chao.b.zhang@intel.com>
Subject: [PATCH] QuarkPlatformPkg/PlatformFlashAccessLib: Skip the update if content is same.
Date: Sun, 9 Oct 2016 20:32:21 +0800 [thread overview]
Message-ID: <1476016341-8884-1-git-send-email-jiewen.yao@intel.com> (raw)
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
next reply other threads:[~2016-10-09 12:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-09 12:32 Jiewen Yao [this message]
2016-10-11 0:37 ` [PATCH] QuarkPlatformPkg/PlatformFlashAccessLib: Skip the update if content is same Kinney, Michael D
2016-10-11 0:39 ` Yao, Jiewen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1476016341-8884-1-git-send-email-jiewen.yao@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox