summaryrefslogtreecommitdiff
path: root/OvmfPkg/AcpiS3SaveDxe/AcpiS3Save.c
diff options
context:
space:
mode:
authorLaszlo Ersek <lersek@redhat.com>2015-07-26 08:02:07 +0000
committerjljusten <jljusten@Edk2>2015-07-26 08:02:07 +0000
commitb88ac532a6ba69aaa84427d319f498372ad3abd8 (patch)
treefd49e1d9ad1d3624404ea1c0fc651d59151aac77 /OvmfPkg/AcpiS3SaveDxe/AcpiS3Save.c
parent421957fb383c29e1ae9e88249681c88c3e9cd35b (diff)
downloadedk2-platforms-b88ac532a6ba69aaa84427d319f498372ad3abd8.tar.xz
OvmfPkg: AcpiS3SaveDxe: call S3Ready() at End-of-Dxe
Call S3Ready() whenever the first of the following occurs: - a driver signals End-of-Dxe, - a driver calls EFI_ACPI_S3_SAVE_PROTOCOL.S3Save(). S3Ready() already contains a static, function scope "latch" that causes it to exit early when called for the second time or later. (At the moment, the only platform in the edk2 tree that includes this driver is OvmfPkg. That platform does not signal End-of-Dxe (yet).) http://thread.gmane.org/gmane.comp.bios.tianocore.devel/16088/focus=16146 Suggested-by: Yao Jiewen <jiewen.yao@intel.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18034 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'OvmfPkg/AcpiS3SaveDxe/AcpiS3Save.c')
-rw-r--r--OvmfPkg/AcpiS3SaveDxe/AcpiS3Save.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/OvmfPkg/AcpiS3SaveDxe/AcpiS3Save.c b/OvmfPkg/AcpiS3SaveDxe/AcpiS3Save.c
index f05764af8b..5eb33e0587 100644
--- a/OvmfPkg/AcpiS3SaveDxe/AcpiS3Save.c
+++ b/OvmfPkg/AcpiS3SaveDxe/AcpiS3Save.c
@@ -29,6 +29,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Guid/AcpiVariableCompatibility.h>
#include <Guid/AcpiS3Context.h>
#include <Guid/Acpi.h>
+#include <Guid/EventGroup.h>
#include <Protocol/AcpiS3Save.h>
#include <Protocol/S3SaveState.h>
#include <Protocol/DxeSmmReadyToLock.h>
@@ -571,6 +572,40 @@ S3Ready (
}
/**
+ Callback function executed when the EndOfDxe event group is signaled.
+
+ @param[in] Event Event whose notification function is being invoked.
+ @param[in] Context The pointer to the notification function's context, which
+ is implementation-dependent.
+**/
+VOID
+EFIAPI
+OnEndOfDxe (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+ EFI_STATUS Status;
+
+ //
+ // Our S3Ready() function ignores both of its parameters, and always
+ // succeeds.
+ //
+ Status = S3Ready (
+ NULL, // This
+ NULL // LegacyMemoryAddress
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ //
+ // Close the event, deregistering the callback and freeing resources.
+ //
+ Status = gBS->CloseEvent (Event);
+ ASSERT_EFI_ERROR (Status);
+}
+
+
+/**
The Driver Entry Point.
The function is the driver Entry point which will produce AcpiS3SaveProtocol.
@@ -591,6 +626,7 @@ InstallAcpiS3Save (
)
{
EFI_STATUS Status;
+ EFI_EVENT EndOfDxeEvent;
if (!QemuFwCfgS3Enabled()) {
return EFI_LOAD_ERROR;
@@ -612,5 +648,15 @@ InstallAcpiS3Save (
NULL
);
ASSERT_EFI_ERROR (Status);
+
+ Status = gBS->CreateEventEx (
+ EVT_NOTIFY_SIGNAL,
+ TPL_CALLBACK,
+ OnEndOfDxe,
+ NULL, /* NotifyContext */
+ &gEfiEndOfDxeEventGroupGuid,
+ &EndOfDxeEvent
+ );
+ ASSERT_EFI_ERROR (Status);
return Status;
}