mirror of https://github.com/acidanthera/audk.git
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
This commit is contained in:
parent
f1e2b7283e
commit
d5c6b7fca3
|
@ -33,6 +33,7 @@ Abstract:
|
||||||
@retval EFI_SUCCESS Protocol registered
|
@retval EFI_SUCCESS Protocol registered
|
||||||
@retval EFI_OUT_OF_RESOURCES Cannot allocate protocol data structure
|
@retval EFI_OUT_OF_RESOURCES Cannot allocate protocol data structure
|
||||||
@retval EFI_DEVICE_ERROR Hardware problems
|
@retval EFI_DEVICE_ERROR Hardware problems
|
||||||
|
@retval EFI_UNSUPPORTED GIC version not supported
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
|
@ -42,8 +43,15 @@ InterruptDxeInitialize (
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
ARM_GIC_ARCH_REVISION Revision;
|
||||||
|
|
||||||
|
Revision = ArmGicGetSupportedArchRevision ();
|
||||||
|
|
||||||
|
if (Revision == ARM_GIC_ARCH_REVISION_2) {
|
||||||
Status = GicV2DxeInitialize (ImageHandle, SystemTable);
|
Status = GicV2DxeInitialize (ImageHandle, SystemTable);
|
||||||
|
} else {
|
||||||
|
Status = EFI_UNSUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,15 @@
|
||||||
|
|
||||||
#include "GicV2/ArmGicV2Lib.h"
|
#include "GicV2/ArmGicV2Lib.h"
|
||||||
|
|
||||||
|
ARM_GIC_ARCH_REVISION
|
||||||
|
EFIAPI
|
||||||
|
ArmGicGetSupportedArchRevision (
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return ARM_GIC_ARCH_REVISION_2;
|
||||||
|
}
|
||||||
|
|
||||||
UINTN
|
UINTN
|
||||||
EFIAPI
|
EFIAPI
|
||||||
ArmGicGetInterfaceIdentification (
|
ArmGicGetInterfaceIdentification (
|
||||||
|
@ -71,16 +80,23 @@ ArmGicAcknowledgeInterrupt (
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINTN Value;
|
UINTN Value;
|
||||||
|
ARM_GIC_ARCH_REVISION Revision;
|
||||||
|
|
||||||
|
Revision = ArmGicGetSupportedArchRevision ();
|
||||||
|
if (Revision == ARM_GIC_ARCH_REVISION_2) {
|
||||||
Value = ArmGicV2AcknowledgeInterrupt (GicInterruptInterfaceBase);
|
Value = ArmGicV2AcknowledgeInterrupt (GicInterruptInterfaceBase);
|
||||||
|
|
||||||
// InterruptId is required for the caller to know if a valid or spurious
|
// InterruptId is required for the caller to know if a valid or spurious
|
||||||
// interrupt has been read
|
// interrupt has been read
|
||||||
ASSERT (InterruptId != NULL);
|
ASSERT (InterruptId != NULL);
|
||||||
|
|
||||||
if (InterruptId != NULL) {
|
if (InterruptId != NULL) {
|
||||||
*InterruptId = Value & ARM_GIC_ICCIAR_ACKINTID;
|
*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;
|
return Value;
|
||||||
}
|
}
|
||||||
|
@ -92,7 +108,14 @@ ArmGicEndOfInterrupt (
|
||||||
IN UINTN Source
|
IN UINTN Source
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
ARM_GIC_ARCH_REVISION Revision;
|
||||||
|
|
||||||
|
Revision = ArmGicGetSupportedArchRevision ();
|
||||||
|
if (Revision == ARM_GIC_ARCH_REVISION_2) {
|
||||||
ArmGicV2EndOfInterrupt (GicInterruptInterfaceBase, Source);
|
ArmGicV2EndOfInterrupt (GicInterruptInterfaceBase, Source);
|
||||||
|
} else {
|
||||||
|
ASSERT_EFI_ERROR (EFI_UNSUPPORTED);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
@ -164,7 +187,14 @@ ArmGicEnableInterruptInterface (
|
||||||
IN INTN GicInterruptInterfaceBase
|
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
|
VOID
|
||||||
|
@ -173,5 +203,12 @@ ArmGicDisableInterruptInterface (
|
||||||
IN INTN GicInterruptInterfaceBase
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
GicV2/ArmGicV2NonSecLib.c
|
GicV2/ArmGicV2NonSecLib.c
|
||||||
|
|
||||||
[LibraryClasses]
|
[LibraryClasses]
|
||||||
|
DebugLib
|
||||||
IoLib
|
IoLib
|
||||||
|
|
||||||
[Packages]
|
[Packages]
|
||||||
|
|
|
@ -18,6 +18,9 @@
|
||||||
//
|
//
|
||||||
// GIC definitions
|
// GIC definitions
|
||||||
//
|
//
|
||||||
|
typedef enum {
|
||||||
|
ARM_GIC_ARCH_REVISION_2
|
||||||
|
} ARM_GIC_ARCH_REVISION;
|
||||||
|
|
||||||
//
|
//
|
||||||
// GIC Distributor
|
// GIC Distributor
|
||||||
|
@ -76,6 +79,12 @@
|
||||||
#define ARM_GIC_ICCIIDR_GET_REVISION(IccIidr) (((IccIidr) >> 12) & 0xF)
|
#define ARM_GIC_ICCIIDR_GET_REVISION(IccIidr) (((IccIidr) >> 12) & 0xF)
|
||||||
#define ARM_GIC_ICCIIDR_GET_IMPLEMENTER(IccIidr) ((IccIidr) & 0xFFF)
|
#define ARM_GIC_ICCIIDR_GET_IMPLEMENTER(IccIidr) ((IccIidr) & 0xFFF)
|
||||||
|
|
||||||
|
ARM_GIC_ARCH_REVISION
|
||||||
|
EFIAPI
|
||||||
|
ArmGicGetSupportedArchRevision (
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
UINTN
|
UINTN
|
||||||
EFIAPI
|
EFIAPI
|
||||||
ArmGicGetInterfaceIdentification (
|
ArmGicGetInterfaceIdentification (
|
||||||
|
|
Loading…
Reference in New Issue