iosapic.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __ASM_IA64_IOSAPIC_H
  3. #define __ASM_IA64_IOSAPIC_H
  4. #define IOSAPIC_REG_SELECT 0x0
  5. #define IOSAPIC_WINDOW 0x10
  6. #define IOSAPIC_EOI 0x40
  7. #define IOSAPIC_VERSION 0x1
  8. /*
  9. * Redirection table entry
  10. */
  11. #define IOSAPIC_RTE_LOW(i) (0x10+i*2)
  12. #define IOSAPIC_RTE_HIGH(i) (0x11+i*2)
  13. #define IOSAPIC_DEST_SHIFT 16
  14. /*
  15. * Delivery mode
  16. */
  17. #define IOSAPIC_DELIVERY_SHIFT 8
  18. #define IOSAPIC_FIXED 0x0
  19. #define IOSAPIC_LOWEST_PRIORITY 0x1
  20. #define IOSAPIC_PMI 0x2
  21. #define IOSAPIC_NMI 0x4
  22. #define IOSAPIC_INIT 0x5
  23. #define IOSAPIC_EXTINT 0x7
  24. /*
  25. * Interrupt polarity
  26. */
  27. #define IOSAPIC_POLARITY_SHIFT 13
  28. #define IOSAPIC_POL_HIGH 0
  29. #define IOSAPIC_POL_LOW 1
  30. /*
  31. * Trigger mode
  32. */
  33. #define IOSAPIC_TRIGGER_SHIFT 15
  34. #define IOSAPIC_EDGE 0
  35. #define IOSAPIC_LEVEL 1
  36. /*
  37. * Mask bit
  38. */
  39. #define IOSAPIC_MASK_SHIFT 16
  40. #define IOSAPIC_MASK (1<<IOSAPIC_MASK_SHIFT)
  41. #define IOSAPIC_VECTOR_MASK 0xffffff00
  42. #ifndef __ASSEMBLY__
  43. #ifdef CONFIG_IOSAPIC
  44. #define NR_IOSAPICS 256
  45. #define iosapic_pcat_compat_init ia64_native_iosapic_pcat_compat_init
  46. #define __iosapic_read __ia64_native_iosapic_read
  47. #define __iosapic_write __ia64_native_iosapic_write
  48. #define iosapic_get_irq_chip ia64_native_iosapic_get_irq_chip
  49. extern void __init ia64_native_iosapic_pcat_compat_init(void);
  50. extern struct irq_chip *ia64_native_iosapic_get_irq_chip(unsigned long trigger);
  51. static inline unsigned int
  52. __ia64_native_iosapic_read(char __iomem *iosapic, unsigned int reg)
  53. {
  54. writel(reg, iosapic + IOSAPIC_REG_SELECT);
  55. return readl(iosapic + IOSAPIC_WINDOW);
  56. }
  57. static inline void
  58. __ia64_native_iosapic_write(char __iomem *iosapic, unsigned int reg, u32 val)
  59. {
  60. writel(reg, iosapic + IOSAPIC_REG_SELECT);
  61. writel(val, iosapic + IOSAPIC_WINDOW);
  62. }
  63. static inline void iosapic_eoi(char __iomem *iosapic, u32 vector)
  64. {
  65. writel(vector, iosapic + IOSAPIC_EOI);
  66. }
  67. extern void __init iosapic_system_init (int pcat_compat);
  68. extern int iosapic_init (unsigned long address, unsigned int gsi_base);
  69. extern int iosapic_remove (unsigned int gsi_base);
  70. extern int gsi_to_irq (unsigned int gsi);
  71. extern int iosapic_register_intr (unsigned int gsi, unsigned long polarity,
  72. unsigned long trigger);
  73. extern void iosapic_unregister_intr (unsigned int irq);
  74. extern void iosapic_override_isa_irq (unsigned int isa_irq, unsigned int gsi,
  75. unsigned long polarity,
  76. unsigned long trigger);
  77. extern int __init iosapic_register_platform_intr (u32 int_type,
  78. unsigned int gsi,
  79. int pmi_vector,
  80. u16 eid, u16 id,
  81. unsigned long polarity,
  82. unsigned long trigger);
  83. #ifdef CONFIG_NUMA
  84. extern void map_iosapic_to_node (unsigned int, int);
  85. #endif
  86. #else
  87. #define iosapic_system_init(pcat_compat) do { } while (0)
  88. #define iosapic_init(address,gsi_base) (-EINVAL)
  89. #define iosapic_remove(gsi_base) (-ENODEV)
  90. #define iosapic_register_intr(gsi,polarity,trigger) (gsi)
  91. #define iosapic_unregister_intr(irq) do { } while (0)
  92. #define iosapic_override_isa_irq(isa_irq,gsi,polarity,trigger) do { } while (0)
  93. #define iosapic_register_platform_intr(type,gsi,pmi,eid,id, \
  94. polarity,trigger) (gsi)
  95. #endif
  96. # endif /* !__ASSEMBLY__ */
  97. #endif /* __ASM_IA64_IOSAPIC_H */