diff options
author | Olivier Martin <olivier.martin@arm.com> | 2014-10-27 10:28:44 +0000 |
---|---|---|
committer | oliviermartin <oliviermartin@Edk2> | 2014-10-27 10:28:44 +0000 |
commit | 5f525769b9254bebea76512cfd348d8637e898e5 (patch) | |
tree | 7a2dfecb997b8a7859f865ce6cf644899f47d81e /ArmPkg/Drivers | |
parent | d5c6b7fca306f5034f1200261bf9f77c52498cd5 (diff) | |
download | edk2-platforms-5f525769b9254bebea76512cfd348d8637e898e5.tar.xz |
ArmPkg/ArmGic: Added GicV3 detection
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
Signed-off-by: Harry Liebel <Harry.Liebel@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16232 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ArmPkg/Drivers')
-rw-r--r-- | ArmPkg/Drivers/ArmGic/AArch64/ArmGicArchLib.c | 35 | ||||
-rw-r--r-- | ArmPkg/Drivers/ArmGic/Arm/ArmGicArchLib.c | 35 | ||||
-rw-r--r-- | ArmPkg/Drivers/ArmGic/ArmGicLib.c | 9 | ||||
-rw-r--r-- | ArmPkg/Drivers/ArmGic/ArmGicLib.inf | 7 | ||||
-rw-r--r-- | ArmPkg/Drivers/ArmGic/ArmGicSecLib.inf | 8 |
5 files changed, 83 insertions, 11 deletions
diff --git a/ArmPkg/Drivers/ArmGic/AArch64/ArmGicArchLib.c b/ArmPkg/Drivers/ArmGic/AArch64/ArmGicArchLib.c new file mode 100644 index 0000000000..5a7837f43d --- /dev/null +++ b/ArmPkg/Drivers/ArmGic/AArch64/ArmGicArchLib.c @@ -0,0 +1,35 @@ +/** @file
+*
+* Copyright (c) 2014, ARM Limited. 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.
+*
+**/
+
+#include <Library/ArmLib.h>
+#include <Library/ArmGicLib.h>
+
+ARM_GIC_ARCH_REVISION
+EFIAPI
+ArmGicGetSupportedArchRevision (
+ VOID
+ )
+{
+ // Ideally we would like to use the GICC IIDR Architecture version here, but
+ // this does not seem to be very reliable as the implementation could easily
+ // get it wrong. It is more reliable to check if the GICv3 System Register
+ // feature is implemented on the CPU. This is also convenient as our GICv3
+ // driver requires SRE. If only Memory mapped access is available we try to
+ // drive the GIC as a v2.
+ if (ArmReadIdPfr0 () & AARCH64_PFR0_GIC) {
+ return ARM_GIC_ARCH_REVISION_3;
+ }
+
+ return ARM_GIC_ARCH_REVISION_2;
+}
diff --git a/ArmPkg/Drivers/ArmGic/Arm/ArmGicArchLib.c b/ArmPkg/Drivers/ArmGic/Arm/ArmGicArchLib.c new file mode 100644 index 0000000000..668858f79a --- /dev/null +++ b/ArmPkg/Drivers/ArmGic/Arm/ArmGicArchLib.c @@ -0,0 +1,35 @@ +/** @file
+*
+* Copyright (c) 2014, ARM Limited. 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.
+*
+**/
+
+#include <Library/ArmLib.h>
+#include <Library/ArmGicLib.h>
+
+ARM_GIC_ARCH_REVISION
+EFIAPI
+ArmGicGetSupportedArchRevision (
+ VOID
+ )
+{
+ // Ideally we would like to use the GICC IIDR Architecture version here, but
+ // this does not seem to be very reliable as the implementation could easily
+ // get it wrong. It is more reliable to check if the GICv3 System Register
+ // feature is implemented on the CPU. This is also convenient as our GICv3
+ // driver requires SRE. If only Memory mapped access is available we try to
+ // drive the GIC as a v2.
+ if (ArmReadIdPfr1 () & ARM_PFR1_GIC) {
+ return ARM_GIC_ARCH_REVISION_3;
+ }
+
+ return ARM_GIC_ARCH_REVISION_2;
+}
diff --git a/ArmPkg/Drivers/ArmGic/ArmGicLib.c b/ArmPkg/Drivers/ArmGic/ArmGicLib.c index 23b312362f..7d99f9f98a 100644 --- a/ArmPkg/Drivers/ArmGic/ArmGicLib.c +++ b/ArmPkg/Drivers/ArmGic/ArmGicLib.c @@ -19,15 +19,6 @@ #include "GicV2/ArmGicV2Lib.h"
-ARM_GIC_ARCH_REVISION
-EFIAPI
-ArmGicGetSupportedArchRevision (
- VOID
- )
-{
- return ARM_GIC_ARCH_REVISION_2;
-}
-
UINTN
EFIAPI
ArmGicGetInterfaceIdentification (
diff --git a/ArmPkg/Drivers/ArmGic/ArmGicLib.inf b/ArmPkg/Drivers/ArmGic/ArmGicLib.inf index def70a0d5e..ca5cd1942b 100644 --- a/ArmPkg/Drivers/ArmGic/ArmGicLib.inf +++ b/ArmPkg/Drivers/ArmGic/ArmGicLib.inf @@ -26,7 +26,14 @@ GicV2/ArmGicV2Lib.c
GicV2/ArmGicV2NonSecLib.c
+[Sources.ARM]
+ Arm/ArmGicArchLib.c
+
+[Sources.AARCH64]
+ AArch64/ArmGicArchLib.c
+
[LibraryClasses]
+ ArmLib
DebugLib
IoLib
diff --git a/ArmPkg/Drivers/ArmGic/ArmGicSecLib.inf b/ArmPkg/Drivers/ArmGic/ArmGicSecLib.inf index 439bb91dae..45382998f0 100644 --- a/ArmPkg/Drivers/ArmGic/ArmGicSecLib.inf +++ b/ArmPkg/Drivers/ArmGic/ArmGicSecLib.inf @@ -26,6 +26,12 @@ GicV2/ArmGicV2Lib.c
GicV2/ArmGicV2SecLib.c
+[Sources.ARM]
+ Arm/ArmGicArchLib.c
+
+[Sources.AARCH64]
+ AArch64/ArmGicArchLib.c
+
[Packages]
ArmPkg/ArmPkg.dec
ArmPlatformPkg/ArmPlatformPkg.dec
@@ -34,7 +40,5 @@ [LibraryClasses]
ArmLib
- ArmPlatformLib
DebugLib
IoLib
- PcdLib
|