summaryrefslogtreecommitdiffstats
path: root/EmbeddedPkg/Include/Library
diff options
context:
space:
mode:
authorOlivier Martin <olivier.martin@arm.com>2015-01-23 15:59:27 +0000
committeroliviermartin <oliviermartin@Edk2>2015-01-23 15:59:27 +0000
commit3356211b9c9afd39cc0ca1bb8d92ee968a8cfd04 (patch)
tree0d67e25ddaf0d621ed32e246457ff0a2c1f89ca7 /EmbeddedPkg/Include/Library
parentbfed5d80af4cb3d76f9e064bc4d513d1be92ee2e (diff)
downloadedk2-3356211b9c9afd39cc0ca1bb8d92ee968a8cfd04.tar.gz
edk2-3356211b9c9afd39cc0ca1bb8d92ee968a8cfd04.tar.bz2
edk2-3356211b9c9afd39cc0ca1bb8d92ee968a8cfd04.zip
EmbeddedPkg: Introduced AcpiLib
AcpiLib is a library to help working with ACPI Tables. In this initial implementation, the library provides: - a helper function to locate and install the ACPI Tables within a Firmware Volume - Some helper macros to initialize some ACPI structures Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Olivier Martin <olivier.martin@arm.com> Reviewed-by: Graeme Gregory <graeme.gregory@linaro.org> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16650 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'EmbeddedPkg/Include/Library')
-rw-r--r--EmbeddedPkg/Include/Library/AcpiLib.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/EmbeddedPkg/Include/Library/AcpiLib.h b/EmbeddedPkg/Include/Library/AcpiLib.h
new file mode 100644
index 0000000000..3eaa1d558e
--- /dev/null
+++ b/EmbeddedPkg/Include/Library/AcpiLib.h
@@ -0,0 +1,62 @@
+/** @file
+ Helper Library for ACPI
+
+ Copyright (c) 2014, ARM Ltd. All rights reserved.
+
+ This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef __ACPI_LIB_H__
+#define __ACPI_LIB_H__
+
+#include <Uefi.h>
+
+//
+// Macros for the Generic Address Space
+//
+#define NULL_GAS { EFI_ACPI_5_0_SYSTEM_MEMORY, 0, 0, EFI_ACPI_5_0_UNDEFINED, 0L }
+#define ARM_GAS8(Address) { EFI_ACPI_5_0_SYSTEM_MEMORY, 8, 0, EFI_ACPI_5_0_BYTE, Address }
+#define ARM_GAS16(Address) { EFI_ACPI_5_0_SYSTEM_MEMORY, 16, 0, EFI_ACPI_5_0_WORD, Address }
+#define ARM_GAS32(Address) { EFI_ACPI_5_0_SYSTEM_MEMORY, 32, 0, EFI_ACPI_5_0_DWORD, Address }
+#define ARM_GASN(Address) { EFI_ACPI_5_0_SYSTEM_MEMORY, 0, 0, EFI_ACPI_5_0_DWORD, Address }
+
+//
+// Macros for the Multiple APIC Description Table (MADT)
+//
+#define EFI_ACPI_5_0_GIC_DISTRIBUTOR_INIT(GicDistHwId, GicDistBase, GicDistVector) \
+ { \
+ EFI_ACPI_5_0_GICD, sizeof (EFI_ACPI_5_0_GIC_DISTRIBUTOR_STRUCTURE), EFI_ACPI_RESERVED_WORD, \
+ GicDistHwId, GicDistBase, GicDistVector, EFI_ACPI_RESERVED_DWORD \
+ }
+
+// Note the parking protocol is configured by UEFI if required
+#define EFI_ACPI_5_0_GIC_STRUCTURE_INIT(GicId, AcpiCpuId, Flags, PmuIrq, GicBase) \
+ { \
+ EFI_ACPI_5_0_GIC, sizeof (EFI_ACPI_5_0_GIC_STRUCTURE), EFI_ACPI_RESERVED_WORD, \
+ GicId, AcpiCpuId, Flags, 0, PmuIrq, 0, GicBase \
+ }
+
+
+/**
+ Locate and Install the ACPI tables from the Firmware Volume
+
+ @param AcpiFile Guid of the ACPI file into the Firmware Volume
+
+ @return EFI_SUCCESS The function completed successfully.
+ @return EFI_NOT_FOUND The protocol could not be located.
+ @return EFI_OUT_OF_RESOURCES There are not enough resources to find the protocol.
+
+**/
+EFI_STATUS
+LocateAndInstallAcpiFromFv (
+ IN CONST EFI_GUID* AcpiFile
+ );
+
+#endif // __ACPI_LIB_H__