3 * Copyright (c) 2011, 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.
15 #include <Library/IoLib.h>
16 #include <Drivers/PL390Gic.h>
21 PL390GicEnableInterruptInterface (
22 IN INTN GicInterruptInterfaceBase
26 * Enable the CPU interface in Non-Secure world
27 * Note: The ICCICR register is banked when Security extensions are implemented
29 MmioWrite32(GicInterruptInterfaceBase
+ GIC_ICCICR
,0x00000001);
34 PL390GicEnableDistributor (
35 IN INTN GicDistributorBase
39 * Enable GIC distributor in Non-Secure world.
40 * Note: The ICDDCR register is banked when Security extensions are implemented
42 MmioWrite32(GicDistributorBase
+ GIC_ICDDCR
, 0x00000001);
48 IN INTN GicDistributorBase
,
49 IN INTN TargetListFilter
,
53 MmioWrite32(GicDistributorBase
+ GIC_ICDSGIR
, ((TargetListFilter
& 0x3) << 24) | ((CPUTargetList
& 0xFF) << 16));
58 PL390GicAcknowledgeSgiFrom (
59 IN INTN GicInterruptInterfaceBase
,
65 InterruptId
= MmioRead32(GicInterruptInterfaceBase
+ GIC_ICCIAR
);
67 //Check if the Interrupt ID is valid, The read from Interrupt Ack register returns CPU ID and Interrupt ID
68 if (((CoreId
& 0x7) << 10) == (InterruptId
& 0x1C00)) {
69 //Got SGI number 0 hence signal End of Interrupt by writing to ICCEOIR
70 MmioWrite32(GicInterruptInterfaceBase
+ GIC_ICCEIOR
, InterruptId
);
79 PL390GicAcknowledgeSgi2From (
80 IN INTN GicInterruptInterfaceBase
,
87 InterruptId
= MmioRead32(GicInterruptInterfaceBase
+ GIC_ICCIAR
);
89 //Check if the Interrupt ID is valid, The read from Interrupt Ack register returns CPU ID and Interrupt ID
90 if((((CoreId
& 0x7) << 10) | (SgiId
& 0x3FF)) == (InterruptId
& 0x1FFF)) {
91 //Got SGI number 0 hence signal End of Interrupt by writing to ICCEOIR
92 MmioWrite32(GicInterruptInterfaceBase
+ GIC_ICCEIOR
, InterruptId
);