diff options
Diffstat (limited to 'arch/frv/include')
-rw-r--r-- | arch/frv/include/asm/atomic.h | 68 | ||||
-rw-r--r-- | arch/frv/include/asm/perf_counter.h | 17 | ||||
-rw-r--r-- | arch/frv/include/asm/system.h | 2 | ||||
-rw-r--r-- | arch/frv/include/asm/unistd.h | 4 |
4 files changed, 88 insertions, 3 deletions
diff --git a/arch/frv/include/asm/atomic.h b/arch/frv/include/asm/atomic.h index 0409d981fd39..00a57af79afc 100644 --- a/arch/frv/include/asm/atomic.h +++ b/arch/frv/include/asm/atomic.h | |||
@@ -121,10 +121,72 @@ static inline void atomic_dec(atomic_t *v) | |||
121 | #define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0) | 121 | #define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0) |
122 | #define atomic_inc_and_test(v) (atomic_add_return(1, (v)) == 0) | 122 | #define atomic_inc_and_test(v) (atomic_add_return(1, (v)) == 0) |
123 | 123 | ||
124 | /* | ||
125 | * 64-bit atomic ops | ||
126 | */ | ||
127 | typedef struct { | ||
128 | volatile long long counter; | ||
129 | } atomic64_t; | ||
130 | |||
131 | #define ATOMIC64_INIT(i) { (i) } | ||
132 | |||
133 | static inline long long atomic64_read(atomic64_t *v) | ||
134 | { | ||
135 | long long counter; | ||
136 | |||
137 | asm("ldd%I1 %M1,%0" | ||
138 | : "=e"(counter) | ||
139 | : "m"(v->counter)); | ||
140 | return counter; | ||
141 | } | ||
142 | |||
143 | static inline void atomic64_set(atomic64_t *v, long long i) | ||
144 | { | ||
145 | asm volatile("std%I0 %1,%M0" | ||
146 | : "=m"(v->counter) | ||
147 | : "e"(i)); | ||
148 | } | ||
149 | |||
150 | extern long long atomic64_inc_return(atomic64_t *v); | ||
151 | extern long long atomic64_dec_return(atomic64_t *v); | ||
152 | extern long long atomic64_add_return(long long i, atomic64_t *v); | ||
153 | extern long long atomic64_sub_return(long long i, atomic64_t *v); | ||
154 | |||
155 | static inline long long atomic64_add_negative(long long i, atomic64_t *v) | ||
156 | { | ||
157 | return atomic64_add_return(i, v) < 0; | ||
158 | } | ||
159 | |||
160 | static inline void atomic64_add(long long i, atomic64_t *v) | ||
161 | { | ||
162 | atomic64_add_return(i, v); | ||
163 | } | ||
164 | |||
165 | static inline void atomic64_sub(long long i, atomic64_t *v) | ||
166 | { | ||
167 | atomic64_sub_return(i, v); | ||
168 | } | ||
169 | |||
170 | static inline void atomic64_inc(atomic64_t *v) | ||
171 | { | ||
172 | atomic64_inc_return(v); | ||
173 | } | ||
174 | |||
175 | static inline void atomic64_dec(atomic64_t *v) | ||
176 | { | ||
177 | atomic64_dec_return(v); | ||
178 | } | ||
179 | |||
180 | #define atomic64_sub_and_test(i,v) (atomic64_sub_return((i), (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) | ||
183 | |||
124 | /*****************************************************************************/ | 184 | /*****************************************************************************/ |
125 | /* | 185 | /* |
126 | * exchange value with memory | 186 | * exchange value with memory |
127 | */ | 187 | */ |
188 | extern uint64_t __xchg_64(uint64_t i, volatile void *v); | ||
189 | |||
128 | #ifndef CONFIG_FRV_OUTOFLINE_ATOMIC_OPS | 190 | #ifndef CONFIG_FRV_OUTOFLINE_ATOMIC_OPS |
129 | 191 | ||
130 | #define xchg(ptr, x) \ | 192 | #define xchg(ptr, x) \ |
@@ -174,8 +236,10 @@ extern uint32_t __xchg_32(uint32_t i, volatile void *v); | |||
174 | 236 | ||
175 | #define tas(ptr) (xchg((ptr), 1)) | 237 | #define tas(ptr) (xchg((ptr), 1)) |
176 | 238 | ||
177 | #define atomic_cmpxchg(v, old, new) (cmpxchg(&((v)->counter), old, new)) | 239 | #define atomic_cmpxchg(v, old, new) (cmpxchg(&(v)->counter, old, new)) |
178 | #define atomic_xchg(v, new) (xchg(&((v)->counter), new)) | 240 | #define atomic_xchg(v, new) (xchg(&(v)->counter, new)) |
241 | #define atomic64_cmpxchg(v, old, new) (__cmpxchg_64(old, new, &(v)->counter)) | ||
242 | #define atomic64_xchg(v, new) (__xchg_64(new, &(v)->counter)) | ||
179 | 243 | ||
180 | static __inline__ int atomic_add_unless(atomic_t *v, int a, int u) | 244 | static __inline__ int atomic_add_unless(atomic_t *v, int a, int u) |
181 | { | 245 | { |
diff --git a/arch/frv/include/asm/perf_counter.h b/arch/frv/include/asm/perf_counter.h new file mode 100644 index 000000000000..ccf726e61b2e --- /dev/null +++ b/arch/frv/include/asm/perf_counter.h | |||
@@ -0,0 +1,17 @@ | |||
1 | /* FRV performance counter support | ||
2 | * | ||
3 | * Copyright (C) 2009 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 Licence | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the Licence, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #ifndef _ASM_PERF_COUNTER_H | ||
13 | #define _ASM_PERF_COUNTER_H | ||
14 | |||
15 | #define PERF_COUNTER_INDEX_OFFSET 0 | ||
16 | |||
17 | #endif /* _ASM_PERF_COUNTER_H */ | ||
diff --git a/arch/frv/include/asm/system.h b/arch/frv/include/asm/system.h index 7742ec000cc4..efd22d9077ac 100644 --- a/arch/frv/include/asm/system.h +++ b/arch/frv/include/asm/system.h | |||
@@ -208,6 +208,8 @@ extern void free_initmem(void); | |||
208 | * - if (*ptr == test) then orig = *ptr; *ptr = test; | 208 | * - if (*ptr == test) then orig = *ptr; *ptr = test; |
209 | * - if (*ptr != test) then orig = *ptr; | 209 | * - if (*ptr != test) then orig = *ptr; |
210 | */ | 210 | */ |
211 | extern uint64_t __cmpxchg_64(uint64_t test, uint64_t new, volatile uint64_t *v); | ||
212 | |||
211 | #ifndef CONFIG_FRV_OUTOFLINE_ATOMIC_OPS | 213 | #ifndef CONFIG_FRV_OUTOFLINE_ATOMIC_OPS |
212 | 214 | ||
213 | #define cmpxchg(ptr, test, new) \ | 215 | #define cmpxchg(ptr, test, new) \ |
diff --git a/arch/frv/include/asm/unistd.h b/arch/frv/include/asm/unistd.h index 96d78d5d2c41..4a8fb427ce0a 100644 --- a/arch/frv/include/asm/unistd.h +++ b/arch/frv/include/asm/unistd.h | |||
@@ -341,10 +341,12 @@ | |||
341 | #define __NR_inotify_init1 332 | 341 | #define __NR_inotify_init1 332 |
342 | #define __NR_preadv 333 | 342 | #define __NR_preadv 333 |
343 | #define __NR_pwritev 334 | 343 | #define __NR_pwritev 334 |
344 | #define __NR_rt_tgsigqueueinfo 335 | ||
345 | #define __NR_perf_counter_open 336 | ||
344 | 346 | ||
345 | #ifdef __KERNEL__ | 347 | #ifdef __KERNEL__ |
346 | 348 | ||
347 | #define NR_syscalls 335 | 349 | #define NR_syscalls 337 |
348 | 350 | ||
349 | #define __ARCH_WANT_IPC_PARSE_VERSION | 351 | #define __ARCH_WANT_IPC_PARSE_VERSION |
350 | /* #define __ARCH_WANT_OLD_READDIR */ | 352 | /* #define __ARCH_WANT_OLD_READDIR */ |