intr_remapping.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. #ifndef __X86_INTR_REMAPPING_H
  22. #define __X86_INTR_REMAPPING_H
  23. #ifdef CONFIG_IRQ_REMAP
  24. struct IO_APIC_route_entry;
  25. struct io_apic_irq_attr;
  26. struct pci_dev;
  27. extern int irq_remapping_enabled;
  28. extern void setup_irq_remapping_ops(void);
  29. extern int irq_remapping_supported(void);
  30. extern int irq_remapping_prepare(void);
  31. extern int irq_remapping_enable(void);
  32. extern void irq_remapping_disable(void);
  33. extern int irq_remapping_reenable(int);
  34. extern int irq_remap_enable_fault_handling(void);
  35. extern int setup_ioapic_remapped_entry(int irq,
  36. struct IO_APIC_route_entry *entry,
  37. unsigned int destination,
  38. int vector,
  39. struct io_apic_irq_attr *attr);
  40. extern int set_remapped_irq_affinity(struct irq_data *data,
  41. const struct cpumask *mask,
  42. bool force);
  43. extern void free_remapped_irq(int irq);
  44. extern void compose_remapped_msi_msg(struct pci_dev *pdev,
  45. unsigned int irq, unsigned int dest,
  46. struct msi_msg *msg, u8 hpet_id);
  47. extern int msi_alloc_remapped_irq(struct pci_dev *pdev, int irq, int nvec);
  48. extern int msi_setup_remapped_irq(struct pci_dev *pdev, unsigned int irq,
  49. int index, int sub_handle);
  50. extern int setup_hpet_msi_remapped(unsigned int irq, unsigned int id);
  51. #else /* CONFIG_IRQ_REMAP */
  52. #define irq_remapping_enabled 0
  53. static inline void setup_irq_remapping_ops(void) { }
  54. static inline int irq_remapping_supported(void) { return 0; }
  55. static inline int irq_remapping_prepare(void) { return -ENODEV; }
  56. static inline int irq_remapping_enable(void) { return -ENODEV; }
  57. static inline void irq_remapping_disable(void) { }
  58. static inline int irq_remapping_reenable(int eim) { return -ENODEV; }
  59. static inline int irq_remap_enable_fault_handling(void) { return -ENODEV; }
  60. static inline int setup_ioapic_remapped_entry(int irq,
  61. struct IO_APIC_route_entry *entry,
  62. unsigned int destination,
  63. int vector,
  64. struct io_apic_irq_attr *attr)
  65. {
  66. return -ENODEV;
  67. }
  68. static inline int set_remapped_irq_affinity(struct irq_data *data,
  69. const struct cpumask *mask,
  70. bool force)
  71. {
  72. return 0;
  73. }
  74. static inline void free_remapped_irq(int irq) { }
  75. static inline void compose_remapped_msi_msg(struct pci_dev *pdev,
  76. unsigned int irq, unsigned int dest,
  77. struct msi_msg *msg, u8 hpet_id)
  78. {
  79. }
  80. static inline int msi_alloc_remapped_irq(struct pci_dev *pdev, int irq, int nvec)
  81. {
  82. return -ENODEV;
  83. }
  84. static inline int msi_setup_remapped_irq(struct pci_dev *pdev, unsigned int irq,
  85. int index, int sub_handle)
  86. {
  87. return -ENODEV;
  88. }
  89. static inline int setup_hpet_msi_remapped(unsigned int irq, unsigned int id)
  90. {
  91. return -ENODEV;
  92. }
  93. #endif /* CONFIG_IRQ_REMAP */
  94. #endif /* __X86_INTR_REMAPPING_H */