diff options
author | Olivier Martin <olivier.martin@arm.com> | 2014-10-27 10:27:27 +0000 |
---|---|---|
committer | oliviermartin <oliviermartin@Edk2> | 2014-10-27 10:27:27 +0000 |
commit | d5c6b7fca306f5034f1200261bf9f77c52498cd5 (patch) | |
tree | ccc8967fa82a66f39bc7887fe7139fa3fb5620e3 /ArmPkg/Drivers/ArmGic/ArmGicLib.c | |
parent | f1e2b7283ea6fa12691edee22aca403c3b3af24c (diff) | |
download | edk2-d5c6b7fca306f5034f1200261bf9f77c52498cd5.tar.gz edk2-d5c6b7fca306f5034f1200261bf9f77c52498cd5.tar.bz2 edk2-d5c6b7fca306f5034f1200261bf9f77c52498cd5.zip |
ArmPkg/ArmGic: Introduced ArmGicGetSupportedArchRevision()
This function returns the revision of the GIC Architecture.
Some GICv3 controllers can work in GICv2 mode. Switching to an
older GIC revision is driven by the higher level exception level.
This function allows code to support any GIC revision at runtime.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16231 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ArmPkg/Drivers/ArmGic/ArmGicLib.c')
-rw-r--r-- | ArmPkg/Drivers/ArmGic/ArmGicLib.c | 61 |
1 files changed, 49 insertions, 12 deletions
diff --git a/ArmPkg/Drivers/ArmGic/ArmGicLib.c b/ArmPkg/Drivers/ArmGic/ArmGicLib.c index 717b18b9e6..23b312362f 100644 --- a/ArmPkg/Drivers/ArmGic/ArmGicLib.c +++ b/ArmPkg/Drivers/ArmGic/ArmGicLib.c @@ -19,6 +19,15 @@ #include "GicV2/ArmGicV2Lib.h"
+ARM_GIC_ARCH_REVISION
+EFIAPI
+ArmGicGetSupportedArchRevision (
+ VOID
+ )
+{
+ return ARM_GIC_ARCH_REVISION_2;
+}
+
UINTN
EFIAPI
ArmGicGetInterfaceIdentification (
@@ -71,15 +80,22 @@ ArmGicAcknowledgeInterrupt ( )
{
UINTN Value;
-
- Value = ArmGicV2AcknowledgeInterrupt (GicInterruptInterfaceBase);
-
- // InterruptId is required for the caller to know if a valid or spurious
- // interrupt has been read
- ASSERT (InterruptId != NULL);
-
- if (InterruptId != NULL) {
- *InterruptId = Value & ARM_GIC_ICCIAR_ACKINTID;
+ ARM_GIC_ARCH_REVISION Revision;
+
+ Revision = ArmGicGetSupportedArchRevision ();
+ if (Revision == ARM_GIC_ARCH_REVISION_2) {
+ Value = ArmGicV2AcknowledgeInterrupt (GicInterruptInterfaceBase);
+ // InterruptId is required for the caller to know if a valid or spurious
+ // interrupt has been read
+ ASSERT (InterruptId != NULL);
+ if (InterruptId != NULL) {
+ *InterruptId = Value & ARM_GIC_ICCIAR_ACKINTID;
+ }
+ } else {
+ ASSERT_EFI_ERROR (EFI_UNSUPPORTED);
+ // Report Spurious interrupt which is what the above controllers would
+ // return if no interrupt was available
+ Value = 1023;
}
return Value;
@@ -92,7 +108,14 @@ ArmGicEndOfInterrupt ( IN UINTN Source
)
{
- ArmGicV2EndOfInterrupt (GicInterruptInterfaceBase, Source);
+ ARM_GIC_ARCH_REVISION Revision;
+
+ Revision = ArmGicGetSupportedArchRevision ();
+ if (Revision == ARM_GIC_ARCH_REVISION_2) {
+ ArmGicV2EndOfInterrupt (GicInterruptInterfaceBase, Source);
+ } else {
+ ASSERT_EFI_ERROR (EFI_UNSUPPORTED);
+ }
}
VOID
@@ -164,7 +187,14 @@ ArmGicEnableInterruptInterface ( IN INTN GicInterruptInterfaceBase
)
{
- return ArmGicV2EnableInterruptInterface (GicInterruptInterfaceBase);
+ ARM_GIC_ARCH_REVISION Revision;
+
+ Revision = ArmGicGetSupportedArchRevision ();
+ if (Revision == ARM_GIC_ARCH_REVISION_2) {
+ ArmGicV2EnableInterruptInterface (GicInterruptInterfaceBase);
+ } else {
+ ASSERT_EFI_ERROR (EFI_UNSUPPORTED);
+ }
}
VOID
@@ -173,5 +203,12 @@ ArmGicDisableInterruptInterface ( IN INTN GicInterruptInterfaceBase
)
{
- return ArmGicV2DisableInterruptInterface (GicInterruptInterfaceBase);
+ ARM_GIC_ARCH_REVISION Revision;
+
+ Revision = ArmGicGetSupportedArchRevision ();
+ if (Revision == ARM_GIC_ARCH_REVISION_2) {
+ ArmGicV2DisableInterruptInterface (GicInterruptInterfaceBase);
+ } else {
+ ASSERT_EFI_ERROR (EFI_UNSUPPORTED);
+ }
}
|