aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/cio/device_fsm.c
diff options
context:
space:
mode:
authorPeter Oberparleiter <peter.oberparleiter@de.ibm.com>2009-12-07 06:51:26 -0500
committerMartin Schwidefsky <sky@mschwide.boeblingen.de.ibm.com>2009-12-07 06:51:31 -0500
commit39f5360b3d68a8e96d280481d9c442e7c005c317 (patch)
tree47d22cf70fffc21959e0728c06279913a863c028 /drivers/s390/cio/device_fsm.c
parente1f0fbd655539b0093738f58d57db83a0ac2dd6c (diff)
[S390] cio: use ccw request infrastructure for sense id
Use the newly introduced ccw request infrastructure to implement the sense id operation. Signed-off-by: Peter Oberparleiter <peter.oberparleiter@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390/cio/device_fsm.c')
-rw-r--r--drivers/s390/cio/device_fsm.c66
1 files changed, 17 insertions, 49 deletions
diff --git a/drivers/s390/cio/device_fsm.c b/drivers/s390/cio/device_fsm.c
index c397442ab3d8..6247d07d395e 100644
--- a/drivers/s390/cio/device_fsm.c
+++ b/drivers/s390/cio/device_fsm.c
@@ -229,7 +229,6 @@ ccw_device_recog_done(struct ccw_device *cdev, int state)
229 229
230 sch = to_subchannel(cdev->dev.parent); 230 sch = to_subchannel(cdev->dev.parent);
231 231
232 ccw_device_set_timeout(cdev, 0);
233 cio_disable_subchannel(sch); 232 cio_disable_subchannel(sch);
234 /* 233 /*
235 * Now that we tried recognition, we have performed device selection 234 * Now that we tried recognition, we have performed device selection
@@ -263,22 +262,10 @@ ccw_device_recog_done(struct ccw_device *cdev, int state)
263 } 262 }
264 switch (state) { 263 switch (state) {
265 case DEV_STATE_NOT_OPER: 264 case DEV_STATE_NOT_OPER:
266 CIO_MSG_EVENT(2, "SenseID : unknown device %04x on "
267 "subchannel 0.%x.%04x\n",
268 cdev->private->dev_id.devno,
269 sch->schid.ssid, sch->schid.sch_no);
270 break; 265 break;
271 case DEV_STATE_OFFLINE: 266 case DEV_STATE_OFFLINE:
272 if (!cdev->online) { 267 if (!cdev->online) {
273 ccw_device_update_sense_data(cdev); 268 ccw_device_update_sense_data(cdev);
274 /* Issue device info message. */
275 CIO_MSG_EVENT(4, "SenseID : device 0.%x.%04x reports: "
276 "CU Type/Mod = %04X/%02X, Dev Type/Mod "
277 "= %04X/%02X\n",
278 cdev->private->dev_id.ssid,
279 cdev->private->dev_id.devno,
280 cdev->id.cu_type, cdev->id.cu_model,
281 cdev->id.dev_type, cdev->id.dev_model);
282 break; 269 break;
283 } 270 }
284 cdev->private->state = DEV_STATE_OFFLINE; 271 cdev->private->state = DEV_STATE_OFFLINE;
@@ -293,10 +280,6 @@ ccw_device_recog_done(struct ccw_device *cdev, int state)
293 } 280 }
294 return; 281 return;
295 case DEV_STATE_BOXED: 282 case DEV_STATE_BOXED:
296 CIO_MSG_EVENT(0, "SenseID : boxed device %04x on "
297 " subchannel 0.%x.%04x\n",
298 cdev->private->dev_id.devno,
299 sch->schid.ssid, sch->schid.sch_no);
300 if (cdev->id.cu_type != 0) { /* device was recognized before */ 283 if (cdev->id.cu_type != 0) { /* device was recognized before */
301 cdev->private->flags.recog_done = 1; 284 cdev->private->flags.recog_done = 1;
302 cdev->private->state = DEV_STATE_BOXED; 285 cdev->private->state = DEV_STATE_BOXED;
@@ -520,27 +503,25 @@ void ccw_device_recognition(struct ccw_device *cdev)
520} 503}
521 504
522/* 505/*
523 * Handle timeout in device recognition. 506 * Handle events for states that use the ccw request infrastructure.
524 */ 507 */
525static void 508static void ccw_device_request_event(struct ccw_device *cdev, enum dev_event e)
526ccw_device_recog_timeout(struct ccw_device *cdev, enum dev_event dev_event)
527{ 509{
528 int ret; 510 switch (e) {
529 511 case DEV_EVENT_NOTOPER:
530 ret = ccw_device_cancel_halt_clear(cdev); 512 ccw_request_notoper(cdev);
531 switch (ret) {
532 case 0:
533 ccw_device_recog_done(cdev, DEV_STATE_BOXED);
534 break; 513 break;
535 case -ENODEV: 514 case DEV_EVENT_INTERRUPT:
536 ccw_device_recog_done(cdev, DEV_STATE_NOT_OPER); 515 ccw_request_handler(cdev);
516 break;
517 case DEV_EVENT_TIMEOUT:
518 ccw_request_timeout(cdev);
537 break; 519 break;
538 default: 520 default:
539 ccw_device_set_timeout(cdev, 3*HZ); 521 break;
540 } 522 }
541} 523}
542 524
543
544void 525void
545ccw_device_verify_done(struct ccw_device *cdev, int err) 526ccw_device_verify_done(struct ccw_device *cdev, int err)
546{ 527{
@@ -713,15 +694,6 @@ ccw_device_onoff_timeout(struct ccw_device *cdev, enum dev_event dev_event)
713} 694}
714 695
715/* 696/*
716 * Handle not oper event in device recognition.
717 */
718static void
719ccw_device_recog_notoper(struct ccw_device *cdev, enum dev_event dev_event)
720{
721 ccw_device_recog_done(cdev, DEV_STATE_NOT_OPER);
722}
723
724/*
725 * Handle not operational event in non-special state. 697 * Handle not operational event in non-special state.
726 */ 698 */
727static void ccw_device_generic_notoper(struct ccw_device *cdev, 699static void ccw_device_generic_notoper(struct ccw_device *cdev,
@@ -1015,10 +987,6 @@ ccw_device_start_id(struct ccw_device *cdev, enum dev_event dev_event)
1015 if (cio_enable_subchannel(sch, (u32)(addr_t)sch) != 0) 987 if (cio_enable_subchannel(sch, (u32)(addr_t)sch) != 0)
1016 /* Couldn't enable the subchannel for i/o. Sick device. */ 988 /* Couldn't enable the subchannel for i/o. Sick device. */
1017 return; 989 return;
1018
1019 /* After 60s the device recognition is considered to have failed. */
1020 ccw_device_set_timeout(cdev, 60*HZ);
1021
1022 cdev->private->state = DEV_STATE_DISCONNECTED_SENSE_ID; 990 cdev->private->state = DEV_STATE_DISCONNECTED_SENSE_ID;
1023 ccw_device_sense_id_start(cdev); 991 ccw_device_sense_id_start(cdev);
1024} 992}
@@ -1141,9 +1109,9 @@ fsm_func_t *dev_jumptable[NR_DEV_STATES][NR_DEV_EVENTS] = {
1141 [DEV_EVENT_VERIFY] = ccw_device_nop, 1109 [DEV_EVENT_VERIFY] = ccw_device_nop,
1142 }, 1110 },
1143 [DEV_STATE_SENSE_ID] = { 1111 [DEV_STATE_SENSE_ID] = {
1144 [DEV_EVENT_NOTOPER] = ccw_device_recog_notoper, 1112 [DEV_EVENT_NOTOPER] = ccw_device_request_event,
1145 [DEV_EVENT_INTERRUPT] = ccw_device_sense_id_irq, 1113 [DEV_EVENT_INTERRUPT] = ccw_device_request_event,
1146 [DEV_EVENT_TIMEOUT] = ccw_device_recog_timeout, 1114 [DEV_EVENT_TIMEOUT] = ccw_device_request_event,
1147 [DEV_EVENT_VERIFY] = ccw_device_nop, 1115 [DEV_EVENT_VERIFY] = ccw_device_nop,
1148 }, 1116 },
1149 [DEV_STATE_OFFLINE] = { 1117 [DEV_STATE_OFFLINE] = {
@@ -1209,9 +1177,9 @@ fsm_func_t *dev_jumptable[NR_DEV_STATES][NR_DEV_EVENTS] = {
1209 [DEV_EVENT_VERIFY] = ccw_device_start_id, 1177 [DEV_EVENT_VERIFY] = ccw_device_start_id,
1210 }, 1178 },
1211 [DEV_STATE_DISCONNECTED_SENSE_ID] = { 1179 [DEV_STATE_DISCONNECTED_SENSE_ID] = {
1212 [DEV_EVENT_NOTOPER] = ccw_device_recog_notoper, 1180 [DEV_EVENT_NOTOPER] = ccw_device_request_event,
1213 [DEV_EVENT_INTERRUPT] = ccw_device_sense_id_irq, 1181 [DEV_EVENT_INTERRUPT] = ccw_device_request_event,
1214 [DEV_EVENT_TIMEOUT] = ccw_device_recog_timeout, 1182 [DEV_EVENT_TIMEOUT] = ccw_device_request_event,
1215 [DEV_EVENT_VERIFY] = ccw_device_nop, 1183 [DEV_EVENT_VERIFY] = ccw_device_nop,
1216 }, 1184 },
1217 [DEV_STATE_CMFCHANGE] = { 1185 [DEV_STATE_CMFCHANGE] = {