aboutsummaryrefslogtreecommitdiffstats
path: root/arch/frv
diff options
context:
space:
mode:
Diffstat (limited to 'arch/frv')
-rw-r--r--arch/frv/include/asm/atomic.h57
-rw-r--r--arch/frv/include/asm/barrier.h29
-rw-r--r--arch/frv/include/asm/bug.h2
-rw-r--r--arch/frv/include/asm/cmpxchg.h (renamed from arch/frv/include/asm/system.h)98
-rw-r--r--arch/frv/include/asm/exec.h17
-rw-r--r--arch/frv/include/asm/switch_to.h35
-rw-r--r--arch/frv/kernel/debug-stub.c1
-rw-r--r--arch/frv/kernel/gdb-io.c1
-rw-r--r--arch/frv/kernel/gdb-stub.c1
-rw-r--r--arch/frv/kernel/irq-mb93091.c1
-rw-r--r--arch/frv/kernel/irq-mb93093.c1
-rw-r--r--arch/frv/kernel/irq-mb93493.c1
-rw-r--r--arch/frv/kernel/irq.c1
-rw-r--r--arch/frv/kernel/process.c1
-rw-r--r--arch/frv/kernel/ptrace.c1
-rw-r--r--arch/frv/kernel/traps.c1
-rw-r--r--arch/frv/mm/fault.c1
-rw-r--r--arch/frv/mm/init.c1
-rw-r--r--arch/frv/mm/kmap.c1
19 files changed, 140 insertions, 111 deletions
diff --git a/arch/frv/include/asm/atomic.h b/arch/frv/include/asm/atomic.h
index 0d8a7d661740..b86329d0e316 100644
--- a/arch/frv/include/asm/atomic.h
+++ b/arch/frv/include/asm/atomic.h
@@ -16,7 +16,7 @@
16 16
17#include <linux/types.h> 17#include <linux/types.h>
18#include <asm/spr-regs.h> 18#include <asm/spr-regs.h>
19#include <asm/system.h> 19#include <asm/cmpxchg.h>
20 20
21#ifdef CONFIG_SMP 21#ifdef CONFIG_SMP
22#error not SMP safe 22#error not SMP safe
@@ -181,61 +181,6 @@ static inline void atomic64_dec(atomic64_t *v)
181#define atomic64_dec_and_test(v) (atomic64_dec_return((v)) == 0) 181#define atomic64_dec_and_test(v) (atomic64_dec_return((v)) == 0)
182#define atomic64_inc_and_test(v) (atomic64_inc_return((v)) == 0) 182#define atomic64_inc_and_test(v) (atomic64_inc_return((v)) == 0)
183 183
184/*****************************************************************************/
185/*
186 * exchange value with memory
187 */
188extern uint64_t __xchg_64(uint64_t i, volatile void *v);
189
190#ifndef CONFIG_FRV_OUTOFLINE_ATOMIC_OPS
191
192#define xchg(ptr, x) \
193({ \
194 __typeof__(ptr) __xg_ptr = (ptr); \
195 __typeof__(*(ptr)) __xg_orig; \
196 \
197 switch (sizeof(__xg_orig)) { \
198 case 4: \
199 asm volatile( \
200 "swap%I0 %M0,%1" \
201 : "+m"(*__xg_ptr), "=r"(__xg_orig) \
202 : "1"(x) \
203 : "memory" \
204 ); \
205 break; \
206 \
207 default: \
208 __xg_orig = (__typeof__(__xg_orig))0; \
209 asm volatile("break"); \
210 break; \
211 } \
212 \
213 __xg_orig; \
214})
215
216#else
217
218extern uint32_t __xchg_32(uint32_t i, volatile void *v);
219
220#define xchg(ptr, x) \
221({ \
222 __typeof__(ptr) __xg_ptr = (ptr); \
223 __typeof__(*(ptr)) __xg_orig; \
224 \
225 switch (sizeof(__xg_orig)) { \
226 case 4: __xg_orig = (__typeof__(*(ptr))) __xchg_32((uint32_t) x, __xg_ptr); break; \
227 default: \
228 __xg_orig = (__typeof__(__xg_orig))0; \
229 asm volatile("break"); \
230 break; \
231 } \
232 __xg_orig; \
233})
234
235#endif
236
237#define tas(ptr) (xchg((ptr), 1))
238
239#define atomic_cmpxchg(v, old, new) (cmpxchg(&(v)->counter, old, new)) 184#define atomic_cmpxchg(v, old, new) (cmpxchg(&(v)->counter, old, new))
240#define atomic_xchg(v, new) (xchg(&(v)->counter, new)) 185#define atomic_xchg(v, new) (xchg(&(v)->counter, new))
241#define atomic64_cmpxchg(v, old, new) (__cmpxchg_64(old, new, &(v)->counter)) 186#define atomic64_cmpxchg(v, old, new) (__cmpxchg_64(old, new, &(v)->counter))
diff --git a/arch/frv/include/asm/barrier.h b/arch/frv/include/asm/barrier.h
new file mode 100644
index 000000000000..06776ad9f5e9
--- /dev/null
+++ b/arch/frv/include/asm/barrier.h
@@ -0,0 +1,29 @@
1/* FR-V CPU memory barrier definitions
2 *
3 * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _ASM_BARRIER_H
13#define _ASM_BARRIER_H
14
15#define nop() asm volatile ("nop"::)
16
17#define mb() asm volatile ("membar" : : :"memory")
18#define rmb() asm volatile ("membar" : : :"memory")
19#define wmb() asm volatile ("membar" : : :"memory")
20#define read_barrier_depends() do { } while (0)
21
22#define smp_mb() barrier()
23#define smp_rmb() barrier()
24#define smp_wmb() barrier()
25#define smp_read_barrier_depends() do {} while(0)
26#define set_mb(var, value) \
27 do { var = (value); barrier(); } while (0)
28
29#endif /* _ASM_BARRIER_H */
diff --git a/arch/frv/include/asm/bug.h b/arch/frv/include/asm/bug.h
index 2e054508a2f6..dd01bcf42ee6 100644
--- a/arch/frv/include/asm/bug.h
+++ b/arch/frv/include/asm/bug.h
@@ -51,4 +51,6 @@ do { \
51 51
52#include <asm-generic/bug.h> 52#include <asm-generic/bug.h>
53 53
54extern void die_if_kernel(const char *, ...) __attribute__((format(printf, 1, 2)));
55
54#endif 56#endif
diff --git a/arch/frv/include/asm/system.h b/arch/frv/include/asm/cmpxchg.h
index 6c10fd2c626d..5b04dd0aecab 100644
--- a/arch/frv/include/asm/system.h
+++ b/arch/frv/include/asm/cmpxchg.h
@@ -1,6 +1,9 @@
1/* system.h: FR-V CPU control definitions 1/* xchg and cmpxchg operation emulation for FR-V
2 * 2 *
3 * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. 3 * For an explanation of how atomic ops work in this arch, see:
4 * Documentation/frv/atomic-ops.txt
5 *
6 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com) 7 * Written by David Howells (dhowells@redhat.com)
5 * 8 *
6 * This program is free software; you can redistribute it and/or 9 * This program is free software; you can redistribute it and/or
@@ -8,54 +11,65 @@
8 * as published by the Free Software Foundation; either version 11 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version. 12 * 2 of the License, or (at your option) any later version.
10 */ 13 */
11 14#ifndef _ASM_CMPXCHG_H
12#ifndef _ASM_SYSTEM_H 15#define _ASM_CMPXCHG_H
13#define _ASM_SYSTEM_H
14 16
15#include <linux/types.h> 17#include <linux/types.h>
16#include <linux/linkage.h>
17#include <linux/kernel.h>
18
19struct thread_struct;
20 18
19/*****************************************************************************/
21/* 20/*
22 * switch_to(prev, next) should switch from task `prev' to `next' 21 * exchange value with memory
23 * `prev' will never be the same as `next'.
24 * The `mb' is to tell GCC not to cache `current' across this call.
25 */ 22 */
26extern asmlinkage 23extern uint64_t __xchg_64(uint64_t i, volatile void *v);
27struct task_struct *__switch_to(struct thread_struct *prev_thread,
28 struct thread_struct *next_thread,
29 struct task_struct *prev);
30
31#define switch_to(prev, next, last) \
32do { \
33 (prev)->thread.sched_lr = \
34 (unsigned long) __builtin_return_address(0); \
35 (last) = __switch_to(&(prev)->thread, &(next)->thread, (prev)); \
36 mb(); \
37} while(0)
38 24
39/* 25#ifndef CONFIG_FRV_OUTOFLINE_ATOMIC_OPS
40 * Force strict CPU ordering. 26
41 */ 27#define xchg(ptr, x) \
42#define nop() asm volatile ("nop"::) 28({ \
43#define mb() asm volatile ("membar" : : :"memory") 29 __typeof__(ptr) __xg_ptr = (ptr); \
44#define rmb() asm volatile ("membar" : : :"memory") 30 __typeof__(*(ptr)) __xg_orig; \
45#define wmb() asm volatile ("membar" : : :"memory") 31 \
46#define read_barrier_depends() do { } while (0) 32 switch (sizeof(__xg_orig)) { \
33 case 4: \
34 asm volatile( \
35 "swap%I0 %M0,%1" \
36 : "+m"(*__xg_ptr), "=r"(__xg_orig) \
37 : "1"(x) \
38 : "memory" \
39 ); \
40 break; \
41 \
42 default: \
43 __xg_orig = (__typeof__(__xg_orig))0; \
44 asm volatile("break"); \
45 break; \
46 } \
47 \
48 __xg_orig; \
49})
47 50
48#define smp_mb() barrier() 51#else
49#define smp_rmb() barrier()
50#define smp_wmb() barrier()
51#define smp_read_barrier_depends() do {} while(0)
52#define set_mb(var, value) \
53 do { var = (value); barrier(); } while (0)
54 52
55extern void die_if_kernel(const char *, ...) __attribute__((format(printf, 1, 2))); 53extern uint32_t __xchg_32(uint32_t i, volatile void *v);
56extern void free_initmem(void); 54
55#define xchg(ptr, x) \
56({ \
57 __typeof__(ptr) __xg_ptr = (ptr); \
58 __typeof__(*(ptr)) __xg_orig; \
59 \
60 switch (sizeof(__xg_orig)) { \
61 case 4: __xg_orig = (__typeof__(*(ptr))) __xchg_32((uint32_t) x, __xg_ptr); break; \
62 default: \
63 __xg_orig = (__typeof__(__xg_orig))0; \
64 asm volatile("break"); \
65 break; \
66 } \
67 __xg_orig; \
68})
69
70#endif
57 71
58#define arch_align_stack(x) (x) 72#define tas(ptr) (xchg((ptr), 1))
59 73
60/*****************************************************************************/ 74/*****************************************************************************/
61/* 75/*
@@ -155,4 +169,4 @@ static inline unsigned long __cmpxchg_local(volatile void *ptr,
155 (unsigned long)(n), sizeof(*(ptr)))) 169 (unsigned long)(n), sizeof(*(ptr))))
156#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n)) 170#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
157 171
158#endif /* _ASM_SYSTEM_H */ 172#endif /* _ASM_CMPXCHG_H */
diff --git a/arch/frv/include/asm/exec.h b/arch/frv/include/asm/exec.h
new file mode 100644
index 000000000000..65c91305d4a7
--- /dev/null
+++ b/arch/frv/include/asm/exec.h
@@ -0,0 +1,17 @@
1/* FR-V CPU executable handling
2 *
3 * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _ASM_EXEC_H
13#define _ASM_EXEC_H
14
15#define arch_align_stack(x) (x)
16
17#endif /* _ASM_EXEC_H */
diff --git a/arch/frv/include/asm/switch_to.h b/arch/frv/include/asm/switch_to.h
new file mode 100644
index 000000000000..2cf0f6a7fbb1
--- /dev/null
+++ b/arch/frv/include/asm/switch_to.h
@@ -0,0 +1,35 @@
1/* FR-V CPU basic task switching
2 *
3 * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#ifndef _ASM_SWITCH_TO_H
13#define _ASM_SWITCH_TO_H
14
15#include <linux/thread_info.h>
16
17/*
18 * switch_to(prev, next) should switch from task `prev' to `next'
19 * `prev' will never be the same as `next'.
20 * The `mb' is to tell GCC not to cache `current' across this call.
21 */
22extern asmlinkage
23struct task_struct *__switch_to(struct thread_struct *prev_thread,
24 struct thread_struct *next_thread,
25 struct task_struct *prev);
26
27#define switch_to(prev, next, last) \
28do { \
29 (prev)->thread.sched_lr = \
30 (unsigned long) __builtin_return_address(0); \
31 (last) = __switch_to(&(prev)->thread, &(next)->thread, (prev)); \
32 mb(); \
33} while(0)
34
35#endif /* _ASM_SWITCH_TO_H */
diff --git a/arch/frv/kernel/debug-stub.c b/arch/frv/kernel/debug-stub.c
index 2845139c8077..a0228f717ef2 100644
--- a/arch/frv/kernel/debug-stub.c
+++ b/arch/frv/kernel/debug-stub.c
@@ -17,7 +17,6 @@
17#include <linux/serial_reg.h> 17#include <linux/serial_reg.h>
18#include <linux/start_kernel.h> 18#include <linux/start_kernel.h>
19 19
20#include <asm/system.h>
21#include <asm/serial-regs.h> 20#include <asm/serial-regs.h>
22#include <asm/timer-regs.h> 21#include <asm/timer-regs.h>
23#include <asm/irc-regs.h> 22#include <asm/irc-regs.h>
diff --git a/arch/frv/kernel/gdb-io.c b/arch/frv/kernel/gdb-io.c
index 2ca641d199f8..0707d35079ba 100644
--- a/arch/frv/kernel/gdb-io.c
+++ b/arch/frv/kernel/gdb-io.c
@@ -19,7 +19,6 @@
19#include <linux/serial_reg.h> 19#include <linux/serial_reg.h>
20 20
21#include <asm/pgtable.h> 21#include <asm/pgtable.h>
22#include <asm/system.h>
23#include <asm/irc-regs.h> 22#include <asm/irc-regs.h>
24#include <asm/timer-regs.h> 23#include <asm/timer-regs.h>
25#include <asm/gdb-stub.h> 24#include <asm/gdb-stub.h>
diff --git a/arch/frv/kernel/gdb-stub.c b/arch/frv/kernel/gdb-stub.c
index a6d5381c94fe..bbe78b0bffec 100644
--- a/arch/frv/kernel/gdb-stub.c
+++ b/arch/frv/kernel/gdb-stub.c
@@ -126,7 +126,6 @@
126 126
127#include <asm/asm-offsets.h> 127#include <asm/asm-offsets.h>
128#include <asm/pgtable.h> 128#include <asm/pgtable.h>
129#include <asm/system.h>
130#include <asm/gdb-stub.h> 129#include <asm/gdb-stub.h>
131 130
132#define LEDS(x) do { /* *(u32*)0xe1200004 = ~(x); mb(); */ } while(0) 131#define LEDS(x) do { /* *(u32*)0xe1200004 = ~(x); mb(); */ } while(0)
diff --git a/arch/frv/kernel/irq-mb93091.c b/arch/frv/kernel/irq-mb93091.c
index 9afc2ea400dc..2cc327a1ca44 100644
--- a/arch/frv/kernel/irq-mb93091.c
+++ b/arch/frv/kernel/irq-mb93091.c
@@ -20,7 +20,6 @@
20#include <linux/bitops.h> 20#include <linux/bitops.h>
21 21
22#include <asm/io.h> 22#include <asm/io.h>
23#include <asm/system.h>
24#include <asm/delay.h> 23#include <asm/delay.h>
25#include <asm/irq.h> 24#include <asm/irq.h>
26#include <asm/irc-regs.h> 25#include <asm/irc-regs.h>
diff --git a/arch/frv/kernel/irq-mb93093.c b/arch/frv/kernel/irq-mb93093.c
index 4d4ad09d3c91..95e4eb4f1f38 100644
--- a/arch/frv/kernel/irq-mb93093.c
+++ b/arch/frv/kernel/irq-mb93093.c
@@ -20,7 +20,6 @@
20#include <linux/bitops.h> 20#include <linux/bitops.h>
21 21
22#include <asm/io.h> 22#include <asm/io.h>
23#include <asm/system.h>
24#include <asm/delay.h> 23#include <asm/delay.h>
25#include <asm/irq.h> 24#include <asm/irq.h>
26#include <asm/irc-regs.h> 25#include <asm/irc-regs.h>
diff --git a/arch/frv/kernel/irq-mb93493.c b/arch/frv/kernel/irq-mb93493.c
index 4d034c7840c9..ba648da0932d 100644
--- a/arch/frv/kernel/irq-mb93493.c
+++ b/arch/frv/kernel/irq-mb93493.c
@@ -20,7 +20,6 @@
20#include <linux/bitops.h> 20#include <linux/bitops.h>
21 21
22#include <asm/io.h> 22#include <asm/io.h>
23#include <asm/system.h>
24#include <asm/delay.h> 23#include <asm/delay.h>
25#include <asm/irq.h> 24#include <asm/irq.h>
26#include <asm/irc-regs.h> 25#include <asm/irc-regs.h>
diff --git a/arch/frv/kernel/irq.c b/arch/frv/kernel/irq.c
index 3facbc28cbbc..2239346fa3db 100644
--- a/arch/frv/kernel/irq.c
+++ b/arch/frv/kernel/irq.c
@@ -28,7 +28,6 @@
28#include <linux/atomic.h> 28#include <linux/atomic.h>
29#include <asm/io.h> 29#include <asm/io.h>
30#include <asm/smp.h> 30#include <asm/smp.h>
31#include <asm/system.h>
32#include <asm/uaccess.h> 31#include <asm/uaccess.h>
33#include <asm/pgalloc.h> 32#include <asm/pgalloc.h>
34#include <asm/delay.h> 33#include <asm/delay.h>
diff --git a/arch/frv/kernel/process.c b/arch/frv/kernel/process.c
index 29cc49783787..d4de48bd5efe 100644
--- a/arch/frv/kernel/process.c
+++ b/arch/frv/kernel/process.c
@@ -28,7 +28,6 @@
28 28
29#include <asm/asm-offsets.h> 29#include <asm/asm-offsets.h>
30#include <asm/uaccess.h> 30#include <asm/uaccess.h>
31#include <asm/system.h>
32#include <asm/setup.h> 31#include <asm/setup.h>
33#include <asm/pgtable.h> 32#include <asm/pgtable.h>
34#include <asm/tlb.h> 33#include <asm/tlb.h>
diff --git a/arch/frv/kernel/ptrace.c b/arch/frv/kernel/ptrace.c
index 9d68f7fac730..3987ff88dab0 100644
--- a/arch/frv/kernel/ptrace.c
+++ b/arch/frv/kernel/ptrace.c
@@ -26,7 +26,6 @@
26#include <asm/uaccess.h> 26#include <asm/uaccess.h>
27#include <asm/page.h> 27#include <asm/page.h>
28#include <asm/pgtable.h> 28#include <asm/pgtable.h>
29#include <asm/system.h>
30#include <asm/processor.h> 29#include <asm/processor.h>
31#include <asm/unistd.h> 30#include <asm/unistd.h>
32 31
diff --git a/arch/frv/kernel/traps.c b/arch/frv/kernel/traps.c
index 1d2dfe67d442..5cfd1420b091 100644
--- a/arch/frv/kernel/traps.c
+++ b/arch/frv/kernel/traps.c
@@ -23,7 +23,6 @@
23#include <asm/asm-offsets.h> 23#include <asm/asm-offsets.h>
24#include <asm/setup.h> 24#include <asm/setup.h>
25#include <asm/fpu.h> 25#include <asm/fpu.h>
26#include <asm/system.h>
27#include <asm/uaccess.h> 26#include <asm/uaccess.h>
28#include <asm/pgtable.h> 27#include <asm/pgtable.h>
29#include <asm/siginfo.h> 28#include <asm/siginfo.h>
diff --git a/arch/frv/mm/fault.c b/arch/frv/mm/fault.c
index a325d57a83d5..331c1e2cfb67 100644
--- a/arch/frv/mm/fault.c
+++ b/arch/frv/mm/fault.c
@@ -20,7 +20,6 @@
20#include <linux/ptrace.h> 20#include <linux/ptrace.h>
21#include <linux/hardirq.h> 21#include <linux/hardirq.h>
22 22
23#include <asm/system.h>
24#include <asm/pgtable.h> 23#include <asm/pgtable.h>
25#include <asm/uaccess.h> 24#include <asm/uaccess.h>
26#include <asm/gdb-stub.h> 25#include <asm/gdb-stub.h>
diff --git a/arch/frv/mm/init.c b/arch/frv/mm/init.c
index fbe5f0dbae06..a19effcccb34 100644
--- a/arch/frv/mm/init.c
+++ b/arch/frv/mm/init.c
@@ -33,7 +33,6 @@
33#include <asm/segment.h> 33#include <asm/segment.h>
34#include <asm/page.h> 34#include <asm/page.h>
35#include <asm/pgtable.h> 35#include <asm/pgtable.h>
36#include <asm/system.h>
37#include <asm/mmu_context.h> 36#include <asm/mmu_context.h>
38#include <asm/virtconvert.h> 37#include <asm/virtconvert.h>
39#include <asm/sections.h> 38#include <asm/sections.h>
diff --git a/arch/frv/mm/kmap.c b/arch/frv/mm/kmap.c
index fb78be38ea02..e9217e605aa8 100644
--- a/arch/frv/mm/kmap.c
+++ b/arch/frv/mm/kmap.c
@@ -21,7 +21,6 @@
21#include <asm/page.h> 21#include <asm/page.h>
22#include <asm/pgalloc.h> 22#include <asm/pgalloc.h>
23#include <asm/io.h> 23#include <asm/io.h>
24#include <asm/system.h>
25 24
26#undef DEBUG 25#undef DEBUG
27 26