0001
0002
0003
0004
0005
0006
0007
0008 #ifndef __ASM_CTL_REG_H
0009 #define __ASM_CTL_REG_H
0010
0011 #include <linux/bits.h>
0012
0013 #define CR0_CLOCK_COMPARATOR_SIGN BIT(63 - 10)
0014 #define CR0_LOW_ADDRESS_PROTECTION BIT(63 - 35)
0015 #define CR0_FETCH_PROTECTION_OVERRIDE BIT(63 - 38)
0016 #define CR0_STORAGE_PROTECTION_OVERRIDE BIT(63 - 39)
0017 #define CR0_EMERGENCY_SIGNAL_SUBMASK BIT(63 - 49)
0018 #define CR0_EXTERNAL_CALL_SUBMASK BIT(63 - 50)
0019 #define CR0_CLOCK_COMPARATOR_SUBMASK BIT(63 - 52)
0020 #define CR0_CPU_TIMER_SUBMASK BIT(63 - 53)
0021 #define CR0_SERVICE_SIGNAL_SUBMASK BIT(63 - 54)
0022 #define CR0_UNUSED_56 BIT(63 - 56)
0023 #define CR0_INTERRUPT_KEY_SUBMASK BIT(63 - 57)
0024 #define CR0_MEASUREMENT_ALERT_SUBMASK BIT(63 - 58)
0025
0026 #define CR14_UNUSED_32 BIT(63 - 32)
0027 #define CR14_UNUSED_33 BIT(63 - 33)
0028 #define CR14_CHANNEL_REPORT_SUBMASK BIT(63 - 35)
0029 #define CR14_RECOVERY_SUBMASK BIT(63 - 36)
0030 #define CR14_DEGRADATION_SUBMASK BIT(63 - 37)
0031 #define CR14_EXTERNAL_DAMAGE_SUBMASK BIT(63 - 38)
0032 #define CR14_WARNING_SUBMASK BIT(63 - 39)
0033
0034 #ifndef __ASSEMBLY__
0035
0036 #include <linux/bug.h>
0037
0038 #define __ctl_load(array, low, high) do { \
0039 typedef struct { char _[sizeof(array)]; } addrtype; \
0040 \
0041 BUILD_BUG_ON(sizeof(addrtype) != (high - low + 1) * sizeof(long));\
0042 asm volatile( \
0043 " lctlg %1,%2,%0\n" \
0044 : \
0045 : "Q" (*(addrtype *)(&array)), "i" (low), "i" (high) \
0046 : "memory"); \
0047 } while (0)
0048
0049 #define __ctl_store(array, low, high) do { \
0050 typedef struct { char _[sizeof(array)]; } addrtype; \
0051 \
0052 BUILD_BUG_ON(sizeof(addrtype) != (high - low + 1) * sizeof(long));\
0053 asm volatile( \
0054 " stctg %1,%2,%0\n" \
0055 : "=Q" (*(addrtype *)(&array)) \
0056 : "i" (low), "i" (high)); \
0057 } while (0)
0058
0059 static __always_inline void __ctl_set_bit(unsigned int cr, unsigned int bit)
0060 {
0061 unsigned long reg;
0062
0063 __ctl_store(reg, cr, cr);
0064 reg |= 1UL << bit;
0065 __ctl_load(reg, cr, cr);
0066 }
0067
0068 static __always_inline void __ctl_clear_bit(unsigned int cr, unsigned int bit)
0069 {
0070 unsigned long reg;
0071
0072 __ctl_store(reg, cr, cr);
0073 reg &= ~(1UL << bit);
0074 __ctl_load(reg, cr, cr);
0075 }
0076
0077 void smp_ctl_set_clear_bit(int cr, int bit, bool set);
0078
0079 static inline void ctl_set_bit(int cr, int bit)
0080 {
0081 smp_ctl_set_clear_bit(cr, bit, true);
0082 }
0083
0084 static inline void ctl_clear_bit(int cr, int bit)
0085 {
0086 smp_ctl_set_clear_bit(cr, bit, false);
0087 }
0088
0089 union ctlreg0 {
0090 unsigned long val;
0091 struct {
0092 unsigned long : 8;
0093 unsigned long tcx : 1;
0094 unsigned long pifo : 1;
0095
0096 unsigned long : 3;
0097 unsigned long ccc : 1;
0098 unsigned long : 18;
0099 unsigned long : 3;
0100 unsigned long lap : 1;
0101 unsigned long : 4;
0102 unsigned long edat : 1;
0103 unsigned long : 2;
0104 unsigned long iep : 1;
0105 unsigned long : 1;
0106 unsigned long afp : 1;
0107 unsigned long vx : 1;
0108 unsigned long : 7;
0109 unsigned long sssm : 1;
0110 unsigned long : 9;
0111 };
0112 };
0113
0114 union ctlreg2 {
0115 unsigned long val;
0116 struct {
0117 unsigned long : 33;
0118 unsigned long ducto : 25;
0119 unsigned long : 1;
0120 unsigned long gse : 1;
0121 unsigned long : 1;
0122 unsigned long tds : 1;
0123 unsigned long tdc : 2;
0124 };
0125 };
0126
0127 union ctlreg5 {
0128 unsigned long val;
0129 struct {
0130 unsigned long : 33;
0131 unsigned long pasteo: 25;
0132 unsigned long : 6;
0133 };
0134 };
0135
0136 union ctlreg15 {
0137 unsigned long val;
0138 struct {
0139 unsigned long lsea : 61;
0140 unsigned long : 3;
0141 };
0142 };
0143
0144 #endif
0145 #endif