internals.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /*
  2. * IRQ subsystem internal functions and variables:
  3. */
  4. #include <linux/irqdesc.h>
  5. #ifdef CONFIG_SPARSE_IRQ
  6. # define IRQ_BITMAP_BITS (NR_IRQS + 8196)
  7. #else
  8. # define IRQ_BITMAP_BITS NR_IRQS
  9. #endif
  10. extern int noirqdebug;
  11. /*
  12. * Bits used by threaded handlers:
  13. * IRQTF_RUNTHREAD - signals that the interrupt handler thread should run
  14. * IRQTF_DIED - handler thread died
  15. * IRQTF_WARNED - warning "IRQ_WAKE_THREAD w/o thread_fn" has been printed
  16. * IRQTF_AFFINITY - irq thread is requested to adjust affinity
  17. */
  18. enum {
  19. IRQTF_RUNTHREAD,
  20. IRQTF_DIED,
  21. IRQTF_WARNED,
  22. IRQTF_AFFINITY,
  23. };
  24. #define irq_data_to_desc(data) container_of(data, struct irq_desc, irq_data)
  25. /* Set default functions for irq_chip structures: */
  26. extern void irq_chip_set_defaults(struct irq_chip *chip);
  27. /* Set default handler: */
  28. extern void compat_irq_chip_set_default_handler(struct irq_desc *desc);
  29. extern int __irq_set_trigger(struct irq_desc *desc, unsigned int irq,
  30. unsigned long flags);
  31. extern void __disable_irq(struct irq_desc *desc, unsigned int irq, bool susp);
  32. extern void __enable_irq(struct irq_desc *desc, unsigned int irq, bool resume);
  33. extern void init_kstat_irqs(struct irq_desc *desc, int node, int nr);
  34. /* Resending of interrupts :*/
  35. void check_irq_resend(struct irq_desc *desc, unsigned int irq);
  36. bool irq_wait_for_poll(struct irq_desc *desc);
  37. #ifdef CONFIG_PROC_FS
  38. extern void register_irq_proc(unsigned int irq, struct irq_desc *desc);
  39. extern void unregister_irq_proc(unsigned int irq, struct irq_desc *desc);
  40. extern void register_handler_proc(unsigned int irq, struct irqaction *action);
  41. extern void unregister_handler_proc(unsigned int irq, struct irqaction *action);
  42. #else
  43. static inline void register_irq_proc(unsigned int irq, struct irq_desc *desc) { }
  44. static inline void unregister_irq_proc(unsigned int irq, struct irq_desc *desc) { }
  45. static inline void register_handler_proc(unsigned int irq,
  46. struct irqaction *action) { }
  47. static inline void unregister_handler_proc(unsigned int irq,
  48. struct irqaction *action) { }
  49. #endif
  50. extern int irq_select_affinity_usr(unsigned int irq, struct cpumask *mask);
  51. extern void irq_set_thread_affinity(struct irq_desc *desc);
  52. /* Inline functions for support of irq chips on slow busses */
  53. static inline void chip_bus_lock(struct irq_desc *desc)
  54. {
  55. if (unlikely(desc->irq_data.chip->irq_bus_lock))
  56. desc->irq_data.chip->irq_bus_lock(&desc->irq_data);
  57. }
  58. static inline void chip_bus_sync_unlock(struct irq_desc *desc)
  59. {
  60. if (unlikely(desc->irq_data.chip->irq_bus_sync_unlock))
  61. desc->irq_data.chip->irq_bus_sync_unlock(&desc->irq_data);
  62. }
  63. /*
  64. * Debugging printout:
  65. */
  66. #include <linux/kallsyms.h>
  67. #define P(f) if (desc->status & f) printk("%14s set\n", #f)
  68. static inline void print_irq_desc(unsigned int irq, struct irq_desc *desc)
  69. {
  70. printk("irq %d, desc: %p, depth: %d, count: %d, unhandled: %d\n",
  71. irq, desc, desc->depth, desc->irq_count, desc->irqs_unhandled);
  72. printk("->handle_irq(): %p, ", desc->handle_irq);
  73. print_symbol("%s\n", (unsigned long)desc->handle_irq);
  74. printk("->irq_data.chip(): %p, ", desc->irq_data.chip);
  75. print_symbol("%s\n", (unsigned long)desc->irq_data.chip);
  76. printk("->action(): %p\n", desc->action);
  77. if (desc->action) {
  78. printk("->action->handler(): %p, ", desc->action->handler);
  79. print_symbol("%s\n", (unsigned long)desc->action->handler);
  80. }
  81. P(IRQ_INPROGRESS);
  82. P(IRQ_DISABLED);
  83. P(IRQ_PENDING);
  84. P(IRQ_REPLAY);
  85. P(IRQ_AUTODETECT);
  86. P(IRQ_WAITING);
  87. P(IRQ_LEVEL);
  88. P(IRQ_MASKED);
  89. #ifdef CONFIG_IRQ_PER_CPU
  90. P(IRQ_PER_CPU);
  91. #endif
  92. P(IRQ_NOPROBE);
  93. P(IRQ_NOREQUEST);
  94. P(IRQ_NOAUTOEN);
  95. }
  96. #undef P