]>
Commit | Line | Data |
---|---|---|
8a96515e | 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 - 2010, Intel Corporation. All rights reserved.<BR>\r | |
6 | \r | |
7 | This program and the accompanying materials\r | |
8 | are licensed and made available under the terms and conditions\r | |
9 | of the BSD License which accompanies this distribution. The\r | |
10 | full text of the license may be found at\r | |
11 | http://opensource.org/licenses/bsd-license.php\r | |
12 | \r | |
13 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
14 | WITHOUT 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 | |
26 | EFI_HANDLE mHandle = NULL;\r | |
27 | \r | |
28 | /**\r | |
29 | Entry point of the ACPI support driver. This function creates and initializes an instance of the ACPI Support \r | |
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 | |
33 | @param SystemTable A pointer to the EFI system table \r | |
34 | \r | |
35 | @retval EFI_SUCCESS Driver initialized successfully\r | |
36 | @retval EFI_LOAD_ERROR Failed to Initialize or has been loaded \r | |
37 | @retval EFI_OUT_OF_RESOURCES Could not allocate needed resources\r | |
38 | **/\r | |
39 | EFI_STATUS\r | |
40 | EFIAPI\r | |
41 | InstallAcpiSupport (\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 | |
88 | } \r | |
89 | \r | |
90 | return Status;\r | |
91 | }\r |