2 * Copyright IBM Corp. 1999, 2009
4 * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
7 #ifndef __ASM_CTL_REG_H
8 #define __ASM_CTL_REG_H
10 #include <linux/bug.h>
13 # define __CTL_LOAD "lctlg"
14 # define __CTL_STORE "stctg"
16 # define __CTL_LOAD "lctl"
17 # define __CTL_STORE "stctl"
20 #define __ctl_load(array, low, high) { \
21 typedef struct { char _[sizeof(array)]; } addrtype; \
23 BUILD_BUG_ON(sizeof(addrtype) != (high - low + 1) * sizeof(long));\
25 __CTL_LOAD " %1,%2,%0\n" \
26 : : "Q" (*(addrtype *)(&array)), "i" (low), "i" (high));\
29 #define __ctl_store(array, low, high) { \
30 typedef struct { char _[sizeof(array)]; } addrtype; \
32 BUILD_BUG_ON(sizeof(addrtype) != (high - low + 1) * sizeof(long));\
34 __CTL_STORE " %1,%2,%0\n" \
35 : "=Q" (*(addrtype *)(&array)) \
36 : "i" (low), "i" (high)); \
39 static inline void __ctl_set_bit(unsigned int cr
, unsigned int bit
)
43 __ctl_store(reg
, cr
, cr
);
45 __ctl_load(reg
, cr
, cr
);
48 static inline void __ctl_clear_bit(unsigned int cr
, unsigned int bit
)
52 __ctl_store(reg
, cr
, cr
);
54 __ctl_load(reg
, cr
, cr
);
57 void smp_ctl_set_bit(int cr
, int bit
);
58 void smp_ctl_clear_bit(int cr
, int bit
);
67 unsigned long lap
: 1; /* Low-address-protection control */
69 unsigned long edat
: 1; /* Enhanced-DAT-enablement control */
75 # define ctl_set_bit(cr, bit) smp_ctl_set_bit(cr, bit)
76 # define ctl_clear_bit(cr, bit) smp_ctl_clear_bit(cr, bit)
78 # define ctl_set_bit(cr, bit) __ctl_set_bit(cr, bit)
79 # define ctl_clear_bit(cr, bit) __ctl_clear_bit(cr, bit)
82 #endif /* __ASM_CTL_REG_H */