public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-devel] [edk2-platforms][PATCH 1/1] AmpereAltraPkg/FlashFvbDxe: Sync up NVRAM FV with NVRAM cached
@ 2024-08-09  3:12 Nhi Pham via groups.io
  2024-08-09 13:00 ` Rebecca Cran via groups.io
  0 siblings, 1 reply; 3+ messages in thread
From: Nhi Pham via groups.io @ 2024-08-09  3:12 UTC (permalink / raw)
  To: devel; +Cc: quic_llindhol, chuong, rebecca, nhi, Tam Chi Nguyen

From: Tam Chi Nguyen <tamnguyenchi@os.amperecomputing.com>

Currently, the NVRAM FV region is only updated once at FlashPei that makes
the data in NVRAM FV outdated with data in NVRAM region in SPI-NOR.
It causes the duplication of the valid NV variables when the Variable
Reclaim process performs. Consequently, after rebooting, system goes to
an infinite loop at GetNextVariableName.

It requires the data in NVRAM FV to be synced up with NVRAM cache in memory
that is managed by VariableDxe.

Signed-off-by: Nhi Pham <nhi@os.amperecomputing.com>
---
 Silicon/Ampere/AmpereAltraPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf | 1 +
 Silicon/Ampere/AmpereAltraPkg/Drivers/FlashFvbDxe/FlashFvbDxe.c   | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf b/Silicon/Ampere/AmpereAltraPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf
index 008fd2315ffe..5f537cf7df27 100644
--- a/Silicon/Ampere/AmpereAltraPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf
+++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf
@@ -25,6 +25,7 @@ [Packages]
   Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec
 
 [LibraryClasses]
+  BaseMemoryLib
   DebugLib
   FlashLib
   PcdLib
diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/FlashFvbDxe/FlashFvbDxe.c b/Silicon/Ampere/AmpereAltraPkg/Drivers/FlashFvbDxe/FlashFvbDxe.c
index 009694703ddd..853c458e375f 100644
--- a/Silicon/Ampere/AmpereAltraPkg/Drivers/FlashFvbDxe/FlashFvbDxe.c
+++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/FlashFvbDxe/FlashFvbDxe.c
@@ -6,6 +6,7 @@
 
 **/
 
+#include <Library/BaseMemoryLib.h>
 #include <Library/DebugLib.h>
 #include <Library/FlashLib.h>
 #include <Library/PcdLib.h>
@@ -361,6 +362,8 @@ FlashFvbDxeWrite (
     return EFI_DEVICE_ERROR;
   }
 
+  CopyMem ((UINT8 *)(UINTN)mNvStorageBase + Lba * mFlashBlockSize + Offset, Buffer, *NumBytes);
+
   return Status;
 }
 
-- 
2.25.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#120303): https://edk2.groups.io/g/devel/message/120303
Mute This Topic: https://groups.io/mt/107802467/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



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

* Re: [edk2-devel] [edk2-platforms][PATCH 1/1] AmpereAltraPkg/FlashFvbDxe: Sync up NVRAM FV with NVRAM cached
  2024-08-09  3:12 [edk2-devel] [edk2-platforms][PATCH 1/1] AmpereAltraPkg/FlashFvbDxe: Sync up NVRAM FV with NVRAM cached Nhi Pham via groups.io
@ 2024-08-09 13:00 ` Rebecca Cran via groups.io
  2024-08-13  3:59   ` Nhi Pham via groups.io
  0 siblings, 1 reply; 3+ messages in thread
From: Rebecca Cran via groups.io @ 2024-08-09 13:00 UTC (permalink / raw)
  To: Nhi Pham, devel; +Cc: quic_llindhol, chuong, Tam Chi Nguyen

Reviewed-by: Rebecca Cran <rebecca@os.amperecomputing.com>


On 8/8/2024 9:12 PM, Nhi Pham wrote:
> From: Tam Chi Nguyen <tamnguyenchi@os.amperecomputing.com>
>
> Currently, the NVRAM FV region is only updated once at FlashPei that makes
> the data in NVRAM FV outdated with data in NVRAM region in SPI-NOR.
> It causes the duplication of the valid NV variables when the Variable
> Reclaim process performs. Consequently, after rebooting, system goes to
> an infinite loop at GetNextVariableName.
>
> It requires the data in NVRAM FV to be synced up with NVRAM cache in memory
> that is managed by VariableDxe.
>
> Signed-off-by: Nhi Pham <nhi@os.amperecomputing.com>
> ---
>   Silicon/Ampere/AmpereAltraPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf | 1 +
>   Silicon/Ampere/AmpereAltraPkg/Drivers/FlashFvbDxe/FlashFvbDxe.c   | 3 +++
>   2 files changed, 4 insertions(+)
>
> diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf b/Silicon/Ampere/AmpereAltraPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf
> index 008fd2315ffe..5f537cf7df27 100644
> --- a/Silicon/Ampere/AmpereAltraPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf
> +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf
> @@ -25,6 +25,7 @@ [Packages]
>     Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec
>   
>   [LibraryClasses]
> +  BaseMemoryLib
>     DebugLib
>     FlashLib
>     PcdLib
> diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/FlashFvbDxe/FlashFvbDxe.c b/Silicon/Ampere/AmpereAltraPkg/Drivers/FlashFvbDxe/FlashFvbDxe.c
> index 009694703ddd..853c458e375f 100644
> --- a/Silicon/Ampere/AmpereAltraPkg/Drivers/FlashFvbDxe/FlashFvbDxe.c
> +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/FlashFvbDxe/FlashFvbDxe.c
> @@ -6,6 +6,7 @@
>   
>   **/
>   
> +#include <Library/BaseMemoryLib.h>
>   #include <Library/DebugLib.h>
>   #include <Library/FlashLib.h>
>   #include <Library/PcdLib.h>
> @@ -361,6 +362,8 @@ FlashFvbDxeWrite (
>       return EFI_DEVICE_ERROR;
>     }
>   
> +  CopyMem ((UINT8 *)(UINTN)mNvStorageBase + Lba * mFlashBlockSize + Offset, Buffer, *NumBytes);
> +
>     return Status;
>   }
>   


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#120308): https://edk2.groups.io/g/devel/message/120308
Mute This Topic: https://groups.io/mt/107802467/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



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

* Re: [edk2-devel] [edk2-platforms][PATCH 1/1] AmpereAltraPkg/FlashFvbDxe: Sync up NVRAM FV with NVRAM cached
  2024-08-09 13:00 ` Rebecca Cran via groups.io
@ 2024-08-13  3:59   ` Nhi Pham via groups.io
  0 siblings, 0 replies; 3+ messages in thread
From: Nhi Pham via groups.io @ 2024-08-13  3:59 UTC (permalink / raw)
  To: Rebecca  Cran OS, devel@edk2.groups.io
  Cc: quic_llindhol@quicinc.com, Chuong Tran OS, Tam Chi Nguyen OS

[-- Attachment #1: Type: text/plain, Size: 3060 bytes --]

Pushed as 70d5c0e3af97..debfeb1f3052

Thanks,
Nhi
________________________________
From: Rebecca Cran OS <rebecca@os.amperecomputing.com>
Sent: Friday, August 9, 2024 8:00 PM
To: Nhi Pham OS <nhi@os.amperecomputing.com>; devel@edk2.groups.io <devel@edk2.groups.io>
Cc: quic_llindhol@quicinc.com <quic_llindhol@quicinc.com>; Chuong Tran OS <chuong@os.amperecomputing.com>; Tam Chi Nguyen OS <tamnguyenchi@os.amperecomputing.com>
Subject: Re: [edk2-platforms][PATCH 1/1] AmpereAltraPkg/FlashFvbDxe: Sync up NVRAM FV with NVRAM cached

Reviewed-by: Rebecca Cran <rebecca@os.amperecomputing.com>


On 8/8/2024 9:12 PM, Nhi Pham wrote:
> From: Tam Chi Nguyen <tamnguyenchi@os.amperecomputing.com>
>
> Currently, the NVRAM FV region is only updated once at FlashPei that makes
> the data in NVRAM FV outdated with data in NVRAM region in SPI-NOR.
> It causes the duplication of the valid NV variables when the Variable
> Reclaim process performs. Consequently, after rebooting, system goes to
> an infinite loop at GetNextVariableName.
>
> It requires the data in NVRAM FV to be synced up with NVRAM cache in memory
> that is managed by VariableDxe.
>
> Signed-off-by: Nhi Pham <nhi@os.amperecomputing.com>
> ---
>   Silicon/Ampere/AmpereAltraPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf | 1 +
>   Silicon/Ampere/AmpereAltraPkg/Drivers/FlashFvbDxe/FlashFvbDxe.c   | 3 +++
>   2 files changed, 4 insertions(+)
>
> diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf b/Silicon/Ampere/AmpereAltraPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf
> index 008fd2315ffe..5f537cf7df27 100644
> --- a/Silicon/Ampere/AmpereAltraPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf
> +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/FlashFvbDxe/FlashFvbDxe.inf
> @@ -25,6 +25,7 @@ [Packages]
>     Silicon/Ampere/AmpereSiliconPkg/AmpereSiliconPkg.dec
>
>   [LibraryClasses]
> +  BaseMemoryLib
>     DebugLib
>     FlashLib
>     PcdLib
> diff --git a/Silicon/Ampere/AmpereAltraPkg/Drivers/FlashFvbDxe/FlashFvbDxe.c b/Silicon/Ampere/AmpereAltraPkg/Drivers/FlashFvbDxe/FlashFvbDxe.c
> index 009694703ddd..853c458e375f 100644
> --- a/Silicon/Ampere/AmpereAltraPkg/Drivers/FlashFvbDxe/FlashFvbDxe.c
> +++ b/Silicon/Ampere/AmpereAltraPkg/Drivers/FlashFvbDxe/FlashFvbDxe.c
> @@ -6,6 +6,7 @@
>
>   **/
>
> +#include <Library/BaseMemoryLib.h>
>   #include <Library/DebugLib.h>
>   #include <Library/FlashLib.h>
>   #include <Library/PcdLib.h>
> @@ -361,6 +362,8 @@ FlashFvbDxeWrite (
>       return EFI_DEVICE_ERROR;
>     }
>
> +  CopyMem ((UINT8 *)(UINTN)mNvStorageBase + Lba * mFlashBlockSize + Offset, Buffer, *NumBytes);
> +
>     return Status;
>   }
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#120323): https://edk2.groups.io/g/devel/message/120323
Mute This Topic: https://groups.io/mt/107802467/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



[-- Attachment #2: Type: text/html, Size: 4974 bytes --]

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

end of thread, other threads:[~2024-08-13  3:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-09  3:12 [edk2-devel] [edk2-platforms][PATCH 1/1] AmpereAltraPkg/FlashFvbDxe: Sync up NVRAM FV with NVRAM cached Nhi Pham via groups.io
2024-08-09 13:00 ` Rebecca Cran via groups.io
2024-08-13  3:59   ` Nhi Pham via groups.io

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