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(x) (x) 24 #define GIC_PPI(x) ((x) + GIC_PPI_BASE) 25 #define GIC_SPI(x) ((x) + GIC_SPI_BASE) 26 27 struct gic_data { 28 vaddr_t gicc_base; 29 vaddr_t gicd_base; 30 size_t max_it; 31 struct itr_chip chip; 32 }; 33 34 /* 35 * The two gic_init_* functions initializes the struct gic_data which is 36 * then used by the other functions. 37 */ 38 39 void gic_init(struct gic_data *gd, paddr_t gicc_base_pa, paddr_t gicd_base_pa); 40 /* initial base address only */ 41 void gic_init_base_addr(struct gic_data *gd, paddr_t gicc_base_pa, 42 paddr_t gicd_base_pa); 43 /* initial cpu if only, mainly use for secondary cpu setup cpu interface */ 44 void gic_cpu_init(struct gic_data *gd); 45 46 void gic_it_handle(struct gic_data *gd); 47 48 void gic_dump_state(struct gic_data *gd); 49 #endif /*__DRIVERS_GIC_H*/ 50