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>
20 #include "GicV2/ArmGicV2Lib.h"
23 * This function configures the interrupts set by the mask to be secure.
28 ArmGicSetSecureInterrupts (
29 IN UINTN GicDistributorBase
,
30 IN UINTN
* GicSecureInterruptMask
,
31 IN UINTN GicSecureInterruptMaskSize
35 UINT32 InterruptStatus
;
37 // We must not have more interrupts defined by the mask than the number of available interrupts
38 ASSERT(GicSecureInterruptMaskSize
<= (ArmGicGetMaxNumInterrupts (GicDistributorBase
) / 32));
40 // Set all the interrupts defined by the mask as Secure
41 for (Index
= 0; Index
< GicSecureInterruptMaskSize
; Index
++) {
42 InterruptStatus
= MmioRead32 (GicDistributorBase
+ ARM_GIC_ICDISR
+ (Index
* 4));
43 MmioWrite32 (GicDistributorBase
+ ARM_GIC_ICDISR
+ (Index
* 4), InterruptStatus
& (~GicSecureInterruptMask
[Index
]));
49 ArmGicEnableDistributor (
50 IN INTN GicDistributorBase
53 // Turn on the GIC distributor
54 MmioWrite32 (GicDistributorBase
+ ARM_GIC_ICDDCR
, 1);
59 ArmGicSetupNonSecure (
61 IN INTN GicDistributorBase
,
62 IN INTN GicInterruptInterfaceBase
65 ArmGicV2SetupNonSecure (MpId
, GicDistributorBase
, GicInterruptInterfaceBase
);