summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArd Biesheuvel <ardb@kernel.org>2025-01-16 16:35:25 +0100
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2025-01-17 18:37:27 +0000
commit2ab362f313248a87c050ebbc02f1b2e08f35d53c (patch)
tree05ce15e2104c3d4ca1ab81f897d552bac6b4e805
parent4e874fcf09e3c8cede327e2209f488b944cbe0fe (diff)
downloadedk2-2ab362f313248a87c050ebbc02f1b2e08f35d53c.tar.gz
ArmPkg/ArmGic: Disentangle ArmGicEnableDistributor () versions
Split ArmGicEnableDistributor () into GICv2 and v3 specific versions, and move them into their single respective callers, so that the original can be dropped from ArmGicLib altogether. Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
-rw-r--r--ArmPkg/Drivers/ArmGic/ArmGicLib.inf1
-rw-r--r--ArmPkg/Drivers/ArmGic/ArmGicNonSecLib.c37
-rw-r--r--ArmPkg/Drivers/ArmGic/GicV2/ArmGicV2Dxe.c9
-rw-r--r--ArmPkg/Drivers/ArmGic/GicV3/ArmGicV3Dxe.c16
-rw-r--r--ArmPkg/Include/Library/ArmGicLib.h6
5 files changed, 25 insertions, 44 deletions
diff --git a/ArmPkg/Drivers/ArmGic/ArmGicLib.inf b/ArmPkg/Drivers/ArmGic/ArmGicLib.inf
index 7c79de8cc2..808ed993e1 100644
--- a/ArmPkg/Drivers/ArmGic/ArmGicLib.inf
+++ b/ArmPkg/Drivers/ArmGic/ArmGicLib.inf
@@ -15,7 +15,6 @@
[Sources]
ArmGicLib.c
- ArmGicNonSecLib.c
GicV2/ArmGicV2Lib.c
GicV2/ArmGicV2NonSecLib.c
diff --git a/ArmPkg/Drivers/ArmGic/ArmGicNonSecLib.c b/ArmPkg/Drivers/ArmGic/ArmGicNonSecLib.c
deleted file mode 100644
index 1a6ad48d1f..0000000000
--- a/ArmPkg/Drivers/ArmGic/ArmGicNonSecLib.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011-2023, Arm Limited. All rights reserved.
-*
-* SPDX-License-Identifier: BSD-2-Clause-Patent
-*
-**/
-
-#include <Uefi.h>
-#include <Library/IoLib.h>
-#include <Library/ArmGicLib.h>
-
-VOID
-EFIAPI
-ArmGicEnableDistributor (
- IN UINTN GicDistributorBase
- )
-{
- ARM_GIC_ARCH_REVISION Revision;
- UINT32 GicDistributorCtl;
-
- /*
- * Enable GIC distributor in Non-Secure world.
- * Note: The ICDDCR register is banked when Security extensions are implemented
- */
- Revision = ArmGicGetSupportedArchRevision ();
- if (Revision == ARM_GIC_ARCH_REVISION_2) {
- MmioWrite32 (GicDistributorBase + ARM_GIC_ICDDCR, 0x1);
- } else {
- GicDistributorCtl = MmioRead32 (GicDistributorBase + ARM_GIC_ICDDCR);
- if ((GicDistributorCtl & ARM_GIC_ICDDCR_ARE) != 0) {
- MmioOr32 (GicDistributorBase + ARM_GIC_ICDDCR, 0x2);
- } else {
- MmioOr32 (GicDistributorBase + ARM_GIC_ICDDCR, 0x1);
- }
- }
-}
diff --git a/ArmPkg/Drivers/ArmGic/GicV2/ArmGicV2Dxe.c b/ArmPkg/Drivers/ArmGic/GicV2/ArmGicV2Dxe.c
index 9906f1c987..acd0564330 100644
--- a/ArmPkg/Drivers/ArmGic/GicV2/ArmGicV2Dxe.c
+++ b/ArmPkg/Drivers/ArmGic/GicV2/ArmGicV2Dxe.c
@@ -389,6 +389,15 @@ GicV2SetTriggerType (
return EFI_SUCCESS;
}
+STATIC
+VOID
+ArmGicEnableDistributor (
+ IN UINTN GicDistributorBase
+ )
+{
+ MmioWrite32 (GicDistributorBase + ARM_GIC_ICDDCR, 0x1);
+}
+
EFI_HARDWARE_INTERRUPT2_PROTOCOL gHardwareInterrupt2V2Protocol = {
(HARDWARE_INTERRUPT2_REGISTER)RegisterInterruptSource,
(HARDWARE_INTERRUPT2_ENABLE)GicV2EnableInterruptSource,
diff --git a/ArmPkg/Drivers/ArmGic/GicV3/ArmGicV3Dxe.c b/ArmPkg/Drivers/ArmGic/GicV3/ArmGicV3Dxe.c
index fb168c5c4b..be5134da43 100644
--- a/ArmPkg/Drivers/ArmGic/GicV3/ArmGicV3Dxe.c
+++ b/ArmPkg/Drivers/ArmGic/GicV3/ArmGicV3Dxe.c
@@ -551,6 +551,22 @@ GicV3SetTriggerType (
return EFI_SUCCESS;
}
+STATIC
+VOID
+ArmGicEnableDistributor (
+ IN UINTN GicDistributorBase
+ )
+{
+ UINT32 GicDistributorCtl;
+
+ GicDistributorCtl = MmioRead32 (GicDistributorBase + ARM_GIC_ICDDCR);
+ if ((GicDistributorCtl & ARM_GIC_ICDDCR_ARE) != 0) {
+ MmioOr32 (GicDistributorBase + ARM_GIC_ICDDCR, 0x2);
+ } else {
+ MmioOr32 (GicDistributorBase + ARM_GIC_ICDDCR, 0x1);
+ }
+}
+
EFI_HARDWARE_INTERRUPT2_PROTOCOL gHardwareInterrupt2V3Protocol = {
(HARDWARE_INTERRUPT2_REGISTER)RegisterInterruptSource,
(HARDWARE_INTERRUPT2_ENABLE)GicV3EnableInterruptSource,
diff --git a/ArmPkg/Include/Library/ArmGicLib.h b/ArmPkg/Include/Library/ArmGicLib.h
index 6f69aeb926..24fd323f2e 100644
--- a/ArmPkg/Include/Library/ArmGicLib.h
+++ b/ArmPkg/Include/Library/ArmGicLib.h
@@ -135,12 +135,6 @@ ArmGicSetSecureInterrupts (
VOID
EFIAPI
-ArmGicEnableDistributor (
- IN UINTN GicDistributorBase
- );
-
-VOID
-EFIAPI
ArmGicDisableDistributor (
IN UINTN GicDistributorBase
);