]>
git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - kernel/irq/internals.h
2 * IRQ subsystem internal functions and variables:
4 * Do not ever include this file from anything else than
5 * kernel/irq/. Do not even think about using any information outside
6 * of this file for your non core code.
8 #include <linux/irqdesc.h>
10 #ifdef CONFIG_SPARSE_IRQ
11 # define IRQ_BITMAP_BITS (NR_IRQS + 8196)
13 # define IRQ_BITMAP_BITS NR_IRQS
19 #define istate core_internal_state__do_not_mess_with_it
21 extern int noirqdebug
;
24 * Bits used by threaded handlers:
25 * IRQTF_RUNTHREAD - signals that the interrupt handler thread should run
26 * IRQTF_DIED - handler thread died
27 * IRQTF_WARNED - warning "IRQ_WAKE_THREAD w/o thread_fn" has been printed
28 * IRQTF_AFFINITY - irq thread is requested to adjust affinity
38 * Bit masks for desc->state
40 * IRQS_AUTODETECT - autodetection in progress
41 * IRQS_SPURIOUS_DISABLED - was disabled due to spurious interrupt
43 * IRQS_POLL_INPROGRESS - polling in progress
44 * IRQS_INPROGRESS - Interrupt in progress
45 * IRQS_ONESHOT - irq is not unmasked in primary handler
46 * IRQS_REPLAY - irq is replayed
47 * IRQS_WAITING - irq is waiting
48 * IRQS_DISABLED - irq is disabled
49 * IRQS_PENDING - irq is pending and replayed later
50 * IRQS_MASKED - irq is masked
53 IRQS_AUTODETECT
= 0x00000001,
54 IRQS_SPURIOUS_DISABLED
= 0x00000002,
55 IRQS_POLL_INPROGRESS
= 0x00000008,
56 IRQS_INPROGRESS
= 0x00000010,
57 IRQS_ONESHOT
= 0x00000020,
58 IRQS_REPLAY
= 0x00000040,
59 IRQS_WAITING
= 0x00000080,
60 IRQS_DISABLED
= 0x00000100,
61 IRQS_PENDING
= 0x00000200,
62 IRQS_MASKED
= 0x00000400,
65 #define irq_data_to_desc(data) container_of(data, struct irq_desc, irq_data)
67 /* Set default functions for irq_chip structures: */
68 extern void irq_chip_set_defaults(struct irq_chip
*chip
);
70 /* Set default handler: */
71 extern void compat_irq_chip_set_default_handler(struct irq_desc
*desc
);
73 extern int __irq_set_trigger(struct irq_desc
*desc
, unsigned int irq
,
75 extern void __disable_irq(struct irq_desc
*desc
, unsigned int irq
, bool susp
);
76 extern void __enable_irq(struct irq_desc
*desc
, unsigned int irq
, bool resume
);
78 extern int irq_startup(struct irq_desc
*desc
);
79 extern void irq_shutdown(struct irq_desc
*desc
);
80 extern void irq_enable(struct irq_desc
*desc
);
81 extern void irq_disable(struct irq_desc
*desc
);
83 extern void init_kstat_irqs(struct irq_desc
*desc
, int node
, int nr
);
85 irqreturn_t
handle_irq_event_percpu(struct irq_desc
*desc
, struct irqaction
*action
);
86 irqreturn_t
handle_irq_event(struct irq_desc
*desc
);
88 /* Resending of interrupts :*/
89 void check_irq_resend(struct irq_desc
*desc
, unsigned int irq
);
90 bool irq_wait_for_poll(struct irq_desc
*desc
);
93 extern void register_irq_proc(unsigned int irq
, struct irq_desc
*desc
);
94 extern void unregister_irq_proc(unsigned int irq
, struct irq_desc
*desc
);
95 extern void register_handler_proc(unsigned int irq
, struct irqaction
*action
);
96 extern void unregister_handler_proc(unsigned int irq
, struct irqaction
*action
);
98 static inline void register_irq_proc(unsigned int irq
, struct irq_desc
*desc
) { }
99 static inline void unregister_irq_proc(unsigned int irq
, struct irq_desc
*desc
) { }
100 static inline void register_handler_proc(unsigned int irq
,
101 struct irqaction
*action
) { }
102 static inline void unregister_handler_proc(unsigned int irq
,
103 struct irqaction
*action
) { }
106 extern int irq_select_affinity_usr(unsigned int irq
, struct cpumask
*mask
);
108 extern void irq_set_thread_affinity(struct irq_desc
*desc
);
110 /* Inline functions for support of irq chips on slow busses */
111 static inline void chip_bus_lock(struct irq_desc
*desc
)
113 if (unlikely(desc
->irq_data
.chip
->irq_bus_lock
))
114 desc
->irq_data
.chip
->irq_bus_lock(&desc
->irq_data
);
117 static inline void chip_bus_sync_unlock(struct irq_desc
*desc
)
119 if (unlikely(desc
->irq_data
.chip
->irq_bus_sync_unlock
))
120 desc
->irq_data
.chip
->irq_bus_sync_unlock(&desc
->irq_data
);
124 * Debugging printout:
127 #include <linux/kallsyms.h>
129 #define P(f) if (desc->status & f) printk("%14s set\n", #f)
130 #define PS(f) if (desc->istate & f) printk("%14s set\n", #f)
132 static inline void print_irq_desc(unsigned int irq
, struct irq_desc
*desc
)
134 printk("irq %d, desc: %p, depth: %d, count: %d, unhandled: %d\n",
135 irq
, desc
, desc
->depth
, desc
->irq_count
, desc
->irqs_unhandled
);
136 printk("->handle_irq(): %p, ", desc
->handle_irq
);
137 print_symbol("%s\n", (unsigned long)desc
->handle_irq
);
138 printk("->irq_data.chip(): %p, ", desc
->irq_data
.chip
);
139 print_symbol("%s\n", (unsigned long)desc
->irq_data
.chip
);
140 printk("->action(): %p\n", desc
->action
);
142 printk("->action->handler(): %p, ", desc
->action
->handler
);
143 print_symbol("%s\n", (unsigned long)desc
->action
->handler
);
147 #ifdef CONFIG_IRQ_PER_CPU