iosapic.h 3.1 KB

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