]> bbs.cooldavid.org Git - net-next-2.6.git/blame - arch/m68k/include/asm/irqflags.h
Merge branches 'sh/pio-death', 'sh/nommu', 'sh/clkfwk', 'sh/core' and 'sh/intc-extens...
[net-next-2.6.git] / arch / m68k / include / asm / irqflags.h
CommitLineData
df9ee292
DH
1#ifndef _M68K_IRQFLAGS_H
2#define _M68K_IRQFLAGS_H
3
4#include <linux/types.h>
ed35f654 5#ifdef CONFIG_MMU
df9ee292 6#include <linux/hardirq.h>
ed35f654 7#endif
df9ee292
DH
8#include <linux/preempt.h>
9#include <asm/thread_info.h>
10#include <asm/entry.h>
11
12static inline unsigned long arch_local_save_flags(void)
13{
14 unsigned long flags;
15 asm volatile ("movew %%sr,%0" : "=d" (flags) : : "memory");
16 return flags;
17}
18
19static inline void arch_local_irq_disable(void)
20{
21#ifdef CONFIG_COLDFIRE
22 asm volatile (
23 "move %/sr,%%d0 \n\t"
24 "ori.l #0x0700,%%d0 \n\t"
25 "move %%d0,%/sr \n"
26 : /* no outputs */
27 :
28 : "cc", "%d0", "memory");
29#else
30 asm volatile ("oriw #0x0700,%%sr" : : : "memory");
31#endif
32}
33
34static inline void arch_local_irq_enable(void)
35{
36#if defined(CONFIG_COLDFIRE)
37 asm volatile (
38 "move %/sr,%%d0 \n\t"
39 "andi.l #0xf8ff,%%d0 \n\t"
40 "move %%d0,%/sr \n"
41 : /* no outputs */
42 :
43 : "cc", "%d0", "memory");
44#else
45# if defined(CONFIG_MMU)
46 if (MACH_IS_Q40 || !hardirq_count())
47# endif
48 asm volatile (
49 "andiw %0,%%sr"
50 :
51 : "i" (ALLOWINT)
52 : "memory");
53#endif
54}
55
56static inline unsigned long arch_local_irq_save(void)
57{
58 unsigned long flags = arch_local_save_flags();
59 arch_local_irq_disable();
60 return flags;
61}
62
63static inline void arch_local_irq_restore(unsigned long flags)
64{
65 asm volatile ("movew %0,%%sr" : : "d" (flags) : "memory");
66}
67
68static inline bool arch_irqs_disabled_flags(unsigned long flags)
69{
70 return (flags & ~ALLOWINT) != 0;
71}
72
73static inline bool arch_irqs_disabled(void)
74{
75 return arch_irqs_disabled_flags(arch_local_save_flags());
76}
77
78#endif /* _M68K_IRQFLAGS_H */