OvmfPkg: add PcdQemuVarsRequire

Add PcdQemuVarsRequire FeaturePcd, so firmware code can figure whenever
the given build is supposed to use the qemu uefi variable service.

Skip the emulated variable store setup in case PcdQemuVarsRequire is
true.  This is needed to make secure boot work.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
Gerd Hoffmann 2023-10-26 14:05:42 +02:00 committed by mergify[bot]
parent cd6f84b70c
commit 9af96e21d8
4 changed files with 9 additions and 0 deletions

View File

@ -464,3 +464,6 @@
# framebuffer. This might be required on platforms that do not tolerate
# misaligned accesses otherwise.
gUefiOvmfPkgTokenSpaceGuid.PcdRemapFrameBufferWriteCombine|FALSE|BOOLEAN|0x75
## This feature flag indicates the firmware build needs the qemu variable service.
gUefiOvmfPkgTokenSpaceGuid.PcdQemuVarsRequire|FALSE|BOOLEAN|0x77

View File

@ -502,6 +502,7 @@
gEfiMdeModulePkgTokenSpaceGuid.PcdEnableVariableRuntimeCache|FALSE
!endif
!if $(QEMU_PV_VARS) == TRUE
gUefiOvmfPkgTokenSpaceGuid.PcdQemuVarsRequire|TRUE
gEfiMdeModulePkgTokenSpaceGuid.PcdEnableVariableRuntimeCache|FALSE
!endif
!if $(SECURE_BOOT_ENABLE) == TRUE

View File

@ -221,6 +221,10 @@ ReserveEmuVariableNvStore (
EFI_PHYSICAL_ADDRESS VariableStore;
RETURN_STATUS PcdStatus;
if (FeaturePcdGet (PcdQemuVarsRequire)) {
return;
}
VariableStore = (EFI_PHYSICAL_ADDRESS)(UINTN)PlatformReserveEmuVariableNvStore ();
PcdStatus = PcdSet64S (PcdEmuVariableNvStoreReserved, VariableStore);

View File

@ -143,6 +143,7 @@
[FeaturePcd]
gUefiOvmfPkgTokenSpaceGuid.PcdSmmSmramRequire
gUefiOvmfPkgTokenSpaceGuid.PcdQemuVarsRequire
[Ppis]
gEfiPeiMasterBootModePpiGuid