1 /* 2 * Copyright (C) 2016, Red Hat Inc, Andrew Jones <drjones@redhat.com> 3 * 4 * This work is licensed under the terms of the GNU LGPL, version 2. 5 */ 6 #ifndef _ASMARM_GIC_H_ 7 #define _ASMARM_GIC_H_ 8 9 10 /* Distributor registers */ 11 #define GICD_CTLR 0x0000 12 #define GICD_TYPER 0x0004 13 #define GICD_IGROUPR 0x0080 14 #define GICD_ISENABLER 0x0100 15 #define GICD_IPRIORITYR 0x0400 16 #define GICD_SGIR 0x0f00 17 18 #define GICD_TYPER_IRQS(typer) ((((typer) & 0x1f) + 1) * 32) 19 #define GICD_INT_EN_SET_SGI 0x0000ffff 20 #define GICD_INT_DEF_PRI_X4 0xa0a0a0a0 21 22 /* CPU interface registers */ 23 #define GICC_CTLR 0x0000 24 #define GICC_PMR 0x0004 25 #define GICC_IAR 0x000c 26 #define GICC_EOIR 0x0010 27 28 #define GICC_INT_PRI_THRESHOLD 0xf0 29 #define GICC_INT_SPURIOUS 0x3ff 30 31 #include <asm/gic-v2.h> 32 #include <asm/gic-v3.h> 33 34 #ifndef __ASSEMBLY__ 35 #include <asm/cpumask.h> 36 37 /* 38 * gic_init will try to find all known gics, and then 39 * initialize the gic data for the one found. 40 * returns 41 * 0 : no gic was found 42 * > 0 : the gic version of the gic found 43 */ 44 extern int gic_init(void); 45 46 /* 47 * gic_enable_defaults enables the gic with basic but useful 48 * settings. gic_enable_defaults will call gic_init if it has 49 * not yet been invoked. 50 */ 51 extern void gic_enable_defaults(void); 52 53 /* 54 * After enabling the gic with gic_enable_defaults the functions 55 * below will work with any supported gic version. 56 */ 57 extern int gic_version(void); 58 extern u32 gic_read_iar(void); 59 extern u32 gic_iar_irqnr(u32 iar); 60 extern void gic_write_eoir(u32 irqstat); 61 extern void gic_ipi_send_single(int irq, int cpu); 62 extern void gic_ipi_send_mask(int irq, const cpumask_t *dest); 63 64 #endif /* !__ASSEMBLY__ */ 65 #endif /* _ASMARM_GIC_H_ */ 66