mirror of https://github.com/acidanthera/audk.git
ArmPkg: cache detected revision in ArmGicArchLib
Instead of inferring the GIC revision from the CPU id registers and the presence/availability of the system register interface upon each invocation, move the logic to a constructor and cache the result. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org> Tested-by: Leif Lindholm <leif.lindholm@linaro.org> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18100 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
e9e9c7e8a4
commit
f94522c823
|
@ -15,9 +15,11 @@
|
|||
#include <Library/ArmLib.h>
|
||||
#include <Library/ArmGicLib.h>
|
||||
|
||||
ARM_GIC_ARCH_REVISION
|
||||
STATIC ARM_GIC_ARCH_REVISION mGicArchRevision;
|
||||
|
||||
RETURN_STATUS
|
||||
EFIAPI
|
||||
ArmGicGetSupportedArchRevision (
|
||||
ArmGicArchLibInitialize (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
|
@ -43,9 +45,22 @@ ArmGicGetSupportedArchRevision (
|
|||
IccSre = ArmGicV3GetControlSystemRegisterEnable ();
|
||||
}
|
||||
if (IccSre & ICC_SRE_EL2_SRE) {
|
||||
return ARM_GIC_ARCH_REVISION_3;
|
||||
mGicArchRevision = ARM_GIC_ARCH_REVISION_3;
|
||||
goto Done;
|
||||
}
|
||||
}
|
||||
|
||||
return ARM_GIC_ARCH_REVISION_2;
|
||||
mGicArchRevision = ARM_GIC_ARCH_REVISION_2;
|
||||
|
||||
Done:
|
||||
return RETURN_SUCCESS;
|
||||
}
|
||||
|
||||
ARM_GIC_ARCH_REVISION
|
||||
EFIAPI
|
||||
ArmGicGetSupportedArchRevision (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
return mGicArchRevision;
|
||||
}
|
||||
|
|
|
@ -15,9 +15,11 @@
|
|||
#include <Library/ArmLib.h>
|
||||
#include <Library/ArmGicLib.h>
|
||||
|
||||
ARM_GIC_ARCH_REVISION
|
||||
STATIC ARM_GIC_ARCH_REVISION mGicArchRevision;
|
||||
|
||||
RETURN_STATUS
|
||||
EFIAPI
|
||||
ArmGicGetSupportedArchRevision (
|
||||
ArmGicArchLibInitialize (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
|
@ -43,9 +45,22 @@ ArmGicGetSupportedArchRevision (
|
|||
IccSre = ArmGicV3GetControlSystemRegisterEnable ();
|
||||
}
|
||||
if (IccSre & ICC_SRE_EL2_SRE) {
|
||||
return ARM_GIC_ARCH_REVISION_3;
|
||||
mGicArchRevision = ARM_GIC_ARCH_REVISION_3;
|
||||
goto Done;
|
||||
}
|
||||
}
|
||||
|
||||
return ARM_GIC_ARCH_REVISION_2;
|
||||
mGicArchRevision = ARM_GIC_ARCH_REVISION_2;
|
||||
|
||||
Done:
|
||||
return RETURN_SUCCESS;
|
||||
}
|
||||
|
||||
ARM_GIC_ARCH_REVISION
|
||||
EFIAPI
|
||||
ArmGicGetSupportedArchRevision (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
return mGicArchRevision;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,8 @@
|
|||
FILE_GUID = cd67f41a-26e9-4482-90c9-a9aff803382a
|
||||
MODULE_TYPE = BASE
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = ArmGicArchLib
|
||||
LIBRARY_CLASS = ArmGicArchLib|DXE_DRIVER UEFI_DRIVER UEFI_APPLICATION
|
||||
CONSTRUCTOR = ArmGicArchLibInitialize
|
||||
|
||||
[Sources.ARM]
|
||||
Arm/ArmGicArchLib.c
|
||||
|
|
Loading…
Reference in New Issue