ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / include / asm-parisc / irq.h
1 /*
2  *      linux/include/asm-parisc/irq.h
3  *
4  *      (C) 1992, 1993 Linus Torvalds, (C) 1997 Ingo Molnar,
5  *              Copyright 1999 SuSE GmbH
6  *
7  *      IRQ/IPI changes taken from work by Thomas Radke
8  *      <tomsoft@informatik.tu-chemnitz.de>
9  */
10
11 #ifndef _ASM_PARISC_IRQ_H
12 #define _ASM_PARISC_IRQ_H
13
14 #include <asm/ptrace.h>
15 #include <asm/types.h>
16 #include <asm/errno.h>
17
18 #include <linux/string.h>
19 #include <linux/interrupt.h>
20 #include <linux/config.h>
21
22
23 #define CPU_IRQ_REGION          1
24 #define TIMER_IRQ               (IRQ_FROM_REGION(CPU_IRQ_REGION) | 0)
25 #define IPI_IRQ                 (IRQ_FROM_REGION(CPU_IRQ_REGION) | 1)
26
27 /* This should be 31 for PA1.1 binaries and 63 for PA-2.0 wide mode */
28 #define MAX_CPU_IRQ             (BITS_PER_LONG - 1)
29
30 #if BITS_PER_LONG == 32
31 #  define IRQ_REGION_SHIFT      5
32 #else
33 #  define IRQ_REGION_SHIFT      6
34 #endif
35
36 #define IRQ_PER_REGION          (1 << IRQ_REGION_SHIFT)
37 #define NR_IRQ_REGS             16
38 #define NR_IRQS                 (NR_IRQ_REGS * IRQ_PER_REGION)
39
40 #define IRQ_REGION(irq)         ((irq) >> IRQ_REGION_SHIFT)
41 #define IRQ_OFFSET(irq)         ((irq) & ((1<<IRQ_REGION_SHIFT)-1))
42 #define IRQ_FROM_REGION(reg)    ((reg) << IRQ_REGION_SHIFT)
43
44 #define EISA_IRQ_REGION         0 /* region 0 needs to be reserved for EISA */
45 #define EISA_MAX_IRQS           16 /* max. (E)ISA irq line */
46
47 struct irq_region_ops {
48         void (*disable_irq)(void *dev, int irq);
49         void (* enable_irq)(void *dev, int irq);
50         void (*   mask_irq)(void *dev, int irq);
51         void (* unmask_irq)(void *dev, int irq);
52 };
53
54 struct irq_region_data {
55         void *dev;
56         const char *name;
57         int irqbase;
58         unsigned int status[IRQ_PER_REGION]; /* IRQ status */
59 };
60
61 struct irq_region {
62         struct irq_region_ops ops;
63         struct irq_region_data data;
64
65         struct irqaction *action;
66 };
67
68 extern struct irq_region *irq_region[NR_IRQ_REGS];
69
70 static __inline__ int irq_canonicalize(int irq)
71 {
72 #ifdef CONFIG_EISA
73         return (irq == (IRQ_FROM_REGION(EISA_IRQ_REGION)+2) 
74                 ? (IRQ_FROM_REGION(EISA_IRQ_REGION)+9) : irq);
75 #else
76         return irq;
77 #endif
78 }
79
80 extern void disable_irq(int);
81 #define disable_irq_nosync(i) disable_irq(i)
82 extern void enable_irq(int);
83
84 extern void do_irq(struct irqaction *a, int i, struct pt_regs *p);
85 extern void do_irq_mask(unsigned long mask, struct irq_region *region,
86         struct pt_regs *regs);
87
88 extern struct irq_region *alloc_irq_region(int count, struct irq_region_ops *ops,
89         const char *name, void *dev);
90
91 extern int txn_alloc_irq(void);
92 extern int txn_claim_irq(int);
93 extern unsigned int txn_alloc_data(int, unsigned int);
94 extern unsigned long txn_alloc_addr(int);
95
96 /* soft power switch support (power.c) */
97 extern struct tasklet_struct power_tasklet;
98
99 struct irqaction;
100 int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *);
101
102 #endif  /* _ASM_PARISC_IRQ_H */