internals.h 3.3 KB

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