2 * arch/sh/kernel/cpu/irq/imask.c
4 * Copyright (C) 1999, 2000 Niibe Yutaka
6 * Simple interrupt handling using IMASK of SR register.
9 /* NOTE: Will not work on level 15 */
10 #include <linux/ptrace.h>
11 #include <linux/errno.h>
12 #include <linux/kernel_stat.h>
13 #include <linux/signal.h>
14 #include <linux/sched.h>
15 #include <linux/interrupt.h>
16 #include <linux/init.h>
17 #include <linux/bitops.h>
18 #include <linux/spinlock.h>
19 #include <linux/cache.h>
20 #include <linux/irq.h>
21 #include <linux/bitmap.h>
22 #include <asm/system.h>
25 /* Bitmap of IRQ masked */
26 #define IMASK_PRIORITY 15
28 static DECLARE_BITMAP(imask_mask
, IMASK_PRIORITY
);
29 static int interrupt_priority
;
31 static inline void set_interrupt_registers(int ip
)
33 unsigned long __dummy
;
36 #ifdef CONFIG_CPU_HAS_SR_RB
42 "cmp/eq #0x3c, %0\n\t"
43 "bt/s 1f ! CLI-ed\n\t"
50 : "r" (~0xf0), "r" (ip
<< 4)
54 static void mask_imask_irq(unsigned int irq
)
56 clear_bit(irq
, imask_mask
);
57 if (interrupt_priority
< IMASK_PRIORITY
- irq
)
58 interrupt_priority
= IMASK_PRIORITY
- irq
;
59 set_interrupt_registers(interrupt_priority
);
62 static void unmask_imask_irq(unsigned int irq
)
64 set_bit(irq
, imask_mask
);
65 interrupt_priority
= IMASK_PRIORITY
-
66 find_first_zero_bit(imask_mask
, IMASK_PRIORITY
);
67 set_interrupt_registers(interrupt_priority
);
70 static struct irq_chip imask_irq_chip
= {
71 .typename
= "SR.IMASK",
72 .mask
= mask_imask_irq
,
73 .unmask
= unmask_imask_irq
,
74 .mask_ack
= mask_imask_irq
,
77 void make_imask_irq(unsigned int irq
)
79 set_irq_chip_and_handler_name(irq
, &imask_irq_chip
,
80 handle_level_irq
, "level");