Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ctcm_fsms.h
Go to the documentation of this file.
1 /*
2  * Copyright IBM Corp. 2001, 2007
3  * Authors: Fritz Elfert ([email protected])
4  * Peter Tiedemann ([email protected])
5  * MPC additions :
6  * Belinda Thompson ([email protected])
7  * Andy Richter ([email protected])
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  * Definitions for the channel statemachine(s) for ctc and ctcmpc
44  *
45  * To allow better kerntyping, prefix-less definitions for channel states
46  * and channel events have been replaced :
47  * ch_event... -> ctc_ch_event...
48  * CH_EVENT... -> CTC_EVENT...
49  * ch_state... -> ctc_ch_state...
50  * CH_STATE... -> CTC_STATE...
51  */
52 /*
53  * Events of the channel statemachine(s) for ctc and ctcmpc
54  */
56  /*
57  * Events, representing return code of
58  * I/O operations (ccw_device_start, ccw_device_halt et al.)
59  */
64 
68  /*
69  * Events, representing unit-check
70  */
79  /*
80  * Events, representing subchannel-check
81  */
83  /*
84  * Events, representing machine checks
85  */
88  /*
89  * Event, representing normal IRQ
90  */
93  /*
94  * Event, representing timer expiry.
95  */
97  /*
98  * Events, representing commands from upper levels.
99  */
103  /*
104  * additional MPC events
105  */
108  /*
109  * MUST be always the last element!!
110  */
112 };
113 
114 /*
115  * States of the channel statemachine(s) for ctc and ctcmpc.
116  */
118  /*
119  * Channel not assigned to any device,
120  * initial state, direction invalid
121  */
123  /*
124  * Channel assigned but not operating
125  */
141  CTC_NR_STATES, /* MUST be the last element of non-expanded states */
142  /*
143  * additional MPC states
144  */
152  CTC_MPC_NR_STATES, /* MUST be the last element of expanded mpc states */
153 };
154 
155 extern const char *ctc_ch_event_names[];
156 
157 extern const char *ctc_ch_state_names[];
158 
159 void ctcm_ccw_check_rc(struct channel *ch, int rc, char *msg);
160 void ctcm_purge_skb_queue(struct sk_buff_head *q);
161 void fsm_action_nop(fsm_instance *fi, int event, void *arg);
162 
163 /*
164  * ----- non-static actions for ctcm channel statemachine -----
165  *
166  */
167 void ctcm_chx_txidle(fsm_instance *fi, int event, void *arg);
168 
169 /*
170  * ----- FSM (state/event/action) of the ctcm channel statemachine -----
171  */
172 extern const fsm_node ch_fsm[];
173 extern int ch_fsm_len;
174 
175 
176 /*
177  * ----- non-static actions for ctcmpc channel statemachine ----
178  *
179  */
180 /* shared :
181 void ctcm_chx_txidle(fsm_instance * fi, int event, void *arg);
182  */
183 void ctcmpc_chx_rxidle(fsm_instance *fi, int event, void *arg);
184 
185 /*
186  * ----- FSM (state/event/action) of the ctcmpc channel statemachine -----
187  */
188 extern const fsm_node ctcmpc_ch_fsm[];
189 extern int mpc_ch_fsm_len;
190 
191 /*
192  * Definitions for the device interface statemachine for ctc and mpc
193  */
194 
195 /*
196  * States of the device interface statemachine.
197  */
207  /*
208  * MUST be always the last element!!
209  */
211 };
212 
213 extern const char *dev_state_names[];
214 
215 /*
216  * Events of the device interface statemachine.
217  * ctcm and ctcmpc
218  */
227  /*
228  * MUST be always the last element!!
229  */
231 };
232 
233 extern const char *dev_event_names[];
234 
235 /*
236  * Actions for the device interface statemachine.
237  * ctc and ctcmpc
238  */
239 /*
240 static void dev_action_start(fsm_instance * fi, int event, void *arg);
241 static void dev_action_stop(fsm_instance * fi, int event, void *arg);
242 static void dev_action_restart(fsm_instance *fi, int event, void *arg);
243 static void dev_action_chup(fsm_instance * fi, int event, void *arg);
244 static void dev_action_chdown(fsm_instance * fi, int event, void *arg);
245 */
246 
247 /*
248  * The (state/event/action) fsm table of the device interface statemachine.
249  * ctcm and ctcmpc
250  */
251 extern const fsm_node dev_fsm[];
252 extern int dev_fsm_len;
253 
254 
255 /*
256  * Definitions for the MPC Group statemachine
257  */
258 
259 /*
260  * MPC Group Station FSM States
261 
262 State Name When In This State
263 ====================== =======================================
264 MPCG_STATE_RESET Initial State When Driver Loaded
265  We receive and send NOTHING
266 
267 MPCG_STATE_INOP INOP Received.
268  Group level non-recoverable error
269 
270 MPCG_STATE_READY XID exchanges for at least 1 write and
271  1 read channel have completed.
272  Group is ready for data transfer.
273 
274 States from ctc_mpc_alloc_channel
275 ==============================================================
276 MPCG_STATE_XID2INITW Awaiting XID2(0) Initiation
277  ATTN from other side will start
278  XID negotiations.
279  Y-side protocol only.
280 
281 MPCG_STATE_XID2INITX XID2(0) negotiations are in progress.
282  At least 1, but not all, XID2(0)'s
283  have been received from partner.
284 
285 MPCG_STATE_XID7INITW XID2(0) complete
286  No XID2(7)'s have yet been received.
287  XID2(7) negotiations pending.
288 
289 MPCG_STATE_XID7INITX XID2(7) negotiations in progress.
290  At least 1, but not all, XID2(7)'s
291  have been received from partner.
292 
293 MPCG_STATE_XID7INITF XID2(7) negotiations complete.
294  Transitioning to READY.
295 
296 MPCG_STATE_READY Ready for Data Transfer.
297 
298 
299 States from ctc_mpc_establish_connectivity call
300 ==============================================================
301 MPCG_STATE_XID0IOWAIT Initiating XID2(0) negotiations.
302  X-side protocol only.
303  ATTN-BUSY from other side will convert
304  this to Y-side protocol and the
305  ctc_mpc_alloc_channel flow will begin.
306 
307 MPCG_STATE_XID0IOWAIX XID2(0) negotiations are in progress.
308  At least 1, but not all, XID2(0)'s
309  have been received from partner.
310 
311 MPCG_STATE_XID7INITI XID2(0) complete
312  No XID2(7)'s have yet been received.
313  XID2(7) negotiations pending.
314 
315 MPCG_STATE_XID7INITZ XID2(7) negotiations in progress.
316  At least 1, but not all, XID2(7)'s
317  have been received from partner.
318 
319 MPCG_STATE_XID7INITF XID2(7) negotiations complete.
320  Transitioning to READY.
321 
322 MPCG_STATE_READY Ready for Data Transfer.
323 
324 */
325 
336 };
337 
353 };
354 
355 #endif
356 /* --- This is the END my friend --- */