/* * drivers/s390/cio/device_fsm.c * finite state machine for device handling * * Copyright (C) 2002 IBM Deutschland Entwicklung GmbH, * IBM Corporation * Author(s): Cornelia Huck (cornelia.huck@de.ibm.com) * Martin Schwidefsky (schwidefsky@de.ibm.com) */#include<linux/module.h>#include<linux/init.h>#include<linux/jiffies.h>#include<linux/string.h>#include<asm/ccwdev.h>#include<asm/cio.h>#include<asm/chpid.h>#include"cio.h"#include"cio_debug.h"#include"css.h"#include"device.h"#include"chsc.h"#include"ioasm.h"#include"chp.h"staticinttimeout_log_enabled;intdevice_is_online(structsubchannel*sch){structccw_device*cdev;cdev=sch_get_cdev(sch);if(!cdev)return0;return(cdev->private->state==DEV_STATE_ONLINE);}intdevice_is_disconnected(structsubchannel*sch){structccw_device*cdev;cdev=sch_get_cdev(sch);if(!cdev)return0;return(cdev->private->state==DEV_STATE_DISCONNECTED||cdev->private->state==DEV_STATE_DISCONNECTED_SENSE_ID);}voiddevice_set_disconnected(structsubchannel*sch){structccw_device*cdev;cdev=sch_get_cdev(sch);if(!cdev)return;ccw_device_set_timeout(cdev,0);cdev->private->flags.fake_irb=0;cdev->private->state=DEV_STATE_DISCONNECTED;if(cdev->online)ccw_device_schedule_recovery();}voiddevice_set_intretry(structsubchannel*sch){structccw_device*cdev;cdev=sch_get_cdev(sch);if(!cdev)return;cdev->private->flags.intretry=1;}intdevice_trigger_verify(structsubchannel*sch){structccw_device*cdev;cdev=sch_get_cdev(sch);if(!cdev||!cdev->online)return-EINVAL;dev_fsm_event(cdev,DEV_EVENT_VERIFY);return0;}staticint__initccw_timeout_log_setup(char*unused){timeout_log_enabled=1;return1;}__setup("ccw_timeout_log",ccw_timeout_log_setup);staticvoidccw_timeout_log(structccw_device*cdev){structschibschib;structsubchannel*sch;structio_subchannel_private*private;intcc<