]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkPkg/Library/FrameworkUefiLib/Acpi.c
IntelFrameworkPkg FrameworkUefiLib: Add new EfiLocateXXXAcpiTable APIs
[mirror_edk2.git] / IntelFrameworkPkg / Library / FrameworkUefiLib / Acpi.c
diff --git a/IntelFrameworkPkg/Library/FrameworkUefiLib/Acpi.c b/IntelFrameworkPkg/Library/FrameworkUefiLib/Acpi.c
new file mode 100644 (file)
index 0000000..4b41abd
--- /dev/null
@@ -0,0 +1,88 @@
+/** @file\r
+  This module provides help function for finding ACPI table.\r
+\r
+  Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>\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 "UefiLibInternal.h"\r
+#include <IndustryStandard/Acpi.h>\r
+\r
+/**\r
+  This function locates next ACPI table in XSDT/RSDT based on Signature and\r
+  previous returned Table.\r
+\r
+  If PreviousTable is NULL:\r
+  This function will locate the first ACPI table in XSDT/RSDT based on\r
+  Signature in gEfiAcpi20TableGuid system configuration table first, and then\r
+  gEfiAcpi10TableGuid system configuration table.\r
+  This function will locate in XSDT first, and then RSDT.\r
+  For DSDT, this function will locate XDsdt in FADT first, and then Dsdt in\r
+  FADT.\r
+  For FACS, this function will locate XFirmwareCtrl in FADT first, and then\r
+  FirmwareCtrl in FADT.\r
+\r
+  If PreviousTable is not NULL:\r
+  1. If it could be located in XSDT in gEfiAcpi20TableGuid system configuration\r
+     table, then this function will just locate next table in XSDT in\r
+     gEfiAcpi20TableGuid system configuration table.\r
+  2. If it could be located in RSDT in gEfiAcpi20TableGuid system configuration\r
+     table, then this function will just locate next table in RSDT in\r
+     gEfiAcpi20TableGuid system configuration table.\r
+  3. If it could be located in RSDT in gEfiAcpi10TableGuid system configuration\r
+     table, then this function will just locate next table in RSDT in\r
+     gEfiAcpi10TableGuid system configuration table.\r
+\r
+  It's not supported that PreviousTable is not NULL but PreviousTable->Signature\r
+  is not same with Signature, NULL will be returned.\r
+\r
+  @param Signature          ACPI table signature.\r
+  @param PreviousTable      Pointer to previous returned table to locate next\r
+                            table, or NULL to locate first table.\r
+\r
+  @return Next ACPI table or NULL if not found.\r
+\r
+**/\r
+EFI_ACPI_COMMON_HEADER *\r
+EFIAPI\r
+EfiLocateNextAcpiTable (\r
+  IN UINT32                     Signature,\r
+  IN EFI_ACPI_COMMON_HEADER     *PreviousTable OPTIONAL\r
+  )\r
+{\r
+  ASSERT (FALSE);\r
+  return NULL;\r
+}\r
+\r
+/**\r
+  This function locates first ACPI table in XSDT/RSDT based on Signature.\r
+\r
+  This function will locate the first ACPI table in XSDT/RSDT based on\r
+  Signature in gEfiAcpi20TableGuid system configuration table first, and then\r
+  gEfiAcpi10TableGuid system configuration table.\r
+  This function will locate in XSDT first, and then RSDT.\r
+  For DSDT, this function will locate XDsdt in FADT first, and then Dsdt in\r
+  FADT.\r
+  For FACS, this function will locate XFirmwareCtrl in FADT first, and then\r
+  FirmwareCtrl in FADT.\r
+\r
+  @param Signature          ACPI table signature.\r
+\r
+  @return First ACPI table or NULL if not found.\r
+\r
+**/\r
+EFI_ACPI_COMMON_HEADER *\r
+EFIAPI\r
+EfiLocateFirstAcpiTable (\r
+  IN UINT32                     Signature\r
+  )\r
+{\r
+  return EfiLocateNextAcpiTable (Signature, NULL);\r
+}\r