diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/sh/kernel/cpu/irq_imask.c |
Linux-2.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/sh/kernel/cpu/irq_imask.c')
-rw-r--r-- | arch/sh/kernel/cpu/irq_imask.c | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/arch/sh/kernel/cpu/irq_imask.c b/arch/sh/kernel/cpu/irq_imask.c new file mode 100644 index 00000000000..f76901e732f --- /dev/null +++ b/arch/sh/kernel/cpu/irq_imask.c | |||
@@ -0,0 +1,116 @@ | |||
1 | /* $Id: irq_imask.c,v 1.1.2.1 2002/11/17 10:53:43 mrbrown Exp $ | ||
2 | * | ||
3 | * linux/arch/sh/kernel/irq_imask.c | ||
4 | * | ||
5 | * Copyright (C) 1999, 2000 Niibe Yutaka | ||
6 | * | ||
7 | * Simple interrupt handling using IMASK of SR register. | ||
8 | * | ||
9 | */ | ||
10 | |||
11 | /* NOTE: Will not work on level 15 */ | ||
12 | |||
13 | |||
14 | #include <linux/ptrace.h> | ||
15 | #include <linux/errno.h> | ||
16 | #include <linux/kernel_stat.h> | ||
17 | #include <linux/signal.h> | ||
18 | #include <linux/sched.h> | ||
19 | #include <linux/interrupt.h> | ||
20 | #include <linux/init.h> | ||
21 | #include <linux/bitops.h> | ||
22 | |||
23 | #include <asm/system.h> | ||
24 | #include <asm/irq.h> | ||
25 | |||
26 | #include <linux/spinlock.h> | ||
27 | #include <linux/cache.h> | ||
28 | #include <linux/irq.h> | ||
29 | |||
30 | /* Bitmap of IRQ masked */ | ||
31 | static unsigned long imask_mask = 0x7fff; | ||
32 | static int interrupt_priority = 0; | ||
33 | |||
34 | static void enable_imask_irq(unsigned int irq); | ||
35 | static void disable_imask_irq(unsigned int irq); | ||
36 | static void shutdown_imask_irq(unsigned int irq); | ||
37 | static void mask_and_ack_imask(unsigned int); | ||
38 | static void end_imask_irq(unsigned int irq); | ||
39 | |||
40 | #define IMASK_PRIORITY 15 | ||
41 | |||
42 | static unsigned int startup_imask_irq(unsigned int irq) | ||
43 | { | ||
44 | /* Nothing to do */ | ||
45 | return 0; /* never anything pending */ | ||
46 | } | ||
47 | |||
48 | static struct hw_interrupt_type imask_irq_type = { | ||
49 | "SR.IMASK", | ||
50 | startup_imask_irq, | ||
51 | shutdown_imask_irq, | ||
52 | enable_imask_irq, | ||
53 | disable_imask_irq, | ||
54 | mask_and_ack_imask, | ||
55 | end_imask_irq | ||
56 | }; | ||
57 | |||
58 | void static inline set_interrupt_registers(int ip) | ||
59 | { | ||
60 | unsigned long __dummy; | ||
61 | |||
62 | asm volatile("ldc %2, r6_bank\n\t" | ||
63 | "stc sr, %0\n\t" | ||
64 | "and #0xf0, %0\n\t" | ||
65 | "shlr2 %0\n\t" | ||
66 | "cmp/eq #0x3c, %0\n\t" | ||
67 | "bt/s 1f ! CLI-ed\n\t" | ||
68 | " stc sr, %0\n\t" | ||
69 | "and %1, %0\n\t" | ||
70 | "or %2, %0\n\t" | ||
71 | "ldc %0, sr\n" | ||
72 | "1:" | ||
73 | : "=&z" (__dummy) | ||
74 | : "r" (~0xf0), "r" (ip << 4) | ||
75 | : "t"); | ||
76 | } | ||
77 | |||
78 | static void disable_imask_irq(unsigned int irq) | ||
79 | { | ||
80 | clear_bit(irq, &imask_mask); | ||
81 | if (interrupt_priority < IMASK_PRIORITY - irq) | ||
82 | interrupt_priority = IMASK_PRIORITY - irq; | ||
83 | |||
84 | set_interrupt_registers(interrupt_priority); | ||
85 | } | ||
86 | |||
87 | static void enable_imask_irq(unsigned int irq) | ||
88 | { | ||
89 | set_bit(irq, &imask_mask); | ||
90 | interrupt_priority = IMASK_PRIORITY - ffz(imask_mask); | ||
91 | |||
92 | set_interrupt_registers(interrupt_priority); | ||
93 | } | ||
94 | |||
95 | static void mask_and_ack_imask(unsigned int irq) | ||
96 | { | ||
97 | disable_imask_irq(irq); | ||
98 | } | ||
99 | |||
100 | static void end_imask_irq(unsigned int irq) | ||
101 | { | ||
102 | if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) | ||
103 | enable_imask_irq(irq); | ||
104 | } | ||
105 | |||
106 | static void shutdown_imask_irq(unsigned int irq) | ||
107 | { | ||
108 | /* Nothing to do */ | ||
109 | } | ||
110 | |||
111 | void make_imask_irq(unsigned int irq) | ||
112 | { | ||
113 | disable_irq_nosync(irq); | ||
114 | irq_desc[irq].handler = &imask_irq_type; | ||
115 | enable_irq(irq); | ||
116 | } | ||