From b7c14f1e43ada836e7c9c4e89829faefd7b8c879 Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Mon, 30 Nov 2015 18:42:01 +0000 Subject: [PATCH] OvmfPkg: AcpiS3SaveDxe: don't fake LockBox protocol if SMM_REQUIRE In SVN r15306 (git commit d4ba06df), "OvmfPkg: S3 Resume: fake LockBox protocol for BootScriptExecutorDxe", we installed a fake LockBox protocol in OVMF's AcpiS3SaveDxe clone. While our other AcpiS3SaveDxe customizations remain valid (or harmless), said change is invalid when OVMF is built with -D SMM_REQUIRE and includes the real protocol provider, "MdeModulePkg/Universal/LockBox/SmmLockBox/SmmLockBox.inf". Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek Reviewed-by: Paolo Bonzini Reviewed-by: Jordan Justen git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19045 6f19259b-4bc3-4df7-8a09-765794883524 --- OvmfPkg/AcpiS3SaveDxe/AcpiS3Save.c | 14 ++++++++------ OvmfPkg/AcpiS3SaveDxe/AcpiS3SaveDxe.inf | 3 ++- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/OvmfPkg/AcpiS3SaveDxe/AcpiS3Save.c b/OvmfPkg/AcpiS3SaveDxe/AcpiS3Save.c index f20560f8fe..e3ff234101 100644 --- a/OvmfPkg/AcpiS3SaveDxe/AcpiS3Save.c +++ b/OvmfPkg/AcpiS3SaveDxe/AcpiS3Save.c @@ -538,12 +538,14 @@ InstallEndOfDxeCallback ( return EFI_LOAD_ERROR; } - Status = gBS->InstallMultipleProtocolInterfaces ( - &ImageHandle, - &gEfiLockBoxProtocolGuid, NULL, - NULL - ); - ASSERT_EFI_ERROR (Status); + if (!FeaturePcdGet (PcdSmmSmramRequire)) { + Status = gBS->InstallMultipleProtocolInterfaces ( + &ImageHandle, + &gEfiLockBoxProtocolGuid, NULL, + NULL + ); + ASSERT_EFI_ERROR (Status); + } Status = gBS->CreateEventEx ( EVT_NOTIFY_SIGNAL, diff --git a/OvmfPkg/AcpiS3SaveDxe/AcpiS3SaveDxe.inf b/OvmfPkg/AcpiS3SaveDxe/AcpiS3SaveDxe.inf index 4cc0713d1a..a288b954b7 100644 --- a/OvmfPkg/AcpiS3SaveDxe/AcpiS3SaveDxe.inf +++ b/OvmfPkg/AcpiS3SaveDxe/AcpiS3SaveDxe.inf @@ -59,7 +59,7 @@ gEfiEndOfDxeEventGroupGuid ## CONSUMES ## Event [Protocols] - gEfiLockBoxProtocolGuid # PROTOCOL ALWAYS_PRODUCED + gEfiLockBoxProtocolGuid # PROTOCOL SOMETIMES_PRODUCED gEfiLegacyBiosProtocolGuid # PROTOCOL ALWAYS_CONSUMED gEfiLegacyRegion2ProtocolGuid # PROTOCOL SOMETIMES_CONSUMED gFrameworkEfiMpServiceProtocolGuid # PROTOCOL SOMETIMES_CONSUMED @@ -71,6 +71,7 @@ gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdS3AcpiReservedMemorySize ## CONSUMES gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdS3BootScriptStackSize ## CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdUse1GPageTable + gUefiOvmfPkgTokenSpaceGuid.PcdSmmSmramRequire ## CONSUMES [Depex] gEfiVariableArchProtocolGuid AND gEfiVariableWriteArchProtocolGuid