TianoCore EDK2 master
Loading...
Searching...
No Matches
ArmGicNonSecLib.c
Go to the documentation of this file.
1
9#include <Uefi.h>
10#include <Library/IoLib.h>
11#include <Library/ArmGicLib.h>
12
13VOID
14EFIAPI
15ArmGicEnableDistributor (
16 IN UINTN GicDistributorBase
17 )
18{
19 ARM_GIC_ARCH_REVISION Revision;
20 UINT32 GicDistributorCtl;
21
22 /*
23 * Enable GIC distributor in Non-Secure world.
24 * Note: The ICDDCR register is banked when Security extensions are implemented
25 */
26 Revision = ArmGicGetSupportedArchRevision ();
27 if (Revision == ARM_GIC_ARCH_REVISION_2) {
28 MmioWrite32 (GicDistributorBase + ARM_GIC_ICDDCR, 0x1);
29 } else {
30 GicDistributorCtl = MmioRead32 (GicDistributorBase + ARM_GIC_ICDDCR);
31 if ((GicDistributorCtl & ARM_GIC_ICDDCR_ARE) != 0) {
32 MmioOr32 (GicDistributorBase + ARM_GIC_ICDDCR, 0x2);
33 } else {
34 MmioOr32 (GicDistributorBase + ARM_GIC_ICDDCR, 0x1);
35 }
36 }
37}
UINT64 UINTN
UINT32 EFIAPI MmioOr32(IN UINTN Address, IN UINT32 OrData)
Definition: IoHighLevel.c:1785
UINT32 EFIAPI MmioRead32(IN UINTN Address)
Definition: IoLib.c:262
UINT32 EFIAPI MmioWrite32(IN UINTN Address, IN UINT32 Value)
Definition: IoLib.c:309
#define IN
Definition: Base.h:279