2 Entry point of OVMF ACPI Platform Driver
4 Copyright (C) 2015, Red Hat, Inc.
5 Copyright (c) 2008 - 2015, Intel Corporation. All rights reserved.<BR>
7 This program and the accompanying materials are licensed and made available
8 under the terms and conditions of the BSD License which accompanies this
9 distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT
13 WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #include <Protocol/PciEnumerationComplete.h>
17 #include "AcpiPlatform.h"
20 EFI_ACPI_TABLE_PROTOCOL
*
21 FindAcpiTableProtocol (
26 EFI_ACPI_TABLE_PROTOCOL
*AcpiTable
;
28 Status
= gBS
->LocateProtocol (
29 &gEfiAcpiTableProtocolGuid
,
33 ASSERT_EFI_ERROR (Status
);
48 DEBUG ((EFI_D_INFO
, "%a: PCI enumeration complete, installing ACPI tables\n",
50 Status
= InstallAcpiTables (FindAcpiTableProtocol ());
51 if (EFI_ERROR (Status
)) {
52 DEBUG ((EFI_D_ERROR
, "%a: InstallAcpiTables: %r\n", __FUNCTION__
, Status
));
54 gBS
->CloseEvent (Event
);
60 AcpiPlatformEntryPoint (
61 IN EFI_HANDLE ImageHandle
,
62 IN EFI_SYSTEM_TABLE
*SystemTable
67 EFI_EVENT PciEnumerated
;
71 // If the platform doesn't support PCI, or PCI enumeration has been disabled,
72 // install the tables at once, and let the entry point's return code reflect
73 // the full functionality.
75 if (PcdGetBool (PcdPciDisableBusEnumeration
)) {
76 DEBUG ((EFI_D_INFO
, "%a: PCI or its enumeration disabled, installing "
77 "ACPI tables\n", __FUNCTION__
));
78 return InstallAcpiTables (FindAcpiTableProtocol ());
82 // Similarly, if PCI enumeration has already completed, install the tables
85 Status
= gBS
->LocateProtocol (&gEfiPciEnumerationCompleteProtocolGuid
,
86 NULL
/* Registration */, &Interface
);
87 if (!EFI_ERROR (Status
)) {
88 DEBUG ((EFI_D_INFO
, "%a: PCI enumeration already complete, "
89 "installing ACPI tables\n", __FUNCTION__
));
90 return InstallAcpiTables (FindAcpiTableProtocol ());
92 ASSERT (Status
== EFI_NOT_FOUND
);
95 // Otherwise, delay installing the ACPI tables until PCI enumeration
96 // completes. The entry point's return status will only reflect the callback
99 Status
= gBS
->CreateEvent (EVT_NOTIFY_SIGNAL
, TPL_CALLBACK
, OnPciEnumerated
,
100 NULL
/* Context */, &PciEnumerated
);
101 if (EFI_ERROR (Status
)) {
105 Status
= gBS
->RegisterProtocolNotify (
106 &gEfiPciEnumerationCompleteProtocolGuid
, PciEnumerated
,
108 if (EFI_ERROR (Status
)) {
109 gBS
->CloseEvent (PciEnumerated
);
111 DEBUG ((EFI_D_INFO
, "%a: PCI enumeration pending, registered callback\n",