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