1
2
3
4
5
6
7
8
9#ifndef _CTCM_FSMS_H_
10#define _CTCM_FSMS_H_
11
12#include <linux/module.h>
13#include <linux/init.h>
14#include <linux/kernel.h>
15#include <linux/slab.h>
16#include <linux/errno.h>
17#include <linux/types.h>
18#include <linux/interrupt.h>
19#include <linux/timer.h>
20#include <linux/bitops.h>
21
22#include <linux/signal.h>
23#include <linux/string.h>
24
25#include <linux/ip.h>
26#include <linux/if_arp.h>
27#include <linux/tcp.h>
28#include <linux/skbuff.h>
29#include <linux/ctype.h>
30#include <net/dst.h>
31
32#include <linux/io.h>
33#include <asm/ccwdev.h>
34#include <asm/ccwgroup.h>
35#include <linux/uaccess.h>
36
37#include <asm/idals.h>
38
39#include "fsm.h"
40#include "ctcm_main.h"
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55enum ctc_ch_events {
56
57
58
59
60 CTC_EVENT_IO_SUCCESS,
61 CTC_EVENT_IO_EBUSY,
62 CTC_EVENT_IO_ENODEV,
63 CTC_EVENT_IO_UNKNOWN,
64
65 CTC_EVENT_ATTNBUSY,
66 CTC_EVENT_ATTN,
67 CTC_EVENT_BUSY,
68
69
70
71 CTC_EVENT_UC_RCRESET,
72 CTC_EVENT_UC_RSRESET,
73 CTC_EVENT_UC_TXTIMEOUT,
74 CTC_EVENT_UC_TXPARITY,
75 CTC_EVENT_UC_HWFAIL,
76 CTC_EVENT_UC_RXPARITY,
77 CTC_EVENT_UC_ZERO,
78 CTC_EVENT_UC_UNKNOWN,
79
80
81
82 CTC_EVENT_SC_UNKNOWN,
83
84
85
86 CTC_EVENT_MC_FAIL,
87 CTC_EVENT_MC_GOOD,
88
89
90
91 CTC_EVENT_IRQ,
92 CTC_EVENT_FINSTAT,
93
94
95
96 CTC_EVENT_TIMER,
97
98
99
100 CTC_EVENT_START,
101 CTC_EVENT_STOP,
102 CTC_NR_EVENTS,
103
104
105
106 CTC_EVENT_SEND_XID = CTC_NR_EVENTS,
107 CTC_EVENT_RSWEEP_TIMER,
108
109
110
111 CTC_MPC_NR_EVENTS,
112};
113
114
115
116
117enum ctc_ch_states {
118
119
120
121
122 CTC_STATE_IDLE,
123
124
125
126 CTC_STATE_STOPPED,
127 CTC_STATE_STARTWAIT,
128 CTC_STATE_STARTRETRY,
129 CTC_STATE_SETUPWAIT,
130 CTC_STATE_RXINIT,
131 CTC_STATE_TXINIT,
132 CTC_STATE_RX,
133 CTC_STATE_TX,
134 CTC_STATE_RXIDLE,
135 CTC_STATE_TXIDLE,
136 CTC_STATE_RXERR,
137 CTC_STATE_TXERR,
138 CTC_STATE_TERM,
139 CTC_STATE_DTERM,
140 CTC_STATE_NOTOP,
141 CTC_NR_STATES,
142
143
144
145 CH_XID0_PENDING = CTC_NR_STATES,
146 CH_XID0_INPROGRESS,
147 CH_XID7_PENDING,
148 CH_XID7_PENDING1,
149 CH_XID7_PENDING2,
150 CH_XID7_PENDING3,
151 CH_XID7_PENDING4,
152 CTC_MPC_NR_STATES,
153};
154
155extern const char *ctc_ch_event_names[];
156
157extern const char *ctc_ch_state_names[];
158
159void ctcm_ccw_check_rc(struct channel *ch, int rc, char *msg);
160void ctcm_purge_skb_queue(struct sk_buff_head *q);
161void fsm_action_nop(fsm_instance *fi, int event, void *arg);
162
163
164
165
166
167void ctcm_chx_txidle(fsm_instance *fi, int event, void *arg);
168
169
170
171
172extern const fsm_node ch_fsm[];
173extern int ch_fsm_len;
174
175
176
177
178
179
180
181
182
183void ctcmpc_chx_rxidle(fsm_instance *fi, int event, void *arg);
184
185
186
187
188extern const fsm_node ctcmpc_ch_fsm[];
189extern int mpc_ch_fsm_len;
190
191
192
193
194
195
196
197
198enum dev_states {
199 DEV_STATE_STOPPED,
200 DEV_STATE_STARTWAIT_RXTX,
201 DEV_STATE_STARTWAIT_RX,
202 DEV_STATE_STARTWAIT_TX,
203 DEV_STATE_STOPWAIT_RXTX,
204 DEV_STATE_STOPWAIT_RX,
205 DEV_STATE_STOPWAIT_TX,
206 DEV_STATE_RUNNING,
207
208
209
210 CTCM_NR_DEV_STATES
211};
212
213extern const char *dev_state_names[];
214
215
216
217
218
219enum dev_events {
220 DEV_EVENT_START,
221 DEV_EVENT_STOP,
222 DEV_EVENT_RXUP,
223 DEV_EVENT_TXUP,
224 DEV_EVENT_RXDOWN,
225 DEV_EVENT_TXDOWN,
226 DEV_EVENT_RESTART,
227
228
229
230 CTCM_NR_DEV_EVENTS
231};
232
233extern const char *dev_event_names[];
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251extern const fsm_node dev_fsm[];
252extern int dev_fsm_len;
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326enum mpcg_events {
327 MPCG_EVENT_INOP,
328 MPCG_EVENT_DISCONC,
329 MPCG_EVENT_XID0DO,
330 MPCG_EVENT_XID2,
331 MPCG_EVENT_XID2DONE,
332 MPCG_EVENT_XID7DONE,
333 MPCG_EVENT_TIMER,
334 MPCG_EVENT_DOIO,
335 MPCG_NR_EVENTS,
336};
337
338enum mpcg_states {
339 MPCG_STATE_RESET,
340 MPCG_STATE_INOP,
341 MPCG_STATE_XID2INITW,
342 MPCG_STATE_XID2INITX,
343 MPCG_STATE_XID7INITW,
344 MPCG_STATE_XID7INITX,
345 MPCG_STATE_XID0IOWAIT,
346 MPCG_STATE_XID0IOWAIX,
347 MPCG_STATE_XID7INITI,
348 MPCG_STATE_XID7INITZ,
349 MPCG_STATE_XID7INITF,
350 MPCG_STATE_FLOWC,
351 MPCG_STATE_READY,
352 MPCG_NR_STATES,
353};
354
355#endif
356
357