1
2
3
4
5#ifndef __S390_ETR_H
6#define __S390_ETR_H
7
8
9struct etr_eacr {
10 unsigned int e0 : 1;
11 unsigned int e1 : 1;
12 unsigned int _pad0 : 5;
13 unsigned int dp : 1;
14 unsigned int p0 : 1;
15 unsigned int p1 : 1;
16 unsigned int _pad1 : 3;
17 unsigned int ea : 1;
18 unsigned int es : 1;
19 unsigned int sl : 1;
20} __attribute__ ((packed));
21
22
23enum etr_psc {
24 etr_psc_operational = 0,
25 etr_psc_semi_operational = 1,
26 etr_psc_protocol_error = 4,
27 etr_psc_no_symbols = 8,
28 etr_psc_no_signal = 12,
29 etr_psc_pps_mode = 13
30};
31
32
33enum etr_lpsc {
34 etr_lpsc_operational_step = 0,
35 etr_lpsc_operational_alt = 1,
36 etr_lpsc_semi_operational = 2,
37 etr_lpsc_protocol_error = 4,
38 etr_lpsc_no_symbol_sync = 8,
39 etr_lpsc_no_signal = 12,
40 etr_lpsc_pps_mode = 13
41};
42
43
44struct etr_esw {
45 struct etr_eacr eacr;
46 unsigned int y : 1;
47 unsigned int _pad0 : 5;
48 unsigned int p : 1;
49 unsigned int q : 1;
50 unsigned int psc0 : 4;
51 unsigned int psc1 : 4;
52} __attribute__ ((packed));
53
54
55struct etr_slsw {
56 unsigned int vv1 : 1;
57 unsigned int vv2 : 1;
58 unsigned int vv3 : 1;
59 unsigned int vv4 : 1;
60 unsigned int _pad0 : 19;
61 unsigned int n : 1;
62 unsigned int v1 : 1;
63 unsigned int v2 : 1;
64 unsigned int v3 : 1;
65 unsigned int v4 : 1;
66 unsigned int _pad1 : 4;
67} __attribute__ ((packed));
68
69
70struct etr_edf1 {
71 unsigned int u : 1;
72 unsigned int _pad0 : 1;
73 unsigned int r : 1;
74 unsigned int _pad1 : 4;
75 unsigned int a : 1;
76 unsigned int net_id : 8;
77 unsigned int etr_id : 8;
78 unsigned int etr_pn : 8;
79} __attribute__ ((packed));
80
81struct etr_edf2 {
82 unsigned int etv : 32;
83} __attribute__ ((packed));
84
85struct etr_edf3 {
86 unsigned int rc : 8;
87 unsigned int _pad0 : 3;
88 unsigned int c : 1;
89 unsigned int tc : 4;
90 unsigned int blto : 8;
91
92 unsigned int buo : 8;
93
94} __attribute__ ((packed));
95
96struct etr_edf4 {
97 unsigned int ed : 8;
98 unsigned int _pad0 : 1;
99 unsigned int buc : 5;
100
101 unsigned int em : 6;
102 unsigned int dc : 6;
103 unsigned int sc : 6;
104} __attribute__ ((packed));
105
106
107
108
109
110
111struct etr_aib {
112 struct etr_esw esw;
113 struct etr_slsw slsw;
114 unsigned long long tsp;
115 struct etr_edf1 edf1;
116 struct etr_edf2 edf2;
117 struct etr_edf3 edf3;
118 struct etr_edf4 edf4;
119 unsigned int reserved[16];
120} __attribute__ ((packed,aligned(8)));
121
122
123struct etr_irq_parm {
124 unsigned int _pad0 : 8;
125 unsigned int pc0 : 1;
126 unsigned int pc1 : 1;
127 unsigned int _pad1 : 3;
128 unsigned int eai : 1;
129 unsigned int _pad2 : 18;
130} __attribute__ ((packed));
131
132
133struct etr_ptff_qto {
134 unsigned long long physical_clock;
135 unsigned long long tod_offset;
136 unsigned long long logical_tod_offset;
137 unsigned long long tod_epoch_difference;
138} __attribute__ ((packed));
139
140
141static inline int etr_setr(struct etr_eacr *ctrl)
142{
143 int rc = -EOPNOTSUPP;
144
145 asm volatile(
146 " .insn s,0xb2160000,%1\n"
147 "0: la %0,0\n"
148 "1:\n"
149 EX_TABLE(0b,1b)
150 : "+d" (rc) : "Q" (*ctrl));
151 return rc;
152}
153
154
155static inline int etr_stetr(struct etr_aib *aib)
156{
157 int rc = -EOPNOTSUPP;
158
159 asm volatile(
160 " .insn s,0xb2170000,%1\n"
161 "0: la %0,0\n"
162 "1:\n"
163 EX_TABLE(0b,1b)
164 : "+d" (rc) : "Q" (*aib));
165 return rc;
166}
167
168
169static inline int etr_steai(struct etr_aib *aib, unsigned int func)
170{
171 register unsigned int reg0 asm("0") = func;
172 int rc = -EOPNOTSUPP;
173
174 asm volatile(
175 " .insn s,0xb2b30000,%1\n"
176 "0: la %0,0\n"
177 "1:\n"
178 EX_TABLE(0b,1b)
179 : "+d" (rc) : "Q" (*aib), "d" (reg0));
180 return rc;
181}
182
183
184#define ETR_STEAI_STEPPING_PORT 0x10
185#define ETR_STEAI_ALTERNATE_PORT 0x11
186#define ETR_STEAI_PORT_0 0x12
187#define ETR_STEAI_PORT_1 0x13
188
189static inline int etr_ptff(void *ptff_block, unsigned int func)
190{
191 register unsigned int reg0 asm("0") = func;
192 register unsigned long reg1 asm("1") = (unsigned long) ptff_block;
193 int rc = -EOPNOTSUPP;
194
195 asm volatile(
196 " .word 0x0104\n"
197 " ipm %0\n"
198 " srl %0,28\n"
199 : "=d" (rc), "=m" (ptff_block)
200 : "d" (reg0), "d" (reg1), "m" (ptff_block) : "cc");
201 return rc;
202}
203
204
205#define ETR_PTFF_QAF 0x00
206#define ETR_PTFF_QTO 0x01
207#define ETR_PTFF_QSI 0x02
208#define ETR_PTFF_ATO 0x40
209#define ETR_PTFF_STO 0x41
210#define ETR_PTFF_SFS 0x42
211#define ETR_PTFF_SGS 0x43
212
213
214void etr_switch_to_local(void);
215void etr_sync_check(void);
216
217
218extern struct atomic_notifier_head s390_epoch_delta_notifier;
219
220
221struct stp_irq_parm {
222 unsigned int _pad0 : 14;
223 unsigned int tsc : 1;
224 unsigned int lac : 1;
225 unsigned int tcpc : 1;
226 unsigned int _pad2 : 15;
227} __attribute__ ((packed));
228
229#define STP_OP_SYNC 1
230#define STP_OP_CTRL 3
231
232struct stp_sstpi {
233 unsigned int rsvd0;
234 unsigned int rsvd1 : 8;
235 unsigned int stratum : 8;
236 unsigned int vbits : 16;
237 unsigned int leaps : 16;
238 unsigned int tmd : 4;
239 unsigned int ctn : 4;
240 unsigned int rsvd2 : 3;
241 unsigned int c : 1;
242 unsigned int tst : 4;
243 unsigned int tzo : 16;
244 unsigned int dsto : 16;
245 unsigned int ctrl : 16;
246 unsigned int rsvd3 : 16;
247 unsigned int tto;
248 unsigned int rsvd4;
249 unsigned int ctnid[3];
250 unsigned int rsvd5;
251 unsigned int todoff[4];
252 unsigned int rsvd6[48];
253} __attribute__ ((packed));
254
255
256void stp_sync_check(void);
257void stp_island_check(void);
258
259#endif
260