]> git.proxmox.com Git - mirror_edk2.git/blame - IntelFrameworkModulePkg/Universal/Acpi/AcpiSupportDxe/AcpiSupport.c
IntelFrameworkModulePkg: Clean up source files
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / Acpi / AcpiSupportDxe / AcpiSupport.c
CommitLineData
8a96515e 1/** @file\r
0a6f4824 2 This is an implementation of the ACPI Support protocol. This is defined in\r
8a96515e 3 the Tiano ACPI External Product Specification, revision 0.3.6.\r
4\r
0a6f4824 5Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
8a96515e 6\r
7This program and the accompanying materials\r
8are licensed and made available under the terms and conditions\r
9of the BSD License which accompanies this distribution. The\r
10full text of the license may be found at\r
11http://opensource.org/licenses/bsd-license.php\r
12\r
13THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
14WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
15\r
16**/\r
17\r
18//\r
19// Includes\r
20//\r
21#include "AcpiSupport.h"\r
22\r
23//\r
24// Handle to install ACPI Table Protocol (and ACPI Suppport protocol).\r
25//\r
26EFI_HANDLE mHandle = NULL;\r
27\r
28/**\r
0a6f4824 29 Entry point of the ACPI support driver. This function creates and initializes an instance of the ACPI Support\r
8a96515e 30 Protocol and installs it on a new handle.\r
31\r
32 @param ImageHandle A handle for the image that is initializing this driver\r
0a6f4824 33 @param SystemTable A pointer to the EFI system table\r
8a96515e 34\r
35 @retval EFI_SUCCESS Driver initialized successfully\r
0a6f4824 36 @retval EFI_LOAD_ERROR Failed to Initialize or has been loaded\r
8a96515e 37 @retval EFI_OUT_OF_RESOURCES Could not allocate needed resources\r
38**/\r
39EFI_STATUS\r
40EFIAPI\r
41InstallAcpiSupport (\r
42 IN EFI_HANDLE ImageHandle,\r
43 IN EFI_SYSTEM_TABLE *SystemTable\r
44 )\r
45\r
46{\r
47 EFI_STATUS Status;\r
48 EFI_ACPI_SUPPORT_INSTANCE *PrivateData;\r
49\r
50 //\r
51 // Initialize our protocol\r
52 //\r
53 PrivateData = AllocateZeroPool (sizeof (EFI_ACPI_SUPPORT_INSTANCE));\r
54 ASSERT (PrivateData);\r
55 PrivateData->Signature = EFI_ACPI_SUPPORT_SIGNATURE;\r
56\r
57 //\r
58 // Call all constructors per produced protocols\r
59 //\r
60 Status = AcpiSupportAcpiSupportConstructor (PrivateData);\r
61 if (EFI_ERROR (Status)) {\r
62 gBS->FreePool (PrivateData);\r
63 return EFI_LOAD_ERROR;\r
64 }\r
65\r
66 //\r
67 // Install ACPI Table protocol and optional ACPI support protocol based on\r
68 // feature flag: PcdInstallAcpiSupportProtocol.\r
69 //\r
70 if (FeaturePcdGet (PcdInstallAcpiSupportProtocol)) {\r
71 Status = gBS->InstallMultipleProtocolInterfaces (\r
72 &mHandle,\r
73 &gEfiAcpiTableProtocolGuid,\r
74 &PrivateData->AcpiTableProtocol,\r
75 &gEfiAcpiSupportProtocolGuid,\r
76 &PrivateData->AcpiSupport,\r
77 NULL\r
78 );\r
79 ASSERT_EFI_ERROR (Status);\r
80 } else {\r
81 Status = gBS->InstallMultipleProtocolInterfaces (\r
82 &mHandle,\r
83 &gEfiAcpiTableProtocolGuid,\r
84 &PrivateData->AcpiTableProtocol,\r
85 NULL\r
86 );\r
87 ASSERT_EFI_ERROR (Status);\r
0a6f4824 88 }\r
8a96515e 89\r
90 return Status;\r
91}\r