]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EmbeddedPkg/Include/Library/AcpiLib.h
EmbeddedPkg: Introduced AcpiLib
[mirror_edk2.git] / EmbeddedPkg / Include / Library / AcpiLib.h
diff --git a/EmbeddedPkg/Include/Library/AcpiLib.h b/EmbeddedPkg/Include/Library/AcpiLib.h
new file mode 100644 (file)
index 0000000..3eaa1d5
--- /dev/null
@@ -0,0 +1,62 @@
+/** @file\r
+  Helper Library for ACPI\r
+\r
+  Copyright (c) 2014, ARM Ltd. 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
+#ifndef __ACPI_LIB_H__\r
+#define __ACPI_LIB_H__\r
+\r
+#include <Uefi.h>\r
+\r
+//\r
+// Macros for the Generic Address Space\r
+//\r
+#define NULL_GAS               { EFI_ACPI_5_0_SYSTEM_MEMORY,  0, 0, EFI_ACPI_5_0_UNDEFINED, 0L }\r
+#define ARM_GAS8(Address)      { EFI_ACPI_5_0_SYSTEM_MEMORY,  8, 0, EFI_ACPI_5_0_BYTE,      Address }\r
+#define ARM_GAS16(Address)     { EFI_ACPI_5_0_SYSTEM_MEMORY, 16, 0, EFI_ACPI_5_0_WORD,      Address }\r
+#define ARM_GAS32(Address)     { EFI_ACPI_5_0_SYSTEM_MEMORY, 32, 0, EFI_ACPI_5_0_DWORD,     Address }\r
+#define ARM_GASN(Address)      { EFI_ACPI_5_0_SYSTEM_MEMORY,  0, 0, EFI_ACPI_5_0_DWORD,     Address }\r
+\r
+//\r
+// Macros for the Multiple APIC Description Table (MADT)\r
+//\r
+#define EFI_ACPI_5_0_GIC_DISTRIBUTOR_INIT(GicDistHwId, GicDistBase, GicDistVector) \\r
+  { \\r
+    EFI_ACPI_5_0_GICD, sizeof (EFI_ACPI_5_0_GIC_DISTRIBUTOR_STRUCTURE), EFI_ACPI_RESERVED_WORD, \\r
+    GicDistHwId, GicDistBase, GicDistVector, EFI_ACPI_RESERVED_DWORD \\r
+  }\r
+\r
+// Note the parking protocol is configured by UEFI if required\r
+#define EFI_ACPI_5_0_GIC_STRUCTURE_INIT(GicId, AcpiCpuId, Flags, PmuIrq, GicBase) \\r
+  { \\r
+    EFI_ACPI_5_0_GIC, sizeof (EFI_ACPI_5_0_GIC_STRUCTURE), EFI_ACPI_RESERVED_WORD, \\r
+    GicId, AcpiCpuId, Flags, 0, PmuIrq, 0, GicBase \\r
+  }\r
+\r
+\r
+/**\r
+  Locate and Install the ACPI tables from the Firmware Volume\r
+\r
+  @param  AcpiFile              Guid of the ACPI file into the Firmware Volume\r
+\r
+  @return EFI_SUCCESS           The function completed successfully.\r
+  @return EFI_NOT_FOUND         The protocol could not be located.\r
+  @return EFI_OUT_OF_RESOURCES  There are not enough resources to find the protocol.\r
+\r
+**/\r
+EFI_STATUS\r
+LocateAndInstallAcpiFromFv (\r
+  IN CONST EFI_GUID* AcpiFile\r
+  );\r
+\r
+#endif // __ACPI_LIB_H__\r