summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/AcpiPlatformDxe
diff options
context:
space:
mode:
authorLaszlo Ersek <lersek@redhat.com>2016-03-13 18:09:57 +0100
committerLaszlo Ersek <lersek@redhat.com>2016-03-23 17:39:35 +0100
commitb6bc800d5ad6f15588a1f5e44f7aa67499399787 (patch)
treefe5863900f2566e2d4cdecb43790e8014f6134a3 /OvmfPkg/AcpiPlatformDxe
parent158990b941e461f69b8ec89bd6c9d0650aeb6188 (diff)
downloadedk2-b6bc800d5ad6f15588a1f5e44f7aa67499399787.tar.gz
edk2-b6bc800d5ad6f15588a1f5e44f7aa67499399787.tar.bz2
edk2-b6bc800d5ad6f15588a1f5e44f7aa67499399787.zip
OvmfPkg: AcpiPlatformDxe: when PCI is enabled, wait for Platform BDS's cue
This patch doesn't change the behavior of AcpiPlatformDxe when PcdPciDisableBusEnumeration is TRUE -- that is, when the driver runs on Xen (OvmfPkg and ArmVirtPkg both), or when the driver runs on QEMU as part of ArmVirtPkg but no PCI host bridge was found by VirtFdtDxe. In these cases the driver continues to install the ACPI tables immediately. However, when PcdPciDisableBusEnumeration is FALSE (i.e., when the driver runs on QEMU as part of OVMF, or as part of ArmVirtPkg and VirtFdtDxe finds a PCI host bridge), we now delay the ACPI table download from QEMU. We wait until the Platform BDS tells us that root bridges have been connected, and PciIo instances are available. The explanation is in the patch titled OvmfPkg: introduce gRootBridgesConnectedEventGroupGuid Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Jordan Justen <jordan.l.justen@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Diffstat (limited to 'OvmfPkg/AcpiPlatformDxe')
-rw-r--r--OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf2
-rw-r--r--OvmfPkg/AcpiPlatformDxe/EntryPoint.c48
-rw-r--r--OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf4
3 files changed, 18 insertions, 36 deletions
diff --git a/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf b/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
index 055f3ad0ee..8e98053994 100644
--- a/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
+++ b/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
@@ -57,10 +57,10 @@
[Protocols]
gEfiAcpiTableProtocolGuid # PROTOCOL ALWAYS_CONSUMED
- gEfiPciEnumerationCompleteProtocolGuid # PROTOCOL SOMETIMES_CONSUMED
[Guids]
gEfiXenInfoGuid
+ gRootBridgesConnectedEventGroupGuid
[Pcd]
gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiTableStorageFile
diff --git a/OvmfPkg/AcpiPlatformDxe/EntryPoint.c b/OvmfPkg/AcpiPlatformDxe/EntryPoint.c
index d713b0d44b..1bfd31a037 100644
--- a/OvmfPkg/AcpiPlatformDxe/EntryPoint.c
+++ b/OvmfPkg/AcpiPlatformDxe/EntryPoint.c
@@ -13,7 +13,7 @@
WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
-#include <Protocol/PciEnumerationComplete.h>
+#include <Guid/RootBridgesConnectedEventGroup.h>
#include "AcpiPlatform.h"
STATIC
@@ -38,14 +38,15 @@ FindAcpiTableProtocol (
STATIC
VOID
EFIAPI
-OnPciEnumerated (
+OnRootBridgesConnected (
IN EFI_EVENT Event,
IN VOID *Context
)
{
EFI_STATUS Status;
- DEBUG ((EFI_D_INFO, "%a: PCI enumeration complete, installing ACPI tables\n",
+ DEBUG ((EFI_D_INFO,
+ "%a: root bridges have been connected, installing ACPI tables\n",
__FUNCTION__));
Status = InstallAcpiTables (FindAcpiTableProtocol ());
if (EFI_ERROR (Status)) {
@@ -63,9 +64,7 @@ AcpiPlatformEntryPoint (
)
{
EFI_STATUS Status;
- VOID *Interface;
- EFI_EVENT PciEnumerated;
- VOID *Registration;
+ EFI_EVENT RootBridgesConnected;
//
// If the platform doesn't support PCI, or PCI enumeration has been disabled,
@@ -79,36 +78,17 @@ AcpiPlatformEntryPoint (
}
//
- // Similarly, if PCI enumeration has already completed, install the tables
- // immediately.
+ // Otherwise, delay installing the ACPI tables until root bridges are
+ // connected. The entry point's return status will only reflect the callback
+ // setup. (Note that we're a DXE_DRIVER; our entry point function is invoked
+ // strictly before BDS is entered and can connect the root bridges.)
//
- Status = gBS->LocateProtocol (&gEfiPciEnumerationCompleteProtocolGuid,
- NULL /* Registration */, &Interface);
+ Status = gBS->CreateEventEx (EVT_NOTIFY_SIGNAL, TPL_CALLBACK,
+ OnRootBridgesConnected, NULL /* Context */,
+ &gRootBridgesConnectedEventGroupGuid, &RootBridgesConnected);
if (!EFI_ERROR (Status)) {
- DEBUG ((EFI_D_INFO, "%a: PCI enumeration already complete, "
- "installing ACPI tables\n", __FUNCTION__));
- return InstallAcpiTables (FindAcpiTableProtocol ());
- }
- ASSERT (Status == EFI_NOT_FOUND);
-
- //
- // Otherwise, delay installing the ACPI tables until PCI enumeration
- // completes. The entry point's return status will only reflect the callback
- // setup.
- //
- Status = gBS->CreateEvent (EVT_NOTIFY_SIGNAL, TPL_CALLBACK, OnPciEnumerated,
- NULL /* Context */, &PciEnumerated);
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- Status = gBS->RegisterProtocolNotify (
- &gEfiPciEnumerationCompleteProtocolGuid, PciEnumerated,
- &Registration);
- if (EFI_ERROR (Status)) {
- gBS->CloseEvent (PciEnumerated);
- } else {
- DEBUG ((EFI_D_INFO, "%a: PCI enumeration pending, registered callback\n",
+ DEBUG ((EFI_D_INFO,
+ "%a: waiting for root bridges to be connected, registered callback\n",
__FUNCTION__));
}
diff --git a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf b/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf
index 22ce165852..c073b2a47e 100644
--- a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf
+++ b/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf
@@ -47,7 +47,9 @@
[Protocols]
gEfiAcpiTableProtocolGuid # PROTOCOL ALWAYS_CONSUMED
- gEfiPciEnumerationCompleteProtocolGuid # PROTOCOL SOMETIMES_CONSUMED
+
+[Guids]
+ gRootBridgesConnectedEventGroupGuid
[Pcd]
gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration