mirror of https://github.com/acidanthera/audk.git
OvmfPkg/PlatformPei: align EmuVariableNvStore at any page boundary
EmuVariableFvbRuntimeDxe now uses a 4KB (EFI_PAGE_SIZE) block size. Cc: Jordan Justen <jordan.l.justen@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Regression-tested-by: Gary Lin <glin@suse.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
This commit is contained in:
parent
7e8329267e
commit
c9e7907d09
|
@ -504,7 +504,6 @@ ReserveEmuVariableNvStore (
|
||||||
{
|
{
|
||||||
EFI_PHYSICAL_ADDRESS VariableStore;
|
EFI_PHYSICAL_ADDRESS VariableStore;
|
||||||
RETURN_STATUS PcdStatus;
|
RETURN_STATUS PcdStatus;
|
||||||
UINT32 Alignment;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Allocate storage for NV variables early on so it will be
|
// Allocate storage for NV variables early on so it will be
|
||||||
|
@ -512,26 +511,15 @@ ReserveEmuVariableNvStore (
|
||||||
// across reboots, this allows the NV variable storage to survive
|
// across reboots, this allows the NV variable storage to survive
|
||||||
// a VM reboot.
|
// a VM reboot.
|
||||||
//
|
//
|
||||||
Alignment = PcdGet32 (PcdFlashNvStorageFtwSpareSize);
|
|
||||||
if ((Alignment & (Alignment - 1)) != 0) {
|
|
||||||
//
|
|
||||||
// Round up Alignment to the next power of two.
|
|
||||||
//
|
|
||||||
Alignment = GetPowerOfTwo32 (Alignment) << 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
VariableStore =
|
VariableStore =
|
||||||
(EFI_PHYSICAL_ADDRESS)(UINTN)
|
(EFI_PHYSICAL_ADDRESS)(UINTN)
|
||||||
AllocateAlignedRuntimePages (
|
AllocateRuntimePages (
|
||||||
EFI_SIZE_TO_PAGES (2 * PcdGet32 (PcdFlashNvStorageFtwSpareSize)),
|
EFI_SIZE_TO_PAGES (2 * PcdGet32 (PcdFlashNvStorageFtwSpareSize))
|
||||||
Alignment
|
|
||||||
);
|
);
|
||||||
DEBUG ((EFI_D_INFO,
|
DEBUG ((EFI_D_INFO,
|
||||||
"Reserved variable store memory: 0x%lX; size: %dkb, "
|
"Reserved variable store memory: 0x%lX; size: %dkb\n",
|
||||||
"alignment: 0x%x\n",
|
|
||||||
VariableStore,
|
VariableStore,
|
||||||
(2 * PcdGet32 (PcdFlashNvStorageFtwSpareSize)) / 1024,
|
(2 * PcdGet32 (PcdFlashNvStorageFtwSpareSize)) / 1024
|
||||||
Alignment
|
|
||||||
));
|
));
|
||||||
PcdStatus = PcdSet64S (PcdEmuVariableNvStoreReserved, VariableStore);
|
PcdStatus = PcdSet64S (PcdEmuVariableNvStoreReserved, VariableStore);
|
||||||
ASSERT_RETURN_ERROR (PcdStatus);
|
ASSERT_RETURN_ERROR (PcdStatus);
|
||||||
|
|
Loading…
Reference in New Issue