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)
63#define GICD_ISENABLERn (GIC_DIST_BASE + 0x100)
70#define GICD_ICENABLERn (GIC_DIST_BASE + 0x180)
77#define GICD_ISPENDRn (GIC_DIST_BASE + 0x200)
84#define GICD_ICPENDRn (GIC_DIST_BASE + 0x280)
91#define GICD_ISACTIVERn (GIC_DIST_BASE + 0x300)
93#if CONFIG_GIC_VER >= 2
98#define GICD_ICACTIVERn (GIC_DIST_BASE + 0x380)
106#define GICD_IPRIORITYRn (GIC_DIST_BASE + 0x400)
113#define GICD_ITARGETSRn (GIC_DIST_BASE + 0x800)
120#define GICD_ICFGRn (GIC_DIST_BASE + 0xc00)
127#define GICD_SGIR (GIC_DIST_BASE + 0xf00)
133#if CONFIG_GIC_VER <= 2
140#define GICC_CTLR (GIC_CPU_BASE + 0x0)
147#define GICC_PMR (GIC_CPU_BASE + 0x4)
154#define GICC_BPR (GIC_CPU_BASE + 0x8)
161#define GICC_IAR (GIC_CPU_BASE + 0xc)
168#define GICC_EOIR (GIC_CPU_BASE + 0x10)
176#define GICC_CTLR_ENABLEGRP0 BIT(0)
177#define GICC_CTLR_ENABLEGRP1 BIT(1)
179#define GICC_CTLR_ENABLE_MASK (GICC_CTLR_ENABLEGRP0 | GICC_CTLR_ENABLEGRP1)
181#if defined(CONFIG_GIC_V2)
183#define GICC_CTLR_FIQBYPDISGRP0 BIT(5)
184#define GICC_CTLR_IRQBYPDISGRP0 BIT(6)
185#define GICC_CTLR_FIQBYPDISGRP1 BIT(7)
186#define GICC_CTLR_IRQBYPDISGRP1 BIT(8)
188#define GICC_CTLR_BYPASS_MASK (GICC_CTLR_FIQBYPDISGRP0 | \
189 GICC_CTLR_IRQBYPDISGRP1 | \
190 GICC_CTLR_FIQBYPDISGRP1 | \
191 GICC_CTLR_IRQBYPDISGRP1)
196#define GICD_SGIR_TGTFILT(x) ((x) << 24)
197#define GICD_SGIR_TGTFILT_CPULIST GICD_SGIR_TGTFILT(0b00)
198#define GICD_SGIR_TGTFILT_ALLBUTREQ GICD_SGIR_TGTFILT(0b01)
199#define GICD_SGIR_TGTFILT_REQONLY GICD_SGIR_TGTFILT(0b10)
201#define GICD_SGIR_CPULIST(x) ((x) << 16)
202#define GICD_SGIR_CPULIST_CPU(n) GICD_SGIR_CPULIST(BIT(n))
203#define GICD_SGIR_CPULIST_MASK 0xff
205#define GICD_SGIR_NSATT BIT(15)
207#define GICD_SGIR_SGIINTID(x) (x)
213#define GICD_ICFGR_MASK BIT_MASK(2)
214#define GICD_ICFGR_TYPE BIT(1)
217#define GICD_TYPER_ITLINESNUM_MASK 0x1f
220#define GICD_TYPER_IDBITS(typer) ((((typer) >> 19) & 0x1f) + 1)
225#define GIC_SGI_INT_BASE 0
226#define GIC_PPI_INT_BASE 16
228#define GIC_IS_SGI(intid) (((intid) >= GIC_SGI_INT_BASE) && \
229 ((intid) < GIC_PPI_INT_BASE))
232#define GIC_SPI_INT_BASE 32
234#define GIC_SPI_MAX_INTID 1019
236#define GIC_IS_SPI(intid) (((intid) >= GIC_SPI_INT_BASE) && \
237 ((intid) <= GIC_SPI_MAX_INTID))
239#define GIC_NUM_INTR_PER_REG 32
241#define GIC_NUM_CFG_PER_REG 16
243#define GIC_NUM_PRI_PER_REG 4
246#define GIC_IDLE_PRIO 0xff
249#define GIC_PRI_MASK 0xff
258#define GIC_INT_DEF_PRI_X4 0xa0a0a0a0
261#define GIC_INTID_SPURIOUS 1023
264#define GIC_NUM_CPU_IF CONFIG_MP_MAX_NUM_CPUS
320 unsigned int irq,
unsigned int prio,
unsigned int flags);
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.
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:96
__UINT64_TYPE__ uint64_t
Definition stdint.h:91
__UINT16_TYPE__ uint16_t
Definition stdint.h:89