]> git.proxmox.com Git - mirror_edk2.git/blob - DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.c
DynamicTablesPkg: Replace BSD License with BSD+Patent License
[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 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8 **/
9
10 #include <Library/DebugLib.h>
11 #include <Library/PcdLib.h>
12 #include <Library/UefiBootServicesTableLib.h>
13 #include <Protocol/AcpiTable.h>
14
15 // Module specific include files.
16 #include <AcpiTableGenerator.h>
17 #include <ConfigurationManagerObject.h>
18 #include <ConfigurationManagerHelper.h>
19 #include <DeviceTreeTableGenerator.h>
20 #include <Library/TableHelperLib.h>
21 #include <Protocol/ConfigurationManagerProtocol.h>
22 #include <Protocol/DynamicTableFactoryProtocol.h>
23 #include <SmbiosTableGenerator.h>
24
25 #include "DynamicTableFactory.h"
26
27 /** The Dynamic Table Factory protocol structure that holds the
28 list of registered ACPI and SMBIOS table generators.
29 */
30 EDKII_DYNAMIC_TABLE_FACTORY_INFO TableFactoryInfo;
31
32 /** A structure describing the Dynamic Table Factory protocol.
33 */
34 STATIC
35 CONST
36 EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL DynamicTableFactoryProtocol = {
37 CREATE_REVISION (1, 0),
38 GetAcpiTableGenerator,
39 RegisterAcpiTableGenerator,
40 DeregisterAcpiTableGenerator,
41 GetSmbiosTableGenerator,
42 RegisterSmbiosTableGenerator,
43 DeregisterSmbiosTableGenerator,
44 GetDtTableGenerator,
45 RegisterDtTableGenerator,
46 DeregisterDtTableGenerator,
47 &TableFactoryInfo
48 };
49
50 /** Entrypoint for Dynamic Table Factory Dxe.
51
52 @param ImageHandle
53 @param SystemTable
54
55 @retval EFI_SUCCESS Success.
56 @retval EFI_OUT_OF_RESOURCES Memory allocation failed.
57 @retval EFI_NOT_FOUND Required interface/object was not found.
58 @retval EFI_INVALID_PARAMETER Some parameter is incorrect/invalid.
59 **/
60 EFI_STATUS
61 EFIAPI
62 DynamicTableFactoryDxeInitialize (
63 IN EFI_HANDLE ImageHandle,
64 IN EFI_SYSTEM_TABLE * CONST SystemTable
65 )
66 {
67 EFI_STATUS Status;
68
69 Status = gBS->InstallProtocolInterface (
70 &ImageHandle,
71 &gEdkiiDynamicTableFactoryProtocolGuid,
72 EFI_NATIVE_INTERFACE,
73 (VOID*)&DynamicTableFactoryProtocol
74 );
75 if (EFI_ERROR (Status)) {
76 DEBUG ((
77 DEBUG_ERROR,
78 "ERROR: Failed to install the Dynamic Table Factory Protocol." \
79 " Status = %r\n",
80 Status
81 ));
82 }
83 return Status;
84 }