From patchwork Mon Mar 14 12:52:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laszlo Ersek X-Patchwork-Id: 63805 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp17443lbc; Mon, 14 Mar 2016 05:52:43 -0700 (PDT) X-Received: by 10.66.192.195 with SMTP id hi3mr37473508pac.149.1457959963386; Mon, 14 Mar 2016 05:52:43 -0700 (PDT) Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id q75si3163211pfq.207.2016.03.14.05.52.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 14 Mar 2016 05:52:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id B43641A1F9B; Mon, 14 Mar 2016 05:53:00 -0700 (PDT) X-Original-To: edk2-devel@ml01.01.org Delivered-To: edk2-devel@ml01.01.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id A99251A1F98 for ; Mon, 14 Mar 2016 05:52:58 -0700 (PDT) Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 7B91CC00F1CA; Mon, 14 Mar 2016 12:52:40 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-113-101.phx2.redhat.com [10.3.113.101]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u2ECqTaJ028980; Mon, 14 Mar 2016 08:52:38 -0400 From: Laszlo Ersek To: edk2-devel@ml01.01.org Date: Mon, 14 Mar 2016 13:52:24 +0100 Message-Id: <1457959945-29391-5-git-send-email-lersek@redhat.com> In-Reply-To: <1457959945-29391-1-git-send-email-lersek@redhat.com> References: <56E6B2D9.5010507@redhat.com> <1457959945-29391-1-git-send-email-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 Cc: Marcel Apfelbaum , Jordan Justen , Ard Biesheuvel Subject: [edk2] [wave 1 PATCH 4/5] OvmfPkg: AcpiPlatformDxe: when PCI is enabled, wait for Platform BDS's cue X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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 gRootBusesConnectedProtocolGuid Cc: Ard Biesheuvel Cc: Gerd Hoffmann Cc: Jordan Justen Cc: Marcel Apfelbaum Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek --- OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf | 2 +- OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf | 2 +- OvmfPkg/AcpiPlatformDxe/EntryPoint.c | 34 +++++++++++--------- 3 files changed, 20 insertions(+), 18 deletions(-) -- 1.8.3.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf b/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf index 055f3ad0ee0f..742ad8016c69 100644 --- a/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf +++ b/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf @@ -53,15 +53,15 @@ [LibraryClasses] MemoryAllocationLib BaseLib DxeServicesTableLib OrderedCollectionLib [Protocols] gEfiAcpiTableProtocolGuid # PROTOCOL ALWAYS_CONSUMED - gEfiPciEnumerationCompleteProtocolGuid # PROTOCOL SOMETIMES_CONSUMED + gRootBusesConnectedProtocolGuid # PROTOCOL SOMETIMES_CONSUMED [Guids] gEfiXenInfoGuid [Pcd] gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiTableStorageFile gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration diff --git a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf b/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf index 22ce165852f9..5a01de58ed53 100644 --- a/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf +++ b/OvmfPkg/AcpiPlatformDxe/QemuFwCfgAcpiPlatformDxe.inf @@ -43,14 +43,14 @@ [LibraryClasses] OrderedCollectionLib QemuFwCfgLib UefiBootServicesTableLib UefiDriverEntryPoint [Protocols] gEfiAcpiTableProtocolGuid # PROTOCOL ALWAYS_CONSUMED - gEfiPciEnumerationCompleteProtocolGuid # PROTOCOL SOMETIMES_CONSUMED + gRootBusesConnectedProtocolGuid # PROTOCOL SOMETIMES_CONSUMED [Pcd] gEfiMdeModulePkgTokenSpaceGuid.PcdPciDisableBusEnumeration [Depex] gEfiAcpiTableProtocolGuid diff --git a/OvmfPkg/AcpiPlatformDxe/EntryPoint.c b/OvmfPkg/AcpiPlatformDxe/EntryPoint.c index d713b0d44b1b..dafdf8578265 100644 --- a/OvmfPkg/AcpiPlatformDxe/EntryPoint.c +++ b/OvmfPkg/AcpiPlatformDxe/EntryPoint.c @@ -9,15 +9,15 @@ distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#include +#include #include "AcpiPlatform.h" STATIC EFI_ACPI_TABLE_PROTOCOL * FindAcpiTableProtocol ( VOID ) @@ -34,22 +34,23 @@ FindAcpiTableProtocol ( return AcpiTable; } STATIC VOID EFIAPI -OnPciEnumerated ( +OnRootBusesConnected ( 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 buses have been connected, installing ACPI tables\n", __FUNCTION__)); Status = InstallAcpiTables (FindAcpiTableProtocol ()); if (EFI_ERROR (Status)) { DEBUG ((EFI_D_ERROR, "%a: InstallAcpiTables: %r\n", __FUNCTION__, Status)); } gBS->CloseEvent (Event); } @@ -60,57 +61,58 @@ EFIAPI AcpiPlatformEntryPoint ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) { EFI_STATUS Status; VOID *Interface; - EFI_EVENT PciEnumerated; + EFI_EVENT RootBusesConnected; VOID *Registration; // // 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 ((EFI_D_INFO, "%a: PCI or its enumeration disabled, installing " "ACPI tables\n", __FUNCTION__)); return InstallAcpiTables (FindAcpiTableProtocol ()); } // - // Similarly, if PCI enumeration has already completed, install the tables + // Similarly, if root buses have already been connected, install the tables // immediately. // - Status = gBS->LocateProtocol (&gEfiPciEnumerationCompleteProtocolGuid, + Status = gBS->LocateProtocol (&gRootBusesConnectedProtocolGuid, NULL /* Registration */, &Interface); if (!EFI_ERROR (Status)) { - DEBUG ((EFI_D_INFO, "%a: PCI enumeration already complete, " + DEBUG ((EFI_D_INFO, "%a: root buses already connected, " "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 + // Otherwise, delay installing the ACPI tables until root buses are + // connected. The entry point's return status will only reflect the callback // setup. // - Status = gBS->CreateEvent (EVT_NOTIFY_SIGNAL, TPL_CALLBACK, OnPciEnumerated, - NULL /* Context */, &PciEnumerated); + Status = gBS->CreateEvent (EVT_NOTIFY_SIGNAL, TPL_CALLBACK, + OnRootBusesConnected, NULL /* Context */, + &RootBusesConnected); if (EFI_ERROR (Status)) { return Status; } - Status = gBS->RegisterProtocolNotify ( - &gEfiPciEnumerationCompleteProtocolGuid, PciEnumerated, - &Registration); + Status = gBS->RegisterProtocolNotify (&gRootBusesConnectedProtocolGuid, + RootBusesConnected, &Registration); if (EFI_ERROR (Status)) { - gBS->CloseEvent (PciEnumerated); + gBS->CloseEvent (RootBusesConnected); } else { - DEBUG ((EFI_D_INFO, "%a: PCI enumeration pending, registered callback\n", + DEBUG ((EFI_D_INFO, + "%a: waiting for root buses to be connected, registered callback\n", __FUNCTION__)); } return Status; }