11bb92983SJerome Forissier /* SPDX-License-Identifier: BSD-2-Clause */ 2b0104773SPascal Brand /* 37315b7b4SJens Wiklander * Copyright (c) 2016, Linaro Limited 4b0104773SPascal Brand * Copyright (c) 2014, STMicroelectronics International N.V. 5b0104773SPascal Brand */ 6b0104773SPascal Brand 77315b7b4SJens Wiklander #ifndef __DRIVERS_GIC_H 87315b7b4SJens Wiklander #define __DRIVERS_GIC_H 9ec219598SPascal Brand #include <types_ext.h> 107315b7b4SJens Wiklander #include <kernel/interrupt.h> 11b0104773SPascal Brand 124e6eecf6SJens Wiklander #if defined(CFG_ARM_GICV3) 132729a4d6SJens Wiklander #define GIC_DIST_REG_SIZE 0x10000 142729a4d6SJens Wiklander #define GIC_CPU_REG_SIZE 0x10000 154e6eecf6SJens Wiklander #else 164e6eecf6SJens Wiklander #define GIC_DIST_REG_SIZE 0x1000 174e6eecf6SJens Wiklander #define GIC_CPU_REG_SIZE 0x1000 184e6eecf6SJens Wiklander #endif 19f13b1003SJens Wiklander 20f13b1003SJens Wiklander #define GIC_PPI_BASE U(16) 21f13b1003SJens Wiklander #define GIC_SPI_BASE U(32) 22f13b1003SJens Wiklander 231428fce8SEtienne Carriere #define GIC_SGI_TO_ITNUM(x) (x) 241428fce8SEtienne Carriere #define GIC_PPI_TO_ITNUM(x) ((x) + GIC_PPI_BASE) 251428fce8SEtienne Carriere #define GIC_SPI_TO_ITNUM(x) ((x) + GIC_SPI_BASE) 262729a4d6SJens Wiklander 277315b7b4SJens Wiklander /* 287315b7b4SJens Wiklander * The two gic_init_* functions initializes the struct gic_data which is 297315b7b4SJens Wiklander * then used by the other functions. 307315b7b4SJens Wiklander */ 317315b7b4SJens Wiklander 3267e55c51SEtienne Carriere /* Initialize GIC */ 33*05089e5fSJens Wiklander void gic_init_v3(paddr_t gicc_base_pa, paddr_t gicd_base_pa, 34*05089e5fSJens Wiklander paddr_t gicr_base_pa); 35*05089e5fSJens Wiklander static inline void gic_init(paddr_t gicc_base_pa, paddr_t gicd_base_pa) 36*05089e5fSJens Wiklander { 37*05089e5fSJens Wiklander gic_init_v3(gicc_base_pa, gicd_base_pa, 0); 38*05089e5fSJens Wiklander } 39b0104773SPascal Brand 4067e55c51SEtienne Carriere /* Only initialize CPU GIC interface, mainly use for secondary CPUs */ 4167e55c51SEtienne Carriere void gic_cpu_init(void); 4267e55c51SEtienne Carriere 4367e55c51SEtienne Carriere /* Print GIC state to console */ 4467e55c51SEtienne Carriere void gic_dump_state(void); 457315b7b4SJens Wiklander #endif /*__DRIVERS_GIC_H*/ 46