diff --git a/OvmfPkg/AcpiS3SaveDxe/AcpiS3Save.c b/OvmfPkg/AcpiS3SaveDxe/AcpiS3Save.c index e3ff234101..176f598fe6 100644 --- a/OvmfPkg/AcpiS3SaveDxe/AcpiS3Save.c +++ b/OvmfPkg/AcpiS3SaveDxe/AcpiS3Save.c @@ -6,7 +6,7 @@ End-of-Dxe event. Copyright (c) 2014-2015, Red Hat, Inc.
-Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions @@ -28,12 +28,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include #include -#include #include #include #include #include -#include #include EFI_GUID mAcpiS3IdtrProfileGuid = { @@ -538,15 +536,6 @@ InstallEndOfDxeCallback ( return EFI_LOAD_ERROR; } - if (!FeaturePcdGet (PcdSmmSmramRequire)) { - Status = gBS->InstallMultipleProtocolInterfaces ( - &ImageHandle, - &gEfiLockBoxProtocolGuid, NULL, - NULL - ); - ASSERT_EFI_ERROR (Status); - } - Status = gBS->CreateEventEx ( EVT_NOTIFY_SIGNAL, TPL_CALLBACK, diff --git a/OvmfPkg/AcpiS3SaveDxe/AcpiS3SaveDxe.inf b/OvmfPkg/AcpiS3SaveDxe/AcpiS3SaveDxe.inf index a288b954b7..f067fc7bf0 100644 --- a/OvmfPkg/AcpiS3SaveDxe/AcpiS3SaveDxe.inf +++ b/OvmfPkg/AcpiS3SaveDxe/AcpiS3SaveDxe.inf @@ -1,7 +1,7 @@ ## @file # AcpiS3Save module installs EndOfDxe callback to prepare S3 boot data. # -# Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
+# Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
# # This program and the accompanying materials are # licensed and made available under the terms and conditions of the BSD License @@ -36,7 +36,6 @@ MdeModulePkg/MdeModulePkg.dec IntelFrameworkPkg/IntelFrameworkPkg.dec IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec - OvmfPkg/OvmfPkg.dec [LibraryClasses] PcdLib @@ -49,7 +48,6 @@ LockBoxLib DebugLib DxeServicesLib - QemuFwCfgLib [Guids] gEfiAcpiVariableGuid # ALWAYS_CONSUMED @@ -59,7 +57,6 @@ gEfiEndOfDxeEventGroupGuid ## CONSUMES ## Event [Protocols] - gEfiLockBoxProtocolGuid # PROTOCOL SOMETIMES_PRODUCED gEfiLegacyBiosProtocolGuid # PROTOCOL ALWAYS_CONSUMED gEfiLegacyRegion2ProtocolGuid # PROTOCOL SOMETIMES_CONSUMED gFrameworkEfiMpServiceProtocolGuid # PROTOCOL SOMETIMES_CONSUMED @@ -71,7 +68,6 @@ gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdS3AcpiReservedMemorySize ## CONSUMES gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdS3BootScriptStackSize ## CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdUse1GPageTable - gUefiOvmfPkgTokenSpaceGuid.PcdSmmSmramRequire ## CONSUMES [Depex] gEfiVariableArchProtocolGuid AND gEfiVariableWriteArchProtocolGuid diff --git a/OvmfPkg/Library/LockBoxLib/LockBoxDxe.c b/OvmfPkg/Library/LockBoxLib/LockBoxDxe.c index c8f2ec8a4e..818646a275 100644 --- a/OvmfPkg/Library/LockBoxLib/LockBoxDxe.c +++ b/OvmfPkg/Library/LockBoxLib/LockBoxDxe.c @@ -1,6 +1,6 @@ /** @file - Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
+ Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -18,6 +18,8 @@ #include #include #include +#include +#include #include /** @@ -115,5 +117,30 @@ LockBoxDxeLibInitialize ( IN EFI_SYSTEM_TABLE *SystemTable ) { - return LockBoxLibInitialize (); + EFI_STATUS Status; + VOID *Interface; + + Status = LockBoxLibInitialize (); + if (!EFI_ERROR (Status)) { + if (QemuFwCfgS3Enabled ()) { + // + // When S3 enabled, the first driver run with this library linked will + // have this library constructor to install LockBox protocol on the + // ImageHandle. As other drivers may have gEfiLockBoxProtocolGuid + // dependency, the first driver should run before them. + // + Status = gBS->LocateProtocol (&gEfiLockBoxProtocolGuid, NULL, &Interface); + if (EFI_ERROR (Status)) { + Status = gBS->InstallProtocolInterface ( + &ImageHandle, + &gEfiLockBoxProtocolGuid, + EFI_NATIVE_INTERFACE, + NULL + ); + ASSERT_EFI_ERROR (Status); + } + } + } + + return Status; } diff --git a/OvmfPkg/Library/LockBoxLib/LockBoxDxeLib.inf b/OvmfPkg/Library/LockBoxLib/LockBoxDxeLib.inf index 08973a47be..bedf1811e0 100644 --- a/OvmfPkg/Library/LockBoxLib/LockBoxDxeLib.inf +++ b/OvmfPkg/Library/LockBoxLib/LockBoxDxeLib.inf @@ -3,7 +3,7 @@ # Library implementing the LockBox interface for OVMF # # Copyright (C) 2013, Red Hat, Inc. -# Copyright (c) 2014, Intel Corporation. All rights reserved.
+# Copyright (c) 2014 - 2016, Intel Corporation. All rights reserved.
# # This program and the accompanying materials are licensed and made available # under the terms and conditions of the BSD License which accompanies this @@ -39,6 +39,10 @@ BaseMemoryLib DebugLib UefiBootServicesTableLib + QemuFwCfgLib + +[Protocols] + gEfiLockBoxProtocolGuid ## SOMETIMES_PRODUCES [Pcd] gUefiOvmfPkgTokenSpaceGuid.PcdOvmfLockBoxStorageBase