]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EmbeddedPkg/Include/Library/AcpiLib.h
EmbeddedPkg/AcpiLib: Add more helper functions
[mirror_edk2.git] / EmbeddedPkg / Include / Library / AcpiLib.h
index 4f2001bfc827d39f61c5131fc109c1b93873a716..9dbacd85b0ef7c1f68e18be7a1aa6f93bf2ec135 100644 (file)
@@ -2,6 +2,7 @@
   Helper Library for ACPI\r
 \r
   Copyright (c) 2014-2016, ARM Ltd. All rights reserved.\r
+  Copyright (c) 2021, Ampere Computing LLC. All rights reserved.\r
 \r
   SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
@@ -13,6 +14,7 @@
 #include <Uefi.h>\r
 \r
 #include <IndustryStandard/Acpi10.h>\r
+#include <Protocol/AcpiSystemDescriptionTable.h>\r
 \r
 //\r
 // Macros for the Generic Address Space\r
@@ -128,4 +130,73 @@ LocateAndInstallAcpiFromFv (
   IN CONST EFI_GUID  *AcpiFile\r
   );\r
 \r
+/**\r
+  This function calculates and updates a UINT8 checksum\r
+  in an ACPI description table header.\r
+\r
+  @param  Buffer          Pointer to buffer to checksum\r
+  @param  Size            Number of bytes to checksum\r
+\r
+  @retval EFI_SUCCESS             The function completed successfully.\r
+  @retval EFI_INVALID_PARAMETER   Invalid parameter.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+AcpiUpdateChecksum (\r
+  IN OUT  UINT8      *Buffer,\r
+  IN      UINTN      Size\r
+  );\r
+\r
+/**\r
+  This function uses the ACPI SDT protocol to search an ACPI table\r
+  with a given signature.\r
+\r
+  @param  AcpiTableSdtProtocol    Pointer to ACPI SDT protocol.\r
+  @param  TableSignature          ACPI table signature.\r
+  @param  Index                   The zero-based index of the table where to search the table.\r
+                                  The index will be updated to the next instance if the table\r
+                                  is found with the matched TableSignature.\r
+  @param  Table                   Pointer to the table.\r
+  @param  TableKey                Pointer to the table key.\r
+\r
+  @return EFI_SUCCESS             The function completed successfully.\r
+  @return EFI_INVALID_PARAMETER   At least one of parameters is invalid.\r
+  @retval EFI_NOT_FOUND           The requested index is too large and a table was not found.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+AcpiLocateTableBySignature (\r
+  IN      EFI_ACPI_SDT_PROTOCOL           *AcpiSdtProtocol,\r
+  IN      UINT32                          TableSignature,\r
+  IN OUT  UINTN                           *Index,\r
+  OUT     EFI_ACPI_DESCRIPTION_HEADER     **Table,\r
+  OUT     UINTN                           *TableKey\r
+  );\r
+\r
+/**\r
+  This function updates the integer value of an AML Object.\r
+\r
+  @param  AcpiTableSdtProtocol    Pointer to ACPI SDT protocol.\r
+  @param  TableHandle             Points to the table representing the starting point\r
+                                  for the object path search.\r
+  @param  AsciiObjectPath         Pointer to the ACPI path of the object being updated.\r
+  @param  Value                   New value to write to the object.\r
+\r
+  @return EFI_SUCCESS             The function completed successfully.\r
+  @return EFI_INVALID_PARAMETER   At least one of parameters is invalid or the data type\r
+                                  of the ACPI object is not an integer value.\r
+  @retval EFI_NOT_FOUND           The object is not found with the given path.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+AcpiAmlObjectUpdateInteger (\r
+  IN  EFI_ACPI_SDT_PROTOCOL           *AcpiSdtProtocol,\r
+  IN  EFI_ACPI_HANDLE                 TableHandle,\r
+  IN  CHAR8                           *AsciiObjectPath,\r
+  IN  UINTN                           Value\r
+  );\r
+\r
 #endif // __ACPI_LIB_H__\r