xref: /kvm-unit-tests/lib/arm/asm/gic-v2.h (revision 0cc3a351b925928827baa4b69cf0e46ff5837083)
1 /*
2  * All GIC* defines are lifted from include/linux/irqchip/arm-gic.h
3  *
4  * Copyright (C) 2016, Red Hat Inc, Andrew Jones <drjones@redhat.com>
5  *
6  * This work is licensed under the terms of the GNU LGPL, version 2.
7  */
8 #ifndef _ASMARM_GIC_V2_H_
9 #define _ASMARM_GIC_V2_H_
10 
11 #ifndef _ASMARM_GIC_H_
12 #error Do not directly include <asm/gic-v2.h>. Include <asm/gic.h>
13 #endif
14 
15 #define GICD_ENABLE			0x1
16 
17 #define GICC_ENABLE			0x1
18 #define GICC_IAR_INT_ID_MASK		0x3ff
19 
20 #ifndef __ASSEMBLER__
21 #include <cpumask.h>
22 
23 struct gicv2_data {
24 	void *dist_base;
25 	void *cpu_base;
26 	unsigned int irq_nr;
27 };
28 extern struct gicv2_data gicv2_data;
29 
30 #define gicv2_dist_base()		(gicv2_data.dist_base)
31 #define gicv2_cpu_base()		(gicv2_data.cpu_base)
32 
33 extern int gicv2_init(void);
34 extern void gicv2_enable_defaults(void);
35 extern u32 gicv2_read_iar(void);
36 extern u32 gicv2_iar_irqnr(u32 iar);
37 extern void gicv2_write_eoir(u32 irqstat);
38 extern void gicv2_ipi_send_single(int irq, int cpu);
39 extern void gicv2_ipi_send_mask(int irq, const cpumask_t *dest);
40 
41 #endif /* !__ASSEMBLER__ */
42 #endif /* _ASMARM_GIC_V2_H_ */
43