summaryrefslogtreecommitdiff
path: root/IntelFrameworkModulePkg/Universal
diff options
context:
space:
mode:
authorLaszlo Ersek <lersek@redhat.com>2015-07-02 06:36:29 +0000
committerabiesheuvel <abiesheuvel@Edk2>2015-07-02 06:36:29 +0000
commite50c79f7d5f6c2f345b12c5d638d0356b8c06dcd (patch)
tree203e7754991f6692c2f540737d2df6d588e7056d /IntelFrameworkModulePkg/Universal
parentdbaeca276b82c56282f2f256abf15a553022602c (diff)
downloadedk2-platforms-e50c79f7d5f6c2f345b12c5d638d0356b8c06dcd.tar.xz
IntelFrameworkModulePkg: 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 Vlv2TbltDevicePkg. 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: Yao Jiewen <jiewen.yao@intel.com> Cc: Jeff Fan <jeff.fan@intel.com> Cc: David Wei <david.wei@intel.com> Cc: Tim He <tim.he@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17805 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'IntelFrameworkModulePkg/Universal')
-rw-r--r--IntelFrameworkModulePkg/Universal/Acpi/AcpiS3SaveDxe/AcpiS3Save.c46
-rw-r--r--IntelFrameworkModulePkg/Universal/Acpi/AcpiS3SaveDxe/AcpiS3SaveDxe.inf1
2 files changed, 47 insertions, 0 deletions
diff --git a/IntelFrameworkModulePkg/Universal/Acpi/AcpiS3SaveDxe/AcpiS3Save.c b/IntelFrameworkModulePkg/Universal/Acpi/AcpiS3SaveDxe/AcpiS3Save.c
index ac3e9470bd..e0fa866535 100644
--- a/IntelFrameworkModulePkg/Universal/Acpi/AcpiS3SaveDxe/AcpiS3Save.c
+++ b/IntelFrameworkModulePkg/Universal/Acpi/AcpiS3SaveDxe/AcpiS3Save.c
@@ -28,6 +28,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 <IndustryStandard/Acpi.h>
@@ -550,6 +551,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.
@@ -570,6 +605,7 @@ InstallAcpiS3Save (
)
{
EFI_STATUS Status;
+ EFI_EVENT EndOfDxeEvent;
if (!FeaturePcdGet(PcdPlatformCsmSupport)) {
//
@@ -591,5 +627,15 @@ InstallAcpiS3Save (
&mS3Save
);
ASSERT_EFI_ERROR (Status);
+
+ Status = gBS->CreateEventEx (
+ EVT_NOTIFY_SIGNAL,
+ TPL_CALLBACK,
+ OnEndOfDxe,
+ NULL, /* NotifyContext */
+ &gEfiEndOfDxeEventGroupGuid,
+ &EndOfDxeEvent
+ );
+ ASSERT_EFI_ERROR (Status);
return Status;
}
diff --git a/IntelFrameworkModulePkg/Universal/Acpi/AcpiS3SaveDxe/AcpiS3SaveDxe.inf b/IntelFrameworkModulePkg/Universal/Acpi/AcpiS3SaveDxe/AcpiS3SaveDxe.inf
index c5dec0546a..e5fb92e4c5 100644
--- a/IntelFrameworkModulePkg/Universal/Acpi/AcpiS3SaveDxe/AcpiS3SaveDxe.inf
+++ b/IntelFrameworkModulePkg/Universal/Acpi/AcpiS3SaveDxe/AcpiS3SaveDxe.inf
@@ -60,6 +60,7 @@
## SOMETIMES_CONSUMES ## Variable:L"AcpiGlobalVariable"
## SOMETIMES_PRODUCES ## Variable:L"AcpiGlobalVariable"
gEfiAcpiVariableCompatiblityGuid
+ gEfiEndOfDxeEventGroupGuid ## CONSUMES ## Event
[Protocols]
gEfiAcpiS3SaveProtocolGuid ## PRODUCES