summaryrefslogtreecommitdiffstats
path: root/ArmPlatformPkg
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@arm.com>2021-01-11 11:47:22 +0100
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2021-01-18 11:19:45 +0000
commit4f214830ce02cf588baba9ae6e7becfd67e5748c (patch)
tree74cfc3b2eb042bb96ef335e8316170914503500a /ArmPlatformPkg
parent7dc277f9e4de5eba0db35af13b7165eb6607ecb9 (diff)
downloadedk2-4f214830ce02cf588baba9ae6e7becfd67e5748c.tar.gz
edk2-4f214830ce02cf588baba9ae6e7becfd67e5748c.tar.bz2
edk2-4f214830ce02cf588baba9ae6e7becfd67e5748c.zip
ArmPlatformPkg/NorFlashDxe: use correct PCD accessors
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. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@arm.com> Acked-by: Laszlo Ersek <lersek@redhat.com> Tested-by: Vijayenthiran Subramaniam <vijayenthiran.subramaniam@arm.com>
Diffstat (limited to 'ArmPlatformPkg')
-rw-r--r--ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c4
-rw-r--r--ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashStandaloneMm.c10
-rw-r--r--ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashStandaloneMm.inf3
3 files changed, 9 insertions, 8 deletions
diff --git a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.c
index 28dc8e125c..f412731200 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 8a4fb395d2..4ebbc06e1d 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);
}
diff --git a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashStandaloneMm.inf b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashStandaloneMm.inf
index b2f72fb4de..56347a8bc7 100644
--- a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashStandaloneMm.inf
+++ b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashStandaloneMm.inf
@@ -49,7 +49,7 @@
[Protocols]
gEfiSmmFirmwareVolumeBlockProtocolGuid
-[Pcd.common]
+[FixedPcd]
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
@@ -60,6 +60,7 @@
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
+[FeaturePcd]
gArmPlatformTokenSpaceGuid.PcdNorFlashCheckBlockLocked
[Depex]