]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blame - arch/s390/include/asm/ctl_reg.h
Merge branches 'pm-cpu', 'pm-cpuidle' and 'pm-domains'
[mirror_ubuntu-zesty-kernel.git] / arch / s390 / include / asm / ctl_reg.h
CommitLineData
a0616cde
DH
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
acf6a004
MH
10#include <linux/bug.h>
11
12325f09
HC
12#define __ctl_load(array, low, high) { \
13 typedef struct { char _[sizeof(array)]; } addrtype; \
14 \
15 BUILD_BUG_ON(sizeof(addrtype) != (high - low + 1) * sizeof(long));\
16 asm volatile( \
5a79859a 17 " lctlg %1,%2,%0\n" \
12325f09
HC
18 : : "Q" (*(addrtype *)(&array)), "i" (low), "i" (high));\
19}
20
21#define __ctl_store(array, low, high) { \
22 typedef struct { char _[sizeof(array)]; } addrtype; \
23 \
24 BUILD_BUG_ON(sizeof(addrtype) != (high - low + 1) * sizeof(long));\
25 asm volatile( \
5a79859a 26 " stctg %1,%2,%0\n" \
12325f09
HC
27 : "=Q" (*(addrtype *)(&array)) \
28 : "i" (low), "i" (high)); \
29}
30
31static inline void __ctl_set_bit(unsigned int cr, unsigned int bit)
32{
33 unsigned long reg;
34
35 __ctl_store(reg, cr, cr);
36 reg |= 1UL << bit;
37 __ctl_load(reg, cr, cr);
38}
39
40static inline void __ctl_clear_bit(unsigned int cr, unsigned int bit)
41{
42 unsigned long reg;
43
44 __ctl_store(reg, cr, cr);
45 reg &= ~(1UL << bit);
46 __ctl_load(reg, cr, cr);
47}
48
9977e886
HB
49void __ctl_set_vx(void);
50
12325f09
HC
51void smp_ctl_set_bit(int cr, int bit);
52void smp_ctl_clear_bit(int cr, int bit);
a0616cde 53
5f4e87a2
HC
54union ctlreg0 {
55 unsigned long val;
56 struct {
5f4e87a2 57 unsigned long : 32;
5f4e87a2
HC
58 unsigned long : 3;
59 unsigned long lap : 1; /* Low-address-protection control */
60 unsigned long : 4;
61 unsigned long edat : 1; /* Enhanced-DAT-enablement control */
cad49cfc
HC
62 unsigned long : 4;
63 unsigned long afp : 1; /* AFP-register control */
64 unsigned long vx : 1; /* Vector enablement control */
65 unsigned long : 17;
5f4e87a2
HC
66 };
67};
68
a0616cde 69#ifdef CONFIG_SMP
12325f09
HC
70# define ctl_set_bit(cr, bit) smp_ctl_set_bit(cr, bit)
71# define ctl_clear_bit(cr, bit) smp_ctl_clear_bit(cr, bit)
a0616cde 72#else
12325f09
HC
73# define ctl_set_bit(cr, bit) __ctl_set_bit(cr, bit)
74# define ctl_clear_bit(cr, bit) __ctl_clear_bit(cr, bit)
75#endif
a0616cde
DH
76
77#endif /* __ASM_CTL_REG_H */