]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OvmfPkg/AcpiPlatformDxe/EntryPoint.c
CorebootPayloadPkg: Add an option to use HPET timer driver
[mirror_edk2.git] / OvmfPkg / AcpiPlatformDxe / EntryPoint.c
index d713b0d44b1b96f55caaa8f10166be8d1f3169b5..1bfd31a0371a479a73a3999c4f85d470d0dd40bf 100644 (file)
@@ -13,7 +13,7 @@
   WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 **/\r
 \r
-#include <Protocol/PciEnumerationComplete.h>\r
+#include <Guid/RootBridgesConnectedEventGroup.h>\r
 #include "AcpiPlatform.h"\r
 \r
 STATIC\r
@@ -38,14 +38,15 @@ FindAcpiTableProtocol (
 STATIC\r
 VOID\r
 EFIAPI\r
-OnPciEnumerated (\r
+OnRootBridgesConnected (\r
   IN EFI_EVENT Event,\r
   IN VOID      *Context\r
   )\r
 {\r
   EFI_STATUS Status;\r
 \r
-  DEBUG ((EFI_D_INFO, "%a: PCI enumeration complete, installing ACPI tables\n",\r
+  DEBUG ((EFI_D_INFO,\r
+    "%a: root bridges have been connected, installing ACPI tables\n",\r
     __FUNCTION__));\r
   Status = InstallAcpiTables (FindAcpiTableProtocol ());\r
   if (EFI_ERROR (Status)) {\r
@@ -63,9 +64,7 @@ AcpiPlatformEntryPoint (
   )\r
 {\r
   EFI_STATUS Status;\r
-  VOID       *Interface;\r
-  EFI_EVENT  PciEnumerated;\r
-  VOID       *Registration;\r
+  EFI_EVENT  RootBridgesConnected;\r
 \r
   //\r
   // If the platform doesn't support PCI, or PCI enumeration has been disabled,\r
@@ -79,36 +78,17 @@ AcpiPlatformEntryPoint (
   }\r
 \r
   //\r
-  // Similarly, if PCI enumeration has already completed, install the tables\r
-  // immediately.\r
+  // Otherwise, delay installing the ACPI tables until root bridges are\r
+  // connected. The entry point's return status will only reflect the callback\r
+  // setup. (Note that we're a DXE_DRIVER; our entry point function is invoked\r
+  // strictly before BDS is entered and can connect the root bridges.)\r
   //\r
-  Status = gBS->LocateProtocol (&gEfiPciEnumerationCompleteProtocolGuid,\r
-                  NULL /* Registration */, &Interface);\r
+  Status = gBS->CreateEventEx (EVT_NOTIFY_SIGNAL, TPL_CALLBACK,\r
+                  OnRootBridgesConnected, NULL /* Context */,\r
+                  &gRootBridgesConnectedEventGroupGuid, &RootBridgesConnected);\r
   if (!EFI_ERROR (Status)) {\r
-    DEBUG ((EFI_D_INFO, "%a: PCI enumeration already complete, "\r
-      "installing ACPI tables\n", __FUNCTION__));\r
-    return InstallAcpiTables (FindAcpiTableProtocol ());\r
-  }\r
-  ASSERT (Status == EFI_NOT_FOUND);\r
-\r
-  //\r
-  // Otherwise, delay installing the ACPI tables until PCI enumeration\r
-  // completes. The entry point's return status will only reflect the callback\r
-  // setup.\r
-  //\r
-  Status = gBS->CreateEvent (EVT_NOTIFY_SIGNAL, TPL_CALLBACK, OnPciEnumerated,\r
-                  NULL /* Context */, &PciEnumerated);\r
-  if (EFI_ERROR (Status)) {\r
-    return Status;\r
-  }\r
-\r
-  Status = gBS->RegisterProtocolNotify (\r
-                  &gEfiPciEnumerationCompleteProtocolGuid, PciEnumerated,\r
-                  &Registration);\r
-  if (EFI_ERROR (Status)) {\r
-    gBS->CloseEvent (PciEnumerated);\r
-  } else {\r
-    DEBUG ((EFI_D_INFO, "%a: PCI enumeration pending, registered callback\n",\r
+    DEBUG ((EFI_D_INFO,\r
+      "%a: waiting for root bridges to be connected, registered callback\n",\r
       __FUNCTION__));\r
   }\r
 \r