diff options
Diffstat (limited to 'arch/m68k')
-rw-r--r-- | arch/m68k/include/asm/entry_no.h | 2 | ||||
-rw-r--r-- | arch/m68k/include/asm/irqflags.h | 76 | ||||
-rw-r--r-- | arch/m68k/include/asm/system_mm.h | 25 | ||||
-rw-r--r-- | arch/m68k/include/asm/system_no.h | 57 |
4 files changed, 79 insertions, 81 deletions
diff --git a/arch/m68k/include/asm/entry_no.h b/arch/m68k/include/asm/entry_no.h index 907ed03d792f..80e41492aa2a 100644 --- a/arch/m68k/include/asm/entry_no.h +++ b/arch/m68k/include/asm/entry_no.h | |||
@@ -28,7 +28,7 @@ | |||
28 | * M68K COLDFIRE | 28 | * M68K COLDFIRE |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #define ALLOWINT 0xf8ff | 31 | #define ALLOWINT (~0x700) |
32 | 32 | ||
33 | #ifdef __ASSEMBLY__ | 33 | #ifdef __ASSEMBLY__ |
34 | 34 | ||
diff --git a/arch/m68k/include/asm/irqflags.h b/arch/m68k/include/asm/irqflags.h new file mode 100644 index 000000000000..4a5b284a1550 --- /dev/null +++ b/arch/m68k/include/asm/irqflags.h | |||
@@ -0,0 +1,76 @@ | |||
1 | #ifndef _M68K_IRQFLAGS_H | ||
2 | #define _M68K_IRQFLAGS_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <linux/hardirq.h> | ||
6 | #include <linux/preempt.h> | ||
7 | #include <asm/thread_info.h> | ||
8 | #include <asm/entry.h> | ||
9 | |||
10 | static inline unsigned long arch_local_save_flags(void) | ||
11 | { | ||
12 | unsigned long flags; | ||
13 | asm volatile ("movew %%sr,%0" : "=d" (flags) : : "memory"); | ||
14 | return flags; | ||
15 | } | ||
16 | |||
17 | static inline void arch_local_irq_disable(void) | ||
18 | { | ||
19 | #ifdef CONFIG_COLDFIRE | ||
20 | asm volatile ( | ||
21 | "move %/sr,%%d0 \n\t" | ||
22 | "ori.l #0x0700,%%d0 \n\t" | ||
23 | "move %%d0,%/sr \n" | ||
24 | : /* no outputs */ | ||
25 | : | ||
26 | : "cc", "%d0", "memory"); | ||
27 | #else | ||
28 | asm volatile ("oriw #0x0700,%%sr" : : : "memory"); | ||
29 | #endif | ||
30 | } | ||
31 | |||
32 | static inline void arch_local_irq_enable(void) | ||
33 | { | ||
34 | #if defined(CONFIG_COLDFIRE) | ||
35 | asm volatile ( | ||
36 | "move %/sr,%%d0 \n\t" | ||
37 | "andi.l #0xf8ff,%%d0 \n\t" | ||
38 | "move %%d0,%/sr \n" | ||
39 | : /* no outputs */ | ||
40 | : | ||
41 | : "cc", "%d0", "memory"); | ||
42 | #else | ||
43 | # if defined(CONFIG_MMU) | ||
44 | if (MACH_IS_Q40 || !hardirq_count()) | ||
45 | # endif | ||
46 | asm volatile ( | ||
47 | "andiw %0,%%sr" | ||
48 | : | ||
49 | : "i" (ALLOWINT) | ||
50 | : "memory"); | ||
51 | #endif | ||
52 | } | ||
53 | |||
54 | static inline unsigned long arch_local_irq_save(void) | ||
55 | { | ||
56 | unsigned long flags = arch_local_save_flags(); | ||
57 | arch_local_irq_disable(); | ||
58 | return flags; | ||
59 | } | ||
60 | |||
61 | static inline void arch_local_irq_restore(unsigned long flags) | ||
62 | { | ||
63 | asm volatile ("movew %0,%%sr" : : "d" (flags) : "memory"); | ||
64 | } | ||
65 | |||
66 | static inline bool arch_irqs_disabled_flags(unsigned long flags) | ||
67 | { | ||
68 | return (flags & ~ALLOWINT) != 0; | ||
69 | } | ||
70 | |||
71 | static inline bool arch_irqs_disabled(void) | ||
72 | { | ||
73 | return arch_irqs_disabled_flags(arch_local_save_flags()); | ||
74 | } | ||
75 | |||
76 | #endif /* _M68K_IRQFLAGS_H */ | ||
diff --git a/arch/m68k/include/asm/system_mm.h b/arch/m68k/include/asm/system_mm.h index dbb6515ffd5b..12053c44cccf 100644 --- a/arch/m68k/include/asm/system_mm.h +++ b/arch/m68k/include/asm/system_mm.h | |||
@@ -3,6 +3,7 @@ | |||
3 | 3 | ||
4 | #include <linux/linkage.h> | 4 | #include <linux/linkage.h> |
5 | #include <linux/kernel.h> | 5 | #include <linux/kernel.h> |
6 | #include <linux/irqflags.h> | ||
6 | #include <asm/segment.h> | 7 | #include <asm/segment.h> |
7 | #include <asm/entry.h> | 8 | #include <asm/entry.h> |
8 | 9 | ||
@@ -62,30 +63,6 @@ asmlinkage void resume(void); | |||
62 | #define smp_wmb() barrier() | 63 | #define smp_wmb() barrier() |
63 | #define smp_read_barrier_depends() ((void)0) | 64 | #define smp_read_barrier_depends() ((void)0) |
64 | 65 | ||
65 | /* interrupt control.. */ | ||
66 | #if 0 | ||
67 | #define local_irq_enable() asm volatile ("andiw %0,%%sr": : "i" (ALLOWINT) : "memory") | ||
68 | #else | ||
69 | #include <linux/hardirq.h> | ||
70 | #define local_irq_enable() ({ \ | ||
71 | if (MACH_IS_Q40 || !hardirq_count()) \ | ||
72 | asm volatile ("andiw %0,%%sr": : "i" (ALLOWINT) : "memory"); \ | ||
73 | }) | ||
74 | #endif | ||
75 | #define local_irq_disable() asm volatile ("oriw #0x0700,%%sr": : : "memory") | ||
76 | #define local_save_flags(x) asm volatile ("movew %%sr,%0":"=d" (x) : : "memory") | ||
77 | #define local_irq_restore(x) asm volatile ("movew %0,%%sr": :"d" (x) : "memory") | ||
78 | |||
79 | static inline int irqs_disabled(void) | ||
80 | { | ||
81 | unsigned long flags; | ||
82 | local_save_flags(flags); | ||
83 | return flags & ~ALLOWINT; | ||
84 | } | ||
85 | |||
86 | /* For spinlocks etc */ | ||
87 | #define local_irq_save(x) ({ local_save_flags(x); local_irq_disable(); }) | ||
88 | |||
89 | #define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) | 66 | #define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) |
90 | 67 | ||
91 | struct __xchg_dummy { unsigned long a[100]; }; | 68 | struct __xchg_dummy { unsigned long a[100]; }; |
diff --git a/arch/m68k/include/asm/system_no.h b/arch/m68k/include/asm/system_no.h index 3c0718d74398..20126c09794e 100644 --- a/arch/m68k/include/asm/system_no.h +++ b/arch/m68k/include/asm/system_no.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define _M68KNOMMU_SYSTEM_H | 2 | #define _M68KNOMMU_SYSTEM_H |
3 | 3 | ||
4 | #include <linux/linkage.h> | 4 | #include <linux/linkage.h> |
5 | #include <linux/irqflags.h> | ||
5 | #include <asm/segment.h> | 6 | #include <asm/segment.h> |
6 | #include <asm/entry.h> | 7 | #include <asm/entry.h> |
7 | 8 | ||
@@ -46,54 +47,6 @@ asmlinkage void resume(void); | |||
46 | (last) = _last; \ | 47 | (last) = _last; \ |
47 | } | 48 | } |
48 | 49 | ||
49 | #ifdef CONFIG_COLDFIRE | ||
50 | #define local_irq_enable() __asm__ __volatile__ ( \ | ||
51 | "move %/sr,%%d0\n\t" \ | ||
52 | "andi.l #0xf8ff,%%d0\n\t" \ | ||
53 | "move %%d0,%/sr\n" \ | ||
54 | : /* no outputs */ \ | ||
55 | : \ | ||
56 | : "cc", "%d0", "memory") | ||
57 | #define local_irq_disable() __asm__ __volatile__ ( \ | ||
58 | "move %/sr,%%d0\n\t" \ | ||
59 | "ori.l #0x0700,%%d0\n\t" \ | ||
60 | "move %%d0,%/sr\n" \ | ||
61 | : /* no outputs */ \ | ||
62 | : \ | ||
63 | : "cc", "%d0", "memory") | ||
64 | /* For spinlocks etc */ | ||
65 | #define local_irq_save(x) __asm__ __volatile__ ( \ | ||
66 | "movew %%sr,%0\n\t" \ | ||
67 | "movew #0x0700,%%d0\n\t" \ | ||
68 | "or.l %0,%%d0\n\t" \ | ||
69 | "movew %%d0,%/sr" \ | ||
70 | : "=d" (x) \ | ||
71 | : \ | ||
72 | : "cc", "%d0", "memory") | ||
73 | #else | ||
74 | |||
75 | /* portable version */ /* FIXME - see entry.h*/ | ||
76 | #define ALLOWINT 0xf8ff | ||
77 | |||
78 | #define local_irq_enable() asm volatile ("andiw %0,%%sr": : "i" (ALLOWINT) : "memory") | ||
79 | #define local_irq_disable() asm volatile ("oriw #0x0700,%%sr": : : "memory") | ||
80 | #endif | ||
81 | |||
82 | #define local_save_flags(x) asm volatile ("movew %%sr,%0":"=d" (x) : : "memory") | ||
83 | #define local_irq_restore(x) asm volatile ("movew %0,%%sr": :"d" (x) : "memory") | ||
84 | |||
85 | /* For spinlocks etc */ | ||
86 | #ifndef local_irq_save | ||
87 | #define local_irq_save(x) do { local_save_flags(x); local_irq_disable(); } while (0) | ||
88 | #endif | ||
89 | |||
90 | #define irqs_disabled() \ | ||
91 | ({ \ | ||
92 | unsigned long flags; \ | ||
93 | local_save_flags(flags); \ | ||
94 | ((flags & 0x0700) == 0x0700); \ | ||
95 | }) | ||
96 | |||
97 | #define iret() __asm__ __volatile__ ("rte": : :"memory", "sp", "cc") | 50 | #define iret() __asm__ __volatile__ ("rte": : :"memory", "sp", "cc") |
98 | 51 | ||
99 | /* | 52 | /* |
@@ -206,12 +159,4 @@ static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int siz | |||
206 | #define arch_align_stack(x) (x) | 159 | #define arch_align_stack(x) (x) |
207 | 160 | ||
208 | 161 | ||
209 | static inline int irqs_disabled_flags(unsigned long flags) | ||
210 | { | ||
211 | if (flags & 0x0700) | ||
212 | return 0; | ||
213 | else | ||
214 | return 1; | ||
215 | } | ||
216 | |||
217 | #endif /* _M68KNOMMU_SYSTEM_H */ | 162 | #endif /* _M68KNOMMU_SYSTEM_H */ |