aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/m68k/amiga/amiints.c74
-rw-r--r--arch/m68k/amiga/cia.c11
-rw-r--r--include/asm-m68k/amigaints.h92
3 files changed, 80 insertions, 97 deletions
diff --git a/arch/m68k/amiga/amiints.c b/arch/m68k/amiga/amiints.c
index b0aa61bf8700..d02458ebd345 100644
--- a/arch/m68k/amiga/amiints.c
+++ b/arch/m68k/amiga/amiints.c
@@ -61,25 +61,25 @@ extern int cia_get_irq_list(struct ciabase *base, struct seq_file *p);
61static irq_node_t *ami_irq_list[AMI_STD_IRQS]; 61static irq_node_t *ami_irq_list[AMI_STD_IRQS];
62 62
63static unsigned short amiga_intena_vals[AMI_STD_IRQS] = { 63static unsigned short amiga_intena_vals[AMI_STD_IRQS] = {
64 [IRQ_AMIGA_VERTB] = IF_VERTB, 64 [IRQ_AMIGA_VERTB-IRQ_USER] = IF_VERTB,
65 [IRQ_AMIGA_COPPER] = IF_COPER, 65 [IRQ_AMIGA_COPPER-IRQ_USER] = IF_COPER,
66 [IRQ_AMIGA_AUD0] = IF_AUD0, 66 [IRQ_AMIGA_AUD0-IRQ_USER] = IF_AUD0,
67 [IRQ_AMIGA_AUD1] = IF_AUD1, 67 [IRQ_AMIGA_AUD1-IRQ_USER] = IF_AUD1,
68 [IRQ_AMIGA_AUD2] = IF_AUD2, 68 [IRQ_AMIGA_AUD2-IRQ_USER] = IF_AUD2,
69 [IRQ_AMIGA_AUD3] = IF_AUD3, 69 [IRQ_AMIGA_AUD3-IRQ_USER] = IF_AUD3,
70 [IRQ_AMIGA_BLIT] = IF_BLIT, 70 [IRQ_AMIGA_BLIT-IRQ_USER] = IF_BLIT,
71 [IRQ_AMIGA_DSKSYN] = IF_DSKSYN, 71 [IRQ_AMIGA_DSKSYN-IRQ_USER] = IF_DSKSYN,
72 [IRQ_AMIGA_DSKBLK] = IF_DSKBLK, 72 [IRQ_AMIGA_DSKBLK-IRQ_USER] = IF_DSKBLK,
73 [IRQ_AMIGA_RBF] = IF_RBF, 73 [IRQ_AMIGA_RBF-IRQ_USER] = IF_RBF,
74 [IRQ_AMIGA_TBE] = IF_TBE, 74 [IRQ_AMIGA_TBE-IRQ_USER] = IF_TBE,
75 [IRQ_AMIGA_SOFT] = IF_SOFT, 75 [IRQ_AMIGA_SOFT-IRQ_USER] = IF_SOFT,
76 [IRQ_AMIGA_PORTS] = IF_PORTS, 76 [IRQ_AMIGA_PORTS-IRQ_USER] = IF_PORTS,
77 [IRQ_AMIGA_EXTER] = IF_EXTER 77 [IRQ_AMIGA_EXTER-IRQ_USER] = IF_EXTER
78}; 78};
79static const unsigned char ami_servers[AMI_STD_IRQS] = { 79static const unsigned char ami_servers[AMI_STD_IRQS] = {
80 [IRQ_AMIGA_VERTB] = 1, 80 [IRQ_AMIGA_VERTB-IRQ_USER] = 1,
81 [IRQ_AMIGA_PORTS] = 1, 81 [IRQ_AMIGA_PORTS-IRQ_USER] = 1,
82 [IRQ_AMIGA_EXTER] = 1 82 [IRQ_AMIGA_EXTER-IRQ_USER] = 1
83}; 83};
84 84
85static short ami_ablecount[AMI_IRQS]; 85static short ami_ablecount[AMI_IRQS];
@@ -210,9 +210,8 @@ int amiga_request_irq(unsigned int irq,
210 return -ENXIO; 210 return -ENXIO;
211 } 211 }
212 212
213 if (irq >= IRQ_AMIGA_AUTO) 213 if (irq < IRQ_USER)
214 return cpu_request_irq(irq - IRQ_AMIGA_AUTO, handler, 214 return cpu_request_irq(irq, handler, flags, devname, dev_id);
215 flags, devname, dev_id);
216 215
217 if (irq >= IRQ_AMIGA_CIAB) 216 if (irq >= IRQ_AMIGA_CIAB)
218 return cia_request_irq(&ciab_base, irq - IRQ_AMIGA_CIAB, 217 return cia_request_irq(&ciab_base, irq - IRQ_AMIGA_CIAB,
@@ -222,6 +221,7 @@ int amiga_request_irq(unsigned int irq,
222 return cia_request_irq(&ciaa_base, irq - IRQ_AMIGA_CIAA, 221 return cia_request_irq(&ciaa_base, irq - IRQ_AMIGA_CIAA,
223 handler, flags, devname, dev_id); 222 handler, flags, devname, dev_id);
224 223
224 irq -= IRQ_USER;
225 /* 225 /*
226 * IRQ_AMIGA_PORTS & IRQ_AMIGA_EXTER defaults to shared, 226 * IRQ_AMIGA_PORTS & IRQ_AMIGA_EXTER defaults to shared,
227 * we could add a check here for the SA_SHIRQ flag but all drivers 227 * we could add a check here for the SA_SHIRQ flag but all drivers
@@ -257,8 +257,8 @@ void amiga_free_irq(unsigned int irq, void *dev_id)
257 return; 257 return;
258 } 258 }
259 259
260 if (irq >= IRQ_AMIGA_AUTO) 260 if (irq < IRQ_USER)
261 cpu_free_irq(irq - IRQ_AMIGA_AUTO, dev_id); 261 cpu_free_irq(irq, dev_id);
262 262
263 if (irq >= IRQ_AMIGA_CIAB) { 263 if (irq >= IRQ_AMIGA_CIAB) {
264 cia_free_irq(&ciab_base, irq - IRQ_AMIGA_CIAB, dev_id); 264 cia_free_irq(&ciab_base, irq - IRQ_AMIGA_CIAB, dev_id);
@@ -270,6 +270,7 @@ void amiga_free_irq(unsigned int irq, void *dev_id)
270 return; 270 return;
271 } 271 }
272 272
273 irq -= IRQ_USER;
273 if (ami_servers[irq]) { 274 if (ami_servers[irq]) {
274 amiga_delete_irq(&ami_irq_list[irq], dev_id); 275 amiga_delete_irq(&ami_irq_list[irq], dev_id);
275 /* if server list empty, disable the interrupt */ 276 /* if server list empty, disable the interrupt */
@@ -306,9 +307,9 @@ void amiga_enable_irq(unsigned int irq)
306 return; 307 return;
307 308
308 /* No action for auto-vector interrupts */ 309 /* No action for auto-vector interrupts */
309 if (irq >= IRQ_AMIGA_AUTO){ 310 if (irq < IRQ_USER) {
310 printk("%s: Trying to enable auto-vector IRQ %i\n", 311 printk("%s: Trying to enable auto-vector IRQ %i\n",
311 __FUNCTION__, irq - IRQ_AMIGA_AUTO); 312 __FUNCTION__, irq);
312 return; 313 return;
313 } 314 }
314 315
@@ -327,7 +328,7 @@ void amiga_enable_irq(unsigned int irq)
327 } 328 }
328 329
329 /* enable the interrupt */ 330 /* enable the interrupt */
330 amiga_custom.intena = IF_SETCLR | amiga_intena_vals[irq]; 331 amiga_custom.intena = IF_SETCLR | amiga_intena_vals[irq-IRQ_USER];
331} 332}
332 333
333void amiga_disable_irq(unsigned int irq) 334void amiga_disable_irq(unsigned int irq)
@@ -341,9 +342,9 @@ void amiga_disable_irq(unsigned int irq)
341 return; 342 return;
342 343
343 /* No action for auto-vector interrupts */ 344 /* No action for auto-vector interrupts */
344 if (irq >= IRQ_AMIGA_AUTO) { 345 if (irq < IRQ_USER) {
345 printk("%s: Trying to disable auto-vector IRQ %i\n", 346 printk("%s: Trying to disable auto-vector IRQ %i\n",
346 __FUNCTION__, irq - IRQ_AMIGA_AUTO); 347 __FUNCTION__, irq);
347 return; 348 return;
348 } 349 }
349 350
@@ -358,24 +359,24 @@ void amiga_disable_irq(unsigned int irq)
358 } 359 }
359 360
360 /* disable the interrupt */ 361 /* disable the interrupt */
361 amiga_custom.intena = amiga_intena_vals[irq]; 362 amiga_custom.intena = amiga_intena_vals[irq-IRQ_USER];
362} 363}
363 364
364inline void amiga_do_irq(int irq, struct pt_regs *fp) 365inline void amiga_do_irq(int irq, struct pt_regs *fp)
365{ 366{
366 kstat_cpu(0).irqs[SYS_IRQS + irq]++; 367 kstat_cpu(0).irqs[irq]++;
367 ami_irq_list[irq]->handler(irq, ami_irq_list[irq]->dev_id, fp); 368 ami_irq_list[irq-IRQ_USER]->handler(irq, ami_irq_list[irq-IRQ_USER]->dev_id, fp);
368} 369}
369 370
370void amiga_do_irq_list(int irq, struct pt_regs *fp) 371void amiga_do_irq_list(int irq, struct pt_regs *fp)
371{ 372{
372 irq_node_t *node; 373 irq_node_t *node;
373 374
374 kstat_cpu(0).irqs[SYS_IRQS + irq]++; 375 kstat_cpu(0).irqs[irq]++;
375 376
376 amiga_custom.intreq = amiga_intena_vals[irq]; 377 amiga_custom.intreq = amiga_intena_vals[irq-IRQ_USER];
377 378
378 for (node = ami_irq_list[irq]; node; node = node->next) 379 for (node = ami_irq_list[irq-IRQ_USER]; node; node = node->next)
379 node->handler(irq, node->dev_id, fp); 380 node->handler(irq, node->dev_id, fp);
380} 381}
381 382
@@ -498,11 +499,12 @@ int show_amiga_interrupts(struct seq_file *p, void *v)
498 int i; 499 int i;
499 irq_node_t *node; 500 irq_node_t *node;
500 501
501 for (i = 0; i < AMI_STD_IRQS; i++) { 502 for (i = IRQ_USER; i < IRQ_AMIGA_CIAA; i++) {
502 if (!(node = ami_irq_list[i])) 503 node = ami_irq_list[i - IRQ_USER];
504 if (!node)
503 continue; 505 continue;
504 seq_printf(p, "ami %2d: %10u ", i, 506 seq_printf(p, "ami %2d: %10u ", i,
505 kstat_cpu(0).irqs[SYS_IRQS + i]); 507 kstat_cpu(0).irqs[i]);
506 do { 508 do {
507 if (node->flags & SA_INTERRUPT) 509 if (node->flags & SA_INTERRUPT)
508 seq_puts(p, "F "); 510 seq_puts(p, "F ");
diff --git a/arch/m68k/amiga/cia.c b/arch/m68k/amiga/cia.c
index 9476eb9440f5..4a003d87f98d 100644
--- a/arch/m68k/amiga/cia.c
+++ b/arch/m68k/amiga/cia.c
@@ -33,14 +33,14 @@ struct ciabase {
33} ciaa_base = { 33} ciaa_base = {
34 .cia = &ciaa, 34 .cia = &ciaa,
35 .int_mask = IF_PORTS, 35 .int_mask = IF_PORTS,
36 .handler_irq = IRQ_AMIGA_AUTO_2, 36 .handler_irq = IRQ_AUTO_2,
37 .cia_irq = IRQ_AMIGA_CIAA, 37 .cia_irq = IRQ_AMIGA_CIAA,
38 .server_irq = IRQ_AMIGA_PORTS, 38 .server_irq = IRQ_AMIGA_PORTS,
39 .name = "CIAA handler" 39 .name = "CIAA handler"
40}, ciab_base = { 40}, ciab_base = {
41 .cia = &ciab, 41 .cia = &ciab,
42 .int_mask = IF_EXTER, 42 .int_mask = IF_EXTER,
43 .handler_irq = IRQ_AMIGA_AUTO_6, 43 .handler_irq = IRQ_AUTO_6,
44 .cia_irq = IRQ_AMIGA_CIAB, 44 .cia_irq = IRQ_AMIGA_CIAB,
45 .server_irq = IRQ_AMIGA_EXTER, 45 .server_irq = IRQ_AMIGA_EXTER,
46 .name = "CIAB handler" 46 .name = "CIAB handler"
@@ -131,12 +131,11 @@ static irqreturn_t cia_handler(int irq, void *dev_id, struct pt_regs *fp)
131 unsigned char ints; 131 unsigned char ints;
132 132
133 mach_irq = base->cia_irq; 133 mach_irq = base->cia_irq;
134 irq = SYS_IRQS + mach_irq;
135 ints = cia_set_irq(base, CIA_ICR_ALL); 134 ints = cia_set_irq(base, CIA_ICR_ALL);
136 amiga_custom.intreq = base->int_mask; 135 amiga_custom.intreq = base->int_mask;
137 for (i = 0; i < CIA_IRQS; i++, irq++, mach_irq++) { 136 for (i = 0; i < CIA_IRQS; i++, mach_irq++) {
138 if (ints & 1) { 137 if (ints & 1) {
139 kstat_cpu(0).irqs[irq]++; 138 kstat_cpu(0).irqs[mach_irq]++;
140 base->irq_list[i].handler(mach_irq, base->irq_list[i].dev_id, fp); 139 base->irq_list[i].handler(mach_irq, base->irq_list[i].dev_id, fp);
141 } 140 }
142 ints >>= 1; 141 ints >>= 1;
@@ -172,7 +171,7 @@ int cia_get_irq_list(struct ciabase *base, struct seq_file *p)
172 j = base->cia_irq; 171 j = base->cia_irq;
173 for (i = 0; i < CIA_IRQS; i++) { 172 for (i = 0; i < CIA_IRQS; i++) {
174 seq_printf(p, "cia %2d: %10d ", j + i, 173 seq_printf(p, "cia %2d: %10d ", j + i,
175 kstat_cpu(0).irqs[SYS_IRQS + j + i]); 174 kstat_cpu(0).irqs[j + i]);
176 seq_puts(p, " "); 175 seq_puts(p, " ");
177 seq_printf(p, "%s\n", base->irq_list[i].devname); 176 seq_printf(p, "%s\n", base->irq_list[i].devname);
178 } 177 }
diff --git a/include/asm-m68k/amigaints.h b/include/asm-m68k/amigaints.h
index aa968d014bb6..576f5d1b5706 100644
--- a/include/asm-m68k/amigaints.h
+++ b/include/asm-m68k/amigaints.h
@@ -13,6 +13,8 @@
13#ifndef _ASMm68k_AMIGAINTS_H_ 13#ifndef _ASMm68k_AMIGAINTS_H_
14#define _ASMm68k_AMIGAINTS_H_ 14#define _ASMm68k_AMIGAINTS_H_
15 15
16#include <asm/irq.h>
17
16/* 18/*
17** Amiga Interrupt sources. 19** Amiga Interrupt sources.
18** 20**
@@ -23,72 +25,52 @@
23#define CIA_IRQS (5) 25#define CIA_IRQS (5)
24#define AMI_IRQS (32) /* AUTO_IRQS+AMI_STD_IRQS+2*CIA_IRQS */ 26#define AMI_IRQS (32) /* AUTO_IRQS+AMI_STD_IRQS+2*CIA_IRQS */
25 27
26/* vertical blanking interrupt */ 28/* builtin serial port interrupts */
27#define IRQ_AMIGA_VERTB 0 29#define IRQ_AMIGA_TBE (IRQ_USER+0)
30#define IRQ_AMIGA_RBF (IRQ_USER+11)
28 31
29/* copper interrupt */ 32/* floppy disk interrupts */
30#define IRQ_AMIGA_COPPER 1 33#define IRQ_AMIGA_DSKBLK (IRQ_USER+1)
34#define IRQ_AMIGA_DSKSYN (IRQ_USER+12)
31 35
32/* Audio interrupts */ 36/* software interrupts */
33#define IRQ_AMIGA_AUD0 2 37#define IRQ_AMIGA_SOFT (IRQ_USER+2)
34#define IRQ_AMIGA_AUD1 3
35#define IRQ_AMIGA_AUD2 4
36#define IRQ_AMIGA_AUD3 5
37 38
38/* Blitter done interrupt */ 39/* interrupts from external hardware */
39#define IRQ_AMIGA_BLIT 6 40#define IRQ_AMIGA_PORTS (IRQ_USER+3)
41#define IRQ_AMIGA_EXTER (IRQ_USER+13)
40 42
41/* floppy disk interrupts */ 43/* copper interrupt */
42#define IRQ_AMIGA_DSKSYN 7 44#define IRQ_AMIGA_COPPER (IRQ_USER+4)
43#define IRQ_AMIGA_DSKBLK 8
44 45
45/* builtin serial port interrupts */ 46/* vertical blanking interrupt */
46#define IRQ_AMIGA_RBF 9 47#define IRQ_AMIGA_VERTB (IRQ_USER+5)
47#define IRQ_AMIGA_TBE 10
48 48
49/* software interrupts */ 49/* Blitter done interrupt */
50#define IRQ_AMIGA_SOFT 11 50#define IRQ_AMIGA_BLIT (IRQ_USER+6)
51 51
52/* interrupts from external hardware */ 52/* Audio interrupts */
53#define IRQ_AMIGA_PORTS 12 53#define IRQ_AMIGA_AUD0 (IRQ_USER+7)
54#define IRQ_AMIGA_EXTER 13 54#define IRQ_AMIGA_AUD1 (IRQ_USER+8)
55#define IRQ_AMIGA_AUD2 (IRQ_USER+9)
56#define IRQ_AMIGA_AUD3 (IRQ_USER+10)
55 57
56/* CIA interrupt sources */ 58/* CIA interrupt sources */
57#define IRQ_AMIGA_CIAA 14 59#define IRQ_AMIGA_CIAA (IRQ_USER+14)
58#define IRQ_AMIGA_CIAA_TA 14 60#define IRQ_AMIGA_CIAA_TA (IRQ_USER+14)
59#define IRQ_AMIGA_CIAA_TB 15 61#define IRQ_AMIGA_CIAA_TB (IRQ_USER+15)
60#define IRQ_AMIGA_CIAA_ALRM 16 62#define IRQ_AMIGA_CIAA_ALRM (IRQ_USER+16)
61#define IRQ_AMIGA_CIAA_SP 17 63#define IRQ_AMIGA_CIAA_SP (IRQ_USER+17)
62#define IRQ_AMIGA_CIAA_FLG 18 64#define IRQ_AMIGA_CIAA_FLG (IRQ_USER+18)
63#define IRQ_AMIGA_CIAB 19 65#define IRQ_AMIGA_CIAB (IRQ_USER+19)
64#define IRQ_AMIGA_CIAB_TA 19 66#define IRQ_AMIGA_CIAB_TA (IRQ_USER+19)
65#define IRQ_AMIGA_CIAB_TB 20 67#define IRQ_AMIGA_CIAB_TB (IRQ_USER+20)
66#define IRQ_AMIGA_CIAB_ALRM 21 68#define IRQ_AMIGA_CIAB_ALRM (IRQ_USER+21)
67#define IRQ_AMIGA_CIAB_SP 22 69#define IRQ_AMIGA_CIAB_SP (IRQ_USER+22)
68#define IRQ_AMIGA_CIAB_FLG 23 70#define IRQ_AMIGA_CIAB_FLG (IRQ_USER+23)
69
70/* auto-vector interrupts */
71#define IRQ_AMIGA_AUTO 24
72#define IRQ_AMIGA_AUTO_0 24 /* This is just a dummy */
73#define IRQ_AMIGA_AUTO_1 25
74#define IRQ_AMIGA_AUTO_2 26
75#define IRQ_AMIGA_AUTO_3 27
76#define IRQ_AMIGA_AUTO_4 28
77#define IRQ_AMIGA_AUTO_5 29
78#define IRQ_AMIGA_AUTO_6 30
79#define IRQ_AMIGA_AUTO_7 31
80
81#define IRQ_FLOPPY IRQ_AMIGA_DSKBLK
82 71
83/* INTREQR masks */
84#define IRQ1_MASK 0x0007 /* INTREQR mask for IRQ 1 */
85#define IRQ2_MASK 0x0008 /* INTREQR mask for IRQ 2 */
86#define IRQ3_MASK 0x0070 /* INTREQR mask for IRQ 3 */
87#define IRQ4_MASK 0x0780 /* INTREQR mask for IRQ 4 */
88#define IRQ5_MASK 0x1800 /* INTREQR mask for IRQ 5 */
89#define IRQ6_MASK 0x2000 /* INTREQR mask for IRQ 6 */
90#define IRQ7_MASK 0x4000 /* INTREQR mask for IRQ 7 */
91 72
73/* INTREQR masks */
92#define IF_SETCLR 0x8000 /* set/clr bit */ 74#define IF_SETCLR 0x8000 /* set/clr bit */
93#define IF_INTEN 0x4000 /* master interrupt bit in INT* registers */ 75#define IF_INTEN 0x4000 /* master interrupt bit in INT* registers */
94#define IF_EXTER 0x2000 /* external level 6 and CIA B interrupt */ 76#define IF_EXTER 0x2000 /* external level 6 and CIA B interrupt */