[edk2-devel] [PATCH 20/43] OvmfPkg/XenAcpiPlatformDxe: remove delayed ACPI table installation

Laszlo Ersek lersek at redhat.com
Wed May 26 20:14:23 UTC 2021


Because "PcdPciDisableBusEnumeration" is always TRUE in the OvmfXen
platform, we can remove the delayed ACPI table installation from
XenAcpiPlatformDxe. A number of dependencies become useless this way;
remove them too.

(Note that, conversely, in the QemuFwCfgAcpiPlatformDxe driver, we
*cannot* assume that "PcdPciDisableBusEnumeration" is always FALSE,
regardless of Xen: in the ArmVirtQemu platform, the PCD may carry either
FALSE or TRUE, dependent on whether or not the QEMU "virt" machine
configuration includes a PCIe host controller, respectively.)

Cc: Anthony Perard <anthony.perard at citrix.com>
Cc: Ard Biesheuvel <ardb+tianocore at kernel.org>
Cc: Jordan Justen <jordan.l.justen at intel.com>
Cc: Julien Grall <julien at xen.org>
Cc: Philippe Mathieu-Daudé <philmd at redhat.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2122
Signed-off-by: Laszlo Ersek <lersek at redhat.com>
---
 OvmfPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf |  8 ---
 OvmfPkg/XenAcpiPlatformDxe/EntryPoint.c           | 56 +-------------------
 2 files changed, 2 insertions(+), 62 deletions(-)

diff --git a/OvmfPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf b/OvmfPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf
index db9b6e093de4..d3a6353a50a6 100644
--- a/OvmfPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf
+++ b/OvmfPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.inf
@@ -25,29 +25,21 @@ [Sources]
   AcpiPlatform.c
   AcpiPlatform.h
   EntryPoint.c
   Xen.c
 
 [Packages]
-  MdeModulePkg/MdeModulePkg.dec
   MdePkg/MdePkg.dec
   OvmfPkg/OvmfPkg.dec
 
 [LibraryClasses]
   BaseLib
   DebugLib
-  PcdLib
   UefiBootServicesTableLib
   UefiDriverEntryPoint
   XenPlatformLib
 
 [Protocols]
   gEfiAcpiTableProtocolGuid                     # PROTOCOL ALWAYS_CONSUMED
 
-[Guids]
-  gRootBridgesConnectedEventGroupGuid
-
-[Pcd]
-  gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration
-
 [Depex]
   gEfiAcpiTableProtocolGuid
diff --git a/OvmfPkg/XenAcpiPlatformDxe/EntryPoint.c b/OvmfPkg/XenAcpiPlatformDxe/EntryPoint.c
index b6d0835fe3d4..1a23790a3b2c 100644
--- a/OvmfPkg/XenAcpiPlatformDxe/EntryPoint.c
+++ b/OvmfPkg/XenAcpiPlatformDxe/EntryPoint.c
@@ -4,15 +4,13 @@
   Copyright (C) 2015-2021, Red Hat, Inc.
   Copyright (c) 2008 - 2015, Intel Corporation. All rights reserved.<BR>
 
   SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
 
-#include <Guid/RootBridgesConnectedEventGroup.h> // gRootBridgesConnectedEve...
-#include <Library/DebugLib.h>                    // DEBUG()
-#include <Library/PcdLib.h>                      // PcdGetBool()
+#include <Library/DebugLib.h>                    // ASSERT_EFI_ERROR()
 #include <Library/UefiBootServicesTableLib.h>    // gBS
 #include <Protocol/AcpiTable.h>                  // EFI_ACPI_TABLE_PROTOCOL
 
 #include "AcpiPlatform.h"
 
 STATIC
@@ -31,65 +29,15 @@ FindAcpiTableProtocol (
                   );
   ASSERT_EFI_ERROR (Status);
   return AcpiTable;
 }
 
 
-STATIC
-VOID
-EFIAPI
-OnRootBridgesConnected (
-  IN EFI_EVENT Event,
-  IN VOID      *Context
-  )
-{
-  EFI_STATUS Status;
-
-  DEBUG ((DEBUG_INFO,
-    "%a: root bridges have been connected, installing ACPI tables\n",
-    __FUNCTION__));
-  Status = InstallAcpiTables (FindAcpiTableProtocol ());
-  if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR, "%a: InstallAcpiTables: %r\n", __FUNCTION__, Status));
-  }
-  gBS->CloseEvent (Event);
-}
-
-
 EFI_STATUS
 EFIAPI
 AcpiPlatformEntryPoint (
   IN EFI_HANDLE         ImageHandle,
   IN EFI_SYSTEM_TABLE   *SystemTable
   )
 {
-  EFI_STATUS Status;
-  EFI_EVENT  RootBridgesConnected;
-
-  //
-  // If the platform doesn't support PCI, or PCI enumeration has been disabled,
-  // install the tables at once, and let the entry point's return code reflect
-  // the full functionality.
-  //
-  if (PcdGetBool (PcdPciDisableBusEnumeration)) {
-    DEBUG ((DEBUG_INFO, "%a: PCI or its enumeration disabled, installing "
-      "ACPI tables\n", __FUNCTION__));
-    return InstallAcpiTables (FindAcpiTableProtocol ());
-  }
-
-  //
-  // 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->CreateEventEx (EVT_NOTIFY_SIGNAL, TPL_CALLBACK,
-                  OnRootBridgesConnected, NULL /* Context */,
-                  &gRootBridgesConnectedEventGroupGuid, &RootBridgesConnected);
-  if (!EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_INFO,
-      "%a: waiting for root bridges to be connected, registered callback\n",
-      __FUNCTION__));
-  }
-
-  return Status;
+  return InstallAcpiTables (FindAcpiTableProtocol ());
 }
-- 
2.19.1.3.g30247aa5d201




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#75689): https://edk2.groups.io/g/devel/message/75689
Mute This Topic: https://groups.io/mt/83110694/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-






More information about the edk2-devel-archive mailing list