[edk2-devel] [PATCH] ArmPlatformPkg/NorFlashDxe: use correct PCD accessors

Ard Biesheuvel posted 1 patch 1 week ago
Failed in applying to current master (apply log)
ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashStandaloneMm.inf |  3 ++-
ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c            |  4 ++--
ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashStandaloneMm.c   | 10 +++++-----
3 files changed, 9 insertions(+), 8 deletions(-)

[edk2-devel] [PATCH] ArmPlatformPkg/NorFlashDxe: use correct PCD accessors

Posted by Ard Biesheuvel 1 week ago
Commit 8015f3f6d4005d83 ("ArmPlatformPkg: Enable support for flash in
64-bit address space") updated the NorFlash DXE and StMM drivers to
take alternate PCDs into account when discovering the base of the
NOR flash regions.

This introduced a disparity between the declarations of the PCD references
in the .INF files, which permits the use of dynamic PCDs, and the code
itself, which now uses FixedPcdGet() accessors. On platforms that actually
use dynamic PCDs, this results in a build error.

So let's clean this up:
- for the DXE version, use the generic PcdGet() accessors, so dynamic PCDs
  are permitted
- for the standalone MM version, redeclare the PCDs as [FixedPcd] in the
  .INF description, and switch to the FixedPcdGet() accessors.

Cc: Vijayenthiran Subramaniam <vijayenthiran.subramaniam@arm.com>
Cc: Masahisa Kojima <masahisa.kojima@linaro.org>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
---
 ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashStandaloneMm.inf |  3 ++-
 ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c            |  4 ++--
 ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashStandaloneMm.c   | 10 +++++-----
 3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashStandaloneMm.inf b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashStandaloneMm.inf
index b2f72fb4de20..56347a8bc7c1 100644
--- a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashStandaloneMm.inf
+++ b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashStandaloneMm.inf
@@ -49,7 +49,7 @@ [Guids]
 [Protocols]
   gEfiSmmFirmwareVolumeBlockProtocolGuid
 
-[Pcd.common]
+[FixedPcd]
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
@@ -60,6 +60,7 @@ [Pcd.common]
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
 
+[FeaturePcd]
   gArmPlatformTokenSpaceGuid.PcdNorFlashCheckBlockLocked
 
 [Depex]
diff --git a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c
index 28dc8e125c78..f412731200cf 100644
--- a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c
+++ b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c
@@ -422,8 +422,8 @@ NorFlashFvbInitialize (
       EFI_MEMORY_UC | EFI_MEMORY_RUNTIME);
   ASSERT_EFI_ERROR (Status);
 
-  mFlashNvStorageVariableBase = (FixedPcdGet64 (PcdFlashNvStorageVariableBase64) != 0) ?
-    FixedPcdGet64 (PcdFlashNvStorageVariableBase64) : FixedPcdGet32 (PcdFlashNvStorageVariableBase);
+  mFlashNvStorageVariableBase = (PcdGet64 (PcdFlashNvStorageVariableBase64) != 0) ?
+    PcdGet64 (PcdFlashNvStorageVariableBase64) : PcdGet32 (PcdFlashNvStorageVariableBase);
 
   // Set the index of the first LBA for the FVB
   Instance->StartLba = (mFlashNvStorageVariableBase - Instance->RegionBaseAddress) / Instance->Media.BlockSize;
diff --git a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashStandaloneMm.c b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashStandaloneMm.c
index 8a4fb395d286..4ebbc06e1de3 100644
--- a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashStandaloneMm.c
+++ b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashStandaloneMm.c
@@ -299,15 +299,15 @@ NorFlashInitialise (
   for (Index = 0; Index < mNorFlashDeviceCount; Index++) {
     // Check if this NOR Flash device contain the variable storage region
 
-   if (PcdGet64 (PcdFlashNvStorageVariableBase64) != 0) {
+   if (FixedPcdGet64 (PcdFlashNvStorageVariableBase64) != 0) {
      ContainVariableStorage =
-       (NorFlashDevices[Index].RegionBaseAddress <= PcdGet64 (PcdFlashNvStorageVariableBase64)) &&
-       (PcdGet64 (PcdFlashNvStorageVariableBase64) + PcdGet32 (PcdFlashNvStorageVariableSize) <=
+       (NorFlashDevices[Index].RegionBaseAddress <= FixedPcdGet64 (PcdFlashNvStorageVariableBase64)) &&
+       (FixedPcdGet64 (PcdFlashNvStorageVariableBase64) + FixedPcdGet32 (PcdFlashNvStorageVariableSize) <=
         NorFlashDevices[Index].RegionBaseAddress + NorFlashDevices[Index].Size);
    } else {
      ContainVariableStorage =
-       (NorFlashDevices[Index].RegionBaseAddress <= PcdGet32 (PcdFlashNvStorageVariableBase)) &&
-       (PcdGet32 (PcdFlashNvStorageVariableBase) + PcdGet32 (PcdFlashNvStorageVariableSize) <=
+       (NorFlashDevices[Index].RegionBaseAddress <= FixedPcdGet32 (PcdFlashNvStorageVariableBase)) &&
+       (FixedPcdGet32 (PcdFlashNvStorageVariableBase) + FixedPcdGet32 (PcdFlashNvStorageVariableSize) <=
         NorFlashDevices[Index].RegionBaseAddress + NorFlashDevices[Index].Size);
   }
 
-- 
2.17.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#70116): https://edk2.groups.io/g/devel/message/70116
Mute This Topic: https://groups.io/mt/79593039/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [PATCH] ArmPlatformPkg/NorFlashDxe: use correct PCD accessors

Posted by Philippe Mathieu-Daudé 6 days, 3 hours ago
Hi Ard,

On 1/11/21 11:57 AM, Ard Biesheuvel wrote:
> Commit 8015f3f6d4005d83 ("ArmPlatformPkg: Enable support for flash in
> 64-bit address space") updated the NorFlash DXE and StMM drivers to
> take alternate PCDs into account when discovering the base of the
> NOR flash regions.
> 
> This introduced a disparity between the declarations of the PCD references
> in the .INF files, which permits the use of dynamic PCDs, and the code
> itself, which now uses FixedPcdGet() accessors. On platforms that actually
> use dynamic PCDs, this results in a build error.

So there is no (mainstream) CI coverage for these platforms?
Could we add at least one?

Thanks,

Phil.



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#70157): https://edk2.groups.io/g/devel/message/70157
Mute This Topic: https://groups.io/mt/79593039/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [PATCH] ArmPlatformPkg/NorFlashDxe: use correct PCD accessors

Posted by Ard Biesheuvel 6 days, 3 hours ago
On 1/12/21 12:42 PM, Philippe Mathieu-Daudé wrote:
> Hi Ard,
> 
> On 1/11/21 11:57 AM, Ard Biesheuvel wrote:
>> Commit 8015f3f6d4005d83 ("ArmPlatformPkg: Enable support for flash in
>> 64-bit address space") updated the NorFlash DXE and StMM drivers to
>> take alternate PCDs into account when discovering the base of the
>> NOR flash regions.
>>
>> This introduced a disparity between the declarations of the PCD references
>> in the .INF files, which permits the use of dynamic PCDs, and the code
>> itself, which now uses FixedPcdGet() accessors. On platforms that actually
>> use dynamic PCDs, this results in a build error.
> 
> So there is no (mainstream) CI coverage for these platforms?
> Could we add at least one?
> 

We could. It was KvmTool.dsc, which lives in the main repo.



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#70158): https://edk2.groups.io/g/devel/message/70158
Mute This Topic: https://groups.io/mt/79593039/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [PATCH] ArmPlatformPkg/NorFlashDxe: use correct PCD accessors

Posted by Sami Mujawar 6 days, 2 hours ago
Hi Ard, Philippe,

I will check if the Kvmtool.dsc build can be supported using the edk2 Core CI.

Regards,

Sami Mujawar

-----Original Message-----
From: Ard Biesheuvel <ard.biesheuvel@arm.com>
Sent: 12 January 2021 12:10 PM
To: Philippe Mathieu-Daudé <philmd@redhat.com>; devel@edk2.groups.io
Cc: leif@nuviainc.com; Vijayenthiran Subramaniam <Vijayenthiran.Subramaniam@arm.com>; Masahisa Kojima <masahisa.kojima@linaro.org>; Sami Mujawar <Sami.Mujawar@arm.com>; Michael D Kinney <michael.d.kinney@intel.com>
Subject: Re: [edk2-devel] [PATCH] ArmPlatformPkg/NorFlashDxe: use correct PCD accessors

On 1/12/21 12:42 PM, Philippe Mathieu-Daudé wrote:
> Hi Ard,
>
> On 1/11/21 11:57 AM, Ard Biesheuvel wrote:
>> Commit 8015f3f6d4005d83 ("ArmPlatformPkg: Enable support for flash in
>> 64-bit address space") updated the NorFlash DXE and StMM drivers to
>> take alternate PCDs into account when discovering the base of the
>> NOR flash regions.
>>
>> This introduced a disparity between the declarations of the PCD references
>> in the .INF files, which permits the use of dynamic PCDs, and the code
>> itself, which now uses FixedPcdGet() accessors. On platforms that actually
>> use dynamic PCDs, this results in a build error.
>
> So there is no (mainstream) CI coverage for these platforms?
> Could we add at least one?
>

We could. It was KvmTool.dsc, which lives in the main repo.

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#70159): https://edk2.groups.io/g/devel/message/70159
Mute This Topic: https://groups.io/mt/79593039/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [PATCH] ArmPlatformPkg/NorFlashDxe: use correct PCD accessors

Posted by Vijayenthiran Subramaniam 6 days, 3 hours ago
On Mon, Jan 11, 2021 at 10:57 AM Ard Biesheuvel <ard.biesheuvel@arm.com> wrote:
>
> Commit 8015f3f6d4005d83 ("ArmPlatformPkg: Enable support for flash in
> 64-bit address space") updated the NorFlash DXE and StMM drivers to
> take alternate PCDs into account when discovering the base of the
> NOR flash regions.
>
> This introduced a disparity between the declarations of the PCD references
> in the .INF files, which permits the use of dynamic PCDs, and the code
> itself, which now uses FixedPcdGet() accessors. On platforms that actually
> use dynamic PCDs, this results in a build error.
>
> So let's clean this up:
> - for the DXE version, use the generic PcdGet() accessors, so dynamic PCDs
>   are permitted
> - for the standalone MM version, redeclare the PCDs as [FixedPcd] in the
>   .INF description, and switch to the FixedPcdGet() accessors.
>
> Cc: Vijayenthiran Subramaniam <vijayenthiran.subramaniam@arm.com>
> Cc: Masahisa Kojima <masahisa.kojima@linaro.org>
> Cc: Sami Mujawar <sami.mujawar@arm.com>
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@arm.com>

I've tested this change on Arm Reference Design platforms (SgiPkg).
Tested-by: Vijayenthiran Subramaniam <vijayenthiran.subramaniam@arm.com>

Also, can you let us know which platform (that used dynamic PCD) broke the
build?

Thanks,
Vijay

> ---
>  ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashStandaloneMm.inf |  3 ++-
>  ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c            |  4 ++--
>  ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashStandaloneMm.c   | 10 +++++-----
>  3 files changed, 9 insertions(+), 8 deletions(-)
>
> diff --git a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashStandaloneMm.inf b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashStandaloneMm.inf
> index b2f72fb4de20..56347a8bc7c1 100644
> --- a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashStandaloneMm.inf
> +++ b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashStandaloneMm.inf
> @@ -49,7 +49,7 @@ [Guids]
>  [Protocols]
>    gEfiSmmFirmwareVolumeBlockProtocolGuid
>
> -[Pcd.common]
> +[FixedPcd]
>    gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64
>    gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase
>    gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
> @@ -60,6 +60,7 @@ [Pcd.common]
>    gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase
>    gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
>
> +[FeaturePcd]
>    gArmPlatformTokenSpaceGuid.PcdNorFlashCheckBlockLocked
>
>  [Depex]
> diff --git a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c
> index 28dc8e125c78..f412731200cf 100644
> --- a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c
> +++ b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c
> @@ -422,8 +422,8 @@ NorFlashFvbInitialize (
>        EFI_MEMORY_UC | EFI_MEMORY_RUNTIME);
>    ASSERT_EFI_ERROR (Status);
>
> -  mFlashNvStorageVariableBase = (FixedPcdGet64 (PcdFlashNvStorageVariableBase64) != 0) ?
> -    FixedPcdGet64 (PcdFlashNvStorageVariableBase64) : FixedPcdGet32 (PcdFlashNvStorageVariableBase);
> +  mFlashNvStorageVariableBase = (PcdGet64 (PcdFlashNvStorageVariableBase64) != 0) ?
> +    PcdGet64 (PcdFlashNvStorageVariableBase64) : PcdGet32 (PcdFlashNvStorageVariableBase);
>
>    // Set the index of the first LBA for the FVB
>    Instance->StartLba = (mFlashNvStorageVariableBase - Instance->RegionBaseAddress) / Instance->Media.BlockSize;
> diff --git a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashStandaloneMm.c b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashStandaloneMm.c
> index 8a4fb395d286..4ebbc06e1de3 100644
> --- a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashStandaloneMm.c
> +++ b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashStandaloneMm.c
> @@ -299,15 +299,15 @@ NorFlashInitialise (
>    for (Index = 0; Index < mNorFlashDeviceCount; Index++) {
>      // Check if this NOR Flash device contain the variable storage region
>
> -   if (PcdGet64 (PcdFlashNvStorageVariableBase64) != 0) {
> +   if (FixedPcdGet64 (PcdFlashNvStorageVariableBase64) != 0) {
>       ContainVariableStorage =
> -       (NorFlashDevices[Index].RegionBaseAddress <= PcdGet64 (PcdFlashNvStorageVariableBase64)) &&
> -       (PcdGet64 (PcdFlashNvStorageVariableBase64) + PcdGet32 (PcdFlashNvStorageVariableSize) <=
> +       (NorFlashDevices[Index].RegionBaseAddress <= FixedPcdGet64 (PcdFlashNvStorageVariableBase64)) &&
> +       (FixedPcdGet64 (PcdFlashNvStorageVariableBase64) + FixedPcdGet32 (PcdFlashNvStorageVariableSize) <=
>          NorFlashDevices[Index].RegionBaseAddress + NorFlashDevices[Index].Size);
>     } else {
>       ContainVariableStorage =
> -       (NorFlashDevices[Index].RegionBaseAddress <= PcdGet32 (PcdFlashNvStorageVariableBase)) &&
> -       (PcdGet32 (PcdFlashNvStorageVariableBase) + PcdGet32 (PcdFlashNvStorageVariableSize) <=
> +       (NorFlashDevices[Index].RegionBaseAddress <= FixedPcdGet32 (PcdFlashNvStorageVariableBase)) &&
> +       (FixedPcdGet32 (PcdFlashNvStorageVariableBase) + FixedPcdGet32 (PcdFlashNvStorageVariableSize) <=
>          NorFlashDevices[Index].RegionBaseAddress + NorFlashDevices[Index].Size);
>    }
>
> --
> 2.17.1
>
>
>
> 
>
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#70156): https://edk2.groups.io/g/devel/message/70156
Mute This Topic: https://groups.io/mt/79593039/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [PATCH] ArmPlatformPkg/NorFlashDxe: use correct PCD accessors

Posted by Laszlo Ersek 6 days, 23 hours ago
On 01/11/21 11:57, Ard Biesheuvel wrote:
> Commit 8015f3f6d4005d83 ("ArmPlatformPkg: Enable support for flash in
> 64-bit address space") updated the NorFlash DXE and StMM drivers to
> take alternate PCDs into account when discovering the base of the
> NOR flash regions.
> 
> This introduced a disparity between the declarations of the PCD references
> in the .INF files, which permits the use of dynamic PCDs, and the code
> itself, which now uses FixedPcdGet() accessors. On platforms that actually
> use dynamic PCDs, this results in a build error.
> 
> So let's clean this up:
> - for the DXE version, use the generic PcdGet() accessors, so dynamic PCDs
>   are permitted
> - for the standalone MM version, redeclare the PCDs as [FixedPcd] in the
>   .INF description, and switch to the FixedPcdGet() accessors.
> 
> Cc: Vijayenthiran Subramaniam <vijayenthiran.subramaniam@arm.com>
> Cc: Masahisa Kojima <masahisa.kojima@linaro.org>
> Cc: Sami Mujawar <sami.mujawar@arm.com>
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
> ---
>  ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashStandaloneMm.inf |  3 ++-
>  ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c            |  4 ++--
>  ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashStandaloneMm.c   | 10 +++++-----
>  3 files changed, 9 insertions(+), 8 deletions(-)

Looks justified to me.

Acked-by: Laszlo Ersek <lersek@redhat.com>

Thanks,
Laszlo

> diff --git a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashStandaloneMm.inf b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashStandaloneMm.inf
> index b2f72fb4de20..56347a8bc7c1 100644
> --- a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashStandaloneMm.inf
> +++ b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashStandaloneMm.inf
> @@ -49,7 +49,7 @@ [Guids]
>  [Protocols]
>    gEfiSmmFirmwareVolumeBlockProtocolGuid
>  
> -[Pcd.common]
> +[FixedPcd]
>    gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64
>    gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase
>    gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
> @@ -60,6 +60,7 @@ [Pcd.common]
>    gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase
>    gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
>  
> +[FeaturePcd]
>    gArmPlatformTokenSpaceGuid.PcdNorFlashCheckBlockLocked
>  
>  [Depex]
> diff --git a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c
> index 28dc8e125c78..f412731200cf 100644
> --- a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c
> +++ b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c
> @@ -422,8 +422,8 @@ NorFlashFvbInitialize (
>        EFI_MEMORY_UC | EFI_MEMORY_RUNTIME);
>    ASSERT_EFI_ERROR (Status);
>  
> -  mFlashNvStorageVariableBase = (FixedPcdGet64 (PcdFlashNvStorageVariableBase64) != 0) ?
> -    FixedPcdGet64 (PcdFlashNvStorageVariableBase64) : FixedPcdGet32 (PcdFlashNvStorageVariableBase);
> +  mFlashNvStorageVariableBase = (PcdGet64 (PcdFlashNvStorageVariableBase64) != 0) ?
> +    PcdGet64 (PcdFlashNvStorageVariableBase64) : PcdGet32 (PcdFlashNvStorageVariableBase);
>  
>    // Set the index of the first LBA for the FVB
>    Instance->StartLba = (mFlashNvStorageVariableBase - Instance->RegionBaseAddress) / Instance->Media.BlockSize;
> diff --git a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashStandaloneMm.c b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashStandaloneMm.c
> index 8a4fb395d286..4ebbc06e1de3 100644
> --- a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashStandaloneMm.c
> +++ b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashStandaloneMm.c
> @@ -299,15 +299,15 @@ NorFlashInitialise (
>    for (Index = 0; Index < mNorFlashDeviceCount; Index++) {
>      // Check if this NOR Flash device contain the variable storage region
>  
> -   if (PcdGet64 (PcdFlashNvStorageVariableBase64) != 0) {
> +   if (FixedPcdGet64 (PcdFlashNvStorageVariableBase64) != 0) {
>       ContainVariableStorage =
> -       (NorFlashDevices[Index].RegionBaseAddress <= PcdGet64 (PcdFlashNvStorageVariableBase64)) &&
> -       (PcdGet64 (PcdFlashNvStorageVariableBase64) + PcdGet32 (PcdFlashNvStorageVariableSize) <=
> +       (NorFlashDevices[Index].RegionBaseAddress <= FixedPcdGet64 (PcdFlashNvStorageVariableBase64)) &&
> +       (FixedPcdGet64 (PcdFlashNvStorageVariableBase64) + FixedPcdGet32 (PcdFlashNvStorageVariableSize) <=
>          NorFlashDevices[Index].RegionBaseAddress + NorFlashDevices[Index].Size);
>     } else {
>       ContainVariableStorage =
> -       (NorFlashDevices[Index].RegionBaseAddress <= PcdGet32 (PcdFlashNvStorageVariableBase)) &&
> -       (PcdGet32 (PcdFlashNvStorageVariableBase) + PcdGet32 (PcdFlashNvStorageVariableSize) <=
> +       (NorFlashDevices[Index].RegionBaseAddress <= FixedPcdGet32 (PcdFlashNvStorageVariableBase)) &&
> +       (FixedPcdGet32 (PcdFlashNvStorageVariableBase) + FixedPcdGet32 (PcdFlashNvStorageVariableSize) <=
>          NorFlashDevices[Index].RegionBaseAddress + NorFlashDevices[Index].Size);
>    }
>  
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#70122): https://edk2.groups.io/g/devel/message/70122
Mute This Topic: https://groups.io/mt/79593039/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-