]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPlatformPkg: Dynamic flash variable base
authorSami Mujawar <sami.mujawar@arm.com>
Fri, 2 Oct 2020 21:13:57 +0000 (22:13 +0100)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Fri, 16 Oct 2020 17:21:04 +0000 (17:21 +0000)
Some virtual machine managers like kvmtool can relocate
the devices in the system memory map. The information
about the devices location in memory is described in the
device tree. Therefore, the CFI memory region and the
associated Non volatile storage variables need to be
adjusted accordingly.

To support such use cases the non-volatile storage
variable base PCD PcdFlashNvStorageVariableBase has
been defined as a dynamic PCD.

The NOR flash driver was using the Flash non-volatile
storage variable base PCD as a fixed PCD, thereby
preventing runtime resolution of the variable base
address.

Therefore update the NOR flash driver to load the
PCD using PcdGet32 instead of FixedPcdGet32.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Ard Biesheuvel <Ard.Biesheuvel@arm.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashFvbDxe.c

index e248fdf6db94191648b5d33bf1a9263f446ee141..9cdd85096a463f69b3b864cecdeaf247e65f4f73 100644 (file)
@@ -1,6 +1,6 @@
 /*++ @file  NorFlashFvbDxe.c\r
 \r
- Copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.<BR>\r
+ Copyright (c) 2011 - 2020, ARM Ltd. All rights reserved.<BR>\r
 \r
  SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
@@ -736,7 +736,7 @@ NorFlashFvbInitialize (
       EFI_MEMORY_UC | EFI_MEMORY_RUNTIME);\r
   ASSERT_EFI_ERROR (Status);\r
 \r
-  mFlashNvStorageVariableBase = FixedPcdGet32 (PcdFlashNvStorageVariableBase);\r
+  mFlashNvStorageVariableBase = PcdGet32 (PcdFlashNvStorageVariableBase);\r
 \r
   // Set the index of the first LBA for the FVB\r
   Instance->StartLba = (PcdGet32 (PcdFlashNvStorageVariableBase) - Instance->RegionBaseAddress) / Instance->Media.BlockSize;\r