mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-26 23:24:03 +02:00
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>
This commit is contained in:
parent
298d8c436a
commit
337a99af10
@ -199,3 +199,46 @@ InstallAndRegisterInterruptService (
|
|||||||
|
|
||||||
return Status;
|
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);
|
||||||
|
}
|
||||||
|
@ -75,4 +75,22 @@ GicGetDistributorIcfgBaseAndBit (
|
|||||||
OUT UINTN *Config1Bit
|
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_
|
#endif // ARM_GIC_DXE_H_
|
||||||
|
@ -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);
|
|
||||||
}
|
|
@ -14,8 +14,6 @@
|
|||||||
LIBRARY_CLASS = ArmGicLib
|
LIBRARY_CLASS = ArmGicLib
|
||||||
|
|
||||||
[Sources]
|
[Sources]
|
||||||
ArmGicLib.c
|
|
||||||
|
|
||||||
GicV2/ArmGicV2Lib.c
|
GicV2/ArmGicV2Lib.c
|
||||||
GicV2/ArmGicV2NonSecLib.c
|
GicV2/ArmGicV2NonSecLib.c
|
||||||
|
|
||||||
|
@ -110,24 +110,6 @@
|
|||||||
// Bit Mask for
|
// Bit Mask for
|
||||||
#define ARM_GIC_ICCIAR_ACKINTID 0x3FF
|
#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
|
// GIC revision 2 specific declarations
|
||||||
|
|
||||||
// Interrupts from 1020 to 1023 are considered as special interrupts
|
// Interrupts from 1020 to 1023 are considered as special interrupts
|
||||||
|
Loading…
x
Reference in New Issue
Block a user