Separate arch_uatomic*.h from arch*.h
[urcu.git] / urcu / arch_s390.h
1 #ifndef _ARCH_S390_H
2 #define _ARCH_S390_H
3
4 /*
5 * Trivial definitions for the S390 architecture based on information from the
6 * Principles of Operation "CPU Serialization" (5-91), "BRANCH ON CONDITION"
7 * (7-25) and "STORE CLOCK" (7-169).
8 *
9 * Copyright (c) 2009 Novell, Inc.
10 * Author: Jan Blunck <jblunck@suse.de>
11 *
12 * Permission is hereby granted, free of charge, to any person obtaining a copy
13 * of this software and associated documentation files (the "Software"), to
14 * deal in the Software without restriction, including without limitation the
15 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
16 * sell copies of the Software, and to permit persons to whom the Software is
17 * furnished to do so, subject to the following conditions:
18 *
19 * The above copyright notice and this permission notice shall be included in
20 * all copies or substantial portions of the Software.
21 *
22 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
28 * IN THE SOFTWARE.
29 */
30
31 #include <compiler.h>
32
33 #define CONFIG_HAVE_MEM_COHERENCY
34 /* Assume SMP machine, given we don't have this information */
35 #define CONFIG_SMP 1
36
37 #ifndef BITS_PER_LONG
38 #define BITS_PER_LONG (__SIZEOF_LONG__ * 8)
39 #endif
40
41 #define mb() __asm__ __volatile__("bcr 15,0" : : : "memory")
42 #define rmb() __asm__ __volatile__("bcr 15,0" : : : "memory");
43 #define wmb() __asm__ __volatile__("bcr 15,0" : : : "memory");
44 #define mc() barrier()
45 #define rmc() barrier()
46 #define wmc() barrier()
47
48 #define smp_mb() mb()
49 #define smp_rmb() rmb()
50 #define smp_wmb() wmb()
51 #define smp_mc() mc()
52 #define smp_rmc() rmc()
53 #define smp_wmc() wmc()
54
55 /* Nop everywhere except on alpha. */
56 #define smp_read_barrier_depends()
57
58 static inline void cpu_relax(void)
59 {
60 barrier();
61 }
62
63 static inline void sync_core()
64 {
65 __asm__ __volatile__("bcr 15,0" : : : "memory");
66 }
67
68 typedef unsigned long long cycles_t;
69
70 static inline cycles_t get_cycles (void)
71 {
72 cycles_t cycles;
73
74 __asm__ __volatile__("stck %0" : "=m" (cycles) : : "cc", "memory" );
75
76 return cycles;
77 }
78
79 #endif /* _ARCH_S390_H */
This page took 0.032478 seconds and 5 git commands to generate.