Linux-libre 4.14.2-gnu
[librecmc/linux-libre.git] / arch / x86 / include / asm / irqdomain.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_IRQDOMAIN_H
3 #define _ASM_IRQDOMAIN_H
4
5 #include <linux/irqdomain.h>
6 #include <asm/hw_irq.h>
7
8 #ifdef CONFIG_X86_LOCAL_APIC
9 enum {
10         /* Allocate contiguous CPU vectors */
11         X86_IRQ_ALLOC_CONTIGUOUS_VECTORS                = 0x1,
12 };
13
14 extern struct irq_domain *x86_vector_domain;
15
16 extern void init_irq_alloc_info(struct irq_alloc_info *info,
17                                 const struct cpumask *mask);
18 extern void copy_irq_alloc_info(struct irq_alloc_info *dst,
19                                 struct irq_alloc_info *src);
20 #endif /* CONFIG_X86_LOCAL_APIC */
21
22 #ifdef CONFIG_X86_IO_APIC
23 struct device_node;
24 struct irq_data;
25
26 enum ioapic_domain_type {
27         IOAPIC_DOMAIN_INVALID,
28         IOAPIC_DOMAIN_LEGACY,
29         IOAPIC_DOMAIN_STRICT,
30         IOAPIC_DOMAIN_DYNAMIC,
31 };
32
33 struct ioapic_domain_cfg {
34         enum ioapic_domain_type         type;
35         const struct irq_domain_ops     *ops;
36         struct device_node              *dev;
37 };
38
39 extern const struct irq_domain_ops mp_ioapic_irqdomain_ops;
40
41 extern int mp_irqdomain_alloc(struct irq_domain *domain, unsigned int virq,
42                               unsigned int nr_irqs, void *arg);
43 extern void mp_irqdomain_free(struct irq_domain *domain, unsigned int virq,
44                               unsigned int nr_irqs);
45 extern void mp_irqdomain_activate(struct irq_domain *domain,
46                                   struct irq_data *irq_data);
47 extern void mp_irqdomain_deactivate(struct irq_domain *domain,
48                                     struct irq_data *irq_data);
49 extern int mp_irqdomain_ioapic_idx(struct irq_domain *domain);
50 #endif /* CONFIG_X86_IO_APIC */
51
52 #ifdef CONFIG_PCI_MSI
53 extern void arch_init_msi_domain(struct irq_domain *domain);
54 #else
55 static inline void arch_init_msi_domain(struct irq_domain *domain) { }
56 #endif
57
58 #ifdef CONFIG_HT_IRQ
59 extern void arch_init_htirq_domain(struct irq_domain *domain);
60 #else
61 static inline void arch_init_htirq_domain(struct irq_domain *domain) { }
62 #endif
63
64 #endif