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_ISACTIVER 0x0300 16 #define GICD_ICACTIVER 0x0380 17 #define GICD_IPRIORITYR 0x0400 18 #define GICD_SGIR 0x0f00 19 20 #define GICD_TYPER_IRQS(typer) ((((typer) & 0x1f) + 1) * 32) 21 #define GICD_INT_EN_SET_SGI 0x0000ffff 22 #define GICD_INT_DEF_PRI_X4 0xa0a0a0a0 23 24 /* CPU interface registers */ 25 #define GICC_CTLR 0x0000 26 #define GICC_PMR 0x0004 27 #define GICC_IAR 0x000c 28 #define GICC_EOIR 0x0010 29 30 #define GICC_INT_PRI_THRESHOLD 0xf0 31 #define GICC_INT_SPURIOUS 0x3ff 32 33 #include <asm/gic-v2.h> 34 #include <asm/gic-v3.h> 35 36 #ifndef __ASSEMBLY__ 37 #include <asm/cpumask.h> 38 39 /* 40 * gic_init will try to find all known gics, and then 41 * initialize the gic data for the one found. 42 * returns 43 * 0 : no gic was found 44 * > 0 : the gic version of the gic found 45 */ 46 extern int gic_init(void); 47 48 /* 49 * gic_enable_defaults enables the gic with basic but useful 50 * settings. gic_enable_defaults will call gic_init if it has 51 * not yet been invoked. 52 */ 53 extern void gic_enable_defaults(void); 54 55 /* 56 * After enabling the gic with gic_enable_defaults the functions 57 * below will work with any supported gic version. 58 */ 59 extern int gic_version(void); 60 extern u32 gic_read_iar(void); 61 extern u32 gic_iar_irqnr(u32 iar); 62 extern void gic_write_eoir(u32 irqstat); 63 extern void gic_ipi_send_single(int irq, int cpu); 64 extern void gic_ipi_send_mask(int irq, const cpumask_t *dest); 65 66 #endif /* !__ASSEMBLY__ */ 67 #endif /* _ASMARM_GIC_H_ */ 68