]> git.proxmox.com Git - mirror_edk2.git/blobdiff - DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.c
DynamicTablesPkg: Dynamic Table Factory Dxe
[mirror_edk2.git] / DynamicTablesPkg / Drivers / DynamicTableFactoryDxe / DynamicTableFactoryDxe.c
diff --git a/DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.c b/DynamicTablesPkg/Drivers/DynamicTableFactoryDxe/DynamicTableFactoryDxe.c
new file mode 100644 (file)
index 0000000..4915d37
--- /dev/null
@@ -0,0 +1,90 @@
+/** @file\r
+  Dynamic Table Factory Dxe\r
+\r
+  Copyright (c) 2017 - 2018, ARM Limited. All rights reserved.\r
+\r
+  This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include <Library/DebugLib.h>\r
+#include <Library/PcdLib.h>\r
+#include <Library/UefiBootServicesTableLib.h>\r
+#include <Protocol/AcpiTable.h>\r
+\r
+// Module specific include files.\r
+#include <AcpiTableGenerator.h>\r
+#include <ConfigurationManagerObject.h>\r
+#include <ConfigurationManagerHelper.h>\r
+#include <DeviceTreeTableGenerator.h>\r
+#include <Library/TableHelperLib.h>\r
+#include <Protocol/ConfigurationManagerProtocol.h>\r
+#include <Protocol/DynamicTableFactoryProtocol.h>\r
+#include <SmbiosTableGenerator.h>\r
+\r
+#include "DynamicTableFactory.h"\r
+\r
+/** The Dynamic Table Factory protocol structure that holds the\r
+    list of registered ACPI and SMBIOS table generators.\r
+*/\r
+EDKII_DYNAMIC_TABLE_FACTORY_INFO TableFactoryInfo;\r
+\r
+/** A structure describing the Dynamic Table Factory protocol.\r
+*/\r
+STATIC\r
+CONST\r
+EDKII_DYNAMIC_TABLE_FACTORY_PROTOCOL DynamicTableFactoryProtocol = {\r
+  CREATE_REVISION (1, 0),\r
+  GetAcpiTableGenerator,\r
+  RegisterAcpiTableGenerator,\r
+  DeregisterAcpiTableGenerator,\r
+  GetSmbiosTableGenerator,\r
+  RegisterSmbiosTableGenerator,\r
+  DeregisterSmbiosTableGenerator,\r
+  GetDtTableGenerator,\r
+  RegisterDtTableGenerator,\r
+  DeregisterDtTableGenerator,\r
+  &TableFactoryInfo\r
+};\r
+\r
+/** Entrypoint for Dynamic Table Factory Dxe.\r
+\r
+  @param  ImageHandle\r
+  @param  SystemTable\r
+\r
+  @retval EFI_SUCCESS           Success.\r
+  @retval EFI_OUT_OF_RESOURCES  Memory allocation failed.\r
+  @retval EFI_NOT_FOUND         Required interface/object was not found.\r
+  @retval EFI_INVALID_PARAMETER Some parameter is incorrect/invalid.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+DynamicTableFactoryDxeInitialize (\r
+  IN  EFI_HANDLE                 ImageHandle,\r
+  IN  EFI_SYSTEM_TABLE   * CONST SystemTable\r
+  )\r
+{\r
+  EFI_STATUS  Status;\r
+\r
+  Status = gBS->InstallProtocolInterface (\r
+                  &ImageHandle,\r
+                  &gEdkiiDynamicTableFactoryProtocolGuid,\r
+                  EFI_NATIVE_INTERFACE,\r
+                  (VOID*)&DynamicTableFactoryProtocol\r
+                  );\r
+  if (EFI_ERROR (Status)) {\r
+    DEBUG ((\r
+      DEBUG_ERROR,\r
+      "ERROR: Failed to install the Dynamic Table Factory Protocol." \\r
+      " Status = %r\n",\r
+      Status\r
+      ));\r
+  }\r
+  return Status;\r
+}\r