ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / include / asm-arm / mach / irq.h
1 /*
2  *  linux/include/asm-arm/mach/irq.h
3  *
4  *  Copyright (C) 1995-2000 Russell King.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  */
10 #ifndef __ASM_ARM_MACH_IRQ_H
11 #define __ASM_ARM_MACH_IRQ_H
12
13 struct irqdesc;
14 struct pt_regs;
15 struct seq_file;
16
17 typedef void (*irq_handler_t)(unsigned int, struct irqdesc *, struct pt_regs *);
18 typedef void (*irq_control_t)(unsigned int);
19
20 struct irqchip {
21         /*
22          * Acknowledge the IRQ.
23          * If this is a level-based IRQ, then it is expected to mask the IRQ
24          * as well.
25          */
26         void (*ack)(unsigned int);
27         /*
28          * Mask the IRQ in hardware.
29          */
30         void (*mask)(unsigned int);
31         /*
32          * Unmask the IRQ in hardware.
33          */
34         void (*unmask)(unsigned int);
35         /*
36          * Ask the hardware to re-trigger the IRQ.
37          * Note: This method _must_ _not_ call the interrupt handler.
38          * If you are unable to retrigger the interrupt, do not
39          * provide a function, or if you do, return non-zero.
40          */
41         int (*retrigger)(unsigned int);
42         /*
43          * Set the type of the IRQ.
44          */
45         int (*type)(unsigned int, unsigned int);
46         /*
47          * Set wakeup-enable on the selected IRQ
48          */
49         int (*wake)(unsigned int, unsigned int);
50 };
51
52 struct irqdesc {
53         irq_handler_t   handle;
54         struct irqchip  *chip;
55         struct irqaction *action;
56         struct list_head pend;
57         void            *chipdata;
58         void            *data;
59         unsigned int    disable_depth;
60
61         unsigned int    triggered: 1;           /* IRQ has occurred           */
62         unsigned int    running  : 1;           /* IRQ is running             */
63         unsigned int    pending  : 1;           /* IRQ is pending             */
64         unsigned int    probing  : 1;           /* IRQ in use for a probe     */
65         unsigned int    probe_ok : 1;           /* IRQ can be used for probe  */
66         unsigned int    valid    : 1;           /* IRQ claimable              */
67         unsigned int    noautoenable : 1;       /* don't automatically enable IRQ */
68         unsigned int    unused   :25;
69
70         /*
71          * IRQ lock detection
72          */
73         unsigned int    lck_cnt;
74         unsigned int    lck_pc;
75         unsigned int    lck_jif;
76 };
77
78 extern struct irqdesc irq_desc[];
79
80 /*
81  * This is internal.  Do not use it.
82  */
83 extern void (*init_arch_irq)(void);
84 extern void init_FIQ(void);
85 extern int show_fiq_list(struct seq_file *, void *);
86 void __set_irq_handler(unsigned int irq, irq_handler_t, int);
87
88 /*
89  * External stuff.
90  */
91 #define set_irq_handler(irq,handler)            __set_irq_handler(irq,handler,0)
92 #define set_irq_chained_handler(irq,handler)    __set_irq_handler(irq,handler,1)
93 #define set_irq_data(irq,d)                     do { irq_desc[irq].data = d; } while (0)
94 #define set_irq_chipdata(irq,d)                 do { irq_desc[irq].chipdata = d; } while (0)
95 #define get_irq_chipdata(irq)                   (irq_desc[irq].chipdata)
96
97 void set_irq_chip(unsigned int irq, struct irqchip *);
98 void set_irq_flags(unsigned int irq, unsigned int flags);
99
100 #ifdef not_yet
101 /*
102  * This is to be used by the top-level machine IRQ decoder only.
103  */
104 static inline void call_irq(struct pt_regs *regs, unsigned int irq)
105 {
106         struct irqdesc *desc = irq_desc + irq;
107
108         spin_lock(&irq_controller_lock);
109         desc->handle(irq, desc, regs);
110         spin_unlock(&irq_controller_lock);
111
112         if (softirq_pending(smp_processor_id()))
113                 do_softirq();
114 }
115 #endif
116
117 #define IRQF_VALID      (1 << 0)
118 #define IRQF_PROBE      (1 << 1)
119 #define IRQF_NOAUTOEN   (1 << 2)
120
121 /*
122  * Built-in IRQ handlers.
123  */
124 void do_level_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs);
125 void do_edge_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs);
126 void do_simple_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs);
127 void do_bad_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs);
128 void dummy_mask_unmask_irq(unsigned int irq);
129
130 #endif