internals.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*
  2. * IRQ subsystem internal functions and variables:
  3. */
  4. extern int noirqdebug;
  5. /* Set default functions for irq_chip structures: */
  6. extern void irq_chip_set_defaults(struct irq_chip *chip);
  7. /* Set default handler: */
  8. extern void compat_irq_chip_set_default_handler(struct irq_desc *desc);
  9. extern int __irq_set_trigger(struct irq_desc *desc, unsigned int irq,
  10. unsigned long flags);
  11. extern void __disable_irq(struct irq_desc *desc, unsigned int irq, bool susp);
  12. extern void __enable_irq(struct irq_desc *desc, unsigned int irq, bool resume);
  13. extern struct lock_class_key irq_desc_lock_class;
  14. extern void init_kstat_irqs(struct irq_desc *desc, int node, int nr);
  15. extern void clear_kstat_irqs(struct irq_desc *desc);
  16. extern spinlock_t sparse_irq_lock;
  17. #ifdef CONFIG_SPARSE_IRQ
  18. /* irq_desc_ptrs allocated at boot time */
  19. extern struct irq_desc **irq_desc_ptrs;
  20. #else
  21. /* irq_desc_ptrs is a fixed size array */
  22. extern struct irq_desc *irq_desc_ptrs[NR_IRQS];
  23. #endif
  24. #ifdef CONFIG_PROC_FS
  25. extern void register_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 register_handler_proc(unsigned int irq,
  31. struct irqaction *action) { }
  32. static inline void unregister_handler_proc(unsigned int irq,
  33. struct irqaction *action) { }
  34. #endif
  35. extern int irq_select_affinity_usr(unsigned int irq);
  36. extern void irq_set_thread_affinity(struct irq_desc *desc);
  37. /* Inline functions for support of irq chips on slow busses */
  38. static inline void chip_bus_lock(unsigned int irq, struct irq_desc *desc)
  39. {
  40. if (unlikely(desc->chip->bus_lock))
  41. desc->chip->bus_lock(irq);
  42. }
  43. static inline void chip_bus_sync_unlock(unsigned int irq, struct irq_desc *desc)
  44. {
  45. if (unlikely(desc->chip->bus_sync_unlock))
  46. desc->chip->bus_sync_unlock(irq);
  47. }
  48. /*
  49. * Debugging printout:
  50. */
  51. #include <linux/kallsyms.h>
  52. #define P(f) if (desc->status & f) printk("%14s set\n", #f)
  53. static inline void print_irq_desc(unsigned int irq, struct irq_desc *desc)
  54. {
  55. printk("irq %d, desc: %p, depth: %d, count: %d, unhandled: %d\n",
  56. irq, desc, desc->depth, desc->irq_count, desc->irqs_unhandled);
  57. printk("->handle_irq(): %p, ", desc->handle_irq);
  58. print_symbol("%s\n", (unsigned long)desc->handle_irq);
  59. printk("->chip(): %p, ", desc->chip);
  60. print_symbol("%s\n", (unsigned long)desc->chip);
  61. printk("->action(): %p\n", desc->action);
  62. if (desc->action) {
  63. printk("->action->handler(): %p, ", desc->action->handler);
  64. print_symbol("%s\n", (unsigned long)desc->action->handler);
  65. }
  66. P(IRQ_INPROGRESS);
  67. P(IRQ_DISABLED);
  68. P(IRQ_PENDING);
  69. P(IRQ_REPLAY);
  70. P(IRQ_AUTODETECT);
  71. P(IRQ_WAITING);
  72. P(IRQ_LEVEL);
  73. P(IRQ_MASKED);
  74. #ifdef CONFIG_IRQ_PER_CPU
  75. P(IRQ_PER_CPU);
  76. #endif
  77. P(IRQ_NOPROBE);
  78. P(IRQ_NOREQUEST);
  79. P(IRQ_NOAUTOEN);
  80. }
  81. #undef P