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