diff options
author | Paul Gortmaker <paul.gortmaker@windriver.com> | 2012-04-01 16:38:46 -0400 |
---|---|---|
committer | Chris Metcalf <cmetcalf@tilera.com> | 2012-04-02 11:57:37 -0400 |
commit | 34f2c0ac111aaf090c7d2432dab532640870733a (patch) | |
tree | 3744df1dd437ecf3b0e4edf4bee2a9b4ed6e258b /arch/tile | |
parent | dd775ae2549217d3ae09363e3edb305d0fa19928 (diff) |
tile: fix multiple build failures from system.h dismantle
Commit bd119c69239322caafdb64517a806037d0d0c70a
"Disintegrate asm/system.h for Tile"
created the asm/switch_to.h file, but did not add an include
of it to all its users.
Also, commit b4816afa3986704d1404fc48e931da5135820472
"Move the asm-generic/system.h xchg() implementation to asm-generic/cmpxchg.h"
introduced the concept of asm/cmpxchg.h but the tile arch
never got one. Fork the cmpxchg content out of the asm/atomic.h
file to create one.
Acked-by: David Howells <dhowells@redhat.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
Diffstat (limited to 'arch/tile')
-rw-r--r-- | arch/tile/include/asm/atomic.h | 50 | ||||
-rw-r--r-- | arch/tile/include/asm/cmpxchg.h | 73 | ||||
-rw-r--r-- | arch/tile/kernel/process.c | 1 | ||||
-rw-r--r-- | arch/tile/kernel/stack.c | 1 |
4 files changed, 77 insertions, 48 deletions
diff --git a/arch/tile/include/asm/atomic.h b/arch/tile/include/asm/atomic.h index bb696da5d7cd..f2461429a4a4 100644 --- a/arch/tile/include/asm/atomic.h +++ b/arch/tile/include/asm/atomic.h | |||
@@ -17,6 +17,8 @@ | |||
17 | #ifndef _ASM_TILE_ATOMIC_H | 17 | #ifndef _ASM_TILE_ATOMIC_H |
18 | #define _ASM_TILE_ATOMIC_H | 18 | #define _ASM_TILE_ATOMIC_H |
19 | 19 | ||
20 | #include <asm/cmpxchg.h> | ||
21 | |||
20 | #ifndef __ASSEMBLY__ | 22 | #ifndef __ASSEMBLY__ |
21 | 23 | ||
22 | #include <linux/compiler.h> | 24 | #include <linux/compiler.h> |
@@ -121,54 +123,6 @@ static inline int atomic_read(const atomic_t *v) | |||
121 | */ | 123 | */ |
122 | #define atomic_add_negative(i, v) (atomic_add_return((i), (v)) < 0) | 124 | #define atomic_add_negative(i, v) (atomic_add_return((i), (v)) < 0) |
123 | 125 | ||
124 | /* Nonexistent functions intended to cause link errors. */ | ||
125 | extern unsigned long __xchg_called_with_bad_pointer(void); | ||
126 | extern unsigned long __cmpxchg_called_with_bad_pointer(void); | ||
127 | |||
128 | #define xchg(ptr, x) \ | ||
129 | ({ \ | ||
130 | typeof(*(ptr)) __x; \ | ||
131 | switch (sizeof(*(ptr))) { \ | ||
132 | case 4: \ | ||
133 | __x = (typeof(__x))(typeof(__x-__x))atomic_xchg( \ | ||
134 | (atomic_t *)(ptr), \ | ||
135 | (u32)(typeof((x)-(x)))(x)); \ | ||
136 | break; \ | ||
137 | case 8: \ | ||
138 | __x = (typeof(__x))(typeof(__x-__x))atomic64_xchg( \ | ||
139 | (atomic64_t *)(ptr), \ | ||
140 | (u64)(typeof((x)-(x)))(x)); \ | ||
141 | break; \ | ||
142 | default: \ | ||
143 | __xchg_called_with_bad_pointer(); \ | ||
144 | } \ | ||
145 | __x; \ | ||
146 | }) | ||
147 | |||
148 | #define cmpxchg(ptr, o, n) \ | ||
149 | ({ \ | ||
150 | typeof(*(ptr)) __x; \ | ||
151 | switch (sizeof(*(ptr))) { \ | ||
152 | case 4: \ | ||
153 | __x = (typeof(__x))(typeof(__x-__x))atomic_cmpxchg( \ | ||
154 | (atomic_t *)(ptr), \ | ||
155 | (u32)(typeof((o)-(o)))(o), \ | ||
156 | (u32)(typeof((n)-(n)))(n)); \ | ||
157 | break; \ | ||
158 | case 8: \ | ||
159 | __x = (typeof(__x))(typeof(__x-__x))atomic64_cmpxchg( \ | ||
160 | (atomic64_t *)(ptr), \ | ||
161 | (u64)(typeof((o)-(o)))(o), \ | ||
162 | (u64)(typeof((n)-(n)))(n)); \ | ||
163 | break; \ | ||
164 | default: \ | ||
165 | __cmpxchg_called_with_bad_pointer(); \ | ||
166 | } \ | ||
167 | __x; \ | ||
168 | }) | ||
169 | |||
170 | #define tas(ptr) (xchg((ptr), 1)) | ||
171 | |||
172 | #endif /* __ASSEMBLY__ */ | 126 | #endif /* __ASSEMBLY__ */ |
173 | 127 | ||
174 | #ifndef __tilegx__ | 128 | #ifndef __tilegx__ |
diff --git a/arch/tile/include/asm/cmpxchg.h b/arch/tile/include/asm/cmpxchg.h new file mode 100644 index 000000000000..276f067e3640 --- /dev/null +++ b/arch/tile/include/asm/cmpxchg.h | |||
@@ -0,0 +1,73 @@ | |||
1 | /* | ||
2 | * cmpxchg.h -- forked from asm/atomic.h with this copyright: | ||
3 | * | ||
4 | * Copyright 2010 Tilera Corporation. All Rights Reserved. | ||
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, version 2. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, but | ||
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
13 | * NON INFRINGEMENT. See the GNU General Public License for | ||
14 | * more details. | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | #ifndef _ASM_TILE_CMPXCHG_H | ||
19 | #define _ASM_TILE_CMPXCHG_H | ||
20 | |||
21 | #ifndef __ASSEMBLY__ | ||
22 | |||
23 | /* Nonexistent functions intended to cause link errors. */ | ||
24 | extern unsigned long __xchg_called_with_bad_pointer(void); | ||
25 | extern unsigned long __cmpxchg_called_with_bad_pointer(void); | ||
26 | |||
27 | #define xchg(ptr, x) \ | ||
28 | ({ \ | ||
29 | typeof(*(ptr)) __x; \ | ||
30 | switch (sizeof(*(ptr))) { \ | ||
31 | case 4: \ | ||
32 | __x = (typeof(__x))(typeof(__x-__x))atomic_xchg( \ | ||
33 | (atomic_t *)(ptr), \ | ||
34 | (u32)(typeof((x)-(x)))(x)); \ | ||
35 | break; \ | ||
36 | case 8: \ | ||
37 | __x = (typeof(__x))(typeof(__x-__x))atomic64_xchg( \ | ||
38 | (atomic64_t *)(ptr), \ | ||
39 | (u64)(typeof((x)-(x)))(x)); \ | ||
40 | break; \ | ||
41 | default: \ | ||
42 | __xchg_called_with_bad_pointer(); \ | ||
43 | } \ | ||
44 | __x; \ | ||
45 | }) | ||
46 | |||
47 | #define cmpxchg(ptr, o, n) \ | ||
48 | ({ \ | ||
49 | typeof(*(ptr)) __x; \ | ||
50 | switch (sizeof(*(ptr))) { \ | ||
51 | case 4: \ | ||
52 | __x = (typeof(__x))(typeof(__x-__x))atomic_cmpxchg( \ | ||
53 | (atomic_t *)(ptr), \ | ||
54 | (u32)(typeof((o)-(o)))(o), \ | ||
55 | (u32)(typeof((n)-(n)))(n)); \ | ||
56 | break; \ | ||
57 | case 8: \ | ||
58 | __x = (typeof(__x))(typeof(__x-__x))atomic64_cmpxchg( \ | ||
59 | (atomic64_t *)(ptr), \ | ||
60 | (u64)(typeof((o)-(o)))(o), \ | ||
61 | (u64)(typeof((n)-(n)))(n)); \ | ||
62 | break; \ | ||
63 | default: \ | ||
64 | __cmpxchg_called_with_bad_pointer(); \ | ||
65 | } \ | ||
66 | __x; \ | ||
67 | }) | ||
68 | |||
69 | #define tas(ptr) (xchg((ptr), 1)) | ||
70 | |||
71 | #endif /* __ASSEMBLY__ */ | ||
72 | |||
73 | #endif /* _ASM_TILE_CMPXCHG_H */ | ||
diff --git a/arch/tile/kernel/process.c b/arch/tile/kernel/process.c index 30caecac94dc..ee01b1c683e4 100644 --- a/arch/tile/kernel/process.c +++ b/arch/tile/kernel/process.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/tracehook.h> | 28 | #include <linux/tracehook.h> |
29 | #include <linux/signal.h> | 29 | #include <linux/signal.h> |
30 | #include <asm/stack.h> | 30 | #include <asm/stack.h> |
31 | #include <asm/switch_to.h> | ||
31 | #include <asm/homecache.h> | 32 | #include <asm/homecache.h> |
32 | #include <asm/syscalls.h> | 33 | #include <asm/syscalls.h> |
33 | #include <asm/traps.h> | 34 | #include <asm/traps.h> |
diff --git a/arch/tile/kernel/stack.c b/arch/tile/kernel/stack.c index 37ee4d037e0b..0be6b0109ce0 100644 --- a/arch/tile/kernel/stack.c +++ b/arch/tile/kernel/stack.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <asm/page.h> | 25 | #include <asm/page.h> |
26 | #include <asm/tlbflush.h> | 26 | #include <asm/tlbflush.h> |
27 | #include <asm/ucontext.h> | 27 | #include <asm/ucontext.h> |
28 | #include <asm/switch_to.h> | ||
28 | #include <asm/sigframe.h> | 29 | #include <asm/sigframe.h> |
29 | #include <asm/stack.h> | 30 | #include <asm/stack.h> |
30 | #include <arch/abi.h> | 31 | #include <arch/abi.h> |