]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | This is an implementation of the ACPI Support protocol. This is defined in\r | |
3 | the Tiano ACPI External Product Specification, revision 0.3.6.\r | |
4 | \r | |
5 | Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r | |
6 | \r | |
7 | SPDX-License-Identifier: BSD-2-Clause-Patent\r | |
8 | \r | |
9 | **/\r | |
10 | \r | |
11 | //\r | |
12 | // Includes\r | |
13 | //\r | |
14 | #include "AcpiSupport.h"\r | |
15 | \r | |
16 | //\r | |
17 | // Handle to install ACPI Table Protocol (and ACPI Suppport protocol).\r | |
18 | //\r | |
19 | EFI_HANDLE mHandle = NULL;\r | |
20 | \r | |
21 | /**\r | |
22 | Entry point of the ACPI support driver. This function creates and initializes an instance of the ACPI Support\r | |
23 | Protocol and installs it on a new handle.\r | |
24 | \r | |
25 | @param ImageHandle A handle for the image that is initializing this driver\r | |
26 | @param SystemTable A pointer to the EFI system table\r | |
27 | \r | |
28 | @retval EFI_SUCCESS Driver initialized successfully\r | |
29 | @retval EFI_LOAD_ERROR Failed to Initialize or has been loaded\r | |
30 | @retval EFI_OUT_OF_RESOURCES Could not allocate needed resources\r | |
31 | **/\r | |
32 | EFI_STATUS\r | |
33 | EFIAPI\r | |
34 | InstallAcpiSupport (\r | |
35 | IN EFI_HANDLE ImageHandle,\r | |
36 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
37 | )\r | |
38 | \r | |
39 | {\r | |
40 | EFI_STATUS Status;\r | |
41 | EFI_ACPI_SUPPORT_INSTANCE *PrivateData;\r | |
42 | \r | |
43 | //\r | |
44 | // Initialize our protocol\r | |
45 | //\r | |
46 | PrivateData = AllocateZeroPool (sizeof (EFI_ACPI_SUPPORT_INSTANCE));\r | |
47 | ASSERT (PrivateData);\r | |
48 | PrivateData->Signature = EFI_ACPI_SUPPORT_SIGNATURE;\r | |
49 | \r | |
50 | //\r | |
51 | // Call all constructors per produced protocols\r | |
52 | //\r | |
53 | Status = AcpiSupportAcpiSupportConstructor (PrivateData);\r | |
54 | if (EFI_ERROR (Status)) {\r | |
55 | gBS->FreePool (PrivateData);\r | |
56 | return EFI_LOAD_ERROR;\r | |
57 | }\r | |
58 | \r | |
59 | //\r | |
60 | // Install ACPI Table protocol and optional ACPI support protocol based on\r | |
61 | // feature flag: PcdInstallAcpiSupportProtocol.\r | |
62 | //\r | |
63 | if (FeaturePcdGet (PcdInstallAcpiSupportProtocol)) {\r | |
64 | Status = gBS->InstallMultipleProtocolInterfaces (\r | |
65 | &mHandle,\r | |
66 | &gEfiAcpiTableProtocolGuid,\r | |
67 | &PrivateData->AcpiTableProtocol,\r | |
68 | &gEfiAcpiSupportProtocolGuid,\r | |
69 | &PrivateData->AcpiSupport,\r | |
70 | NULL\r | |
71 | );\r | |
72 | ASSERT_EFI_ERROR (Status);\r | |
73 | } else {\r | |
74 | Status = gBS->InstallMultipleProtocolInterfaces (\r | |
75 | &mHandle,\r | |
76 | &gEfiAcpiTableProtocolGuid,\r | |
77 | &PrivateData->AcpiTableProtocol,\r | |
78 | NULL\r | |
79 | );\r | |
80 | ASSERT_EFI_ERROR (Status);\r | |
81 | }\r | |
82 | \r | |
83 | return Status;\r | |
84 | }\r |