]>
Commit | Line | Data |
---|---|---|
736baef4 JR |
1 | /* |
2 | * Copyright (C) 2012 Advanced Micro Devices, Inc. | |
3 | * Author: Joerg Roedel <joerg.roedel@amd.com> | |
4 | * | |
5 | * This program is free software; you can redistribute it and/or modify it | |
6 | * under the terms of the GNU General Public License version 2 as published | |
7 | * by the Free Software Foundation. | |
8 | * | |
9 | * This program is distributed in the hope that it will be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
13 | * | |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write to the Free Software | |
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
17 | * | |
18 | * This header file contains the interface of the interrupt remapping code to | |
19 | * the x86 interrupt management code. | |
20 | */ | |
21 | ||
8a8f422d SS |
22 | #ifndef __X86_IRQ_REMAPPING_H |
23 | #define __X86_IRQ_REMAPPING_H | |
736baef4 | 24 | |
947045a2 JL |
25 | #include <linux/irqdomain.h> |
26 | #include <asm/hw_irq.h> | |
399988ee | 27 | #include <asm/io_apic.h> |
736baef4 | 28 | |
35d3d814 JR |
29 | struct IO_APIC_route_entry; |
30 | struct io_apic_irq_attr; | |
31 | struct irq_chip; | |
32 | struct msi_msg; | |
33 | struct pci_dev; | |
34 | struct irq_cfg; | |
947045a2 | 35 | struct irq_alloc_info; |
35d3d814 | 36 | |
399988ee | 37 | #ifdef CONFIG_IRQ_REMAP |
0c3f173a | 38 | |
03bbcb2e | 39 | extern void set_irq_remapping_broken(void); |
95a02e97 SS |
40 | extern int irq_remapping_prepare(void); |
41 | extern int irq_remapping_enable(void); | |
42 | extern void irq_remapping_disable(void); | |
43 | extern int irq_remapping_reenable(int); | |
44 | extern int irq_remap_enable_fault_handling(void); | |
45 | extern int setup_ioapic_remapped_entry(int irq, | |
46 | struct IO_APIC_route_entry *entry, | |
47 | unsigned int destination, | |
48 | int vector, | |
49 | struct io_apic_irq_attr *attr); | |
95a02e97 SS |
50 | extern void free_remapped_irq(int irq); |
51 | extern void compose_remapped_msi_msg(struct pci_dev *pdev, | |
52 | unsigned int irq, unsigned int dest, | |
53 | struct msi_msg *msg, u8 hpet_id); | |
95a02e97 | 54 | extern int setup_hpet_msi_remapped(unsigned int irq, unsigned int id); |
6a9f5de2 | 55 | extern void panic_if_irq_remap(const char *msg); |
2976fd84 JR |
56 | extern bool setup_remapped_irq(int irq, |
57 | struct irq_cfg *cfg, | |
58 | struct irq_chip *chip); | |
736baef4 | 59 | |
9b1b0e42 JR |
60 | void irq_remap_modify_chip_defaults(struct irq_chip *chip); |
61 | ||
947045a2 JL |
62 | extern struct irq_domain * |
63 | irq_remapping_get_ir_irq_domain(struct irq_alloc_info *info); | |
64 | extern struct irq_domain * | |
65 | irq_remapping_get_irq_domain(struct irq_alloc_info *info); | |
66 | extern void irq_remapping_print_chip(struct irq_data *data, struct seq_file *p); | |
67 | ||
68 | /* Create PCI MSI/MSIx irqdomain, use @parent as the parent irqdomain. */ | |
69 | static inline struct irq_domain * | |
70 | arch_create_msi_irq_domain(struct irq_domain *parent) | |
71 | { | |
72 | return NULL; | |
73 | } | |
74 | ||
75 | /* Get parent irqdomain for interrupt remapping irqdomain */ | |
76 | static inline struct irq_domain *arch_get_ir_parent_domain(void) | |
77 | { | |
78 | return x86_vector_domain; | |
79 | } | |
80 | ||
736baef4 JR |
81 | #else /* CONFIG_IRQ_REMAP */ |
82 | ||
03bbcb2e | 83 | static inline void set_irq_remapping_broken(void) { } |
95a02e97 SS |
84 | static inline int irq_remapping_prepare(void) { return -ENODEV; } |
85 | static inline int irq_remapping_enable(void) { return -ENODEV; } | |
86 | static inline void irq_remapping_disable(void) { } | |
87 | static inline int irq_remapping_reenable(int eim) { return -ENODEV; } | |
88 | static inline int irq_remap_enable_fault_handling(void) { return -ENODEV; } | |
89 | static inline int setup_ioapic_remapped_entry(int irq, | |
90 | struct IO_APIC_route_entry *entry, | |
91 | unsigned int destination, | |
92 | int vector, | |
93 | struct io_apic_irq_attr *attr) | |
0c3f173a JR |
94 | { |
95 | return -ENODEV; | |
96 | } | |
95a02e97 SS |
97 | static inline void free_remapped_irq(int irq) { } |
98 | static inline void compose_remapped_msi_msg(struct pci_dev *pdev, | |
99 | unsigned int irq, unsigned int dest, | |
100 | struct msi_msg *msg, u8 hpet_id) | |
5e2b930b JR |
101 | { |
102 | } | |
95a02e97 | 103 | static inline int setup_hpet_msi_remapped(unsigned int irq, unsigned int id) |
5e2b930b JR |
104 | { |
105 | return -ENODEV; | |
106 | } | |
6a9f5de2 JR |
107 | |
108 | static inline void panic_if_irq_remap(const char *msg) | |
109 | { | |
110 | } | |
9b1b0e42 | 111 | |
9b1b0e42 JR |
112 | static inline void irq_remap_modify_chip_defaults(struct irq_chip *chip) |
113 | { | |
114 | } | |
115 | ||
2976fd84 JR |
116 | static inline bool setup_remapped_irq(int irq, |
117 | struct irq_cfg *cfg, | |
118 | struct irq_chip *chip) | |
119 | { | |
120 | return false; | |
121 | } | |
947045a2 JL |
122 | |
123 | static inline struct irq_domain * | |
124 | irq_remapping_get_ir_irq_domain(struct irq_alloc_info *info) | |
125 | { | |
126 | return NULL; | |
127 | } | |
128 | ||
129 | static inline struct irq_domain * | |
130 | irq_remapping_get_irq_domain(struct irq_alloc_info *info) | |
131 | { | |
132 | return NULL; | |
133 | } | |
134 | ||
135 | #define irq_remapping_print_chip NULL | |
736baef4 JR |
136 | #endif /* CONFIG_IRQ_REMAP */ |
137 | ||
a62b32cd JL |
138 | extern int dmar_alloc_hwirq(void); |
139 | extern void dmar_free_hwirq(int irq); | |
a553b142 | 140 | |
8a8f422d | 141 | #endif /* __X86_IRQ_REMAPPING_H */ |