Joerg Roedel | 736baef | 2012-03-30 11:47:00 -0700 | [diff] [blame] | 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 | |
Suresh Siddha | 8a8f422 | 2012-03-30 11:47:08 -0700 | [diff] [blame] | 22 | #ifndef __X86_IRQ_REMAPPING_H |
| 23 | #define __X86_IRQ_REMAPPING_H |
Joerg Roedel | 736baef | 2012-03-30 11:47:00 -0700 | [diff] [blame] | 24 | |
Suresh Siddha | 399988e | 2012-05-08 00:08:52 -0700 | [diff] [blame] | 25 | #include <asm/io_apic.h> |
Joerg Roedel | 736baef | 2012-03-30 11:47:00 -0700 | [diff] [blame] | 26 | |
Suresh Siddha | 399988e | 2012-05-08 00:08:52 -0700 | [diff] [blame] | 27 | #ifdef CONFIG_IRQ_REMAP |
Joerg Roedel | 0c3f173 | 2012-03-30 11:47:02 -0700 | [diff] [blame] | 28 | |
Suresh Siddha | 95a02e9 | 2012-03-30 11:47:07 -0700 | [diff] [blame] | 29 | extern void setup_irq_remapping_ops(void); |
| 30 | extern int irq_remapping_supported(void); |
Neil Horman | 03bbcb2 | 2013-04-16 16:38:32 -0400 | [diff] [blame^] | 31 | extern void set_irq_remapping_broken(void); |
Suresh Siddha | 95a02e9 | 2012-03-30 11:47:07 -0700 | [diff] [blame] | 32 | extern int irq_remapping_prepare(void); |
| 33 | extern int irq_remapping_enable(void); |
| 34 | extern void irq_remapping_disable(void); |
| 35 | extern int irq_remapping_reenable(int); |
| 36 | extern int irq_remap_enable_fault_handling(void); |
| 37 | extern int setup_ioapic_remapped_entry(int irq, |
| 38 | struct IO_APIC_route_entry *entry, |
| 39 | unsigned int destination, |
| 40 | int vector, |
| 41 | struct io_apic_irq_attr *attr); |
Suresh Siddha | 95a02e9 | 2012-03-30 11:47:07 -0700 | [diff] [blame] | 42 | extern void free_remapped_irq(int irq); |
| 43 | extern void compose_remapped_msi_msg(struct pci_dev *pdev, |
| 44 | unsigned int irq, unsigned int dest, |
| 45 | struct msi_msg *msg, u8 hpet_id); |
Suresh Siddha | 95a02e9 | 2012-03-30 11:47:07 -0700 | [diff] [blame] | 46 | extern int setup_hpet_msi_remapped(unsigned int irq, unsigned int id); |
Joerg Roedel | 6a9f5de | 2012-09-26 12:44:41 +0200 | [diff] [blame] | 47 | extern void panic_if_irq_remap(const char *msg); |
Joerg Roedel | 2976fd8 | 2012-09-26 12:44:48 +0200 | [diff] [blame] | 48 | extern bool setup_remapped_irq(int irq, |
| 49 | struct irq_cfg *cfg, |
| 50 | struct irq_chip *chip); |
Joerg Roedel | 736baef | 2012-03-30 11:47:00 -0700 | [diff] [blame] | 51 | |
Joerg Roedel | 9b1b0e4 | 2012-09-26 12:44:45 +0200 | [diff] [blame] | 52 | void irq_remap_modify_chip_defaults(struct irq_chip *chip); |
| 53 | |
Joerg Roedel | 736baef | 2012-03-30 11:47:00 -0700 | [diff] [blame] | 54 | #else /* CONFIG_IRQ_REMAP */ |
| 55 | |
Suresh Siddha | 95a02e9 | 2012-03-30 11:47:07 -0700 | [diff] [blame] | 56 | static inline void setup_irq_remapping_ops(void) { } |
| 57 | static inline int irq_remapping_supported(void) { return 0; } |
Neil Horman | 03bbcb2 | 2013-04-16 16:38:32 -0400 | [diff] [blame^] | 58 | static inline void set_irq_remapping_broken(void) { } |
Suresh Siddha | 95a02e9 | 2012-03-30 11:47:07 -0700 | [diff] [blame] | 59 | static inline int irq_remapping_prepare(void) { return -ENODEV; } |
| 60 | static inline int irq_remapping_enable(void) { return -ENODEV; } |
| 61 | static inline void irq_remapping_disable(void) { } |
| 62 | static inline int irq_remapping_reenable(int eim) { return -ENODEV; } |
| 63 | static inline int irq_remap_enable_fault_handling(void) { return -ENODEV; } |
| 64 | static inline int setup_ioapic_remapped_entry(int irq, |
| 65 | struct IO_APIC_route_entry *entry, |
| 66 | unsigned int destination, |
| 67 | int vector, |
| 68 | struct io_apic_irq_attr *attr) |
Joerg Roedel | 0c3f173 | 2012-03-30 11:47:02 -0700 | [diff] [blame] | 69 | { |
| 70 | return -ENODEV; |
| 71 | } |
Suresh Siddha | 95a02e9 | 2012-03-30 11:47:07 -0700 | [diff] [blame] | 72 | static inline void free_remapped_irq(int irq) { } |
| 73 | static inline void compose_remapped_msi_msg(struct pci_dev *pdev, |
| 74 | unsigned int irq, unsigned int dest, |
| 75 | struct msi_msg *msg, u8 hpet_id) |
Joerg Roedel | 5e2b930 | 2012-03-30 11:47:05 -0700 | [diff] [blame] | 76 | { |
| 77 | } |
Suresh Siddha | 95a02e9 | 2012-03-30 11:47:07 -0700 | [diff] [blame] | 78 | static inline int setup_hpet_msi_remapped(unsigned int irq, unsigned int id) |
Joerg Roedel | 5e2b930 | 2012-03-30 11:47:05 -0700 | [diff] [blame] | 79 | { |
| 80 | return -ENODEV; |
| 81 | } |
Joerg Roedel | 6a9f5de | 2012-09-26 12:44:41 +0200 | [diff] [blame] | 82 | |
| 83 | static inline void panic_if_irq_remap(const char *msg) |
| 84 | { |
| 85 | } |
Joerg Roedel | 9b1b0e4 | 2012-09-26 12:44:45 +0200 | [diff] [blame] | 86 | |
Joerg Roedel | 9b1b0e4 | 2012-09-26 12:44:45 +0200 | [diff] [blame] | 87 | static inline void irq_remap_modify_chip_defaults(struct irq_chip *chip) |
| 88 | { |
| 89 | } |
| 90 | |
Joerg Roedel | 2976fd8 | 2012-09-26 12:44:48 +0200 | [diff] [blame] | 91 | static inline bool setup_remapped_irq(int irq, |
| 92 | struct irq_cfg *cfg, |
| 93 | struct irq_chip *chip) |
| 94 | { |
| 95 | return false; |
| 96 | } |
Joerg Roedel | 736baef | 2012-03-30 11:47:00 -0700 | [diff] [blame] | 97 | #endif /* CONFIG_IRQ_REMAP */ |
| 98 | |
Suresh Siddha | 8a8f422 | 2012-03-30 11:47:08 -0700 | [diff] [blame] | 99 | #endif /* __X86_IRQ_REMAPPING_H */ |