16#ifndef ZEPHYR_INCLUDE_DRIVERS_GIC_H_
17#define ZEPHYR_INCLUDE_DRIVERS_GIC_H_
23#define GIC_DIST_BASE DT_REG_ADDR_BY_IDX(DT_INST(0, arm_gic), 0)
24#define GIC_CPU_BASE DT_REG_ADDR_BY_IDX(DT_INST(0, arm_gic), 1)
35#define GICD_CTLR (GIC_DIST_BASE + 0x0)
42#define GICD_TYPER (GIC_DIST_BASE + 0x4)
49#define GICD_IIDR (GIC_DIST_BASE + 0x8)
56#define GICD_IGROUPRn (GIC_DIST_BASE + 0x80)
62#define GICD_IGROUPRnE (GIC_DIST_BASE + 0x1000)
69#define GICD_ISENABLERn (GIC_DIST_BASE + 0x100)
75#define GICD_ISENABLERnE (GIC_DIST_BASE + 0x1200)
82#define GICD_ICENABLERn (GIC_DIST_BASE + 0x180)
88#define GICD_ICENABLERnE (GIC_DIST_BASE + 0x1400)
95#define GICD_ISPENDRn (GIC_DIST_BASE + 0x200)
101#define GICD_ISPENDRnE (GIC_DIST_BASE + 0x1600)
108#define GICD_ICPENDRn (GIC_DIST_BASE + 0x280)
114#define GICD_ICPENDRnE (GIC_DIST_BASE + 0x1800)
121#define GICD_ISACTIVERn (GIC_DIST_BASE + 0x300)
127#define GICD_ISACTIVERnE (GIC_DIST_BASE + 0x1A00)
129#if CONFIG_GIC_VER >= 2
134#define GICD_ICACTIVERn (GIC_DIST_BASE + 0x380)
140#define GICD_ICACTIVERnE (GIC_DIST_BASE + 0x1C00)
148#define GICD_IPRIORITYRn (GIC_DIST_BASE + 0x400)
154#define GICD_IPRIORITYRnE (GIC_DIST_BASE + 0x2000)
161#define GICD_ITARGETSRn (GIC_DIST_BASE + 0x800)
168#define GICD_ICFGRn (GIC_DIST_BASE + 0xc00)
174#define GICD_ICFGRnE (GIC_DIST_BASE + 0x3000)
181#define GICD_SGIR (GIC_DIST_BASE + 0xf00)
187#if CONFIG_GIC_VER <= 2
194#define GICC_CTLR (GIC_CPU_BASE + 0x0)
201#define GICC_PMR (GIC_CPU_BASE + 0x4)
208#define GICC_BPR (GIC_CPU_BASE + 0x8)
215#define GICC_IAR (GIC_CPU_BASE + 0xc)
222#define GICC_EOIR (GIC_CPU_BASE + 0x10)
229#define GICC_CTLR_ENABLEGRP0 BIT(0)
230#define GICC_CTLR_ENABLEGRP1 BIT(1)
232#define GICC_CTLR_ENABLE_MASK (GICC_CTLR_ENABLEGRP0 | GICC_CTLR_ENABLEGRP1)
234#if defined(CONFIG_GIC_V2)
236#define GICC_CTLR_FIQBYPDISGRP0 BIT(5)
237#define GICC_CTLR_IRQBYPDISGRP0 BIT(6)
238#define GICC_CTLR_FIQBYPDISGRP1 BIT(7)
239#define GICC_CTLR_IRQBYPDISGRP1 BIT(8)
241#define GICC_CTLR_BYPASS_MASK \
242 (GICC_CTLR_FIQBYPDISGRP0 | GICC_CTLR_IRQBYPDISGRP1 | GICC_CTLR_FIQBYPDISGRP1 | \
243 GICC_CTLR_IRQBYPDISGRP1)
248#define GICD_SGIR_TGTFILT(x) ((x) << 24)
249#define GICD_SGIR_TGTFILT_CPULIST GICD_SGIR_TGTFILT(0b00)
250#define GICD_SGIR_TGTFILT_ALLBUTREQ GICD_SGIR_TGTFILT(0b01)
251#define GICD_SGIR_TGTFILT_REQONLY GICD_SGIR_TGTFILT(0b10)
253#define GICD_SGIR_CPULIST(x) ((x) << 16)
254#define GICD_SGIR_CPULIST_CPU(n) GICD_SGIR_CPULIST(BIT(n))
255#define GICD_SGIR_CPULIST_MASK 0xff
257#define GICD_SGIR_NSATT BIT(15)
259#define GICD_SGIR_SGIINTID(x) (x)
264#define GICD_ICFGR_MASK BIT_MASK(2)
265#define GICD_ICFGR_TYPE BIT(1)
268#define GICD_TYPER_ITLINESNUM_MASK 0x1f
271#define GICD_TYPER_ESPI_MASK BIT(8)
274#define GICD_TYPER_IDBITS(typer) ((((typer) >> 19) & 0x1f) + 1)
279#define GIC_SGI_INT_BASE 0
280#define GIC_PPI_INT_BASE 16
282#define GIC_IS_SGI(intid) (((intid) >= GIC_SGI_INT_BASE) && ((intid) < GIC_PPI_INT_BASE))
284#define GIC_SPI_INT_BASE 32
286#define GIC_SPI_MAX_INTID 1019
288#define GIC_IS_SPI(intid) (((intid) >= GIC_SPI_INT_BASE) && ((intid) <= GIC_SPI_MAX_INTID))
290#define GIC_NUM_INTR_PER_REG 32
292#define GIC_NUM_CFG_PER_REG 16
294#define GIC_NUM_PRI_PER_REG 4
297#define GIC_IDLE_PRIO 0xff
300#define GIC_PRI_MASK 0xff
309#define GIC_INT_DEF_PRI_X4 0xa0a0a0a0
312#define GIC_INTID_SPURIOUS 1023
315#define GIC_NUM_CPU_IF CONFIG_MP_MAX_NUM_CPUS
void gic_raise_sgi(unsigned int sgi_id, uint64_t target_aff, uint16_t target_list)
raise SGI to target cores
void arm_gic_irq_clear_pending(unsigned int irq)
Clear the pending irq.
void arm_gic_secondary_init(void)
Initialize GIC of secondary cores.
void arm_gic_irq_disable(unsigned int irq)
Disable interrupt.
void arm_gic_eoi(unsigned int irq)
Signal end-of-interrupt.
void arm_gic_irq_enable(unsigned int irq)
Enable interrupt.
void arm_gic_irq_set_pending(unsigned int irq)
Set interrupt as pending.
bool arm_gic_irq_is_enabled(unsigned int irq)
Check if an interrupt is enabled.
bool arm_gic_irq_is_pending(unsigned int irq)
Check if an interrupt is pending.
void arm_gic_irq_set_priority(unsigned int irq, unsigned int prio, unsigned int flags)
Set interrupt priority.
unsigned int arm_gic_get_active(void)
Get active interrupt ID.
flags
Definition parser.h:97
__UINT64_TYPE__ uint64_t
Definition stdint.h:91
__UINT16_TYPE__ uint16_t
Definition stdint.h:89