xref: /optee_os/core/include/drivers/gic.h (revision 32b3180828fa15a49ccc86ecb4be9d274c140c89)
1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*
3  * Copyright (c) 2016, Linaro Limited
4  * Copyright (c) 2014, STMicroelectronics International N.V.
5  */
6 
7 #ifndef __DRIVERS_GIC_H
8 #define __DRIVERS_GIC_H
9 #include <types_ext.h>
10 #include <kernel/interrupt.h>
11 
12 #if defined(CFG_ARM_GICV3)
13 #define GIC_DIST_REG_SIZE	0x10000
14 #define GIC_CPU_REG_SIZE	0x10000
15 #else
16 #define GIC_DIST_REG_SIZE	0x1000
17 #define GIC_CPU_REG_SIZE	0x1000
18 #endif
19 
20 #define GIC_PPI_BASE		U(16)
21 #define GIC_SPI_BASE		U(32)
22 
23 #define GIC_SGI_TO_ITNUM(x)	(x)
24 #define GIC_PPI_TO_ITNUM(x)	((x) + GIC_PPI_BASE)
25 #define GIC_SPI_TO_ITNUM(x)	((x) + GIC_SPI_BASE)
26 
27 /*
28  * The two gic_init_* functions initializes the struct gic_data which is
29  * then used by the other functions.
30  */
31 
32 /* Initialize GIC */
33 void gic_init(paddr_t gicc_base_pa, paddr_t gicd_base_pa);
34 
35 /* Only initialize CPU GIC interface, mainly use for secondary CPUs */
36 void gic_cpu_init(void);
37 
38 /* Print GIC state to console */
39 void gic_dump_state(void);
40 #endif /*__DRIVERS_GIC_H*/
41