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 
17 #include <linux/string.h>
18 #include <linux/interrupt.h>
19 
20 
21 #define CPU_IRQ_REGION		1
22 #define TIMER_IRQ		(IRQ_FROM_REGION(CPU_IRQ_REGION) | 0)
23 #define	IPI_IRQ			(IRQ_FROM_REGION(CPU_IRQ_REGION) | 1)
24 
25 /* This should be 31 for PA1.1 binaries and 63 for PA-2.0 wide mode */
26 #define MAX_CPU_IRQ		(BITS_PER_LONG - 1)
27 
28 #if BITS_PER_LONG == 32
29 #  define IRQ_REGION_SHIFT 	5
30 #else
31 #  define IRQ_REGION_SHIFT 	6
32 #endif
33 
34 #define IRQ_PER_REGION		(1 << IRQ_REGION_SHIFT)
35 #define NR_IRQ_REGS		16
36 #define NR_IRQS			(NR_IRQ_REGS * IRQ_PER_REGION)
37 
38 #define IRQ_REGION(irq) 	((irq) >> IRQ_REGION_SHIFT)
39 #define IRQ_OFFSET(irq)		((irq) & ((1<<IRQ_REGION_SHIFT)-1))
40 #define	IRQ_FROM_REGION(reg)	((reg) << IRQ_REGION_SHIFT)
41 
42 #define EISA_IRQ_REGION		0 /* region 0 needs to be reserved for EISA */
43 #define EISA_MAX_IRQS		16 /* max. (E)ISA irq line */
44 
45 struct irq_region_ops {
46 	void (*disable_irq)(void *dev, int irq);
47 	void (* enable_irq)(void *dev, int irq);
48 	void (*   mask_irq)(void *dev, int irq);
49 	void (* unmask_irq)(void *dev, int irq);
50 };
51 
52 struct irq_region_data {
53 	void *dev;
54 	const char *name;
55 	int irqbase;
56 	unsigned int status[IRQ_PER_REGION]; /* IRQ status */
57 };
58 
59 struct irq_region {
60 	struct irq_region_ops ops;
61 	struct irq_region_data data;
62 
63 	struct irqaction *action;
64 };
65 
66 extern struct irq_region *irq_region[NR_IRQ_REGS];
67 
irq_cannonicalize(int irq)68 static __inline__ int irq_cannonicalize(int irq)
69 {
70 #ifdef CONFIG_EISA
71 	return (irq == (IRQ_FROM_REGION(EISA_IRQ_REGION)+2)
72 		? (IRQ_FROM_REGION(EISA_IRQ_REGION)+9) : irq);
73 #else
74 	return irq;
75 #endif
76 }
77 
78 extern void disable_irq(int);
79 #define disable_irq_nosync(i) disable_irq(i)
80 extern void enable_irq(int);
81 
82 extern void do_irq(struct irqaction *a, int i, struct pt_regs *p);
83 extern void do_irq_mask(unsigned long mask, struct irq_region *region,
84 	struct pt_regs *regs);
85 
86 extern struct irq_region *alloc_irq_region(int count, struct irq_region_ops *ops,
87 	const char *name, void *dev);
88 
89 extern int txn_alloc_irq(void);
90 extern int txn_claim_irq(int);
91 extern unsigned int txn_alloc_data(int, unsigned int);
92 extern unsigned long txn_alloc_addr(int);
93 
94 /* soft power switch support (power.c) */
95 extern struct tasklet_struct power_tasklet;
96 
97 #endif	/* _ASM_PARISC_IRQ_H */
98