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
#include <Guid/AcpiVariableCompatibility.h>\r
#include <Guid/AcpiS3Context.h>\r
#include <Guid/Acpi.h>\r
#include <Guid/AcpiVariableCompatibility.h>\r
#include <Guid/AcpiS3Context.h>\r
#include <Guid/Acpi.h>\r
+#include <Guid/EventGroup.h>\r
#include <Protocol/AcpiS3Save.h>\r
#include <Protocol/S3SaveState.h>\r
#include <Protocol/DxeSmmReadyToLock.h>\r
#include <Protocol/AcpiS3Save.h>\r
#include <Protocol/S3SaveState.h>\r
#include <Protocol/DxeSmmReadyToLock.h>\r
return EFI_SUCCESS;\r
}\r
\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+ Callback function executed when the EndOfDxe event group is signaled.\r
+\r
+ @param[in] Event Event whose notification function is being invoked.\r
+ @param[in] Context The pointer to the notification function's context, which\r
+ is implementation-dependent.\r
+**/\r
+VOID\r
+EFIAPI\r
+OnEndOfDxe (\r
+ IN EFI_EVENT Event,\r
+ IN VOID *Context\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+\r
+ //\r
+ // Our S3Ready() function ignores both of its parameters, and always\r
+ // succeeds.\r
+ //\r
+ Status = S3Ready (\r
+ NULL, // This\r
+ NULL // LegacyMemoryAddress\r
+ );\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+ //\r
+ // Close the event, deregistering the callback and freeing resources.\r
+ //\r
+ Status = gBS->CloseEvent (Event);\r
+ ASSERT_EFI_ERROR (Status);\r
+}\r
+\r
+\r
/**\r
The Driver Entry Point.\r
\r
/**\r
The Driver Entry Point.\r
\r
)\r
{\r
EFI_STATUS Status;\r
)\r
{\r
EFI_STATUS Status;\r
+ EFI_EVENT EndOfDxeEvent;\r
\r
if (!QemuFwCfgS3Enabled()) {\r
return EFI_LOAD_ERROR;\r
\r
if (!QemuFwCfgS3Enabled()) {\r
return EFI_LOAD_ERROR;\r
NULL\r
);\r
ASSERT_EFI_ERROR (Status);\r
NULL\r
);\r
ASSERT_EFI_ERROR (Status);\r
+\r
+ Status = gBS->CreateEventEx (\r
+ EVT_NOTIFY_SIGNAL,\r
+ TPL_CALLBACK,\r
+ OnEndOfDxe,\r
+ NULL, /* NotifyContext */\r
+ &gEfiEndOfDxeEventGroupGuid,\r
+ &EndOfDxeEvent\r
+ );\r
+ ASSERT_EFI_ERROR (Status);\r
gEfiAcpiS3ContextGuid # ALWAYS_CONSUMED\r
gEfiAcpi20TableGuid # ALWAYS_CONSUMED System Table\r
gEfiAcpi10TableGuid # ALWAYS_CONSUMED System Table\r
gEfiAcpiS3ContextGuid # ALWAYS_CONSUMED\r
gEfiAcpi20TableGuid # ALWAYS_CONSUMED System Table\r
gEfiAcpi10TableGuid # ALWAYS_CONSUMED System Table\r
+ gEfiEndOfDxeEventGroupGuid ## CONSUMES ## Event\r
\r
[Protocols]\r
gEfiAcpiS3SaveProtocolGuid # PROTOCOL ALWAYS_PRODUCED\r
\r
[Protocols]\r
gEfiAcpiS3SaveProtocolGuid # PROTOCOL ALWAYS_PRODUCED\r