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

* Re: [PATCH] QuarkPlatformPkg/PlatformFlashAccessLib: Skip the update if content is same.
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Kinney, Michael D @ 2016-10-11  0:37 UTC (permalink / raw)
  To: Yao, Jiewen, edk2-devel@lists.01.org, Kinney, Michael D
  Cc: Tian, Feng, Gao, Liming, Zeng, Star, Zhang, Chao B

Jiewen,

I have applied this patch on top of your FMP v2 series and verified that it 
skips erase/write of FLASH sectors that match in Galileo Gen 2 platform.

Since this patch is against the new lib that is part of Quark specific capsule
update, it should be integrated into an FMP v3 patch series after all FMP v2
feedback is received.

Thanks,

Mike

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Jiewen Yao
> Sent: Sunday, October 9, 2016 5:32 AM
> To: edk2-devel@lists.01.org
> Cc: Tian, Feng <feng.tian@intel.com>; Gao, Liming <liming.gao@intel.com>; Zeng, Star
> <star.zeng@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>; Zhang, Chao B
> <chao.b.zhang@intel.com>
> Subject: [edk2] [PATCH] QuarkPlatformPkg/PlatformFlashAccessLib: Skip the update if
> content is same.
> 
> 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/PlatformFlashAccessLi
> bDxe.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git
> a/QuarkPlatformPkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccess
> LibDxe.c
> b/QuarkPlatformPkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccess
> LibDxe.c
> index 3ad30b1..aeafb1b 100644
> ---
> a/QuarkPlatformPkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccess
> LibDxe.c
> +++
> b/QuarkPlatformPkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccess
> LibDxe.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
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


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

* Re: [PATCH] QuarkPlatformPkg/PlatformFlashAccessLib: Skip the update if content is same.
  2016-10-11  0:37 ` Kinney, Michael D
@ 2016-10-11  0:39   ` Yao, Jiewen
  0 siblings, 0 replies; 3+ messages in thread
From: Yao, Jiewen @ 2016-10-11  0:39 UTC (permalink / raw)
  To: Kinney, Michael D, edk2-devel@lists.01.org
  Cc: Tian, Feng, Gao, Liming, Zeng, Star, Zhang, Chao B

Sure. Definition. It will be merged. :)
Thanks to help me validate that.

From: Kinney, Michael D
Sent: Tuesday, October 11, 2016 8:38 AM
To: Yao, Jiewen <jiewen.yao@intel.com>; edk2-devel@lists.01.org; Kinney, Michael D <michael.d.kinney@intel.com>
Cc: Tian, Feng <feng.tian@intel.com>; Gao, Liming <liming.gao@intel.com>; Zeng, Star <star.zeng@intel.com>; Zhang, Chao B <chao.b.zhang@intel.com>
Subject: RE: [edk2] [PATCH] QuarkPlatformPkg/PlatformFlashAccessLib: Skip the update if content is same.

Jiewen,

I have applied this patch on top of your FMP v2 series and verified that it
skips erase/write of FLASH sectors that match in Galileo Gen 2 platform.

Since this patch is against the new lib that is part of Quark specific capsule
update, it should be integrated into an FMP v3 patch series after all FMP v2
feedback is received.

Thanks,

Mike

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Jiewen Yao
> Sent: Sunday, October 9, 2016 5:32 AM
> To: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
> Cc: Tian, Feng <feng.tian@intel.com<mailto:feng.tian@intel.com>>; Gao, Liming <liming.gao@intel.com<mailto:liming.gao@intel.com>>; Zeng, Star
> <star.zeng@intel.com<mailto:star.zeng@intel.com>>; Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>; Zhang, Chao B
> <chao.b.zhang@intel.com<mailto:chao.b.zhang@intel.com>>
> Subject: [edk2] [PATCH] QuarkPlatformPkg/PlatformFlashAccessLib: Skip the update if
> content is same.
>
> 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<mailto:michael.d.kinney@intel.com>>
> Cc: Kelly Steele <kelly.steele@intel.com<mailto:kelly.steele@intel.com>>
> Cc: Feng Tian <feng.tian@intel.com<mailto:feng.tian@intel.com>>
> Cc: Star Zeng <star.zeng@intel.com<mailto:star.zeng@intel.com>>
> Cc: Liming Gao <liming.gao@intel.com<mailto:liming.gao@intel.com>>
> Cc: Chao Zhang <chao.b.zhang@intel.com<mailto:chao.b.zhang@intel.com>>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jiewen Yao <jiewen.yao@intel.com<mailto:jiewen.yao@intel.com>>
> ---
>
> QuarkPlatformPkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccessLi
> bDxe.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git
> a/QuarkPlatformPkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccess
> LibDxe.c
> b/QuarkPlatformPkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccess
> LibDxe.c
> index 3ad30b1..aeafb1b 100644
> ---
> a/QuarkPlatformPkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccess
> LibDxe.c
> +++
> b/QuarkPlatformPkg/Feature/Capsule/Library/PlatformFlashAccessLib/PlatformFlashAccess
> LibDxe.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
>
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[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