diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2006-04-03 12:56:36 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2006-04-18 22:14:21 -0400 |
commit | e4ac58afdfac792c0583af30dbd9eae53e24c78b (patch) | |
tree | 7517bef2c515fc630e4d3d238867b91cde96f558 /arch/mips/tx4927 | |
parent | d35d473c25d43d7db3e5e18b66d558d2a631cca8 (diff) |
[MIPS] Rewrite all the assembler interrupt handlers to C.
Saves like 1,600 lines of code, is way easier to debug, compilers
frequently do a better job than the cut and paste type of handlers many
boards had. And finally having all the stuff done in a single place
also means alot of bug potencial for the MT ASE is gone.
The only surviving handler in assembler is the DECstation one; I hope
Maciej will rewrite it.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/tx4927')
-rw-r--r-- | arch/mips/tx4927/common/Makefile | 2 | ||||
-rw-r--r-- | arch/mips/tx4927/common/tx4927_irq.c | 30 | ||||
-rw-r--r-- | arch/mips/tx4927/common/tx4927_irq_handler.S | 104 |
3 files changed, 24 insertions, 112 deletions
diff --git a/arch/mips/tx4927/common/Makefile b/arch/mips/tx4927/common/Makefile index 8fa126b296e1..9cb9535ebacb 100644 --- a/arch/mips/tx4927/common/Makefile +++ b/arch/mips/tx4927/common/Makefile | |||
@@ -6,7 +6,7 @@ | |||
6 | # unless it's something special (ie not a .c file). | 6 | # unless it's something special (ie not a .c file). |
7 | # | 7 | # |
8 | 8 | ||
9 | obj-y += tx4927_prom.o tx4927_setup.o tx4927_irq.o tx4927_irq_handler.o | 9 | obj-y += tx4927_prom.o tx4927_setup.o tx4927_irq.o |
10 | 10 | ||
11 | obj-$(CONFIG_TOSHIBA_FPCIB0) += smsc_fdc37m81x.o | 11 | obj-$(CONFIG_TOSHIBA_FPCIB0) += smsc_fdc37m81x.o |
12 | obj-$(CONFIG_KGDB) += tx4927_dbgio.o | 12 | obj-$(CONFIG_KGDB) += tx4927_dbgio.o |
diff --git a/arch/mips/tx4927/common/tx4927_irq.c b/arch/mips/tx4927/common/tx4927_irq.c index 5ab2e2b76018..8ca68015cf40 100644 --- a/arch/mips/tx4927/common/tx4927_irq.c +++ b/arch/mips/tx4927/common/tx4927_irq.c | |||
@@ -525,8 +525,6 @@ static void tx4927_irq_pic_end(unsigned int irq) | |||
525 | */ | 525 | */ |
526 | void __init tx4927_irq_init(void) | 526 | void __init tx4927_irq_init(void) |
527 | { | 527 | { |
528 | extern asmlinkage void tx4927_irq_handler(void); | ||
529 | |||
530 | TX4927_IRQ_DPRINTK(TX4927_IRQ_INIT, "-\n"); | 528 | TX4927_IRQ_DPRINTK(TX4927_IRQ_INIT, "-\n"); |
531 | 529 | ||
532 | TX4927_IRQ_DPRINTK(TX4927_IRQ_INIT, "=Calling tx4927_irq_cp0_init()\n"); | 530 | TX4927_IRQ_DPRINTK(TX4927_IRQ_INIT, "=Calling tx4927_irq_cp0_init()\n"); |
@@ -535,16 +533,12 @@ void __init tx4927_irq_init(void) | |||
535 | TX4927_IRQ_DPRINTK(TX4927_IRQ_INIT, "=Calling tx4927_irq_pic_init()\n"); | 533 | TX4927_IRQ_DPRINTK(TX4927_IRQ_INIT, "=Calling tx4927_irq_pic_init()\n"); |
536 | tx4927_irq_pic_init(); | 534 | tx4927_irq_pic_init(); |
537 | 535 | ||
538 | TX4927_IRQ_DPRINTK(TX4927_IRQ_INIT, | ||
539 | "=Calling set_except_vector(tx4927_irq_handler)\n"); | ||
540 | set_except_vector(0, tx4927_irq_handler); | ||
541 | |||
542 | TX4927_IRQ_DPRINTK(TX4927_IRQ_INIT, "+\n"); | 536 | TX4927_IRQ_DPRINTK(TX4927_IRQ_INIT, "+\n"); |
543 | 537 | ||
544 | return; | 538 | return; |
545 | } | 539 | } |
546 | 540 | ||
547 | int tx4927_irq_nested(void) | 541 | static int tx4927_irq_nested(void) |
548 | { | 542 | { |
549 | int sw_irq = 0; | 543 | int sw_irq = 0; |
550 | u32 level2; | 544 | u32 level2; |
@@ -582,3 +576,25 @@ int tx4927_irq_nested(void) | |||
582 | 576 | ||
583 | return (sw_irq); | 577 | return (sw_irq); |
584 | } | 578 | } |
579 | |||
580 | asmlinkage void plat_irq_dispatch(struct pt_regs *regs) | ||
581 | { | ||
582 | unsigned int pending = read_c0_status() & read_c0_cause(); | ||
583 | |||
584 | if (pending & STATUSF_IP7) /* cpu timer */ | ||
585 | do_IRQ(TX4927_IRQ_CPU_TIMER, regs); | ||
586 | else if (pending & STATUSF_IP2) { /* tx4927 pic */ | ||
587 | unsigned int irq = tx4927_irq_nested(); | ||
588 | |||
589 | if (unlikely(irq == 0)) { | ||
590 | spurious_interrupt(regs); | ||
591 | return; | ||
592 | } | ||
593 | do_IRQ(irq, regs); | ||
594 | } else if (pending & STATUSF_IP0) /* user line 0 */ | ||
595 | do_IRQ(TX4927_IRQ_USER0, regs); | ||
596 | else if (pending & STATUSF_IP1) /* user line 1 */ | ||
597 | do_IRQ(TX4927_IRQ_USER1, regs); | ||
598 | else | ||
599 | spurious_interrupt(regs); | ||
600 | } | ||
diff --git a/arch/mips/tx4927/common/tx4927_irq_handler.S b/arch/mips/tx4927/common/tx4927_irq_handler.S deleted file mode 100644 index 0b2ea02574f2..000000000000 --- a/arch/mips/tx4927/common/tx4927_irq_handler.S +++ /dev/null | |||
@@ -1,104 +0,0 @@ | |||
1 | /* | ||
2 | * linux/arch/mips/tx4927/common/tx4927_irq_handler.S | ||
3 | * | ||
4 | * Primary interrupt handler for tx4927 based systems | ||
5 | * | ||
6 | * Author: MontaVista Software, Inc. | ||
7 | * Author: jsun@mvista.com or jsun@junsun.net | ||
8 | * source@mvista.com | ||
9 | * | ||
10 | * Copyright 2001-2002 MontaVista Software Inc. | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify it | ||
13 | * under the terms of the GNU General Public License as published by the | ||
14 | * Free Software Foundation; either version 2 of the License, or (at your | ||
15 | * option) any later version. | ||
16 | * | ||
17 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED | ||
18 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
19 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
22 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | ||
23 | * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
24 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR | ||
25 | * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE | ||
26 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
27 | * | ||
28 | * You should have received a copy of the GNU General Public License along | ||
29 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
30 | * 675 Mass Ave, Cambridge, MA 02139, USA. | ||
31 | */ | ||
32 | #include <asm/asm.h> | ||
33 | #include <asm/mipsregs.h> | ||
34 | #include <asm/addrspace.h> | ||
35 | #include <asm/regdef.h> | ||
36 | #include <asm/stackframe.h> | ||
37 | #include <asm/tx4927/tx4927.h> | ||
38 | |||
39 | .align 5 | ||
40 | NESTED(tx4927_irq_handler, PT_SIZE, sp) | ||
41 | SAVE_ALL | ||
42 | CLI | ||
43 | .set at | ||
44 | |||
45 | mfc0 t0, CP0_CAUSE | ||
46 | mfc0 t1, CP0_STATUS | ||
47 | and t0, t1 | ||
48 | |||
49 | andi t1, t0, STATUSF_IP7 /* cpu timer */ | ||
50 | bnez t1, ll_ip7 | ||
51 | |||
52 | /* IP6..IP3 multiplexed -- do not use */ | ||
53 | |||
54 | andi t1, t0, STATUSF_IP2 /* tx4927 pic */ | ||
55 | bnez t1, ll_ip2 | ||
56 | |||
57 | andi t1, t0, STATUSF_IP0 /* user line 0 */ | ||
58 | bnez t1, ll_ip0 | ||
59 | |||
60 | andi t1, t0, STATUSF_IP1 /* user line 1 */ | ||
61 | bnez t1, ll_ip1 | ||
62 | |||
63 | .set reorder | ||
64 | |||
65 | /* wrong alarm or masked ... */ | ||
66 | jal spurious_interrupt | ||
67 | nop | ||
68 | j ret_from_irq | ||
69 | END(tx4927_irq_handler) | ||
70 | |||
71 | .align 5 | ||
72 | |||
73 | |||
74 | ll_ip7: | ||
75 | li a0, TX4927_IRQ_CPU_TIMER | ||
76 | move a1, sp | ||
77 | jal do_IRQ | ||
78 | j ret_from_irq | ||
79 | |||
80 | ll_ip2: | ||
81 | jal tx4927_irq_nested | ||
82 | nop | ||
83 | beqz v0, goto_spurious_interrupt | ||
84 | nop | ||
85 | move a0, v0 | ||
86 | move a1, sp | ||
87 | jal do_IRQ | ||
88 | j ret_from_irq | ||
89 | |||
90 | goto_spurious_interrupt: | ||
91 | j spurious_interrupt | ||
92 | nop | ||
93 | |||
94 | ll_ip1: | ||
95 | li a0, TX4927_IRQ_USER1 | ||
96 | move a1, sp | ||
97 | jal do_IRQ | ||
98 | j ret_from_irq | ||
99 | |||
100 | ll_ip0: | ||
101 | li a0, TX4927_IRQ_USER0 | ||
102 | move a1, sp | ||
103 | jal do_IRQ | ||
104 | j ret_from_irq | ||