]>
Commit | Line | Data |
---|---|---|
5f55c700 | 1 | /** @file\r |
2 | ACPI Table Protocol Driver\r | |
3 | \r | |
3dc8585e | 4 | Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r |
e5eed7d3 | 5 | This program and the accompanying materials\r |
5f55c700 | 6 | are licensed and made available under the terms and conditions of the BSD License\r |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
13 | **/\r | |
14 | \r | |
15 | //\r | |
16 | // Includes\r | |
17 | //\r | |
18 | #include "AcpiTable.h"\r | |
19 | \r | |
20 | //\r | |
21 | // Handle to install ACPI Table Protocol\r | |
22 | //\r | |
23 | EFI_HANDLE mHandle = NULL;\r | |
afe7c8b2 | 24 | GLOBAL_REMOVE_IF_UNREFERENCED EFI_ACPI_TABLE_INSTANCE *mPrivateData = NULL;\r |
5f55c700 | 25 | \r |
26 | /**\r | |
27 | Entry point of the ACPI table driver.\r | |
28 | Creates and initializes an instance of the ACPI Table\r | |
29 | Protocol and installs it on a new handle.\r | |
30 | \r | |
31 | @param ImageHandle A handle for the image that is initializing this driver.\r | |
32 | @param SystemTable A pointer to the EFI system table.\r | |
33 | \r | |
34 | @return EFI_SUCCESS Driver initialized successfully.\r | |
35 | @return EFI_LOAD_ERROR Failed to Initialize or has been loaded.\r | |
36 | @return EFI_OUT_OF_RESOURCES Could not allocate needed resources.\r | |
37 | \r | |
38 | **/\r | |
39 | EFI_STATUS\r | |
40 | EFIAPI\r | |
41 | InitializeAcpiTableDxe (\r | |
42 | IN EFI_HANDLE ImageHandle,\r | |
43 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
44 | )\r | |
45 | {\r | |
46 | EFI_STATUS Status;\r | |
47 | EFI_ACPI_TABLE_INSTANCE *PrivateData;\r | |
48 | \r | |
49 | //\r | |
50 | // Initialize our protocol\r | |
51 | //\r | |
52 | PrivateData = AllocateZeroPool (sizeof (EFI_ACPI_TABLE_INSTANCE));\r | |
53 | ASSERT (PrivateData);\r | |
54 | PrivateData->Signature = EFI_ACPI_TABLE_SIGNATURE;\r | |
55 | \r | |
56 | //\r | |
57 | // Call all constructors per produced protocols\r | |
58 | //\r | |
59 | Status = AcpiTableAcpiTableConstructor (PrivateData);\r | |
60 | if (EFI_ERROR (Status)) {\r | |
61 | gBS->FreePool (PrivateData);\r | |
62 | return EFI_LOAD_ERROR;\r | |
63 | }\r | |
64 | \r | |
65 | //\r | |
66 | // Install ACPI Table protocol\r | |
67 | //\r | |
3dc8585e JY |
68 | if (FeaturePcdGet (PcdInstallAcpiSdtProtocol)) {\r |
69 | mPrivateData = PrivateData;\r | |
70 | Status = gBS->InstallMultipleProtocolInterfaces (\r | |
71 | &mHandle,\r | |
72 | &gEfiAcpiTableProtocolGuid,\r | |
73 | &PrivateData->AcpiTableProtocol,\r | |
74 | &gEfiAcpiSdtProtocolGuid,\r | |
75 | &mPrivateData->AcpiSdtProtocol,\r | |
76 | NULL\r | |
77 | );\r | |
78 | } else {\r | |
79 | Status = gBS->InstallMultipleProtocolInterfaces (\r | |
80 | &mHandle,\r | |
81 | &gEfiAcpiTableProtocolGuid,\r | |
82 | &PrivateData->AcpiTableProtocol,\r | |
83 | NULL\r | |
84 | );\r | |
85 | }\r | |
5f55c700 | 86 | ASSERT_EFI_ERROR (Status);\r |
87 | \r | |
88 | return Status;\r | |
89 | }\r | |
90 | \r |