]> Pileus Git - ~andy/linux/blob - include/asm-sparc/irq.h
[SPARC64]: Virtualize IRQ numbers.
[~andy/linux] / include / asm-sparc / irq.h
1 /* $Id: irq.h,v 1.32 2000/08/26 02:42:28 anton Exp $
2  * irq.h: IRQ registers on the Sparc.
3  *
4  * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
5  */
6
7 #ifndef _SPARC_IRQ_H
8 #define _SPARC_IRQ_H
9
10 #include <linux/config.h>
11 #include <linux/linkage.h>
12 #include <linux/threads.h>     /* For NR_CPUS */
13 #include <linux/interrupt.h>
14
15 #include <asm/system.h>     /* For SUN4M_NCPUS */
16 #include <asm/btfixup.h>
17
18 #define __irq_ino(irq) irq
19 #define __irq_pil(irq) irq
20
21 #define NR_IRQS    16
22
23 #define irq_canonicalize(irq)   (irq)
24
25 /* Dave Redman (djhr@tadpole.co.uk)
26  * changed these to function pointers.. it saves cycles and will allow
27  * the irq dependencies to be split into different files at a later date
28  * sun4c_irq.c, sun4m_irq.c etc so we could reduce the kernel size.
29  * Jakub Jelinek (jj@sunsite.mff.cuni.cz)
30  * Changed these to btfixup entities... It saves cycles :)
31  */
32 BTFIXUPDEF_CALL(void, disable_irq, unsigned int)
33 BTFIXUPDEF_CALL(void, enable_irq, unsigned int)
34 BTFIXUPDEF_CALL(void, disable_pil_irq, unsigned int)
35 BTFIXUPDEF_CALL(void, enable_pil_irq, unsigned int)
36 BTFIXUPDEF_CALL(void, clear_clock_irq, void)
37 BTFIXUPDEF_CALL(void, clear_profile_irq, int)
38 BTFIXUPDEF_CALL(void, load_profile_irq, int, unsigned int)
39
40 static inline void disable_irq_nosync(unsigned int irq)
41 {
42         BTFIXUP_CALL(disable_irq)(irq);
43 }
44
45 static inline void disable_irq(unsigned int irq)
46 {
47         BTFIXUP_CALL(disable_irq)(irq);
48 }
49
50 static inline void enable_irq(unsigned int irq)
51 {
52         BTFIXUP_CALL(enable_irq)(irq);
53 }
54
55 static inline void disable_pil_irq(unsigned int irq)
56 {
57         BTFIXUP_CALL(disable_pil_irq)(irq);
58 }
59
60 static inline void enable_pil_irq(unsigned int irq)
61 {
62         BTFIXUP_CALL(enable_pil_irq)(irq);
63 }
64
65 static inline void clear_clock_irq(void)
66 {
67         BTFIXUP_CALL(clear_clock_irq)();
68 }
69
70 static inline void clear_profile_irq(int irq)
71 {
72         BTFIXUP_CALL(clear_profile_irq)(irq);
73 }
74
75 static inline void load_profile_irq(int cpu, int limit)
76 {
77         BTFIXUP_CALL(load_profile_irq)(cpu, limit);
78 }
79
80 extern void (*sparc_init_timers)(irqreturn_t (*lvl10_irq)(int, void *, struct pt_regs *));
81 extern void claim_ticker14(irqreturn_t (*irq_handler)(int, void *, struct pt_regs *),
82                            int irq,
83                            unsigned int timeout);
84
85 #ifdef CONFIG_SMP
86 BTFIXUPDEF_CALL(void, set_cpu_int, int, int)
87 BTFIXUPDEF_CALL(void, clear_cpu_int, int, int)
88 BTFIXUPDEF_CALL(void, set_irq_udt, int)
89
90 #define set_cpu_int(cpu,level) BTFIXUP_CALL(set_cpu_int)(cpu,level)
91 #define clear_cpu_int(cpu,level) BTFIXUP_CALL(clear_cpu_int)(cpu,level)
92 #define set_irq_udt(cpu) BTFIXUP_CALL(set_irq_udt)(cpu)
93 #endif
94
95 extern int request_fast_irq(unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_regs *), unsigned long flags, __const__ char *devname);
96
97 /* On the sun4m, just like the timers, we have both per-cpu and master
98  * interrupt registers.
99  */
100
101 /* These registers are used for sending/receiving irqs from/to
102  * different cpu's.
103  */
104 struct sun4m_intreg_percpu {
105         unsigned int tbt;        /* Interrupts still pending for this cpu. */
106
107         /* These next two registers are WRITE-ONLY and are only
108          * "on bit" sensitive, "off bits" written have NO affect.
109          */
110         unsigned int clear;  /* Clear this cpus irqs here. */
111         unsigned int set;    /* Set this cpus irqs here. */
112         unsigned char space[PAGE_SIZE - 12];
113 };
114
115 /*
116  * djhr
117  * Actually the clear and set fields in this struct are misleading..
118  * according to the SLAVIO manual (and the same applies for the SEC)
119  * the clear field clears bits in the mask which will ENABLE that IRQ
120  * the set field sets bits in the mask to DISABLE the IRQ.
121  *
122  * Also the undirected_xx address in the SLAVIO is defined as
123  * RESERVED and write only..
124  *
125  * DAVEM_NOTE: The SLAVIO only specifies behavior on uniprocessor
126  *             sun4m machines, for MP the layout makes more sense.
127  */
128 struct sun4m_intregs {
129         struct sun4m_intreg_percpu cpu_intregs[SUN4M_NCPUS];
130         unsigned int tbt;                /* IRQ's that are still pending. */
131         unsigned int irqs;               /* Master IRQ bits. */
132
133         /* Again, like the above, two these registers are WRITE-ONLY. */
134         unsigned int clear;              /* Clear master IRQ's by setting bits here. */
135         unsigned int set;                /* Set master IRQ's by setting bits here. */
136
137         /* This register is both READ and WRITE. */
138         unsigned int undirected_target;  /* Which cpu gets undirected irqs. */
139 };
140
141 extern struct sun4m_intregs *sun4m_interrupts;
142
143 /* 
144  * Bit field defines for the interrupt registers on various
145  * Sparc machines.
146  */
147
148 /* The sun4c interrupt register. */
149 #define SUN4C_INT_ENABLE  0x01     /* Allow interrupts. */
150 #define SUN4C_INT_E14     0x80     /* Enable level 14 IRQ. */
151 #define SUN4C_INT_E10     0x20     /* Enable level 10 IRQ. */
152 #define SUN4C_INT_E8      0x10     /* Enable level 8 IRQ. */
153 #define SUN4C_INT_E6      0x08     /* Enable level 6 IRQ. */
154 #define SUN4C_INT_E4      0x04     /* Enable level 4 IRQ. */
155 #define SUN4C_INT_E1      0x02     /* Enable level 1 IRQ. */
156
157 /* Dave Redman (djhr@tadpole.co.uk)
158  * The sun4m interrupt registers.
159  */
160 #define SUN4M_INT_ENABLE        0x80000000
161 #define SUN4M_INT_E14           0x00000080
162 #define SUN4M_INT_E10           0x00080000
163
164 #define SUN4M_HARD_INT(x)       (0x000000001 << (x))
165 #define SUN4M_SOFT_INT(x)       (0x000010000 << (x))
166
167 #define SUN4M_INT_MASKALL       0x80000000        /* mask all interrupts */
168 #define SUN4M_INT_MODULE_ERR    0x40000000        /* module error */
169 #define SUN4M_INT_M2S_WRITE     0x20000000        /* write buffer error */
170 #define SUN4M_INT_ECC           0x10000000        /* ecc memory error */
171 #define SUN4M_INT_FLOPPY        0x00400000        /* floppy disk */
172 #define SUN4M_INT_MODULE        0x00200000        /* module interrupt */
173 #define SUN4M_INT_VIDEO         0x00100000        /* onboard video */
174 #define SUN4M_INT_REALTIME      0x00080000        /* system timer */
175 #define SUN4M_INT_SCSI          0x00040000        /* onboard scsi */
176 #define SUN4M_INT_AUDIO         0x00020000        /* audio/isdn */
177 #define SUN4M_INT_ETHERNET      0x00010000        /* onboard ethernet */
178 #define SUN4M_INT_SERIAL        0x00008000        /* serial ports */
179 #define SUN4M_INT_KBDMS         0x00004000        /* keyboard/mouse */
180 #define SUN4M_INT_SBUSBITS      0x00003F80        /* sbus int bits */
181
182 #define SUN4M_INT_SBUS(x)       (1 << (x+7))
183 #define SUN4M_INT_VME(x)        (1 << (x))
184
185 struct irqaction;
186 struct pt_regs;
187 int handle_IRQ_event(unsigned int, struct pt_regs *, struct irqaction *);
188
189 #endif