1 #ifndef _ASM_HW_IRQ_H
2 #define _ASM_HW_IRQ_H
3
4 #include <xen/device_tree.h>
5 #include <public/device_tree_defs.h>
6
7 #include <asm/irq-dt.h>
8
9 #define NR_VECTORS 256 /* XXX */
10
11 typedef struct {
12 DECLARE_BITMAP(_bits,NR_VECTORS);
13 } vmask_t;
14
15 struct arch_pirq
16 {
17 };
18
19 struct arch_irq_desc {
20 unsigned int type;
21 };
22
23 #define NR_LOCAL_IRQS 32
24
25 /*
26 * This only covers the interrupts that Xen cares about, so SGIs, PPIs and
27 * SPIs. LPIs are too numerous, also only propagated to guests, so they are
28 * not included in this number.
29 */
30 #define NR_IRQS 1024
31
32 #define LPI_OFFSET 8192
33
34 /* LPIs are always numbered starting at 8192, so 0 is a good invalid case. */
35 #define INVALID_LPI 0
36
37 /* This is a spurious interrupt ID which never makes it into the GIC code. */
38 #define INVALID_IRQ 1023
39
40 extern const unsigned int nr_irqs;
41 #define nr_static_irqs NR_IRQS
42
43 struct irq_desc;
44 struct irqaction;
45
46 struct irq_desc *__irq_to_desc(unsigned int irq);
47
48 #define irq_to_desc(irq) __irq_to_desc(irq)
49
50 void do_IRQ(struct cpu_user_regs *regs, unsigned int irq, int is_fiq);
51
is_lpi(unsigned int irq)52 static inline bool is_lpi(unsigned int irq)
53 {
54 return irq >= LPI_OFFSET;
55 }
56
57 #define domain_pirq_to_irq(d, pirq) (pirq)
58
59 bool is_assignable_irq(unsigned int irq);
60
61 void init_IRQ(void);
62
63 int route_irq_to_guest(struct domain *d, unsigned int virq,
64 unsigned int irq, const char *devname);
65 int release_guest_irq(struct domain *d, unsigned int virq);
66
67 void arch_move_irqs(struct vcpu *v);
68
69 #define arch_evtchn_bind_pirq(d, pirq) ((void)((d) + (pirq)))
70
71 /* Set IRQ type for an SPI */
72 int irq_set_spi_type(unsigned int spi, unsigned int type);
73
74 int irq_set_type(unsigned int irq, unsigned int type);
75
76 int platform_get_irq(const struct dt_device_node *device, int index);
77
78 int platform_get_irq_byname(const struct dt_device_node *np, const char *name);
79
80 void irq_set_affinity(struct irq_desc *desc, const cpumask_t *mask);
81
82 /*
83 * Use this helper in places that need to know whether the IRQ type is
84 * set by the domain.
85 */
86 bool irq_type_set_by_domain(const struct domain *d);
87
88 void irq_end_none(struct irq_desc *irq);
89 #define irq_end_none irq_end_none
90
91 #endif /* _ASM_HW_IRQ_H */
92 /*
93 * Local variables:
94 * mode: C
95 * c-file-style: "BSD"
96 * c-basic-offset: 4
97 * indent-tabs-mode: nil
98 * End:
99 */
100