]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTable.c
MdeModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Universal / Acpi / AcpiTableDxe / AcpiTable.c
1 /** @file
2 ACPI Table Protocol Driver
3
4 Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 //
10 // Includes
11 //
12 #include "AcpiTable.h"
13
14 //
15 // Handle to install ACPI Table Protocol
16 //
17 EFI_HANDLE mHandle = NULL;
18 GLOBAL_REMOVE_IF_UNREFERENCED EFI_ACPI_TABLE_INSTANCE *mPrivateData = NULL;
19
20 /**
21 Entry point of the ACPI table driver.
22 Creates and initializes an instance of the ACPI Table
23 Protocol and installs it on a new handle.
24
25 @param ImageHandle A handle for the image that is initializing this driver.
26 @param SystemTable A pointer to the EFI system table.
27
28 @return EFI_SUCCESS Driver initialized successfully.
29 @return EFI_LOAD_ERROR Failed to Initialize or has been loaded.
30 @return EFI_OUT_OF_RESOURCES Could not allocate needed resources.
31
32 **/
33 EFI_STATUS
34 EFIAPI
35 InitializeAcpiTableDxe (
36 IN EFI_HANDLE ImageHandle,
37 IN EFI_SYSTEM_TABLE *SystemTable
38 )
39 {
40 EFI_STATUS Status;
41 EFI_ACPI_TABLE_INSTANCE *PrivateData;
42
43 //
44 // Initialize our protocol
45 //
46 PrivateData = AllocateZeroPool (sizeof (EFI_ACPI_TABLE_INSTANCE));
47 ASSERT (PrivateData);
48 PrivateData->Signature = EFI_ACPI_TABLE_SIGNATURE;
49
50 //
51 // Call all constructors per produced protocols
52 //
53 Status = AcpiTableAcpiTableConstructor (PrivateData);
54 if (EFI_ERROR (Status)) {
55 gBS->FreePool (PrivateData);
56 return EFI_LOAD_ERROR;
57 }
58
59 //
60 // Install ACPI Table protocol
61 //
62 if (FeaturePcdGet (PcdInstallAcpiSdtProtocol)) {
63 mPrivateData = PrivateData;
64 Status = gBS->InstallMultipleProtocolInterfaces (
65 &mHandle,
66 &gEfiAcpiTableProtocolGuid,
67 &PrivateData->AcpiTableProtocol,
68 &gEfiAcpiSdtProtocolGuid,
69 &mPrivateData->AcpiSdtProtocol,
70 NULL
71 );
72 } else {
73 Status = gBS->InstallMultipleProtocolInterfaces (
74 &mHandle,
75 &gEfiAcpiTableProtocolGuid,
76 &PrivateData->AcpiTableProtocol,
77 NULL
78 );
79 }
80 ASSERT_EFI_ERROR (Status);
81
82 return Status;
83 }
84