]> git.proxmox.com Git - mirror_edk2.git/blob - DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.c
4915d379e88bdb9e0fb023d7ad8fb8dd73870f04
[mirror_edk2.git] / DynamicTablesPkg / Drivers / DynamicTableFactoryDxe / DynamicTableFactoryDxe.c
1 /** @file
2 Dynamic Table Factory Dxe
3
4 Copyright (c) 2017 - 2018, ARM Limited. All rights reserved.
5
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
14 **/
15
16 #include <Library/DebugLib.h>
17 #include <Library/PcdLib.h>
18 #include <Library/UefiBootServicesTableLib.h>
19 #include <Protocol/AcpiTable.h>
20
21 // Module specific include files.
22 #include <AcpiTableGenerator.h>
23 #include <ConfigurationManagerObject.h>
24 #include <ConfigurationManagerHelper.h>
25 #include <DeviceTreeTableGenerator.h>
26 #include <Library/TableHelperLib.h>
27 #include <Protocol/ConfigurationManagerProtocol.h>
28 #include <Protocol/DynamicTableFactoryProtocol.h>
29 #include <SmbiosTableGenerator.h>
30
31 #include "DynamicTableFactory.h"
32
33 /** The Dynamic Table Factory protocol structure that holds the
34 list of registered ACPI and SMBIOS table generators.
35 */
36 EDKII_DYNAMIC_TABLE_FACTORY_INFO TableFactoryInfo;
37
38 /** A structure describing the Dynamic Table Factory protocol.
39 */
40 STATIC
41 CONST
42 EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL DynamicTableFactoryProtocol = {
43 CREATE_REVISION (1, 0),
44 GetAcpiTableGenerator,
45 RegisterAcpiTableGenerator,
46 DeregisterAcpiTableGenerator,
47 GetSmbiosTableGenerator,
48 RegisterSmbiosTableGenerator,
49 DeregisterSmbiosTableGenerator,
50 GetDtTableGenerator,
51 RegisterDtTableGenerator,
52 DeregisterDtTableGenerator,
53 &TableFactoryInfo
54 };
55
56 /** Entrypoint for Dynamic Table Factory Dxe.
57
58 @param ImageHandle
59 @param SystemTable
60
61 @retval EFI_SUCCESS Success.
62 @retval EFI_OUT_OF_RESOURCES Memory allocation failed.
63 @retval EFI_NOT_FOUND Required interface/object was not found.
64 @retval EFI_INVALID_PARAMETER Some parameter is incorrect/invalid.
65 **/
66 EFI_STATUS
67 EFIAPI
68 DynamicTableFactoryDxeInitialize (
69 IN EFI_HANDLE ImageHandle,
70 IN EFI_SYSTEM_TABLE * CONST SystemTable
71 )
72 {
73 EFI_STATUS Status;
74
75 Status = gBS->InstallProtocolInterface (
76 &ImageHandle,
77 &gEdkiiDynamicTableFactoryProtocolGuid,
78 EFI_NATIVE_INTERFACE,
79 (VOID*)&DynamicTableFactoryProtocol
80 );
81 if (EFI_ERROR (Status)) {
82 DEBUG ((
83 DEBUG_ERROR,
84 "ERROR: Failed to install the Dynamic Table Factory Protocol." \
85 " Status = %r\n",
86 Status
87 ));
88 }
89 return Status;
90 }