On Mon, Jan 11, 2021 at 10:57 AM Ard Biesheuvel <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@...> Cc: Masahisa Kojima <masahisa.kojima@...> Cc: Sami Mujawar <sami.mujawar@...> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@...>
I've tested this change on Arm Reference Design platforms (SgiPkg). Tested-by: Vijayenthiran Subramaniam <vijayenthiran.subramaniam@...>
Also, can you let us know which platform (that used dynamic PCD) broke the build?
// 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