powerpc: use consistent types in mktree
[zen-stable.git] / drivers / s390 / net / ctcm_fsms.h
blob2326aba9807af3dfbff1e917b7bb07acee4fdd1e
1 /*
2 * drivers/s390/net/ctcm_fsms.h
4 * Copyright IBM Corp. 2001, 2007
5 * Authors: Fritz Elfert (felfert@millenux.com)
6 * Peter Tiedemann (ptiedem@de.ibm.com)
7 * MPC additions :
8 * Belinda Thompson (belindat@us.ibm.com)
9 * Andy Richter (richtera@us.ibm.com)
11 #ifndef _CTCM_FSMS_H_
12 #define _CTCM_FSMS_H_
14 #include <linux/module.h>
15 #include <linux/init.h>
16 #include <linux/kernel.h>
17 #include <linux/slab.h>
18 #include <linux/errno.h>
19 #include <linux/types.h>
20 #include <linux/interrupt.h>
21 #include <linux/timer.h>
22 #include <linux/bitops.h>
24 #include <linux/signal.h>
25 #include <linux/string.h>
27 #include <linux/ip.h>
28 #include <linux/if_arp.h>
29 #include <linux/tcp.h>
30 #include <linux/skbuff.h>
31 #include <linux/ctype.h>
32 #include <net/dst.h>
34 #include <linux/io.h>
35 #include <asm/ccwdev.h>
36 #include <asm/ccwgroup.h>
37 #include <linux/uaccess.h>
39 #include <asm/idals.h>
41 #include "fsm.h"
42 #include "cu3088.h"
43 #include "ctcm_main.h"
46 * Definitions for the channel statemachine(s) for ctc and ctcmpc
48 * To allow better kerntyping, prefix-less definitions for channel states
49 * and channel events have been replaced :
50 * ch_event... -> ctc_ch_event...
51 * CH_EVENT... -> CTC_EVENT...
52 * ch_state... -> ctc_ch_state...
53 * CH_STATE... -> CTC_STATE...
56 * Events of the channel statemachine(s) for ctc and ctcmpc
58 enum ctc_ch_events {
60 * Events, representing return code of
61 * I/O operations (ccw_device_start, ccw_device_halt et al.)
63 CTC_EVENT_IO_SUCCESS,
64 CTC_EVENT_IO_EBUSY,
65 CTC_EVENT_IO_ENODEV,
66 CTC_EVENT_IO_UNKNOWN,
68 CTC_EVENT_ATTNBUSY,
69 CTC_EVENT_ATTN,
70 CTC_EVENT_BUSY,
72 * Events, representing unit-check
74 CTC_EVENT_UC_RCRESET,
75 CTC_EVENT_UC_RSRESET,
76 CTC_EVENT_UC_TXTIMEOUT,
77 CTC_EVENT_UC_TXPARITY,
78 CTC_EVENT_UC_HWFAIL,
79 CTC_EVENT_UC_RXPARITY,
80 CTC_EVENT_UC_ZERO,
81 CTC_EVENT_UC_UNKNOWN,
83 * Events, representing subchannel-check
85 CTC_EVENT_SC_UNKNOWN,
87 * Events, representing machine checks
89 CTC_EVENT_MC_FAIL,
90 CTC_EVENT_MC_GOOD,
92 * Event, representing normal IRQ
94 CTC_EVENT_IRQ,
95 CTC_EVENT_FINSTAT,
97 * Event, representing timer expiry.
99 CTC_EVENT_TIMER,
101 * Events, representing commands from upper levels.
103 CTC_EVENT_START,
104 CTC_EVENT_STOP,
105 CTC_NR_EVENTS,
107 * additional MPC events
109 CTC_EVENT_SEND_XID = CTC_NR_EVENTS,
110 CTC_EVENT_RSWEEP_TIMER,
112 * MUST be always the last element!!
114 CTC_MPC_NR_EVENTS,
118 * States of the channel statemachine(s) for ctc and ctcmpc.
120 enum ctc_ch_states {
122 * Channel not assigned to any device,
123 * initial state, direction invalid
125 CTC_STATE_IDLE,
127 * Channel assigned but not operating
129 CTC_STATE_STOPPED,
130 CTC_STATE_STARTWAIT,
131 CTC_STATE_STARTRETRY,
132 CTC_STATE_SETUPWAIT,
133 CTC_STATE_RXINIT,
134 CTC_STATE_TXINIT,
135 CTC_STATE_RX,
136 CTC_STATE_TX,
137 CTC_STATE_RXIDLE,
138 CTC_STATE_TXIDLE,
139 CTC_STATE_RXERR,
140 CTC_STATE_TXERR,
141 CTC_STATE_TERM,
142 CTC_STATE_DTERM,
143 CTC_STATE_NOTOP,
144 CTC_NR_STATES, /* MUST be the last element of non-expanded states */
146 * additional MPC states
148 CH_XID0_PENDING = CTC_NR_STATES,
149 CH_XID0_INPROGRESS,
150 CH_XID7_PENDING,
151 CH_XID7_PENDING1,
152 CH_XID7_PENDING2,
153 CH_XID7_PENDING3,
154 CH_XID7_PENDING4,
155 CTC_MPC_NR_STATES, /* MUST be the last element of expanded mpc states */
158 extern const char *ctc_ch_event_names[];
160 extern const char *ctc_ch_state_names[];
162 void ctcm_ccw_check_rc(struct channel *ch, int rc, char *msg);
163 void ctcm_purge_skb_queue(struct sk_buff_head *q);
164 void fsm_action_nop(fsm_instance *fi, int event, void *arg);
167 * ----- non-static actions for ctcm channel statemachine -----
170 void ctcm_chx_txidle(fsm_instance *fi, int event, void *arg);
173 * ----- FSM (state/event/action) of the ctcm channel statemachine -----
175 extern const fsm_node ch_fsm[];
176 extern int ch_fsm_len;
180 * ----- non-static actions for ctcmpc channel statemachine ----
183 /* shared :
184 void ctcm_chx_txidle(fsm_instance * fi, int event, void *arg);
186 void ctcmpc_chx_rxidle(fsm_instance *fi, int event, void *arg);
189 * ----- FSM (state/event/action) of the ctcmpc channel statemachine -----
191 extern const fsm_node ctcmpc_ch_fsm[];
192 extern int mpc_ch_fsm_len;
195 * Definitions for the device interface statemachine for ctc and mpc
199 * States of the device interface statemachine.
201 enum dev_states {
202 DEV_STATE_STOPPED,
203 DEV_STATE_STARTWAIT_RXTX,
204 DEV_STATE_STARTWAIT_RX,
205 DEV_STATE_STARTWAIT_TX,
206 DEV_STATE_STOPWAIT_RXTX,
207 DEV_STATE_STOPWAIT_RX,
208 DEV_STATE_STOPWAIT_TX,
209 DEV_STATE_RUNNING,
211 * MUST be always the last element!!
213 CTCM_NR_DEV_STATES
216 extern const char *dev_state_names[];
219 * Events of the device interface statemachine.
220 * ctcm and ctcmpc
222 enum dev_events {
223 DEV_EVENT_START,
224 DEV_EVENT_STOP,
225 DEV_EVENT_RXUP,
226 DEV_EVENT_TXUP,
227 DEV_EVENT_RXDOWN,
228 DEV_EVENT_TXDOWN,
229 DEV_EVENT_RESTART,
231 * MUST be always the last element!!
233 CTCM_NR_DEV_EVENTS
236 extern const char *dev_event_names[];
239 * Actions for the device interface statemachine.
240 * ctc and ctcmpc
243 static void dev_action_start(fsm_instance * fi, int event, void *arg);
244 static void dev_action_stop(fsm_instance * fi, int event, void *arg);
245 static void dev_action_restart(fsm_instance *fi, int event, void *arg);
246 static void dev_action_chup(fsm_instance * fi, int event, void *arg);
247 static void dev_action_chdown(fsm_instance * fi, int event, void *arg);
251 * The (state/event/action) fsm table of the device interface statemachine.
252 * ctcm and ctcmpc
254 extern const fsm_node dev_fsm[];
255 extern int dev_fsm_len;
259 * Definitions for the MPC Group statemachine
263 * MPC Group Station FSM States
265 State Name When In This State
266 ====================== =======================================
267 MPCG_STATE_RESET Initial State When Driver Loaded
268 We receive and send NOTHING
270 MPCG_STATE_INOP INOP Received.
271 Group level non-recoverable error
273 MPCG_STATE_READY XID exchanges for at least 1 write and
274 1 read channel have completed.
275 Group is ready for data transfer.
277 States from ctc_mpc_alloc_channel
278 ==============================================================
279 MPCG_STATE_XID2INITW Awaiting XID2(0) Initiation
280 ATTN from other side will start
281 XID negotiations.
282 Y-side protocol only.
284 MPCG_STATE_XID2INITX XID2(0) negotiations are in progress.
285 At least 1, but not all, XID2(0)'s
286 have been received from partner.
288 MPCG_STATE_XID7INITW XID2(0) complete
289 No XID2(7)'s have yet been received.
290 XID2(7) negotiations pending.
292 MPCG_STATE_XID7INITX XID2(7) negotiations in progress.
293 At least 1, but not all, XID2(7)'s
294 have been received from partner.
296 MPCG_STATE_XID7INITF XID2(7) negotiations complete.
297 Transitioning to READY.
299 MPCG_STATE_READY Ready for Data Transfer.
302 States from ctc_mpc_establish_connectivity call
303 ==============================================================
304 MPCG_STATE_XID0IOWAIT Initiating XID2(0) negotiations.
305 X-side protocol only.
306 ATTN-BUSY from other side will convert
307 this to Y-side protocol and the
308 ctc_mpc_alloc_channel flow will begin.
310 MPCG_STATE_XID0IOWAIX XID2(0) negotiations are in progress.
311 At least 1, but not all, XID2(0)'s
312 have been received from partner.
314 MPCG_STATE_XID7INITI XID2(0) complete
315 No XID2(7)'s have yet been received.
316 XID2(7) negotiations pending.
318 MPCG_STATE_XID7INITZ XID2(7) negotiations in progress.
319 At least 1, but not all, XID2(7)'s
320 have been received from partner.
322 MPCG_STATE_XID7INITF XID2(7) negotiations complete.
323 Transitioning to READY.
325 MPCG_STATE_READY Ready for Data Transfer.
329 enum mpcg_events {
330 MPCG_EVENT_INOP,
331 MPCG_EVENT_DISCONC,
332 MPCG_EVENT_XID0DO,
333 MPCG_EVENT_XID2,
334 MPCG_EVENT_XID2DONE,
335 MPCG_EVENT_XID7DONE,
336 MPCG_EVENT_TIMER,
337 MPCG_EVENT_DOIO,
338 MPCG_NR_EVENTS,
341 enum mpcg_states {
342 MPCG_STATE_RESET,
343 MPCG_STATE_INOP,
344 MPCG_STATE_XID2INITW,
345 MPCG_STATE_XID2INITX,
346 MPCG_STATE_XID7INITW,
347 MPCG_STATE_XID7INITX,
348 MPCG_STATE_XID0IOWAIT,
349 MPCG_STATE_XID0IOWAIX,
350 MPCG_STATE_XID7INITI,
351 MPCG_STATE_XID7INITZ,
352 MPCG_STATE_XID7INITF,
353 MPCG_STATE_FLOWC,
354 MPCG_STATE_READY,
355 MPCG_NR_STATES,
358 #endif
359 /* --- This is the END my friend --- */