ArmDisassemblerLib|ArmPkg/Library/ArmDisassemblerLib/ArmDisassemblerLib.inf\r
DmaLib|ArmPkg/Library/ArmDmaLib/ArmDmaLib.inf\r
ArmGicLib|ArmPkg/Drivers/ArmGic/ArmGicLib.inf\r
- ArmGicArchLib|ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.inf\r
+ ArmGicArchLib|ArmVirtPkg/Library/ArmVirtGicArchLib/ArmVirtGicArchLib.inf\r
ArmPlatformStackLib|ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatformStackLib.inf\r
ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf\r
ArmHvcLib|ArmPkg/Library/ArmHvcLib/ArmHvcLib.inf\r
--- /dev/null
+/** @file\r
+ ArmGicArchLib library class implementation for DT based virt platforms\r
+\r
+ Copyright (c) 2015, Linaro Ltd. All rights reserved.<BR>\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
+#include <Base.h>\r
+\r
+#include <Library/ArmGicLib.h>\r
+#include <Library/ArmGicArchLib.h>\r
+#include <Library/PcdLib.h>\r
+#include <Library/DebugLib.h>\r
+\r
+STATIC ARM_GIC_ARCH_REVISION mGicArchRevision;\r
+\r
+RETURN_STATUS\r
+EFIAPI\r
+ArmVirtGicArchLibConstructor (\r
+ VOID\r
+ )\r
+{\r
+ UINT32 IccSre;\r
+\r
+ switch (PcdGet32 (PcdArmGicRevision)) {\r
+\r
+ case 3:\r
+ //\r
+ // The default implementation of ArmGicArchLib is responsible for enabling\r
+ // the system register interface on the GICv3 if one is found. So let's do\r
+ // the same here.\r
+ //\r
+ IccSre = ArmGicV3GetControlSystemRegisterEnable ();\r
+ if (!(IccSre & ICC_SRE_EL2_SRE)) {\r
+ ArmGicV3SetControlSystemRegisterEnable (IccSre | ICC_SRE_EL2_SRE);\r
+ IccSre = ArmGicV3GetControlSystemRegisterEnable ();\r
+ }\r
+\r
+ //\r
+ // Unlike the default implementation, there is no fall through to GICv2\r
+ // mode if this GICv3 cannot be driven in native mode due to the fact\r
+ // that the System Register interface is unavailable.\r
+ //\r
+ ASSERT (IccSre & ICC_SRE_EL2_SRE);\r
+\r
+ mGicArchRevision = ARM_GIC_ARCH_REVISION_3;\r
+ break;\r
+\r
+ case 2:\r
+ mGicArchRevision = ARM_GIC_ARCH_REVISION_2;\r
+ break;\r
+\r
+ default:\r
+ DEBUG ((EFI_D_ERROR, "%a: No GIC revision specified!\n", __FUNCTION__));\r
+ return RETURN_NOT_FOUND;\r
+ }\r
+ return RETURN_SUCCESS;\r
+}\r
+\r
+ARM_GIC_ARCH_REVISION\r
+EFIAPI\r
+ArmGicGetSupportedArchRevision (\r
+ VOID\r
+ )\r
+{\r
+ return mGicArchRevision;\r
+}\r
--- /dev/null
+#/** @file\r
+#\r
+# Component description file for ArmVirtGicArchLib module\r
+#\r
+# Copyright (c) 2015, Linaro Ltd. All rights reserved.<BR>\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
+[Defines]\r
+ INF_VERSION = 0x00010005\r
+ BASE_NAME = ArmVirtGicArchLib\r
+ FILE_GUID = 87b0dc84-4661-4deb-a789-97977ff636ed\r
+ MODULE_TYPE = BASE\r
+ VERSION_STRING = 1.0\r
+ LIBRARY_CLASS = ArmGicArchLib|DXE_DRIVER UEFI_DRIVER UEFI_APPLICATION\r
+ CONSTRUCTOR = ArmVirtGicArchLibConstructor\r
+\r
+[Sources]\r
+ ArmVirtGicArchLib.c\r
+\r
+[LibraryClasses]\r
+ PcdLib\r
+ DebugLib\r
+ ArmGicLib\r
+\r
+[Packages]\r
+ MdePkg/MdePkg.dec\r
+ ArmPkg/ArmPkg.dec\r
+ ArmVirtPkg/ArmVirtPkg.dec\r
+\r
+[Pcd]\r
+ gArmVirtTokenSpaceGuid.PcdArmGicRevision\r