3 * Copyright (c) 2011-2014, ARM Limited. All rights reserved.
5 * SPDX-License-Identifier: BSD-2-Clause-Patent
10 #include <Library/DebugLib.h>
11 #include <Library/IoLib.h>
12 #include <Library/ArmGicLib.h>
15 * This function configures the interrupts set by the mask to be secure.
20 ArmGicSetSecureInterrupts (
21 IN UINTN GicDistributorBase
,
22 IN UINTN
* GicSecureInterruptMask
,
23 IN UINTN GicSecureInterruptMaskSize
27 UINT32 InterruptStatus
;
29 // We must not have more interrupts defined by the mask than the number of available interrupts
30 ASSERT(GicSecureInterruptMaskSize
<= (ArmGicGetMaxNumInterrupts (GicDistributorBase
) / 32));
32 // Set all the interrupts defined by the mask as Secure
33 for (Index
= 0; Index
< GicSecureInterruptMaskSize
; Index
++) {
34 InterruptStatus
= MmioRead32 (GicDistributorBase
+ ARM_GIC_ICDISR
+ (Index
* 4));
35 MmioWrite32 (GicDistributorBase
+ ARM_GIC_ICDISR
+ (Index
* 4), InterruptStatus
& (~GicSecureInterruptMask
[Index
]));
41 ArmGicEnableDistributor (
42 IN INTN GicDistributorBase
45 // Turn on the GIC distributor
46 MmioWrite32 (GicDistributorBase
+ ARM_GIC_ICDDCR
, 1);
51 ArmGicSetupNonSecure (
53 IN INTN GicDistributorBase
,
54 IN INTN GicInterruptInterfaceBase
57 ArmGicV2SetupNonSecure (MpId
, GicDistributorBase
, GicInterruptInterfaceBase
);