}\r
\r
\r
+/**\r
+ Empty callback function executed when the EndOfDxe event group is signaled.\r
+\r
+ We only need this function because we'd like to signal EndOfDxe, and for that\r
+ we need to create an event, with a callback function.\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
+STATIC\r
+VOID\r
+EFIAPI\r
+OnEndOfDxe (\r
+ IN EFI_EVENT Event,\r
+ IN VOID *Context\r
+ )\r
+{\r
+}\r
+\r
+\r
VOID\r
EFIAPI\r
PlatformBdsPolicyBehavior (\r
{\r
EFI_STATUS Status;\r
EFI_BOOT_MODE BootMode;\r
+ EFI_EVENT EndOfDxeEvent;\r
\r
DEBUG ((EFI_D_INFO, "PlatformBdsPolicyBehavior\n"));\r
\r
VisitAllInstancesOfProtocol (&gEfiPciRootBridgeIoProtocolGuid,\r
ConnectRootBridge, NULL);\r
\r
+ //\r
+ // We can't signal End-of-Dxe earlier than this. Namely, End-of-Dxe triggers\r
+ // the preparation of S3 system information. That logic has a hard dependency\r
+ // on the presence of the FACS ACPI table. Since our ACPI tables are only\r
+ // installed after PCI enumeration completes, we must not trigger the S3 save\r
+ // earlier, hence we can't signal End-of-Dxe earlier.\r
+ //\r
+ Status = gBS->CreateEventEx (EVT_NOTIFY_SIGNAL, TPL_CALLBACK, OnEndOfDxe,\r
+ NULL /* NotifyContext */, &gEfiEndOfDxeEventGroupGuid,\r
+ &EndOfDxeEvent);\r
+ if (!EFI_ERROR (Status)) {\r
+ gBS->SignalEvent (EndOfDxeEvent);\r
+ gBS->CloseEvent (EndOfDxeEvent);\r
+ }\r
+\r
if (PcdGetBool (PcdOvmfFlashVariablesEnable)) {\r
DEBUG ((EFI_D_INFO, "PlatformBdsPolicyBehavior: not restoring NvVars "\r
"from disk since flash variables appear to be supported.\n"));\r