internals.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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. #define irq_data_to_desc(data) container_of(data, struct irq_desc, irq_data)
  12. /* Set default functions for irq_chip structures: */
  13. extern void irq_chip_set_defaults(struct irq_chip *chip);
  14. /* Set default handler: */
  15. extern void compat_irq_chip_set_default_handler(struct irq_desc *desc);
  16. extern int __irq_set_trigger(struct irq_desc *desc, unsigned int irq,
  17. unsigned long flags);
  18. extern void __disable_irq(struct irq_desc *desc, unsigned int irq, bool susp);
  19. extern void __enable_irq(struct irq_desc *desc, unsigned int irq, bool resume);
  20. extern void init_kstat_irqs(struct irq_desc *desc, int node, int nr);
  21. /* Resending of interrupts :*/
  22. void check_irq_resend(struct irq_desc *desc, unsigned int irq);
  23. #ifdef CONFIG_PROC_FS
  24. extern void register_irq_proc(unsigned int irq, struct irq_desc *desc);
  25. extern void unregister_irq_proc(unsigned int irq, struct irq_desc *desc);
  26. extern void register_handler_proc(unsigned int irq, struct irqaction *action);
  27. extern void unregister_handler_proc(unsigned int irq, struct irqaction *action);
  28. #else
  29. static inline void register_irq_proc(unsigned int irq, struct irq_desc *desc) { }
  30. static inline void unregister_irq_proc(unsigned int irq, struct irq_desc *desc) { }
  31. static inline void register_handler_proc(unsigned int irq,
  32. struct irqaction *action) { }
  33. static inline void unregister_handler_proc(unsigned int irq,
  34. struct irqaction *action) { }
  35. #endif
  36. extern int irq_select_affinity_usr(unsigned int irq);
  37. extern void irq_set_thread_affinity(struct irq_desc *desc);
  38. #ifndef CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED
  39. static inline void irq_end(unsigned int irq, struct irq_desc *desc)
  40. {
  41. if (desc->irq_data.chip && desc->irq_data.chip->end)
  42. desc->irq_data.chip->end(irq);
  43. }
  44. #else
  45. static inline void irq_end(unsigned int irq, struct irq_desc *desc) { }
  46. #endif
  47. /* Inline functions for support of irq chips on slow busses */
  48. static inline void chip_bus_lock(struct irq_desc *desc)
  49. {
  50. if (unlikely(desc->irq_data.chip->irq_bus_lock))
  51. desc->irq_data.chip->irq_bus_lock(&desc->irq_data);
  52. }
  53. static inline void chip_bus_sync_unlock(struct irq_desc *desc)
  54. {
  55. if (unlikely(desc->irq_data.chip->irq_bus_sync_unlock))
  56. desc->irq_data.chip->irq_bus_sync_unlock(&desc->irq_data);
  57. }
  58. /*
  59. * Debugging printout:
  60. */
  61. #include <linux/kallsyms.h>
  62. #define P(f) if (desc->status & f) printk("%14s set\n", #f)
  63. static inline void print_irq_desc(unsigned int irq, struct irq_desc *desc)
  64. {
  65. printk("irq %d, desc: %p, depth: %d, count: %d, unhandled: %d\n",
  66. irq, desc, desc->depth, desc->irq_count, desc->irqs_unhandled);
  67. printk("->handle_irq(): %p, ", desc->handle_irq);
  68. print_symbol("%s\n", (unsigned long)desc->handle_irq);
  69. printk("->irq_data.chip(): %p, ", desc->irq_data.chip);
  70. print_symbol("%s\n", (unsigned long)desc->irq_data.chip);
  71. printk("->action(): %p\n", desc->action);
  72. if (desc->action) {
  73. printk("->action->handler(): %p, ", desc->action->handler);
  74. print_symbol("%s\n", (unsigned long)desc->action->handler);
  75. }
  76. P(IRQ_INPROGRESS);
  77. P(IRQ_DISABLED);
  78. P(IRQ_PENDING);
  79. P(IRQ_REPLAY);
  80. P(IRQ_AUTODETECT);
  81. P(IRQ_WAITING);
  82. P(IRQ_LEVEL);
  83. P(IRQ_MASKED);
  84. #ifdef CONFIG_IRQ_PER_CPU
  85. P(IRQ_PER_CPU);
  86. #endif
  87. P(IRQ_NOPROBE);
  88. P(IRQ_NOREQUEST);
  89. P(IRQ_NOAUTOEN);
  90. }
  91. #undef P