From 5374e31a46cacb77692115f9919728c867381d65 Mon Sep 17 00:00:00 2001 From: Olivier Martin Date: Tue, 25 Mar 2014 15:11:52 +0000 Subject: [PATCH 12/14] ArmPkg/ArmGic: Added GicV3 detection Change-Id: I9a796ec1c3e6020b69c1c1b492406f3e749efad3 --- ArmPkg/Drivers/ArmGic/AArch64/ArmGicArchLib.c | 29 +++++++++++++++++++++++++++ ArmPkg/Drivers/ArmGic/Arm/ArmGicArchLib.c | 29 +++++++++++++++++++++++++++ ArmPkg/Drivers/ArmGic/ArmGicLib.c | 9 --------- ArmPkg/Drivers/ArmGic/ArmGicLib.inf | 7 +++++++ ArmPkg/Drivers/ArmGic/ArmGicSecLib.inf | 9 ++++++--- ArmPkg/Include/Library/ArmGicLib.h | 3 ++- 6 files changed, 73 insertions(+), 13 deletions(-) create mode 100755 ArmPkg/Drivers/ArmGic/AArch64/ArmGicArchLib.c create mode 100755 ArmPkg/Drivers/ArmGic/Arm/ArmGicArchLib.c diff --git a/ArmPkg/Drivers/ArmGic/AArch64/ArmGicArchLib.c b/ArmPkg/Drivers/ArmGic/AArch64/ArmGicArchLib.c new file mode 100755 index 0000000..723d549 --- /dev/null +++ b/ArmPkg/Drivers/ArmGic/AArch64/ArmGicArchLib.c @@ -0,0 +1,29 @@ +/** @file +* +* Copyright (c) 2013-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 +#include + +ARM_GIC_ARCH_REVISION +EFIAPI +ArmGicGetSupportedArchRevision ( + VOID + ) +{ + if (ArmReadIdPfr0 () & AARCH64_PFR0_GIC) { + return ARM_GIC_ARCH_REVISION_3; + } else { + 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 100755 index 0000000..51e7f83 --- /dev/null +++ b/ArmPkg/Drivers/ArmGic/Arm/ArmGicArchLib.c @@ -0,0 +1,29 @@ +/** @file +* +* Copyright (c) 2013-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 +#include + +ARM_GIC_ARCH_REVISION +EFIAPI +ArmGicGetSupportedArchRevision ( + VOID + ) +{ + if (ArmReadIdPfr1 () & ARM_PFR1_GIC) { + return ARM_GIC_ARCH_REVISION_3; + } else { + return ARM_GIC_ARCH_REVISION_2; + } +} diff --git a/ArmPkg/Drivers/ArmGic/ArmGicLib.c b/ArmPkg/Drivers/ArmGic/ArmGicLib.c index bf1810f..1b0a4cf 100755 --- 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 5fe07e6..0171f3d 100755 --- 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 07e750f..84a3e60 100755 --- 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,8 +40,5 @@ [LibraryClasses] ArmLib - ArmPlatformLib DebugLib IoLib - PcdLib - diff --git a/ArmPkg/Include/Library/ArmGicLib.h b/ArmPkg/Include/Library/ArmGicLib.h index 6c88bff..5248fe6 100644 --- a/ArmPkg/Include/Library/ArmGicLib.h +++ b/ArmPkg/Include/Library/ArmGicLib.h @@ -19,7 +19,8 @@ // GIC definitions // typedef enum { - ARM_GIC_ARCH_REVISION_2 + ARM_GIC_ARCH_REVISION_2, + ARM_GIC_ARCH_REVISION_3 } ARM_GIC_ARCH_REVISION; // -- 1.8.5