summaryrefslogtreecommitdiffstats
path: root/ArmPkg
diff options
context:
space:
mode:
authorArd Biesheuvel <ardb@kernel.org>2025-01-16 16:48:31 +0100
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2025-01-17 18:37:27 +0000
commit337a99af10693bb682e4ba79f393146f21930d4f (patch)
tree5c5787f20a693aebce857d48e4e6900910a5339b /ArmPkg
parent298d8c436a24d386c2f8ff2c117a755abe90ee6d (diff)
downloadedk2-337a99af10693bb682e4ba79f393146f21930d4f.tar.gz
ArmPkg/ArmGic: Move remaining shared code into ArmGicDxe
Move the remaining ArmGicLib code that is shared between the v2 and v3 GIC DXE drivers into ArmGicCommonDxe.c Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Diffstat (limited to 'ArmPkg')
-rw-r--r--ArmPkg/Drivers/ArmGic/ArmGicCommonDxe.c43
-rw-r--r--ArmPkg/Drivers/ArmGic/ArmGicDxe.h18
-rw-r--r--ArmPkg/Drivers/ArmGic/ArmGicLib.c57
-rw-r--r--ArmPkg/Drivers/ArmGic/ArmGicLib.inf2
-rw-r--r--ArmPkg/Include/Library/ArmGicLib.h18
5 files changed, 61 insertions, 77 deletions
diff --git a/ArmPkg/Drivers/ArmGic/ArmGicCommonDxe.c b/ArmPkg/Drivers/ArmGic/ArmGicCommonDxe.c
index c285c27fdd..8e845511d6 100644
--- a/ArmPkg/Drivers/ArmGic/ArmGicCommonDxe.c
+++ b/ArmPkg/Drivers/ArmGic/ArmGicCommonDxe.c
@@ -199,3 +199,46 @@ InstallAndRegisterInterruptService (
return Status;
}
+
+/**
+ Return the GIC CPU Interrupt Interface ID.
+
+ @param GicInterruptInterfaceBase Base address of the GIC Interrupt Interface.
+
+ @retval CPU Interface Identification information.
+**/
+UINT32
+EFIAPI
+ArmGicGetInterfaceIdentification (
+ IN UINTN GicInterruptInterfaceBase
+ )
+{
+ // Read the GIC Identification Register
+ return MmioRead32 (GicInterruptInterfaceBase + ARM_GIC_ICCIIDR);
+}
+
+UINTN
+EFIAPI
+ArmGicGetMaxNumInterrupts (
+ IN UINTN GicDistributorBase
+ )
+{
+ UINTN ItLines;
+
+ ItLines = MmioRead32 (GicDistributorBase + ARM_GIC_ICDICTR) & 0x1F;
+
+ //
+ // Interrupt ID 1020-1023 are reserved.
+ //
+ return (ItLines == 0x1f) ? 1020 : 32 * (ItLines + 1);
+}
+
+VOID
+EFIAPI
+ArmGicDisableDistributor (
+ IN UINTN GicDistributorBase
+ )
+{
+ // Disable Gic Distributor
+ MmioWrite32 (GicDistributorBase + ARM_GIC_ICDDCR, 0x0);
+}
diff --git a/ArmPkg/Drivers/ArmGic/ArmGicDxe.h b/ArmPkg/Drivers/ArmGic/ArmGicDxe.h
index 0f621682a1..4e09989843 100644
--- a/ArmPkg/Drivers/ArmGic/ArmGicDxe.h
+++ b/ArmPkg/Drivers/ArmGic/ArmGicDxe.h
@@ -75,4 +75,22 @@ GicGetDistributorIcfgBaseAndBit (
OUT UINTN *Config1Bit
);
+UINT32
+EFIAPI
+ArmGicGetInterfaceIdentification (
+ IN UINTN GicInterruptInterfaceBase
+ );
+
+VOID
+EFIAPI
+ArmGicDisableDistributor (
+ IN UINTN GicDistributorBase
+ );
+
+UINTN
+EFIAPI
+ArmGicGetMaxNumInterrupts (
+ IN UINTN GicDistributorBase
+ );
+
#endif // ARM_GIC_DXE_H_
diff --git a/ArmPkg/Drivers/ArmGic/ArmGicLib.c b/ArmPkg/Drivers/ArmGic/ArmGicLib.c
deleted file mode 100644
index 61d5dacba2..0000000000
--- a/ArmPkg/Drivers/ArmGic/ArmGicLib.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/** @file
-*
-* Copyright (c) 2011-2023, Arm Limited. All rights reserved.
-*
-* SPDX-License-Identifier: BSD-2-Clause-Patent
-*
-**/
-
-#include <Base.h>
-#include <Library/ArmGicLib.h>
-#include <Library/ArmLib.h>
-#include <Library/DebugLib.h>
-#include <Library/IoLib.h>
-#include <Library/PcdLib.h>
-
-/**
- Return the GIC CPU Interrupt Interface ID.
-
- @param GicInterruptInterfaceBase Base address of the GIC Interrupt Interface.
-
- @retval CPU Interface Identification information.
-**/
-UINT32
-EFIAPI
-ArmGicGetInterfaceIdentification (
- IN UINTN GicInterruptInterfaceBase
- )
-{
- // Read the GIC Identification Register
- return MmioRead32 (GicInterruptInterfaceBase + ARM_GIC_ICCIIDR);
-}
-
-UINTN
-EFIAPI
-ArmGicGetMaxNumInterrupts (
- IN UINTN GicDistributorBase
- )
-{
- UINTN ItLines;
-
- ItLines = MmioRead32 (GicDistributorBase + ARM_GIC_ICDICTR) & 0x1F;
-
- //
- // Interrupt ID 1020-1023 are reserved.
- //
- return (ItLines == 0x1f) ? 1020 : 32 * (ItLines + 1);
-}
-
-VOID
-EFIAPI
-ArmGicDisableDistributor (
- IN UINTN GicDistributorBase
- )
-{
- // Disable Gic Distributor
- MmioWrite32 (GicDistributorBase + ARM_GIC_ICDDCR, 0x0);
-}
diff --git a/ArmPkg/Drivers/ArmGic/ArmGicLib.inf b/ArmPkg/Drivers/ArmGic/ArmGicLib.inf
index 808ed993e1..c79bcbad37 100644
--- a/ArmPkg/Drivers/ArmGic/ArmGicLib.inf
+++ b/ArmPkg/Drivers/ArmGic/ArmGicLib.inf
@@ -14,8 +14,6 @@
LIBRARY_CLASS = ArmGicLib
[Sources]
- ArmGicLib.c
-
GicV2/ArmGicV2Lib.c
GicV2/ArmGicV2NonSecLib.c
diff --git a/ArmPkg/Include/Library/ArmGicLib.h b/ArmPkg/Include/Library/ArmGicLib.h
index bb2e415e69..a0781361d9 100644
--- a/ArmPkg/Include/Library/ArmGicLib.h
+++ b/ArmPkg/Include/Library/ArmGicLib.h
@@ -110,24 +110,6 @@
// Bit Mask for
#define ARM_GIC_ICCIAR_ACKINTID 0x3FF
-UINT32
-EFIAPI
-ArmGicGetInterfaceIdentification (
- IN UINTN GicInterruptInterfaceBase
- );
-
-VOID
-EFIAPI
-ArmGicDisableDistributor (
- IN UINTN GicDistributorBase
- );
-
-UINTN
-EFIAPI
-ArmGicGetMaxNumInterrupts (
- IN UINTN GicDistributorBase
- );
-
// GIC revision 2 specific declarations
// Interrupts from 1020 to 1023 are considered as special interrupts