6f4b48ba7a5cb30160bc8c55e1c9989456342935
[firefly-linux-kernel-4.4.55.git] / arch / x86 / include / asm / irq_remapping.h
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
22 #ifndef __X86_IRQ_REMAPPING_H
23 #define __X86_IRQ_REMAPPING_H
24
25 #include <asm/io_apic.h>
26
27 #ifdef CONFIG_IRQ_REMAP
28
29 extern void setup_irq_remapping_ops(void);
30 extern int irq_remapping_supported(void);
31 extern int irq_remapping_prepare(void);
32 extern int irq_remapping_enable(void);
33 extern void irq_remapping_disable(void);
34 extern int irq_remapping_reenable(int);
35 extern int irq_remap_enable_fault_handling(void);
36 extern int setup_ioapic_remapped_entry(int irq,
37                                        struct IO_APIC_route_entry *entry,
38                                        unsigned int destination,
39                                        int vector,
40                                        struct io_apic_irq_attr *attr);
41 extern void free_remapped_irq(int irq);
42 extern void compose_remapped_msi_msg(struct pci_dev *pdev,
43                                      unsigned int irq, unsigned int dest,
44                                      struct msi_msg *msg, u8 hpet_id);
45 extern int setup_hpet_msi_remapped(unsigned int irq, unsigned int id);
46 extern void panic_if_irq_remap(const char *msg);
47
48 #else  /* CONFIG_IRQ_REMAP */
49
50 static inline void setup_irq_remapping_ops(void) { }
51 static inline int irq_remapping_supported(void) { return 0; }
52 static inline int irq_remapping_prepare(void) { return -ENODEV; }
53 static inline int irq_remapping_enable(void) { return -ENODEV; }
54 static inline void irq_remapping_disable(void) { }
55 static inline int irq_remapping_reenable(int eim) { return -ENODEV; }
56 static inline int irq_remap_enable_fault_handling(void) { return -ENODEV; }
57 static inline int setup_ioapic_remapped_entry(int irq,
58                                               struct IO_APIC_route_entry *entry,
59                                               unsigned int destination,
60                                               int vector,
61                                               struct io_apic_irq_attr *attr)
62 {
63         return -ENODEV;
64 }
65 static inline void free_remapped_irq(int irq) { }
66 static inline void compose_remapped_msi_msg(struct pci_dev *pdev,
67                                             unsigned int irq, unsigned int dest,
68                                             struct msi_msg *msg, u8 hpet_id)
69 {
70 }
71 static inline int setup_hpet_msi_remapped(unsigned int irq, unsigned int id)
72 {
73         return -ENODEV;
74 }
75
76 static inline void panic_if_irq_remap(const char *msg)
77 {
78 }
79 #endif /* CONFIG_IRQ_REMAP */
80
81 #endif /* __X86_IRQ_REMAPPING_H */