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 /*
8 * These defines correspond to the Xen internal representation of the
9 * IRQ types. We choose to make them the same as the existing device
10 * tree definitions for convenience.
11 */
12 #define IRQ_TYPE_NONE DT_IRQ_TYPE_NONE
13 #define IRQ_TYPE_EDGE_RISING DT_IRQ_TYPE_EDGE_RISING
14 #define IRQ_TYPE_EDGE_FALLING DT_IRQ_TYPE_EDGE_FALLING
15 #define IRQ_TYPE_EDGE_BOTH DT_IRQ_TYPE_EDGE_BOTH
16 #define IRQ_TYPE_LEVEL_HIGH DT_IRQ_TYPE_LEVEL_HIGH
17 #define IRQ_TYPE_LEVEL_LOW DT_IRQ_TYPE_LEVEL_LOW
18 #define IRQ_TYPE_LEVEL_MASK DT_IRQ_TYPE_LEVEL_MASK
19 #define IRQ_TYPE_SENSE_MASK DT_IRQ_TYPE_SENSE_MASK
20 #define IRQ_TYPE_INVALID DT_IRQ_TYPE_INVALID
21
22 #define NR_VECTORS 256 /* XXX */
23
24 typedef struct {
25 DECLARE_BITMAP(_bits,NR_VECTORS);
26 } vmask_t;
27
28 struct arch_pirq
29 {
30 };
31
32 struct arch_irq_desc {
33 unsigned int type;
34 };
35
36 #define NR_LOCAL_IRQS 32
37
38 /*
39 * This only covers the interrupts that Xen cares about, so SGIs, PPIs and
40 * SPIs. LPIs are too numerous, also only propagated to guests, so they are
41 * not included in this number.
42 */
43 #define NR_IRQS 1024
44
45 #define LPI_OFFSET 8192
46
47 /* LPIs are always numbered starting at 8192, so 0 is a good invalid case. */
48 #define INVALID_LPI 0
49
50 /* This is a spurious interrupt ID which never makes it into the GIC code. */
51 #define INVALID_IRQ 1023
52
53 extern const unsigned int nr_irqs;
54 #define nr_static_irqs NR_IRQS
55 #define arch_hwdom_irqs(domid) NR_IRQS
56
57 struct irq_desc;
58 struct irqaction;
59
60 struct irq_desc *__irq_to_desc(int irq);
61
62 #define irq_to_desc(irq) __irq_to_desc(irq)
63
64 void do_IRQ(struct cpu_user_regs *regs, unsigned int irq, int is_fiq);
65
is_lpi(unsigned int irq)66 static inline bool is_lpi(unsigned int irq)
67 {
68 return irq >= LPI_OFFSET;
69 }
70
71 #define domain_pirq_to_irq(d, pirq) (pirq)
72
73 bool is_assignable_irq(unsigned int irq);
74
75 void init_IRQ(void);
76 void init_secondary_IRQ(void);
77
78 int route_irq_to_guest(struct domain *d, unsigned int virq,
79 unsigned int irq, const char *devname);
80 int release_guest_irq(struct domain *d, unsigned int irq);
81
82 void arch_move_irqs(struct vcpu *v);
83
84 #define arch_evtchn_bind_pirq(d, pirq) ((void)((d) + (pirq)))
85
86 /* Set IRQ type for an SPI */
87 int irq_set_spi_type(unsigned int spi, unsigned int type);
88
89 int irq_set_type(unsigned int irq, unsigned int type);
90
91 int platform_get_irq(const struct dt_device_node *device, int index);
92
93 void irq_set_affinity(struct irq_desc *desc, const cpumask_t *cpu_mask);
94
95 /*
96 * Use this helper in places that need to know whether the IRQ type is
97 * set by the domain.
98 */
99 bool irq_type_set_by_domain(const struct domain *d);
100
101 #endif /* _ASM_HW_IRQ_H */
102 /*
103 * Local variables:
104 * mode: C
105 * c-file-style: "BSD"
106 * c-basic-offset: 4
107 * indent-tabs-mode: nil
108 * End:
109 */
110