]>
Commit | Line | Data |
---|---|---|
04951644 LE |
1 | /** @file\r |
2 | Entry point of OVMF ACPI Platform Driver\r | |
3 | \r | |
4 | Copyright (C) 2015, Red Hat, Inc.\r | |
5 | Copyright (c) 2008 - 2015, Intel Corporation. All rights reserved.<BR>\r | |
6 | \r | |
b26f0cf9 | 7 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
04951644 LE |
8 | **/\r |
9 | \r | |
b6bc800d | 10 | #include <Guid/RootBridgesConnectedEventGroup.h>\r |
04951644 LE |
11 | #include "AcpiPlatform.h"\r |
12 | \r | |
13 | STATIC\r | |
14 | EFI_ACPI_TABLE_PROTOCOL *\r | |
15 | FindAcpiTableProtocol (\r | |
16 | VOID\r | |
17 | )\r | |
18 | {\r | |
19 | EFI_STATUS Status;\r | |
20 | EFI_ACPI_TABLE_PROTOCOL *AcpiTable;\r | |
21 | \r | |
22 | Status = gBS->LocateProtocol (\r | |
23 | &gEfiAcpiTableProtocolGuid,\r | |
24 | NULL,\r | |
25 | (VOID**)&AcpiTable\r | |
26 | );\r | |
27 | ASSERT_EFI_ERROR (Status);\r | |
28 | return AcpiTable;\r | |
29 | }\r | |
30 | \r | |
818bc86a LE |
31 | \r |
32 | STATIC\r | |
33 | VOID\r | |
34 | EFIAPI\r | |
b6bc800d | 35 | OnRootBridgesConnected (\r |
818bc86a LE |
36 | IN EFI_EVENT Event,\r |
37 | IN VOID *Context\r | |
38 | )\r | |
39 | {\r | |
40 | EFI_STATUS Status;\r | |
41 | \r | |
70d5086c | 42 | DEBUG ((DEBUG_INFO,\r |
b6bc800d | 43 | "%a: root bridges have been connected, installing ACPI tables\n",\r |
818bc86a LE |
44 | __FUNCTION__));\r |
45 | Status = InstallAcpiTables (FindAcpiTableProtocol ());\r | |
46 | if (EFI_ERROR (Status)) {\r | |
70d5086c | 47 | DEBUG ((DEBUG_ERROR, "%a: InstallAcpiTables: %r\n", __FUNCTION__, Status));\r |
818bc86a LE |
48 | }\r |
49 | gBS->CloseEvent (Event);\r | |
50 | }\r | |
51 | \r | |
52 | \r | |
04951644 LE |
53 | EFI_STATUS\r |
54 | EFIAPI\r | |
55 | AcpiPlatformEntryPoint (\r | |
56 | IN EFI_HANDLE ImageHandle,\r | |
57 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
58 | )\r | |
59 | {\r | |
60 | EFI_STATUS Status;\r | |
b6bc800d | 61 | EFI_EVENT RootBridgesConnected;\r |
818bc86a LE |
62 | \r |
63 | //\r | |
64 | // If the platform doesn't support PCI, or PCI enumeration has been disabled,\r | |
65 | // install the tables at once, and let the entry point's return code reflect\r | |
66 | // the full functionality.\r | |
67 | //\r | |
68 | if (PcdGetBool (PcdPciDisableBusEnumeration)) {\r | |
70d5086c | 69 | DEBUG ((DEBUG_INFO, "%a: PCI or its enumeration disabled, installing "\r |
818bc86a LE |
70 | "ACPI tables\n", __FUNCTION__));\r |
71 | return InstallAcpiTables (FindAcpiTableProtocol ());\r | |
72 | }\r | |
73 | \r | |
74 | //\r | |
b6bc800d LE |
75 | // Otherwise, delay installing the ACPI tables until root bridges are\r |
76 | // connected. The entry point's return status will only reflect the callback\r | |
77 | // setup. (Note that we're a DXE_DRIVER; our entry point function is invoked\r | |
78 | // strictly before BDS is entered and can connect the root bridges.)\r | |
818bc86a | 79 | //\r |
b6bc800d LE |
80 | Status = gBS->CreateEventEx (EVT_NOTIFY_SIGNAL, TPL_CALLBACK,\r |
81 | OnRootBridgesConnected, NULL /* Context */,\r | |
82 | &gRootBridgesConnectedEventGroupGuid, &RootBridgesConnected);\r | |
818bc86a | 83 | if (!EFI_ERROR (Status)) {\r |
70d5086c | 84 | DEBUG ((DEBUG_INFO,\r |
b6bc800d | 85 | "%a: waiting for root bridges to be connected, registered callback\n",\r |
818bc86a LE |
86 | __FUNCTION__));\r |
87 | }\r | |
04951644 | 88 | \r |
04951644 LE |
89 | return Status;\r |
90 | }\r |