3 * Copyright (c) 2011-2014, ARM Limited. All rights reserved.
5 * This program and the accompanying materials
6 * are licensed and made available under the terms and conditions of the BSD License
7 * which accompanies this distribution. The full text of the license may be found at
8 * http://opensource.org/licenses/bsd-license.php
10 * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #include <Library/DebugLib.h>
17 #include <Library/IoLib.h>
18 #include <Library/ArmGicLib.h>
21 * This function configures the interrupts set by the mask to be secure.
26 ArmGicSetSecureInterrupts (
27 IN UINTN GicDistributorBase
,
28 IN UINTN
* GicSecureInterruptMask
,
29 IN UINTN GicSecureInterruptMaskSize
33 UINT32 InterruptStatus
;
35 // We must not have more interrupts defined by the mask than the number of available interrupts
36 ASSERT(GicSecureInterruptMaskSize
<= (ArmGicGetMaxNumInterrupts (GicDistributorBase
) / 32));
38 // Set all the interrupts defined by the mask as Secure
39 for (Index
= 0; Index
< GicSecureInterruptMaskSize
; Index
++) {
40 InterruptStatus
= MmioRead32 (GicDistributorBase
+ ARM_GIC_ICDISR
+ (Index
* 4));
41 MmioWrite32 (GicDistributorBase
+ ARM_GIC_ICDISR
+ (Index
* 4), InterruptStatus
& (~GicSecureInterruptMask
[Index
]));
47 ArmGicEnableDistributor (
48 IN INTN GicDistributorBase
51 // Turn on the GIC distributor
52 MmioWrite32 (GicDistributorBase
+ ARM_GIC_ICDDCR
, 1);
57 ArmGicSetupNonSecure (
59 IN INTN GicDistributorBase
,
60 IN INTN GicInterruptInterfaceBase
63 ArmGicV2SetupNonSecure (MpId
, GicDistributorBase
, GicInterruptInterfaceBase
);