summaryrefslogtreecommitdiff
path: root/OvmfPkg/Library/PlatformBdsLib
diff options
context:
space:
mode:
Diffstat (limited to 'OvmfPkg/Library/PlatformBdsLib')
-rw-r--r--OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c37
-rw-r--r--OvmfPkg/Library/PlatformBdsLib/BdsPlatform.h1
-rw-r--r--OvmfPkg/Library/PlatformBdsLib/PlatformBdsLib.inf3
3 files changed, 41 insertions, 0 deletions
diff --git a/OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c b/OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c
index de13c6b5c3..ce299875cd 100644
--- a/OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBdsLib/BdsPlatform.c
@@ -1163,6 +1163,27 @@ Returns:
}
+/**
+ Empty callback function executed when the EndOfDxe event group is signaled.
+
+ We only need this function because we'd like to signal EndOfDxe, and for that
+ we need to create an event, with a callback function.
+
+ @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.
+**/
+STATIC
+VOID
+EFIAPI
+OnEndOfDxe (
+ IN EFI_EVENT Event,
+ IN VOID *Context
+ )
+{
+}
+
+
VOID
EFIAPI
PlatformBdsPolicyBehavior (
@@ -1197,12 +1218,28 @@ Returns:
{
EFI_STATUS Status;
EFI_BOOT_MODE BootMode;
+ EFI_EVENT EndOfDxeEvent;
DEBUG ((EFI_D_INFO, "PlatformBdsPolicyBehavior\n"));
VisitAllInstancesOfProtocol (&gEfiPciRootBridgeIoProtocolGuid,
ConnectRootBridge, NULL);
+ //
+ // We can't signal End-of-Dxe earlier than this. Namely, End-of-Dxe triggers
+ // the preparation of S3 system information. That logic has a hard dependency
+ // on the presence of the FACS ACPI table. Since our ACPI tables are only
+ // installed after PCI enumeration completes, we must not trigger the S3 save
+ // earlier, hence we can't signal End-of-Dxe earlier.
+ //
+ Status = gBS->CreateEventEx (EVT_NOTIFY_SIGNAL, TPL_CALLBACK, OnEndOfDxe,
+ NULL /* NotifyContext */, &gEfiEndOfDxeEventGroupGuid,
+ &EndOfDxeEvent);
+ if (!EFI_ERROR (Status)) {
+ gBS->SignalEvent (EndOfDxeEvent);
+ gBS->CloseEvent (EndOfDxeEvent);
+ }
+
if (PcdGetBool (PcdOvmfFlashVariablesEnable)) {
DEBUG ((EFI_D_INFO, "PlatformBdsPolicyBehavior: not restoring NvVars "
"from disk since flash variables appear to be supported.\n"));
diff --git a/OvmfPkg/Library/PlatformBdsLib/BdsPlatform.h b/OvmfPkg/Library/PlatformBdsLib/BdsPlatform.h
index e3e950e4ae..b510178668 100644
--- a/OvmfPkg/Library/PlatformBdsLib/BdsPlatform.h
+++ b/OvmfPkg/Library/PlatformBdsLib/BdsPlatform.h
@@ -59,6 +59,7 @@ Abstract:
#include <Guid/Mps.h>
#include <Guid/HobList.h>
#include <Guid/GlobalVariable.h>
+#include <Guid/EventGroup.h>
#include <OvmfPlatforms.h>
diff --git a/OvmfPkg/Library/PlatformBdsLib/PlatformBdsLib.inf b/OvmfPkg/Library/PlatformBdsLib/PlatformBdsLib.inf
index ce2972013d..c40871b673 100644
--- a/OvmfPkg/Library/PlatformBdsLib/PlatformBdsLib.inf
+++ b/OvmfPkg/Library/PlatformBdsLib/PlatformBdsLib.inf
@@ -65,3 +65,6 @@
[Protocols]
gEfiDecompressProtocolGuid
gEfiPciRootBridgeIoProtocolGuid
+
+[Guids]
+ gEfiEndOfDxeEventGroupGuid