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