All tables except the FACS and FACP will now be delayed, and only
published at the ReadyToBoot signal.

This will allow QEMU to rebuild the tables after PCI enumeration.

Since not all platforms will have PCI enumeration, using ReadyToBoot
guarantees that the tables will be published. (Whereas depending on
gEfiPciEnumerationCompleteProtocolGuid can lead to a situation where
the tables are not installed.)

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.jus...@intel.com>
---
 OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h  |  1 +
 OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c | 40 +++++++++++++++++++++++++++++----
 2 files changed, 37 insertions(+), 4 deletions(-)

diff --git a/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h 
b/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h
index ae11e79..4c592fb 100644
--- a/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h
+++ b/OvmfPkg/AcpiPlatformDxe/AcpiPlatform.h
@@ -24,6 +24,7 @@
 #include <Library/UefiBootServicesTableLib.h>
 #include <Library/DebugLib.h>
 #include <Library/PcdLib.h>
+#include <Library/UefiLib.h>
 
 #include <IndustryStandard/Acpi.h>
 
diff --git a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c 
b/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c
index b3be65d..eac1977 100644
--- a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c
+++ b/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpi.c
@@ -728,6 +728,35 @@ FreeLoader:
 }
 
 
+STATIC
+VOID
+EFIAPI
+PublishAllAcpiTables (
+  IN      EFI_EVENT                 Event,
+  IN      VOID                      *Context
+  )
+{
+  EFI_STATUS                         Status;
+  EFI_ACPI_TABLE_PROTOCOL            *AcpiProtocol;
+
+  //
+  // Only publish tables once
+  //
+  gBS->CloseEvent (Event);
+
+  DEBUG ((EFI_D_VERBOSE, "%a %d\n", __FUNCTION__, __LINE__));
+
+  AcpiProtocol = (EFI_ACPI_TABLE_PROTOCOL*) Context;
+
+  //
+  // At this callback, PCI enumeration should be complete. Therefore QEMU's
+  // tables are now finalized, and we can install them.
+  //
+  Status = DownloadAndInstallTables (AcpiProtocol, FALSE);
+  ASSERT_EFI_ERROR (Status);
+}
+
+
 /**
   Download, process, and install ACPI table data from the QEMU loader
   interface.
@@ -761,6 +790,7 @@ InstallQemuFwCfgTables (
   )
 {
   EFI_STATUS          Status;
+  EFI_EVENT           PublishAllTablesEvent = NULL;
 
   //
   // At this early stage, we install a few tables that other code depends on.
@@ -771,11 +801,13 @@ InstallQemuFwCfgTables (
   if (EFI_ERROR (Status)) {
     return Status;
   }
-  Status = DownloadAndInstallTables (AcpiProtocol, FALSE);
-  if (EFI_ERROR (Status)) {
-    return Status;
-  }
 
+  Status = EfiCreateEventReadyToBootEx (
+             TPL_NOTIFY,
+             PublishAllAcpiTables,
+             (VOID*) AcpiProtocol,
+             &PublishAllTablesEvent
+             );
   return Status;
 }
 
-- 
2.1.4


------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to