intr_remapping.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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 intr_remapping_enabled;
  28. extern void setup_intr_remapping(void);
  29. extern int intr_remapping_supported(void);
  30. extern int intr_hardware_init(void);
  31. extern int intr_hardware_enable(void);
  32. extern void intr_hardware_disable(void);
  33. extern int intr_hardware_reenable(int);
  34. extern int intr_enable_fault_handling(void);
  35. extern int intr_setup_ioapic_entry(int irq,
  36. struct IO_APIC_route_entry *entry,
  37. unsigned int destination, int vector,
  38. struct io_apic_irq_attr *attr);
  39. extern int intr_set_affinity(struct irq_data *data,
  40. const struct cpumask *mask,
  41. bool force);
  42. extern void intr_free_irq(int irq);
  43. extern void intr_compose_msi_msg(struct pci_dev *pdev,
  44. unsigned int irq, unsigned int dest,
  45. struct msi_msg *msg, u8 hpet_id);
  46. extern int intr_msi_alloc_irq(struct pci_dev *pdev, int irq, int nvec);
  47. extern int intr_msi_setup_irq(struct pci_dev *pdev, unsigned int irq,
  48. int index, int sub_handle);
  49. extern int intr_setup_hpet_msi(unsigned int irq, unsigned int id);
  50. #else /* CONFIG_IRQ_REMAP */
  51. #define intr_remapping_enabled 0
  52. static inline void setup_intr_remapping(void) { }
  53. static inline int intr_remapping_supported(void) { return 0; }
  54. static inline int intr_hardware_init(void) { return -ENODEV; }
  55. static inline int intr_hardware_enable(void) { return -ENODEV; }
  56. static inline void intr_hardware_disable(void) { }
  57. static inline int intr_hardware_reenable(int eim) { return -ENODEV; }
  58. static inline int intr_enable_fault_handling(void) { return -ENODEV; }
  59. static inline int intr_setup_ioapic_entry(int irq,
  60. struct IO_APIC_route_entry *entry,
  61. unsigned int destination, int vector,
  62. struct io_apic_irq_attr *attr)
  63. {
  64. return -ENODEV;
  65. }
  66. static inline int intr_set_affinity(struct irq_data *data,
  67. const struct cpumask *mask,
  68. bool force)
  69. {
  70. return 0;
  71. }
  72. static inline void intr_free_irq(int irq) { }
  73. static inline void intr_compose_msi_msg(struct pci_dev *pdev,
  74. unsigned int irq, unsigned int dest,
  75. struct msi_msg *msg, u8 hpet_id)
  76. {
  77. }
  78. static inline int intr_msi_alloc_irq(struct pci_dev *pdev, int irq, int nvec)
  79. {
  80. return -ENODEV;
  81. }
  82. static inline int intr_msi_setup_irq(struct pci_dev *pdev, unsigned int irq,
  83. int index, int sub_handle)
  84. {
  85. return -ENODEV;
  86. }
  87. static inline int intr_setup_hpet_msi(unsigned int irq, unsigned int id)
  88. {
  89. return -ENODEV;
  90. }
  91. #endif /* CONFIG_IRQ_REMAP */
  92. #endif /* __X86_INTR_REMAPPING_H */