aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel/irq_cpu.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/mips/kernel/irq_cpu.c
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'arch/mips/kernel/irq_cpu.c')
-rw-r--r--arch/mips/kernel/irq_cpu.c118
1 files changed, 118 insertions, 0 deletions
diff --git a/arch/mips/kernel/irq_cpu.c b/arch/mips/kernel/irq_cpu.c
new file mode 100644
index 000000000000..2b936cf1ef70
--- /dev/null
+++ b/arch/mips/kernel/irq_cpu.c
@@ -0,0 +1,118 @@
1/*
2 * Copyright 2001 MontaVista Software Inc.
3 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
4 *
5 * Copyright (C) 2001 Ralf Baechle
6 *
7 * This file define the irq handler for MIPS CPU interrupts.
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 */
14
15/*
16 * Almost all MIPS CPUs define 8 interrupt sources. They are typically
17 * level triggered (i.e., cannot be cleared from CPU; must be cleared from
18 * device). The first two are software interrupts which we don't really
19 * use or support. The last one is usually the CPU timer interrupt if
20 * counter register is present or, for CPUs with an external FPU, by
21 * convention it's the FPU exception interrupt.
22 *
23 * Don't even think about using this on SMP. You have been warned.
24 *
25 * This file exports one global function:
26 * void mips_cpu_irq_init(int irq_base);
27 */
28#include <linux/init.h>
29#include <linux/interrupt.h>
30#include <linux/kernel.h>
31
32#include <asm/irq_cpu.h>
33#include <asm/mipsregs.h>
34#include <asm/system.h>
35
36static int mips_cpu_irq_base;
37
38static inline void unmask_mips_irq(unsigned int irq)
39{
40 clear_c0_cause(0x100 << (irq - mips_cpu_irq_base));
41 set_c0_status(0x100 << (irq - mips_cpu_irq_base));
42}
43
44static inline void mask_mips_irq(unsigned int irq)
45{
46 clear_c0_status(0x100 << (irq - mips_cpu_irq_base));
47}
48
49static inline void mips_cpu_irq_enable(unsigned int irq)
50{
51 unsigned long flags;
52
53 local_irq_save(flags);
54 unmask_mips_irq(irq);
55 local_irq_restore(flags);
56}
57
58static void mips_cpu_irq_disable(unsigned int irq)
59{
60 unsigned long flags;
61
62 local_irq_save(flags);
63 mask_mips_irq(irq);
64 local_irq_restore(flags);
65}
66
67static unsigned int mips_cpu_irq_startup(unsigned int irq)
68{
69 mips_cpu_irq_enable(irq);
70
71 return 0;
72}
73
74#define mips_cpu_irq_shutdown mips_cpu_irq_disable
75
76/*
77 * While we ack the interrupt interrupts are disabled and thus we don't need
78 * to deal with concurrency issues. Same for mips_cpu_irq_end.
79 */
80static void mips_cpu_irq_ack(unsigned int irq)
81{
82 /* Only necessary for soft interrupts */
83 clear_c0_cause(0x100 << (irq - mips_cpu_irq_base));
84
85 mask_mips_irq(irq);
86}
87
88static void mips_cpu_irq_end(unsigned int irq)
89{
90 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
91 unmask_mips_irq(irq);
92}
93
94static hw_irq_controller mips_cpu_irq_controller = {
95 "MIPS",
96 mips_cpu_irq_startup,
97 mips_cpu_irq_shutdown,
98 mips_cpu_irq_enable,
99 mips_cpu_irq_disable,
100 mips_cpu_irq_ack,
101 mips_cpu_irq_end,
102 NULL /* no affinity stuff for UP */
103};
104
105
106void __init mips_cpu_irq_init(int irq_base)
107{
108 int i;
109
110 for (i = irq_base; i < irq_base + 8; i++) {
111 irq_desc[i].status = IRQ_DISABLED;
112 irq_desc[i].action = NULL;
113 irq_desc[i].depth = 1;
114 irq_desc[i].handler = &mips_cpu_irq_controller;
115 }
116
117 mips_cpu_irq_base = irq_base;
118}