]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTable.c
Add ACPI drivers:
[mirror_edk2.git] / MdeModulePkg / Universal / Acpi / AcpiTableDxe / AcpiTable.c
diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTable.c b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTable.c
new file mode 100755 (executable)
index 0000000..773c0f7
--- /dev/null
@@ -0,0 +1,77 @@
+/** @file\r
+  ACPI Table Protocol Driver\r
+\r
+  Copyright (c) 2006, 2008, 2009, Intel Corporation<BR>\r
+  All rights reserved. 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
+//\r
+// Includes\r
+//\r
+#include "AcpiTable.h"\r
+\r
+//\r
+// Handle to install ACPI Table Protocol\r
+//\r
+EFI_HANDLE    mHandle = NULL;\r
+\r
+/**\r
+  Entry point of the ACPI table driver.\r
+  Creates and initializes an instance of the ACPI Table\r
+  Protocol and installs it on a new handle.\r
+\r
+  @param  ImageHandle   A handle for the image that is initializing this driver.\r
+  @param  SystemTable   A pointer to the EFI system table.\r
+\r
+  @return EFI_SUCCESS           Driver initialized successfully.\r
+  @return EFI_LOAD_ERROR        Failed to Initialize or has been loaded.\r
+  @return EFI_OUT_OF_RESOURCES  Could not allocate needed resources.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+InitializeAcpiTableDxe (\r
+  IN EFI_HANDLE           ImageHandle,\r
+  IN EFI_SYSTEM_TABLE     *SystemTable\r
+  )\r
+{\r
+  EFI_STATUS                Status;\r
+  EFI_ACPI_TABLE_INSTANCE   *PrivateData;\r
+\r
+  //\r
+  // Initialize our protocol\r
+  //\r
+  PrivateData = AllocateZeroPool (sizeof (EFI_ACPI_TABLE_INSTANCE));\r
+  ASSERT (PrivateData);\r
+  PrivateData->Signature = EFI_ACPI_TABLE_SIGNATURE;\r
+\r
+  //\r
+  // Call all constructors per produced protocols\r
+  //\r
+  Status = AcpiTableAcpiTableConstructor (PrivateData);\r
+  if (EFI_ERROR (Status)) {\r
+    gBS->FreePool (PrivateData);\r
+    return EFI_LOAD_ERROR;\r
+  }\r
+\r
+  //\r
+  // Install ACPI Table protocol\r
+  //\r
+  Status = gBS->InstallMultipleProtocolInterfaces (\r
+                  &mHandle,\r
+                  &gEfiAcpiTableProtocolGuid,\r
+                  &PrivateData->AcpiTableProtocol,\r
+                  NULL\r
+                  );\r
+  ASSERT_EFI_ERROR (Status);\r
+\r
+  return Status;\r
+}\r
+\r