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