[S390] cio: introduce fcx bit to chsc characteristics
[deliverable/linux.git] / drivers / s390 / cio / device_fsm.c
CommitLineData
1da177e4
LT
1/*
2 * drivers/s390/cio/device_fsm.c
3 * finite state machine for device handling
4 *
c820de39 5 * Copyright IBM Corp. 2002,2008
4ce3b30c 6 * Author(s): Cornelia Huck (cornelia.huck@de.ibm.com)
1da177e4
LT
7 * Martin Schwidefsky (schwidefsky@de.ibm.com)
8 */
9
10#include <linux/module.h>
1da177e4 11#include <linux/init.h>
4e57b681
TS
12#include <linux/jiffies.h>
13#include <linux/string.h>
1da177e4
LT
14
15#include <asm/ccwdev.h>
4c24da79 16#include <asm/cio.h>
e5854a58 17#include <asm/chpid.h>
1da177e4
LT
18
19#include "cio.h"
20#include "cio_debug.h"
21#include "css.h"
22#include "device.h"
23#include "chsc.h"
24#include "ioasm.h"
e6b6e10a 25#include "chp.h"
1da177e4 26
14ff56bb
SO
27static int timeout_log_enabled;
28
14ff56bb
SO
29static int __init ccw_timeout_log_setup(char *unused)
30{
31 timeout_log_enabled = 1;
32 return 1;
33}
34
35__setup("ccw_timeout_log", ccw_timeout_log_setup);
36
37static void ccw_timeout_log(struct ccw_device *cdev)
38{
39 struct schib schib;
40 struct subchannel *sch;
cd6b4f27 41 struct io_subchannel_private *private;
14ff56bb
SO
42 int cc;
43
44 sch = to_subchannel(cdev->dev.parent);
cd6b4f27 45 private = to_io_private(sch);
14ff56bb
SO
46 cc = stsch(sch->schid, &schib);
47
48 printk(KERN_WARNING "cio: ccw device timeout occurred at %llx, "
49 "device information:\n", get_clock());
50 printk(KERN_WARNING "cio: orb:\n");
51 print_hex_dump(KERN_WARNING, "cio: ", DUMP_PREFIX_NONE, 16, 1,
cd6b4f27 52 &private->orb, sizeof(private->orb), 0);
14ff56bb
SO
53 printk(KERN_WARNING "cio: ccw device bus id: %s\n", cdev->dev.bus_id);
54 printk(KERN_WARNING "cio: subchannel bus id: %s\n", sch->dev.bus_id);
55 printk(KERN_WARNING "cio: subchannel lpm: %02x, opm: %02x, "
56 "vpm: %02x\n", sch->lpm, sch->opm, sch->vpm);
57
cd6b4f27
CH
58 if ((void *)(addr_t)private->orb.cpa == &private->sense_ccw ||
59 (void *)(addr_t)private->orb.cpa == cdev->private->iccws)
14ff56bb
SO
60 printk(KERN_WARNING "cio: last channel program (intern):\n");
61 else
62 printk(KERN_WARNING "cio: last channel program:\n");
63
64 print_hex_dump(KERN_WARNING, "cio: ", DUMP_PREFIX_NONE, 16, 1,
cd6b4f27
CH
65 (void *)(addr_t)private->orb.cpa,
66 sizeof(struct ccw1), 0);
14ff56bb
SO
67 printk(KERN_WARNING "cio: ccw device state: %d\n",
68 cdev->private->state);
69 printk(KERN_WARNING "cio: store subchannel returned: cc=%d\n", cc);
70 printk(KERN_WARNING "cio: schib:\n");
71 print_hex_dump(KERN_WARNING, "cio: ", DUMP_PREFIX_NONE, 16, 1,
72 &schib, sizeof(schib), 0);
73 printk(KERN_WARNING "cio: ccw device flags:\n");
74 print_hex_dump(KERN_WARNING, "cio: ", DUMP_PREFIX_NONE, 16, 1,
75 &cdev->private->flags, sizeof(cdev->private->flags), 0);
76}
77
1da177e4
LT
78/*
79 * Timeout function. It just triggers a DEV_EVENT_TIMEOUT.
80 */
81static void
82ccw_device_timeout(unsigned long data)
83{
84 struct ccw_device *cdev;
85
86 cdev = (struct ccw_device *) data;
87 spin_lock_irq(cdev->ccwlock);
14ff56bb
SO
88 if (timeout_log_enabled)
89 ccw_timeout_log(cdev);
1da177e4
LT
90 dev_fsm_event(cdev, DEV_EVENT_TIMEOUT);
91 spin_unlock_irq(cdev->ccwlock);
92}
93
94/*
95 * Set timeout
96 */
97void
98ccw_device_set_timeout(struct ccw_device *cdev, int expires)
99{
100 if (expires == 0) {
101 del_timer(&cdev->private->timer);
102 return;
103 }
104 if (timer_pending(&cdev->private->timer)) {
105 if (mod_timer(&cdev->private->timer, jiffies + expires))
106 return;
107 }
108 cdev->private->timer.function = ccw_device_timeout;
109 cdev->private->timer.data = (unsigned long) cdev;
110 cdev->private->timer.expires = jiffies + expires;
111 add_timer(&cdev->private->timer);
112}
113
1da177e4
LT
114/*
115 * Cancel running i/o. This is called repeatedly since halt/clear are
116 * asynchronous operations. We do one try with cio_cancel, two tries
117 * with cio_halt, 255 tries with cio_clear. If everythings fails panic.
118 * Returns 0 if device now idle, -ENODEV for device not operational and
119 * -EBUSY if an interrupt is expected (either from halt/clear or from a
120 * status pending).
121 */
122int
123ccw_device_cancel_halt_clear(struct ccw_device *cdev)
124{
125 struct subchannel *sch;
126 int ret;
127
128 sch = to_subchannel(cdev->dev.parent);
a8237fc4 129 ret = stsch(sch->schid, &sch->schib);
1da177e4
LT
130 if (ret || !sch->schib.pmcw.dnv)
131 return -ENODEV;
2470b648
CH
132 if (!sch->schib.pmcw.ena)
133 /* Not operational -> done. */
1da177e4
LT
134 return 0;
135 /* Stage 1: cancel io. */
136 if (!(sch->schib.scsw.actl & SCSW_ACTL_HALT_PEND) &&
137 !(sch->schib.scsw.actl & SCSW_ACTL_CLEAR_PEND)) {
138 ret = cio_cancel(sch);
139 if (ret != -EINVAL)
140 return ret;
141 /* cancel io unsuccessful. From now on it is asynchronous. */
142 cdev->private->iretry = 3; /* 3 halt retries. */
143 }
144 if (!(sch->schib.scsw.actl & SCSW_ACTL_CLEAR_PEND)) {
145 /* Stage 2: halt io. */
146 if (cdev->private->iretry) {
147 cdev->private->iretry--;
148 ret = cio_halt(sch);
ba4ba8a6
PO
149 if (ret != -EBUSY)
150 return (ret == 0) ? -EBUSY : ret;
1da177e4
LT
151 }
152 /* halt io unsuccessful. */
153 cdev->private->iretry = 255; /* 255 clear retries. */
154 }
155 /* Stage 3: clear io. */
156 if (cdev->private->iretry) {
157 cdev->private->iretry--;
158 ret = cio_clear (sch);
159 return (ret == 0) ? -EBUSY : ret;
160 }
161 panic("Can't stop i/o on subchannel.\n");
162}
163
164static int
165ccw_device_handle_oper(struct ccw_device *cdev)
166{
167 struct subchannel *sch;
168
169 sch = to_subchannel(cdev->dev.parent);
170 cdev->private->flags.recog_done = 1;
171 /*
172 * Check if cu type and device type still match. If
173 * not, it is certainly another device and we have to
d7b5a4c9 174 * de- and re-register.
1da177e4
LT
175 */
176 if (cdev->id.cu_type != cdev->private->senseid.cu_type ||
177 cdev->id.cu_model != cdev->private->senseid.cu_model ||
178 cdev->id.dev_type != cdev->private->senseid.dev_type ||
d7b5a4c9 179 cdev->id.dev_model != cdev->private->senseid.dev_model) {
1da177e4 180 PREPARE_WORK(&cdev->private->kick_work,
c1637532 181 ccw_device_do_unreg_rereg);
1da177e4
LT
182 queue_work(ccw_device_work, &cdev->private->kick_work);
183 return 0;
184 }
185 cdev->private->flags.donotify = 1;
186 return 1;
187}
188
189/*
190 * The machine won't give us any notification by machine check if a chpid has
191 * been varied online on the SE so we have to find out by magic (i. e. driving
192 * the channel subsystem to device selection and updating our path masks).
193 */
4d284cac 194static void
1da177e4
LT
195__recover_lost_chpids(struct subchannel *sch, int old_lpm)
196{
197 int mask, i;
f86635fa 198 struct chp_id chpid;
1da177e4 199
f86635fa 200 chp_id_init(&chpid);
1da177e4
LT
201 for (i = 0; i<8; i++) {
202 mask = 0x80 >> i;
203 if (!(sch->lpm & mask))
204 continue;
205 if (old_lpm & mask)
206 continue;
f86635fa 207 chpid.id = sch->schib.pmcw.chpid[i];
83b3370c
PO
208 if (!chp_is_registered(chpid))
209 css_schedule_eval_all();
1da177e4
LT
210 }
211}
212
213/*
214 * Stop device recognition.
215 */
216static void
217ccw_device_recog_done(struct ccw_device *cdev, int state)
218{
219 struct subchannel *sch;
220 int notify, old_lpm, same_dev;
221
222 sch = to_subchannel(cdev->dev.parent);
223
224 ccw_device_set_timeout(cdev, 0);
225 cio_disable_subchannel(sch);
226 /*
227 * Now that we tried recognition, we have performed device selection
228 * through ssch() and the path information is up to date.
229 */
230 old_lpm = sch->lpm;
a8237fc4 231 stsch(sch->schid, &sch->schib);
28bdc6f6 232 sch->lpm = sch->schib.pmcw.pam & sch->opm;
4ffa9234
CH
233 /* Check since device may again have become not operational. */
234 if (!sch->schib.pmcw.dnv)
235 state = DEV_STATE_NOT_OPER;
1da177e4
LT
236 if (cdev->private->state == DEV_STATE_DISCONNECTED_SENSE_ID)
237 /* Force reprobe on all chpids. */
238 old_lpm = 0;
239 if (sch->lpm != old_lpm)
240 __recover_lost_chpids(sch, old_lpm);
241 if (cdev->private->state == DEV_STATE_DISCONNECTED_SENSE_ID) {
242 if (state == DEV_STATE_NOT_OPER) {
243 cdev->private->flags.recog_done = 1;
244 cdev->private->state = DEV_STATE_DISCONNECTED;
245 return;
246 }
247 /* Boxed devices don't need extra treatment. */
248 }
249 notify = 0;
250 same_dev = 0; /* Keep the compiler quiet... */
251 switch (state) {
252 case DEV_STATE_NOT_OPER:
139b83dd
ME
253 CIO_MSG_EVENT(2, "SenseID : unknown device %04x on "
254 "subchannel 0.%x.%04x\n",
255 cdev->private->dev_id.devno,
256 sch->schid.ssid, sch->schid.sch_no);
1da177e4
LT
257 break;
258 case DEV_STATE_OFFLINE:
259 if (cdev->private->state == DEV_STATE_DISCONNECTED_SENSE_ID) {
260 same_dev = ccw_device_handle_oper(cdev);
261 notify = 1;
262 }
263 /* fill out sense information */
81388d2a 264 memset(&cdev->id, 0, sizeof(cdev->id));
292888c8
HC
265 cdev->id.cu_type = cdev->private->senseid.cu_type;
266 cdev->id.cu_model = cdev->private->senseid.cu_model;
267 cdev->id.dev_type = cdev->private->senseid.dev_type;
268 cdev->id.dev_model = cdev->private->senseid.dev_model;
1da177e4
LT
269 if (notify) {
270 cdev->private->state = DEV_STATE_OFFLINE;
271 if (same_dev) {
272 /* Get device online again. */
273 ccw_device_online(cdev);
274 wake_up(&cdev->private->wait_q);
275 }
276 return;
277 }
278 /* Issue device info message. */
139b83dd
ME
279 CIO_MSG_EVENT(4, "SenseID : device 0.%x.%04x reports: "
280 "CU Type/Mod = %04X/%02X, Dev Type/Mod = "
281 "%04X/%02X\n",
282 cdev->private->dev_id.ssid,
283 cdev->private->dev_id.devno,
284 cdev->id.cu_type, cdev->id.cu_model,
285 cdev->id.dev_type, cdev->id.dev_model);
1da177e4
LT
286 break;
287 case DEV_STATE_BOXED:
139b83dd
ME
288 CIO_MSG_EVENT(0, "SenseID : boxed device %04x on "
289 " subchannel 0.%x.%04x\n",
290 cdev->private->dev_id.devno,
291 sch->schid.ssid, sch->schid.sch_no);
1da177e4
LT
292 break;
293 }
294 cdev->private->state = state;
295 io_subchannel_recog_done(cdev);
296 if (state != DEV_STATE_NOT_OPER)
297 wake_up(&cdev->private->wait_q);
298}
299
300/*
301 * Function called from device_id.c after sense id has completed.
302 */
303void
304ccw_device_sense_id_done(struct ccw_device *cdev, int err)
305{
306 switch (err) {
307 case 0:
308 ccw_device_recog_done(cdev, DEV_STATE_OFFLINE);
309 break;
310 case -ETIME: /* Sense id stopped by timeout. */
311 ccw_device_recog_done(cdev, DEV_STATE_BOXED);
312 break;
313 default:
314 ccw_device_recog_done(cdev, DEV_STATE_NOT_OPER);
315 break;
316 }
317}
318
c820de39
CH
319int ccw_device_notify(struct ccw_device *cdev, int event)
320{
321 if (!cdev->drv)
322 return 0;
323 if (!cdev->online)
324 return 0;
325 return cdev->drv->notify ? cdev->drv->notify(cdev, event) : 0;
326}
327
1da177e4 328static void
c1637532 329ccw_device_oper_notify(struct work_struct *work)
1da177e4 330{
c1637532 331 struct ccw_device_private *priv;
1da177e4 332 struct ccw_device *cdev;
1da177e4 333 int ret;
ee04bbcc 334 unsigned long flags;
1da177e4 335
c1637532
MS
336 priv = container_of(work, struct ccw_device_private, kick_work);
337 cdev = priv->cdev;
c820de39 338 ret = ccw_device_notify(cdev, CIO_OPER);
ee04bbcc 339 spin_lock_irqsave(cdev->ccwlock, flags);
ee04bbcc 340 if (ret) {
94bb0633 341 /* Reenable channel measurements, if needed. */
ee04bbcc 342 spin_unlock_irqrestore(cdev->ccwlock, flags);
94bb0633 343 cmf_reenable(cdev);
ee04bbcc 344 spin_lock_irqsave(cdev->ccwlock, flags);
1da177e4 345 wake_up(&cdev->private->wait_q);
94bb0633 346 }
ee04bbcc
CH
347 spin_unlock_irqrestore(cdev->ccwlock, flags);
348 if (!ret)
349 /* Driver doesn't want device back. */
350 ccw_device_do_unreg_rereg(work);
1da177e4
LT
351}
352
353/*
354 * Finished with online/offline processing.
355 */
356static void
357ccw_device_done(struct ccw_device *cdev, int state)
358{
359 struct subchannel *sch;
360
361 sch = to_subchannel(cdev->dev.parent);
362
f1ee3281
CH
363 ccw_device_set_timeout(cdev, 0);
364
1da177e4
LT
365 if (state != DEV_STATE_ONLINE)
366 cio_disable_subchannel(sch);
367
368 /* Reset device status. */
369 memset(&cdev->private->irb, 0, sizeof(struct irb));
370
371 cdev->private->state = state;
372
373
374 if (state == DEV_STATE_BOXED)
139b83dd
ME
375 CIO_MSG_EVENT(0, "Boxed device %04x on subchannel %04x\n",
376 cdev->private->dev_id.devno, sch->schid.sch_no);
1da177e4
LT
377
378 if (cdev->private->flags.donotify) {
379 cdev->private->flags.donotify = 0;
c1637532 380 PREPARE_WORK(&cdev->private->kick_work, ccw_device_oper_notify);
1da177e4
LT
381 queue_work(ccw_device_notify_work, &cdev->private->kick_work);
382 }
383 wake_up(&cdev->private->wait_q);
384
385 if (css_init_done && state != DEV_STATE_ONLINE)
386 put_device (&cdev->dev);
387}
388
4d284cac 389static int cmp_pgid(struct pgid *p1, struct pgid *p2)
7e560814
CH
390{
391 char *c1;
392 char *c2;
393
394 c1 = (char *)p1;
395 c2 = (char *)p2;
396
397 return memcmp(c1 + 1, c2 + 1, sizeof(struct pgid) - 1);
398}
399
400static void __ccw_device_get_common_pgid(struct ccw_device *cdev)
401{
402 int i;
403 int last;
404
405 last = 0;
406 for (i = 0; i < 8; i++) {
407 if (cdev->private->pgid[i].inf.ps.state1 == SNID_STATE1_RESET)
408 /* No PGID yet */
409 continue;
410 if (cdev->private->pgid[last].inf.ps.state1 ==
411 SNID_STATE1_RESET) {
412 /* First non-zero PGID */
413 last = i;
414 continue;
415 }
416 if (cmp_pgid(&cdev->private->pgid[i],
417 &cdev->private->pgid[last]) == 0)
418 /* Non-conflicting PGIDs */
419 continue;
420
421 /* PGID mismatch, can't pathgroup. */
422 CIO_MSG_EVENT(0, "SNID - pgid mismatch for device "
423 "0.%x.%04x, can't pathgroup\n",
78964268
CH
424 cdev->private->dev_id.ssid,
425 cdev->private->dev_id.devno);
7e560814
CH
426 cdev->private->options.pgroup = 0;
427 return;
428 }
429 if (cdev->private->pgid[last].inf.ps.state1 ==
430 SNID_STATE1_RESET)
431 /* No previous pgid found */
7c9f4e3a
CH
432 memcpy(&cdev->private->pgid[0],
433 &channel_subsystems[0]->global_pgid,
7e560814
CH
434 sizeof(struct pgid));
435 else
436 /* Use existing pgid */
437 memcpy(&cdev->private->pgid[0], &cdev->private->pgid[last],
438 sizeof(struct pgid));
439}
440
1da177e4
LT
441/*
442 * Function called from device_pgid.c after sense path ground has completed.
443 */
444void
445ccw_device_sense_pgid_done(struct ccw_device *cdev, int err)
446{
447 struct subchannel *sch;
448
449 sch = to_subchannel(cdev->dev.parent);
450 switch (err) {
7e560814
CH
451 case -EOPNOTSUPP: /* path grouping not supported, use nop instead. */
452 cdev->private->options.pgroup = 0;
453 break;
454 case 0: /* success */
455 case -EACCES: /* partial success, some paths not operational */
456 /* Check if all pgids are equal or 0. */
457 __ccw_device_get_common_pgid(cdev);
1da177e4
LT
458 break;
459 case -ETIME: /* Sense path group id stopped by timeout. */
460 case -EUSERS: /* device is reserved for someone else. */
461 ccw_device_done(cdev, DEV_STATE_BOXED);
7e560814 462 return;
1da177e4
LT
463 default:
464 ccw_device_done(cdev, DEV_STATE_NOT_OPER);
7e560814 465 return;
1da177e4 466 }
7e560814 467 /* Start Path Group verification. */
7e560814 468 cdev->private->state = DEV_STATE_VERIFY;
28bdc6f6 469 cdev->private->flags.doverify = 0;
7e560814 470 ccw_device_verify_start(cdev);
1da177e4
LT
471}
472
473/*
474 * Start device recognition.
475 */
476int
477ccw_device_recognition(struct ccw_device *cdev)
478{
479 struct subchannel *sch;
480 int ret;
481
482 if ((cdev->private->state != DEV_STATE_NOT_OPER) &&
483 (cdev->private->state != DEV_STATE_BOXED))
484 return -EINVAL;
485 sch = to_subchannel(cdev->dev.parent);
edf22096 486 ret = cio_enable_subchannel(sch, (u32)(addr_t)sch);
1da177e4
LT
487 if (ret != 0)
488 /* Couldn't enable the subchannel for i/o. Sick device. */
489 return ret;
490
491 /* After 60s the device recognition is considered to have failed. */
492 ccw_device_set_timeout(cdev, 60*HZ);
493
494 /*
495 * We used to start here with a sense pgid to find out whether a device
496 * is locked by someone else. Unfortunately, the sense pgid command
497 * code has other meanings on devices predating the path grouping
498 * algorithm, so we start with sense id and box the device after an
499 * timeout (or if sense pgid during path verification detects the device
500 * is locked, as may happen on newer devices).
501 */
502 cdev->private->flags.recog_done = 0;
503 cdev->private->state = DEV_STATE_SENSE_ID;
504 ccw_device_sense_id_start(cdev);
505 return 0;
506}
507
508/*
509 * Handle timeout in device recognition.
510 */
511static void
512ccw_device_recog_timeout(struct ccw_device *cdev, enum dev_event dev_event)
513{
514 int ret;
515
516 ret = ccw_device_cancel_halt_clear(cdev);
517 switch (ret) {
518 case 0:
519 ccw_device_recog_done(cdev, DEV_STATE_BOXED);
520 break;
521 case -ENODEV:
522 ccw_device_recog_done(cdev, DEV_STATE_NOT_OPER);
523 break;
524 default:
525 ccw_device_set_timeout(cdev, 3*HZ);
526 }
527}
528
529
1da177e4
LT
530void
531ccw_device_verify_done(struct ccw_device *cdev, int err)
532{
28bdc6f6
PO
533 struct subchannel *sch;
534
535 sch = to_subchannel(cdev->dev.parent);
536 /* Update schib - pom may have changed. */
537 stsch(sch->schid, &sch->schib);
538 /* Update lpm with verified path mask. */
539 sch->lpm = sch->vpm;
540 /* Repeat path verification? */
541 if (cdev->private->flags.doverify) {
542 cdev->private->flags.doverify = 0;
543 ccw_device_verify_start(cdev);
544 return;
545 }
1da177e4
LT
546 switch (err) {
547 case -EOPNOTSUPP: /* path grouping not supported, just set online. */
548 cdev->private->options.pgroup = 0;
549 case 0:
550 ccw_device_done(cdev, DEV_STATE_ONLINE);
551 /* Deliver fake irb to device driver, if needed. */
552 if (cdev->private->flags.fake_irb) {
553 memset(&cdev->private->irb, 0, sizeof(struct irb));
292888c8
HC
554 cdev->private->irb.scsw.cc = 1;
555 cdev->private->irb.scsw.fctl = SCSW_FCTL_START_FUNC;
556 cdev->private->irb.scsw.actl = SCSW_ACTL_START_PEND;
557 cdev->private->irb.scsw.stctl = SCSW_STCTL_STATUS_PEND;
1da177e4
LT
558 cdev->private->flags.fake_irb = 0;
559 if (cdev->handler)
560 cdev->handler(cdev, cdev->private->intparm,
561 &cdev->private->irb);
562 memset(&cdev->private->irb, 0, sizeof(struct irb));
563 }
564 break;
565 case -ETIME:
8b42f5c2
PO
566 /* Reset oper notify indication after verify error. */
567 cdev->private->flags.donotify = 0;
1da177e4
LT
568 ccw_device_done(cdev, DEV_STATE_BOXED);
569 break;
570 default:
8b42f5c2
PO
571 /* Reset oper notify indication after verify error. */
572 cdev->private->flags.donotify = 0;
46258ab5
CH
573 if (cdev->online) {
574 ccw_device_set_timeout(cdev, 0);
3f4cf6e7 575 dev_fsm_event(cdev, DEV_EVENT_NOTOPER);
46258ab5 576 } else
ee04bbcc 577 ccw_device_done(cdev, DEV_STATE_NOT_OPER);
1da177e4
LT
578 break;
579 }
580}
581
582/*
583 * Get device online.
584 */
585int
586ccw_device_online(struct ccw_device *cdev)
587{
588 struct subchannel *sch;
589 int ret;
590
591 if ((cdev->private->state != DEV_STATE_OFFLINE) &&
592 (cdev->private->state != DEV_STATE_BOXED))
593 return -EINVAL;
594 sch = to_subchannel(cdev->dev.parent);
595 if (css_init_done && !get_device(&cdev->dev))
596 return -ENODEV;
edf22096 597 ret = cio_enable_subchannel(sch, (u32)(addr_t)sch);
1da177e4
LT
598 if (ret != 0) {
599 /* Couldn't enable the subchannel for i/o. Sick device. */
600 if (ret == -ENODEV)
601 dev_fsm_event(cdev, DEV_EVENT_NOTOPER);
602 return ret;
603 }
604 /* Do we want to do path grouping? */
605 if (!cdev->private->options.pgroup) {
7e560814
CH
606 /* Start initial path verification. */
607 cdev->private->state = DEV_STATE_VERIFY;
28bdc6f6 608 cdev->private->flags.doverify = 0;
7e560814 609 ccw_device_verify_start(cdev);
1da177e4
LT
610 return 0;
611 }
612 /* Do a SensePGID first. */
613 cdev->private->state = DEV_STATE_SENSE_PGID;
614 ccw_device_sense_pgid_start(cdev);
615 return 0;
616}
617
618void
619ccw_device_disband_done(struct ccw_device *cdev, int err)
620{
621 switch (err) {
622 case 0:
623 ccw_device_done(cdev, DEV_STATE_OFFLINE);
624 break;
625 case -ETIME:
626 ccw_device_done(cdev, DEV_STATE_BOXED);
627 break;
628 default:
3ecb0a5a 629 cdev->private->flags.donotify = 0;
3f4cf6e7 630 dev_fsm_event(cdev, DEV_EVENT_NOTOPER);
1da177e4
LT
631 ccw_device_done(cdev, DEV_STATE_NOT_OPER);
632 break;
633 }
634}
635
636/*
637 * Shutdown device.
638 */
639int
640ccw_device_offline(struct ccw_device *cdev)
641{
642 struct subchannel *sch;
643
d7b5a4c9
CH
644 if (ccw_device_is_orphan(cdev)) {
645 ccw_device_done(cdev, DEV_STATE_OFFLINE);
646 return 0;
647 }
1da177e4 648 sch = to_subchannel(cdev->dev.parent);
a8237fc4 649 if (stsch(sch->schid, &sch->schib) || !sch->schib.pmcw.dnv)
1da177e4
LT
650 return -ENODEV;
651 if (cdev->private->state != DEV_STATE_ONLINE) {
652 if (sch->schib.scsw.actl != 0)
653 return -EBUSY;
654 return -EINVAL;
655 }
656 if (sch->schib.scsw.actl != 0)
657 return -EBUSY;
658 /* Are we doing path grouping? */
659 if (!cdev->private->options.pgroup) {
660 /* No, set state offline immediately. */
661 ccw_device_done(cdev, DEV_STATE_OFFLINE);
662 return 0;
663 }
664 /* Start Set Path Group commands. */
665 cdev->private->state = DEV_STATE_DISBAND_PGID;
666 ccw_device_disband_start(cdev);
667 return 0;
668}
669
670/*
671 * Handle timeout in device online/offline process.
672 */
673static void
674ccw_device_onoff_timeout(struct ccw_device *cdev, enum dev_event dev_event)
675{
676 int ret;
677
678 ret = ccw_device_cancel_halt_clear(cdev);
679 switch (ret) {
680 case 0:
681 ccw_device_done(cdev, DEV_STATE_BOXED);
682 break;
683 case -ENODEV:
684 ccw_device_done(cdev, DEV_STATE_NOT_OPER);
685 break;
686 default:
687 ccw_device_set_timeout(cdev, 3*HZ);
688 }
689}
690
691/*
692 * Handle not oper event in device recognition.
693 */
694static void
695ccw_device_recog_notoper(struct ccw_device *cdev, enum dev_event dev_event)
696{
697 ccw_device_recog_done(cdev, DEV_STATE_NOT_OPER);
698}
699
700/*
3f4cf6e7 701 * Handle not operational event in non-special state.
1da177e4 702 */
3f4cf6e7
CH
703static void ccw_device_generic_notoper(struct ccw_device *cdev,
704 enum dev_event dev_event)
1da177e4
LT
705{
706 struct subchannel *sch;
707
708 cdev->private->state = DEV_STATE_NOT_OPER;
709 sch = to_subchannel(cdev->dev.parent);
3f4cf6e7 710 css_schedule_eval(sch->schid);
1da177e4
LT
711}
712
713/*
714 * Handle path verification event.
715 */
716static void
717ccw_device_online_verify(struct ccw_device *cdev, enum dev_event dev_event)
718{
719 struct subchannel *sch;
720
1da177e4
LT
721 if (cdev->private->state == DEV_STATE_W4SENSE) {
722 cdev->private->flags.doverify = 1;
723 return;
724 }
725 sch = to_subchannel(cdev->dev.parent);
726 /*
727 * Since we might not just be coming from an interrupt from the
728 * subchannel we have to update the schib.
729 */
a8237fc4 730 stsch(sch->schid, &sch->schib);
1da177e4
LT
731
732 if (sch->schib.scsw.actl != 0 ||
65200c29 733 (sch->schib.scsw.stctl & SCSW_STCTL_STATUS_PEND) ||
1da177e4
LT
734 (cdev->private->irb.scsw.stctl & SCSW_STCTL_STATUS_PEND)) {
735 /*
736 * No final status yet or final status not yet delivered
737 * to the device driver. Can't do path verfication now,
738 * delay until final status was delivered.
739 */
740 cdev->private->flags.doverify = 1;
741 return;
742 }
743 /* Device is idle, we can do the path verification. */
744 cdev->private->state = DEV_STATE_VERIFY;
28bdc6f6 745 cdev->private->flags.doverify = 0;
1da177e4
LT
746 ccw_device_verify_start(cdev);
747}
748
749/*
750 * Got an interrupt for a normal io (state online).
751 */
752static void
753ccw_device_irq(struct ccw_device *cdev, enum dev_event dev_event)
754{
755 struct irb *irb;
756
757 irb = (struct irb *) __LC_IRB;
758 /* Check for unsolicited interrupt. */
759 if ((irb->scsw.stctl ==
760 (SCSW_STCTL_STATUS_PEND | SCSW_STCTL_ALERT_STATUS))
761 && (!irb->scsw.cc)) {
762 if ((irb->scsw.dstat & DEV_STAT_UNIT_CHECK) &&
763 !irb->esw.esw0.erw.cons) {
764 /* Unit check but no sense data. Need basic sense. */
765 if (ccw_device_do_sense(cdev, irb) != 0)
766 goto call_handler_unsol;
e0ec5749 767 memcpy(&cdev->private->irb, irb, sizeof(struct irb));
1da177e4
LT
768 cdev->private->state = DEV_STATE_W4SENSE;
769 cdev->private->intparm = 0;
770 return;
771 }
772call_handler_unsol:
773 if (cdev->handler)
774 cdev->handler (cdev, 0, irb);
18374d37
CH
775 if (cdev->private->flags.doverify)
776 ccw_device_online_verify(cdev, 0);
1da177e4
LT
777 return;
778 }
779 /* Accumulate status and find out if a basic sense is needed. */
780 ccw_device_accumulate_irb(cdev, irb);
781 if (cdev->private->flags.dosense) {
782 if (ccw_device_do_sense(cdev, irb) == 0) {
783 cdev->private->state = DEV_STATE_W4SENSE;
784 }
785 return;
786 }
787 /* Call the handler. */
788 if (ccw_device_call_handler(cdev) && cdev->private->flags.doverify)
789 /* Start delayed path verification. */
790 ccw_device_online_verify(cdev, 0);
791}
792
793/*
794 * Got an timeout in online state.
795 */
796static void
797ccw_device_online_timeout(struct ccw_device *cdev, enum dev_event dev_event)
798{
799 int ret;
800
801 ccw_device_set_timeout(cdev, 0);
802 ret = ccw_device_cancel_halt_clear(cdev);
803 if (ret == -EBUSY) {
804 ccw_device_set_timeout(cdev, 3*HZ);
805 cdev->private->state = DEV_STATE_TIMEOUT_KILL;
806 return;
807 }
3f4cf6e7
CH
808 if (ret == -ENODEV)
809 dev_fsm_event(cdev, DEV_EVENT_NOTOPER);
810 else if (cdev->handler)
1da177e4
LT
811 cdev->handler(cdev, cdev->private->intparm,
812 ERR_PTR(-ETIMEDOUT));
813}
814
815/*
816 * Got an interrupt for a basic sense.
817 */
2b67fc46 818static void
1da177e4
LT
819ccw_device_w4sense(struct ccw_device *cdev, enum dev_event dev_event)
820{
821 struct irb *irb;
822
823 irb = (struct irb *) __LC_IRB;
824 /* Check for unsolicited interrupt. */
825 if (irb->scsw.stctl ==
826 (SCSW_STCTL_STATUS_PEND | SCSW_STCTL_ALERT_STATUS)) {
827 if (irb->scsw.cc == 1)
828 /* Basic sense hasn't started. Try again. */
829 ccw_device_do_sense(cdev, irb);
830 else {
139b83dd 831 CIO_MSG_EVENT(0, "0.%x.%04x: unsolicited "
e556bbbd
CH
832 "interrupt during w4sense...\n",
833 cdev->private->dev_id.ssid,
834 cdev->private->dev_id.devno);
1da177e4
LT
835 if (cdev->handler)
836 cdev->handler (cdev, 0, irb);
837 }
838 return;
839 }
3ba1998e
CH
840 /*
841 * Check if a halt or clear has been issued in the meanwhile. If yes,
842 * only deliver the halt/clear interrupt to the device driver as if it
843 * had killed the original request.
844 */
845 if (irb->scsw.fctl & (SCSW_FCTL_CLEAR_FUNC | SCSW_FCTL_HALT_FUNC)) {
d23861ff
CH
846 /* Retry Basic Sense if requested. */
847 if (cdev->private->flags.intretry) {
848 cdev->private->flags.intretry = 0;
849 ccw_device_do_sense(cdev, irb);
850 return;
851 }
3ba1998e
CH
852 cdev->private->flags.dosense = 0;
853 memset(&cdev->private->irb, 0, sizeof(struct irb));
854 ccw_device_accumulate_irb(cdev, irb);
855 goto call_handler;
856 }
1da177e4
LT
857 /* Add basic sense info to irb. */
858 ccw_device_accumulate_basic_sense(cdev, irb);
859 if (cdev->private->flags.dosense) {
860 /* Another basic sense is needed. */
861 ccw_device_do_sense(cdev, irb);
862 return;
863 }
3ba1998e 864call_handler:
1da177e4
LT
865 cdev->private->state = DEV_STATE_ONLINE;
866 /* Call the handler. */
867 if (ccw_device_call_handler(cdev) && cdev->private->flags.doverify)
868 /* Start delayed path verification. */
869 ccw_device_online_verify(cdev, 0);
870}
871
872static void
873ccw_device_clear_verify(struct ccw_device *cdev, enum dev_event dev_event)
874{
875 struct irb *irb;
876
877 irb = (struct irb *) __LC_IRB;
878 /* Accumulate status. We don't do basic sense. */
879 ccw_device_accumulate_irb(cdev, irb);
b4f7b1ee
CH
880 /* Remember to clear irb to avoid residuals. */
881 memset(&cdev->private->irb, 0, sizeof(struct irb));
1da177e4
LT
882 /* Try to start delayed device verification. */
883 ccw_device_online_verify(cdev, 0);
884 /* Note: Don't call handler for cio initiated clear! */
885}
886
887static void
888ccw_device_killing_irq(struct ccw_device *cdev, enum dev_event dev_event)
889{
890 struct subchannel *sch;
891
892 sch = to_subchannel(cdev->dev.parent);
893 ccw_device_set_timeout(cdev, 0);
7c8427c3
CH
894 /* Start delayed path verification. */
895 ccw_device_online_verify(cdev, 0);
1da177e4 896 /* OK, i/o is dead now. Call interrupt handler. */
1da177e4
LT
897 if (cdev->handler)
898 cdev->handler(cdev, cdev->private->intparm,
e7769b48 899 ERR_PTR(-EIO));
1da177e4
LT
900}
901
902static void
903ccw_device_killing_timeout(struct ccw_device *cdev, enum dev_event dev_event)
904{
905 int ret;
906
907 ret = ccw_device_cancel_halt_clear(cdev);
908 if (ret == -EBUSY) {
909 ccw_device_set_timeout(cdev, 3*HZ);
910 return;
911 }
7c8427c3
CH
912 /* Start delayed path verification. */
913 ccw_device_online_verify(cdev, 0);
1da177e4
LT
914 if (cdev->handler)
915 cdev->handler(cdev, cdev->private->intparm,
e7769b48 916 ERR_PTR(-EIO));
1da177e4
LT
917}
918
c820de39 919void ccw_device_kill_io(struct ccw_device *cdev)
1da177e4
LT
920{
921 int ret;
1da177e4 922
1da177e4
LT
923 ret = ccw_device_cancel_halt_clear(cdev);
924 if (ret == -EBUSY) {
925 ccw_device_set_timeout(cdev, 3*HZ);
926 cdev->private->state = DEV_STATE_TIMEOUT_KILL;
927 return;
928 }
7c8427c3
CH
929 /* Start delayed path verification. */
930 ccw_device_online_verify(cdev, 0);
1da177e4
LT
931 if (cdev->handler)
932 cdev->handler(cdev, cdev->private->intparm,
e7769b48 933 ERR_PTR(-EIO));
1da177e4
LT
934}
935
936static void
28bdc6f6 937ccw_device_delay_verify(struct ccw_device *cdev, enum dev_event dev_event)
1da177e4 938{
28bdc6f6 939 /* Start verification after current task finished. */
7e560814 940 cdev->private->flags.doverify = 1;
1da177e4
LT
941}
942
943static void
944ccw_device_stlck_done(struct ccw_device *cdev, enum dev_event dev_event)
945{
946 struct irb *irb;
947
948 switch (dev_event) {
949 case DEV_EVENT_INTERRUPT:
950 irb = (struct irb *) __LC_IRB;
951 /* Check for unsolicited interrupt. */
952 if ((irb->scsw.stctl ==
953 (SCSW_STCTL_STATUS_PEND | SCSW_STCTL_ALERT_STATUS)) &&
954 (!irb->scsw.cc))
955 /* FIXME: we should restart stlck here, but this
956 * is extremely unlikely ... */
957 goto out_wakeup;
958
959 ccw_device_accumulate_irb(cdev, irb);
960 /* We don't care about basic sense etc. */
961 break;
962 default: /* timeout */
963 break;
964 }
965out_wakeup:
966 wake_up(&cdev->private->wait_q);
967}
968
969static void
970ccw_device_start_id(struct ccw_device *cdev, enum dev_event dev_event)
971{
972 struct subchannel *sch;
973
974 sch = to_subchannel(cdev->dev.parent);
edf22096 975 if (cio_enable_subchannel(sch, (u32)(addr_t)sch) != 0)
1da177e4
LT
976 /* Couldn't enable the subchannel for i/o. Sick device. */
977 return;
978
979 /* After 60s the device recognition is considered to have failed. */
980 ccw_device_set_timeout(cdev, 60*HZ);
981
982 cdev->private->state = DEV_STATE_DISCONNECTED_SENSE_ID;
983 ccw_device_sense_id_start(cdev);
984}
985
c820de39 986void ccw_device_trigger_reprobe(struct ccw_device *cdev)
1da177e4 987{
c820de39 988 struct subchannel *sch;
1da177e4 989
1da177e4
LT
990 if (cdev->private->state != DEV_STATE_DISCONNECTED)
991 return;
992
c820de39 993 sch = to_subchannel(cdev->dev.parent);
1da177e4 994 /* Update some values. */
a8237fc4 995 if (stsch(sch->schid, &sch->schib))
1da177e4 996 return;
7674da77
CH
997 if (!sch->schib.pmcw.dnv)
998 return;
1da177e4
LT
999 /*
1000 * The pim, pam, pom values may not be accurate, but they are the best
1001 * we have before performing device selection :/
1002 */
28bdc6f6 1003 sch->lpm = sch->schib.pmcw.pam & sch->opm;
1da177e4 1004 /* Re-set some bits in the pmcw that were lost. */
1da177e4
LT
1005 sch->schib.pmcw.csense = 1;
1006 sch->schib.pmcw.ena = 0;
1007 if ((sch->lpm & (sch->lpm - 1)) != 0)
1008 sch->schib.pmcw.mp = 1;
1da177e4 1009 /* We should also udate ssd info, but this has to wait. */
d7b5a4c9
CH
1010 /* Check if this is another device which appeared on the same sch. */
1011 if (sch->schib.pmcw.dev != cdev->private->dev_id.devno) {
1012 PREPARE_WORK(&cdev->private->kick_work,
1013 ccw_device_move_to_orphanage);
c5d4a999 1014 queue_work(slow_path_wq, &cdev->private->kick_work);
d7b5a4c9
CH
1015 } else
1016 ccw_device_start_id(cdev, 0);
1da177e4
LT
1017}
1018
1019static void
1020ccw_device_offline_irq(struct ccw_device *cdev, enum dev_event dev_event)
1021{
1022 struct subchannel *sch;
1023
1024 sch = to_subchannel(cdev->dev.parent);
1025 /*
1026 * An interrupt in state offline means a previous disable was not
1027 * successful. Try again.
1028 */
1029 cio_disable_subchannel(sch);
1030}
1031
1032static void
1033ccw_device_change_cmfstate(struct ccw_device *cdev, enum dev_event dev_event)
1034{
1035 retry_set_schib(cdev);
1036 cdev->private->state = DEV_STATE_ONLINE;
1037 dev_fsm_event(cdev, dev_event);
1038}
1039
94bb0633
CH
1040static void ccw_device_update_cmfblock(struct ccw_device *cdev,
1041 enum dev_event dev_event)
1042{
1043 cmf_retry_copy_block(cdev);
1044 cdev->private->state = DEV_STATE_ONLINE;
1045 dev_fsm_event(cdev, dev_event);
1046}
1da177e4
LT
1047
1048static void
1049ccw_device_quiesce_done(struct ccw_device *cdev, enum dev_event dev_event)
1050{
1051 ccw_device_set_timeout(cdev, 0);
1052 if (dev_event == DEV_EVENT_NOTOPER)
1053 cdev->private->state = DEV_STATE_NOT_OPER;
1054 else
1055 cdev->private->state = DEV_STATE_OFFLINE;
1056 wake_up(&cdev->private->wait_q);
1057}
1058
1059static void
1060ccw_device_quiesce_timeout(struct ccw_device *cdev, enum dev_event dev_event)
1061{
1062 int ret;
1063
1064 ret = ccw_device_cancel_halt_clear(cdev);
1065 switch (ret) {
1066 case 0:
1067 cdev->private->state = DEV_STATE_OFFLINE;
1068 wake_up(&cdev->private->wait_q);
1069 break;
1070 case -ENODEV:
1071 cdev->private->state = DEV_STATE_NOT_OPER;
1072 wake_up(&cdev->private->wait_q);
1073 break;
1074 default:
1075 ccw_device_set_timeout(cdev, HZ/10);
1076 }
1077}
1078
1079/*
1080 * No operation action. This is used e.g. to ignore a timeout event in
1081 * state offline.
1082 */
1083static void
1084ccw_device_nop(struct ccw_device *cdev, enum dev_event dev_event)
1085{
1086}
1087
1088/*
1089 * Bug operation action.
1090 */
1091static void
1092ccw_device_bug(struct ccw_device *cdev, enum dev_event dev_event)
1093{
139b83dd
ME
1094 CIO_MSG_EVENT(0, "Internal state [%i][%i] not handled for device "
1095 "0.%x.%04x\n", cdev->private->state, dev_event,
1096 cdev->private->dev_id.ssid,
1097 cdev->private->dev_id.devno);
1da177e4
LT
1098 BUG();
1099}
1100
1101/*
1102 * device statemachine
1103 */
1104fsm_func_t *dev_jumptable[NR_DEV_STATES][NR_DEV_EVENTS] = {
1105 [DEV_STATE_NOT_OPER] = {
1106 [DEV_EVENT_NOTOPER] = ccw_device_nop,
1107 [DEV_EVENT_INTERRUPT] = ccw_device_bug,
1108 [DEV_EVENT_TIMEOUT] = ccw_device_nop,
1109 [DEV_EVENT_VERIFY] = ccw_device_nop,
1110 },
1111 [DEV_STATE_SENSE_PGID] = {
3f4cf6e7 1112 [DEV_EVENT_NOTOPER] = ccw_device_generic_notoper,
1da177e4
LT
1113 [DEV_EVENT_INTERRUPT] = ccw_device_sense_pgid_irq,
1114 [DEV_EVENT_TIMEOUT] = ccw_device_onoff_timeout,
1115 [DEV_EVENT_VERIFY] = ccw_device_nop,
1116 },
1117 [DEV_STATE_SENSE_ID] = {
1118 [DEV_EVENT_NOTOPER] = ccw_device_recog_notoper,
1119 [DEV_EVENT_INTERRUPT] = ccw_device_sense_id_irq,
1120 [DEV_EVENT_TIMEOUT] = ccw_device_recog_timeout,
1121 [DEV_EVENT_VERIFY] = ccw_device_nop,
1122 },
1123 [DEV_STATE_OFFLINE] = {
3f4cf6e7 1124 [DEV_EVENT_NOTOPER] = ccw_device_generic_notoper,
1da177e4
LT
1125 [DEV_EVENT_INTERRUPT] = ccw_device_offline_irq,
1126 [DEV_EVENT_TIMEOUT] = ccw_device_nop,
1127 [DEV_EVENT_VERIFY] = ccw_device_nop,
1128 },
1129 [DEV_STATE_VERIFY] = {
3f4cf6e7 1130 [DEV_EVENT_NOTOPER] = ccw_device_generic_notoper,
1da177e4
LT
1131 [DEV_EVENT_INTERRUPT] = ccw_device_verify_irq,
1132 [DEV_EVENT_TIMEOUT] = ccw_device_onoff_timeout,
28bdc6f6 1133 [DEV_EVENT_VERIFY] = ccw_device_delay_verify,
1da177e4
LT
1134 },
1135 [DEV_STATE_ONLINE] = {
3f4cf6e7 1136 [DEV_EVENT_NOTOPER] = ccw_device_generic_notoper,
1da177e4
LT
1137 [DEV_EVENT_INTERRUPT] = ccw_device_irq,
1138 [DEV_EVENT_TIMEOUT] = ccw_device_online_timeout,
1139 [DEV_EVENT_VERIFY] = ccw_device_online_verify,
1140 },
1141 [DEV_STATE_W4SENSE] = {
3f4cf6e7 1142 [DEV_EVENT_NOTOPER] = ccw_device_generic_notoper,
1da177e4
LT
1143 [DEV_EVENT_INTERRUPT] = ccw_device_w4sense,
1144 [DEV_EVENT_TIMEOUT] = ccw_device_nop,
1145 [DEV_EVENT_VERIFY] = ccw_device_online_verify,
1146 },
1147 [DEV_STATE_DISBAND_PGID] = {
3f4cf6e7 1148 [DEV_EVENT_NOTOPER] = ccw_device_generic_notoper,
1da177e4
LT
1149 [DEV_EVENT_INTERRUPT] = ccw_device_disband_irq,
1150 [DEV_EVENT_TIMEOUT] = ccw_device_onoff_timeout,
1151 [DEV_EVENT_VERIFY] = ccw_device_nop,
1152 },
1153 [DEV_STATE_BOXED] = {
3f4cf6e7 1154 [DEV_EVENT_NOTOPER] = ccw_device_generic_notoper,
1da177e4
LT
1155 [DEV_EVENT_INTERRUPT] = ccw_device_stlck_done,
1156 [DEV_EVENT_TIMEOUT] = ccw_device_stlck_done,
1157 [DEV_EVENT_VERIFY] = ccw_device_nop,
1158 },
1159 /* states to wait for i/o completion before doing something */
1160 [DEV_STATE_CLEAR_VERIFY] = {
3f4cf6e7 1161 [DEV_EVENT_NOTOPER] = ccw_device_generic_notoper,
1da177e4
LT
1162 [DEV_EVENT_INTERRUPT] = ccw_device_clear_verify,
1163 [DEV_EVENT_TIMEOUT] = ccw_device_nop,
1164 [DEV_EVENT_VERIFY] = ccw_device_nop,
1165 },
1166 [DEV_STATE_TIMEOUT_KILL] = {
3f4cf6e7 1167 [DEV_EVENT_NOTOPER] = ccw_device_generic_notoper,
1da177e4
LT
1168 [DEV_EVENT_INTERRUPT] = ccw_device_killing_irq,
1169 [DEV_EVENT_TIMEOUT] = ccw_device_killing_timeout,
1170 [DEV_EVENT_VERIFY] = ccw_device_nop, //FIXME
1171 },
1da177e4
LT
1172 [DEV_STATE_QUIESCE] = {
1173 [DEV_EVENT_NOTOPER] = ccw_device_quiesce_done,
1174 [DEV_EVENT_INTERRUPT] = ccw_device_quiesce_done,
1175 [DEV_EVENT_TIMEOUT] = ccw_device_quiesce_timeout,
1176 [DEV_EVENT_VERIFY] = ccw_device_nop,
1177 },
1178 /* special states for devices gone not operational */
1179 [DEV_STATE_DISCONNECTED] = {
1180 [DEV_EVENT_NOTOPER] = ccw_device_nop,
1181 [DEV_EVENT_INTERRUPT] = ccw_device_start_id,
1182 [DEV_EVENT_TIMEOUT] = ccw_device_bug,
28bdc6f6 1183 [DEV_EVENT_VERIFY] = ccw_device_start_id,
1da177e4
LT
1184 },
1185 [DEV_STATE_DISCONNECTED_SENSE_ID] = {
1186 [DEV_EVENT_NOTOPER] = ccw_device_recog_notoper,
1187 [DEV_EVENT_INTERRUPT] = ccw_device_sense_id_irq,
1188 [DEV_EVENT_TIMEOUT] = ccw_device_recog_timeout,
1189 [DEV_EVENT_VERIFY] = ccw_device_nop,
1190 },
1191 [DEV_STATE_CMFCHANGE] = {
1192 [DEV_EVENT_NOTOPER] = ccw_device_change_cmfstate,
1193 [DEV_EVENT_INTERRUPT] = ccw_device_change_cmfstate,
1194 [DEV_EVENT_TIMEOUT] = ccw_device_change_cmfstate,
1195 [DEV_EVENT_VERIFY] = ccw_device_change_cmfstate,
1196 },
94bb0633
CH
1197 [DEV_STATE_CMFUPDATE] = {
1198 [DEV_EVENT_NOTOPER] = ccw_device_update_cmfblock,
1199 [DEV_EVENT_INTERRUPT] = ccw_device_update_cmfblock,
1200 [DEV_EVENT_TIMEOUT] = ccw_device_update_cmfblock,
1201 [DEV_EVENT_VERIFY] = ccw_device_update_cmfblock,
1202 },
1da177e4
LT
1203};
1204
1da177e4 1205EXPORT_SYMBOL_GPL(ccw_device_set_timeout);
This page took 0.445376 seconds and 5 git commands to generate.