aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/include/asm/ctl_reg.h
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2012-03-28 13:30:02 -0400
committerDavid Howells <dhowells@redhat.com>2012-03-28 13:30:02 -0400
commita0616cdebcfd575dcd4c46102d1b52fbb827fc29 (patch)
tree49c67a23f3bcdb72a94317ddeff65e450b574746 /arch/s390/include/asm/ctl_reg.h
parentae3a197e3d0bfe3f4bf1693723e82dc018c096f3 (diff)
Disintegrate asm/system.h for S390
Disintegrate asm/system.h for S390. Signed-off-by: David Howells <dhowells@redhat.com> cc: linux-s390@vger.kernel.org
Diffstat (limited to 'arch/s390/include/asm/ctl_reg.h')
-rw-r--r--arch/s390/include/asm/ctl_reg.h76
1 files changed, 76 insertions, 0 deletions
diff --git a/arch/s390/include/asm/ctl_reg.h b/arch/s390/include/asm/ctl_reg.h
new file mode 100644
index 000000000000..ecde9417d669
--- /dev/null
+++ b/arch/s390/include/asm/ctl_reg.h
@@ -0,0 +1,76 @@
1/*
2 * Copyright IBM Corp. 1999, 2009
3 *
4 * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
5 */
6
7#ifndef __ASM_CTL_REG_H
8#define __ASM_CTL_REG_H
9
10#ifdef __s390x__
11
12#define __ctl_load(array, low, high) ({ \
13 typedef struct { char _[sizeof(array)]; } addrtype; \
14 asm volatile( \
15 " lctlg %1,%2,%0\n" \
16 : : "Q" (*(addrtype *)(&array)), \
17 "i" (low), "i" (high)); \
18 })
19
20#define __ctl_store(array, low, high) ({ \
21 typedef struct { char _[sizeof(array)]; } addrtype; \
22 asm volatile( \
23 " stctg %1,%2,%0\n" \
24 : "=Q" (*(addrtype *)(&array)) \
25 : "i" (low), "i" (high)); \
26 })
27
28#else /* __s390x__ */
29
30#define __ctl_load(array, low, high) ({ \
31 typedef struct { char _[sizeof(array)]; } addrtype; \
32 asm volatile( \
33 " lctl %1,%2,%0\n" \
34 : : "Q" (*(addrtype *)(&array)), \
35 "i" (low), "i" (high)); \
36})
37
38#define __ctl_store(array, low, high) ({ \
39 typedef struct { char _[sizeof(array)]; } addrtype; \
40 asm volatile( \
41 " stctl %1,%2,%0\n" \
42 : "=Q" (*(addrtype *)(&array)) \
43 : "i" (low), "i" (high)); \
44 })
45
46#endif /* __s390x__ */
47
48#define __ctl_set_bit(cr, bit) ({ \
49 unsigned long __dummy; \
50 __ctl_store(__dummy, cr, cr); \
51 __dummy |= 1UL << (bit); \
52 __ctl_load(__dummy, cr, cr); \
53})
54
55#define __ctl_clear_bit(cr, bit) ({ \
56 unsigned long __dummy; \
57 __ctl_store(__dummy, cr, cr); \
58 __dummy &= ~(1UL << (bit)); \
59 __ctl_load(__dummy, cr, cr); \
60})
61
62#ifdef CONFIG_SMP
63
64extern void smp_ctl_set_bit(int cr, int bit);
65extern void smp_ctl_clear_bit(int cr, int bit);
66#define ctl_set_bit(cr, bit) smp_ctl_set_bit(cr, bit)
67#define ctl_clear_bit(cr, bit) smp_ctl_clear_bit(cr, bit)
68
69#else
70
71#define ctl_set_bit(cr, bit) __ctl_set_bit(cr, bit)
72#define ctl_clear_bit(cr, bit) __ctl_clear_bit(cr, bit)
73
74#endif /* CONFIG_SMP */
75
76#endif /* __ASM_CTL_REG_H */