]> git.proxmox.com Git - mirror_edk2.git/blame - OvmfPkg/AcpiPlatformDxe/EntryPoint.c
EmulatorPkg: Save the modified order after rebooting
[mirror_edk2.git] / OvmfPkg / AcpiPlatformDxe / EntryPoint.c
CommitLineData
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
13STATIC\r
14EFI_ACPI_TABLE_PROTOCOL *\r
15FindAcpiTableProtocol (\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
32STATIC\r
33VOID\r
34EFIAPI\r
b6bc800d 35OnRootBridgesConnected (\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
b6bc800d
LE
42 DEBUG ((EFI_D_INFO,\r
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
47 DEBUG ((EFI_D_ERROR, "%a: InstallAcpiTables: %r\n", __FUNCTION__, Status));\r
48 }\r
49 gBS->CloseEvent (Event);\r
50}\r
51\r
52\r
04951644
LE
53EFI_STATUS\r
54EFIAPI\r
55AcpiPlatformEntryPoint (\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
69 DEBUG ((EFI_D_INFO, "%a: PCI or its enumeration disabled, installing "\r
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
b6bc800d
LE
84 DEBUG ((EFI_D_INFO,\r
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