genirq: Protect tglx from tripping over his own feet
[deliverable/linux.git] / kernel / irq / internals.h
CommitLineData
1da177e4
LT
1/*
2 * IRQ subsystem internal functions and variables:
dbec07ba
TG
3 *
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.
1da177e4 7 */
e144710b 8#include <linux/irqdesc.h>
1da177e4 9
c1ee6264
TG
10#ifdef CONFIG_SPARSE_IRQ
11# define IRQ_BITMAP_BITS (NR_IRQS + 8196)
12#else
13# define IRQ_BITMAP_BITS NR_IRQS
14#endif
15
e6bea9c4
TG
16#include "settings.h"
17
dbec07ba
TG
18#define istate core_internal_state__do_not_mess_with_it
19
1da177e4
LT
20extern int noirqdebug;
21
1535dfac
TG
22/*
23 * Bits used by threaded handlers:
24 * IRQTF_RUNTHREAD - signals that the interrupt handler thread should run
25 * IRQTF_DIED - handler thread died
26 * IRQTF_WARNED - warning "IRQ_WAKE_THREAD w/o thread_fn" has been printed
27 * IRQTF_AFFINITY - irq thread is requested to adjust affinity
28 */
29enum {
30 IRQTF_RUNTHREAD,
31 IRQTF_DIED,
32 IRQTF_WARNED,
33 IRQTF_AFFINITY,
34};
35
a77c4635
TG
36#define irq_data_to_desc(data) container_of(data, struct irq_desc, irq_data)
37
6a6de9ef
TG
38/* Set default functions for irq_chip structures: */
39extern void irq_chip_set_defaults(struct irq_chip *chip);
40
41/* Set default handler: */
42extern void compat_irq_chip_set_default_handler(struct irq_desc *desc);
43
0c5d1eb7
DB
44extern int __irq_set_trigger(struct irq_desc *desc, unsigned int irq,
45 unsigned long flags);
0a0c5168
RW
46extern void __disable_irq(struct irq_desc *desc, unsigned int irq, bool susp);
47extern void __enable_irq(struct irq_desc *desc, unsigned int irq, bool resume);
0c5d1eb7 48
46999238
TG
49extern int irq_startup(struct irq_desc *desc);
50extern void irq_shutdown(struct irq_desc *desc);
87923470
TG
51extern void irq_enable(struct irq_desc *desc);
52extern void irq_disable(struct irq_desc *desc);
46999238 53
85ac16d0 54extern void init_kstat_irqs(struct irq_desc *desc, int node, int nr);
0fa0ebbf 55
4912609f
TG
56irqreturn_t handle_irq_event_percpu(struct irq_desc *desc, struct irqaction *action);
57irqreturn_t handle_irq_event(struct irq_desc *desc);
58
e144710b
TG
59/* Resending of interrupts :*/
60void check_irq_resend(struct irq_desc *desc, unsigned int irq);
fe200ae4 61bool irq_wait_for_poll(struct irq_desc *desc);
e144710b 62
1da177e4 63#ifdef CONFIG_PROC_FS
2c6927a3 64extern void register_irq_proc(unsigned int irq, struct irq_desc *desc);
13bfe99e 65extern void unregister_irq_proc(unsigned int irq, struct irq_desc *desc);
1da177e4
LT
66extern void register_handler_proc(unsigned int irq, struct irqaction *action);
67extern void unregister_handler_proc(unsigned int irq, struct irqaction *action);
68#else
2c6927a3 69static inline void register_irq_proc(unsigned int irq, struct irq_desc *desc) { }
13bfe99e 70static inline void unregister_irq_proc(unsigned int irq, struct irq_desc *desc) { }
1da177e4
LT
71static inline void register_handler_proc(unsigned int irq,
72 struct irqaction *action) { }
73static inline void unregister_handler_proc(unsigned int irq,
74 struct irqaction *action) { }
75#endif
76
3b8249e7 77extern int irq_select_affinity_usr(unsigned int irq, struct cpumask *mask);
f6d87f4b 78
591d2fb0 79extern void irq_set_thread_affinity(struct irq_desc *desc);
57b150cc 80
70aedd24 81/* Inline functions for support of irq chips on slow busses */
3876ec9e 82static inline void chip_bus_lock(struct irq_desc *desc)
70aedd24 83{
3876ec9e
TG
84 if (unlikely(desc->irq_data.chip->irq_bus_lock))
85 desc->irq_data.chip->irq_bus_lock(&desc->irq_data);
70aedd24
TG
86}
87
3876ec9e 88static inline void chip_bus_sync_unlock(struct irq_desc *desc)
70aedd24 89{
3876ec9e
TG
90 if (unlikely(desc->irq_data.chip->irq_bus_sync_unlock))
91 desc->irq_data.chip->irq_bus_sync_unlock(&desc->irq_data);
70aedd24
TG
92}
93
43f77759
IM
94/*
95 * Debugging printout:
96 */
97
98#include <linux/kallsyms.h>
99
100#define P(f) if (desc->status & f) printk("%14s set\n", #f)
101
102static inline void print_irq_desc(unsigned int irq, struct irq_desc *desc)
103{
104 printk("irq %d, desc: %p, depth: %d, count: %d, unhandled: %d\n",
105 irq, desc, desc->depth, desc->irq_count, desc->irqs_unhandled);
106 printk("->handle_irq(): %p, ", desc->handle_irq);
107 print_symbol("%s\n", (unsigned long)desc->handle_irq);
6b8ff312
TG
108 printk("->irq_data.chip(): %p, ", desc->irq_data.chip);
109 print_symbol("%s\n", (unsigned long)desc->irq_data.chip);
43f77759
IM
110 printk("->action(): %p\n", desc->action);
111 if (desc->action) {
112 printk("->action->handler(): %p, ", desc->action->handler);
113 print_symbol("%s\n", (unsigned long)desc->action->handler);
114 }
115
116 P(IRQ_INPROGRESS);
117 P(IRQ_DISABLED);
118 P(IRQ_PENDING);
119 P(IRQ_REPLAY);
120 P(IRQ_AUTODETECT);
121 P(IRQ_WAITING);
122 P(IRQ_LEVEL);
123 P(IRQ_MASKED);
124#ifdef CONFIG_IRQ_PER_CPU
125 P(IRQ_PER_CPU);
126#endif
127 P(IRQ_NOPROBE);
128 P(IRQ_NOREQUEST);
129 P(IRQ_NOAUTOEN);
130}
131
132#undef P
133
This page took 0.560067 seconds and 5 git commands to generate.