]> git.proxmox.com Git - mirror_edk2.git/blame - OvmfPkg/Bhyve/AcpiPlatformDxe/EntryPoint.c
OvmfPkg: Apply uncrustify changes
[mirror_edk2.git] / OvmfPkg / Bhyve / AcpiPlatformDxe / EntryPoint.c
CommitLineData
656419f9
RC
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
7 SPDX-License-Identifier: BSD-2-Clause-Patent\r
8**/\r
9\r
10#include <Guid/RootBridgesConnectedEventGroup.h>\r
11#include "AcpiPlatform.h"\r
12\r
13STATIC\r
14EFI_ACPI_TABLE_PROTOCOL *\r
15FindAcpiTableProtocol (\r
16 VOID\r
17 )\r
18{\r
ac0a286f
MK
19 EFI_STATUS Status;\r
20 EFI_ACPI_TABLE_PROTOCOL *AcpiTable;\r
656419f9
RC
21\r
22 Status = gBS->LocateProtocol (\r
23 &gEfiAcpiTableProtocolGuid,\r
24 NULL,\r
ac0a286f 25 (VOID **)&AcpiTable\r
656419f9
RC
26 );\r
27 ASSERT_EFI_ERROR (Status);\r
28 return AcpiTable;\r
29}\r
30\r
656419f9
RC
31STATIC\r
32VOID\r
33EFIAPI\r
34OnRootBridgesConnected (\r
ac0a286f
MK
35 IN EFI_EVENT Event,\r
36 IN VOID *Context\r
656419f9
RC
37 )\r
38{\r
ac0a286f 39 EFI_STATUS Status;\r
656419f9 40\r
ac0a286f
MK
41 DEBUG ((\r
42 DEBUG_INFO,\r
656419f9 43 "%a: root bridges have been connected, installing ACPI tables\n",\r
ac0a286f
MK
44 __FUNCTION__\r
45 ));\r
656419f9
RC
46 Status = InstallAcpiTables (FindAcpiTableProtocol ());\r
47 if (EFI_ERROR (Status)) {\r
48 DEBUG ((DEBUG_ERROR, "%a: InstallAcpiTables: %r\n", __FUNCTION__, Status));\r
49 }\r
ac0a286f 50\r
656419f9
RC
51 gBS->CloseEvent (Event);\r
52}\r
53\r
656419f9
RC
54EFI_STATUS\r
55EFIAPI\r
56AcpiPlatformEntryPoint (\r
ac0a286f
MK
57 IN EFI_HANDLE ImageHandle,\r
58 IN EFI_SYSTEM_TABLE *SystemTable\r
656419f9
RC
59 )\r
60{\r
ac0a286f
MK
61 EFI_STATUS Status;\r
62 EFI_EVENT RootBridgesConnected;\r
656419f9
RC
63\r
64 //\r
65 // If the platform doesn't support PCI, or PCI enumeration has been disabled,\r
66 // install the tables at once, and let the entry point's return code reflect\r
67 // the full functionality.\r
68 //\r
69 if (PcdGetBool (PcdPciDisableBusEnumeration)) {\r
ac0a286f
MK
70 DEBUG ((\r
71 DEBUG_INFO,\r
72 "%a: PCI or its enumeration disabled, installing "\r
73 "ACPI tables\n",\r
74 __FUNCTION__\r
75 ));\r
656419f9
RC
76 return InstallAcpiTables (FindAcpiTableProtocol ());\r
77 }\r
78\r
79 //\r
80 // Otherwise, delay installing the ACPI tables until root bridges are\r
81 // connected. The entry point's return status will only reflect the callback\r
82 // setup. (Note that we're a DXE_DRIVER; our entry point function is invoked\r
83 // strictly before BDS is entered and can connect the root bridges.)\r
84 //\r
ac0a286f
MK
85 Status = gBS->CreateEventEx (\r
86 EVT_NOTIFY_SIGNAL,\r
87 TPL_CALLBACK,\r
88 OnRootBridgesConnected,\r
89 NULL /* Context */,\r
90 &gRootBridgesConnectedEventGroupGuid,\r
91 &RootBridgesConnected\r
92 );\r
656419f9 93 if (!EFI_ERROR (Status)) {\r
ac0a286f
MK
94 DEBUG ((\r
95 DEBUG_INFO,\r
656419f9 96 "%a: waiting for root bridges to be connected, registered callback\n",\r
ac0a286f
MK
97 __FUNCTION__\r
98 ));\r
656419f9
RC
99 }\r
100\r
101 return Status;\r
102}\r