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.
16 #include <Library/IoLib.h>
17 #include <Drivers/PL390Gic.h>
22 PL390GicEnableInterruptInterface (
23 IN INTN GicInterruptInterfaceBase
27 * Enable the CPU interface in Non-Secure world
28 * Note: The ICCICR register is banked when Security extensions are implemented
30 MmioWrite32 (GicInterruptInterfaceBase
+ GIC_ICCICR
,0x00000001);
35 PL390GicEnableDistributor (
36 IN INTN GicDistributorBase
40 * Enable GIC distributor in Non-Secure world.
41 * Note: The ICDDCR register is banked when Security extensions are implemented
43 MmioWrite32 (GicDistributorBase
+ GIC_ICDDCR
, 0x00000001);
49 IN INTN GicDistributorBase
,
50 IN INTN TargetListFilter
,
54 MmioWrite32 (GicDistributorBase
+ GIC_ICDSGIR
, ((TargetListFilter
& 0x3) << 24) | ((CPUTargetList
& 0xFF) << 16));
59 PL390GicAcknowledgeSgiFrom (
60 IN INTN GicInterruptInterfaceBase
,
66 InterruptId
= MmioRead32 (GicInterruptInterfaceBase
+ GIC_ICCIAR
);
68 // Check if the Interrupt ID is valid, The read from Interrupt Ack register returns CPU ID and Interrupt ID
69 if (((CoreId
& 0x7) << 10) == (InterruptId
& 0x1C00)) {
70 // Got SGI number 0 hence signal End of Interrupt by writing to ICCEOIR
71 MmioWrite32 (GicInterruptInterfaceBase
+ GIC_ICCEIOR
, InterruptId
);
80 PL390GicAcknowledgeSgi2From (
81 IN INTN GicInterruptInterfaceBase
,
88 InterruptId
= MmioRead32(GicInterruptInterfaceBase
+ GIC_ICCIAR
);
90 // Check if the Interrupt ID is valid, The read from Interrupt Ack register returns CPU ID and Interrupt ID
91 if((((CoreId
& 0x7) << 10) | (SgiId
& 0x3FF)) == (InterruptId
& 0x1FFF)) {
92 // Got SGI number 0 hence signal End of Interrupt by writing to ICCEOIR
93 MmioWrite32 (GicInterruptInterfaceBase
+ GIC_ICCEIOR
, InterruptId
);