Copyright (C) 2015, Red Hat, Inc.\r
Copyright (c) 2008 - 2015, Intel Corporation. All rights reserved.<BR>\r
\r
- This program and the accompanying materials are licensed and made available\r
- under the terms and conditions of the BSD License which accompanies this\r
- distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT\r
- WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+ SPDX-License-Identifier: BSD-2-Clause-Patent\r
**/\r
\r
+#include <Guid/RootBridgesConnectedEventGroup.h>\r
#include "AcpiPlatform.h"\r
\r
STATIC\r
return AcpiTable;\r
}\r
\r
+\r
+STATIC\r
+VOID\r
+EFIAPI\r
+OnRootBridgesConnected (\r
+ IN EFI_EVENT Event,\r
+ IN VOID *Context\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+\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
+ DEBUG ((EFI_D_ERROR, "%a: InstallAcpiTables: %r\n", __FUNCTION__, Status));\r
+ }\r
+ gBS->CloseEvent (Event);\r
+}\r
+\r
+\r
EFI_STATUS\r
EFIAPI\r
AcpiPlatformEntryPoint (\r
)\r
{\r
EFI_STATUS Status;\r
+ EFI_EVENT RootBridgesConnected;\r
+\r
+ //\r
+ // If the platform doesn't support PCI, or PCI enumeration has been disabled,\r
+ // install the tables at once, and let the entry point's return code reflect\r
+ // the full functionality.\r
+ //\r
+ if (PcdGetBool (PcdPciDisableBusEnumeration)) {\r
+ DEBUG ((EFI_D_INFO, "%a: PCI or its enumeration disabled, installing "\r
+ "ACPI tables\n", __FUNCTION__));\r
+ return InstallAcpiTables (FindAcpiTableProtocol ());\r
+ }\r
+\r
+ //\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->CreateEventEx (EVT_NOTIFY_SIGNAL, TPL_CALLBACK,\r
+ OnRootBridgesConnected, NULL /* Context */,\r
+ &gRootBridgesConnectedEventGroupGuid, &RootBridgesConnected);\r
+ if (!EFI_ERROR (Status)) {\r
+ DEBUG ((EFI_D_INFO,\r
+ "%a: waiting for root bridges to be connected, registered callback\n",\r
+ __FUNCTION__));\r
+ }\r
\r
- Status = InstallAcpiTables (FindAcpiTableProtocol ());\r
return Status;\r
}\r