0001
0002 #ifndef S390_DEVICE_H
0003 #define S390_DEVICE_H
0004
0005 #include <asm/ccwdev.h>
0006 #include <linux/atomic.h>
0007 #include <linux/timer.h>
0008 #include <linux/wait.h>
0009 #include <linux/notifier.h>
0010 #include <linux/kernel_stat.h>
0011 #include "io_sch.h"
0012
0013
0014
0015
0016 enum dev_state {
0017 DEV_STATE_NOT_OPER,
0018 DEV_STATE_SENSE_ID,
0019 DEV_STATE_OFFLINE,
0020 DEV_STATE_VERIFY,
0021 DEV_STATE_ONLINE,
0022 DEV_STATE_W4SENSE,
0023 DEV_STATE_DISBAND_PGID,
0024 DEV_STATE_BOXED,
0025
0026 DEV_STATE_TIMEOUT_KILL,
0027 DEV_STATE_QUIESCE,
0028
0029 DEV_STATE_DISCONNECTED,
0030 DEV_STATE_DISCONNECTED_SENSE_ID,
0031 DEV_STATE_CMFCHANGE,
0032 DEV_STATE_CMFUPDATE,
0033 DEV_STATE_STEAL_LOCK,
0034
0035 NR_DEV_STATES
0036 };
0037
0038
0039
0040
0041 enum dev_event {
0042 DEV_EVENT_NOTOPER,
0043 DEV_EVENT_INTERRUPT,
0044 DEV_EVENT_TIMEOUT,
0045 DEV_EVENT_VERIFY,
0046
0047 NR_DEV_EVENTS
0048 };
0049
0050 struct ccw_device;
0051
0052
0053
0054
0055 typedef void (fsm_func_t)(struct ccw_device *, enum dev_event);
0056 extern fsm_func_t *dev_jumptable[NR_DEV_STATES][NR_DEV_EVENTS];
0057
0058 static inline void
0059 dev_fsm_event(struct ccw_device *cdev, enum dev_event dev_event)
0060 {
0061 int state = cdev->private->state;
0062
0063 if (dev_event == DEV_EVENT_INTERRUPT) {
0064 if (state == DEV_STATE_ONLINE)
0065 inc_irq_stat(cdev->private->int_class);
0066 else if (state != DEV_STATE_CMFCHANGE &&
0067 state != DEV_STATE_CMFUPDATE)
0068 inc_irq_stat(IRQIO_CIO);
0069 }
0070 dev_jumptable[state][dev_event](cdev, dev_event);
0071 }
0072
0073
0074
0075
0076 static inline int
0077 dev_fsm_final_state(struct ccw_device *cdev)
0078 {
0079 return (cdev->private->state == DEV_STATE_NOT_OPER ||
0080 cdev->private->state == DEV_STATE_OFFLINE ||
0081 cdev->private->state == DEV_STATE_ONLINE ||
0082 cdev->private->state == DEV_STATE_BOXED);
0083 }
0084
0085 int __init io_subchannel_init(void);
0086
0087 void io_subchannel_recog_done(struct ccw_device *cdev);
0088 void io_subchannel_init_config(struct subchannel *sch);
0089
0090 int ccw_device_cancel_halt_clear(struct ccw_device *);
0091
0092 int ccw_device_is_orphan(struct ccw_device *);
0093
0094 void ccw_device_recognition(struct ccw_device *);
0095 int ccw_device_online(struct ccw_device *);
0096 int ccw_device_offline(struct ccw_device *);
0097 void ccw_device_update_sense_data(struct ccw_device *);
0098 int ccw_device_test_sense_data(struct ccw_device *);
0099 int ccw_purge_blacklisted(void);
0100 void ccw_device_sched_todo(struct ccw_device *cdev, enum cdev_todo todo);
0101 struct ccw_device *get_ccwdev_by_dev_id(struct ccw_dev_id *dev_id);
0102
0103
0104 void ccw_device_accumulate_irb(struct ccw_device *, struct irb *);
0105 void ccw_device_accumulate_basic_sense(struct ccw_device *, struct irb *);
0106 int ccw_device_accumulate_and_sense(struct ccw_device *, struct irb *);
0107 int ccw_device_do_sense(struct ccw_device *, struct irb *);
0108
0109
0110 int lpm_adjust(int lpm, int mask);
0111 void ccw_request_start(struct ccw_device *);
0112 int ccw_request_cancel(struct ccw_device *cdev);
0113 void ccw_request_handler(struct ccw_device *cdev);
0114 void ccw_request_timeout(struct ccw_device *cdev);
0115 void ccw_request_notoper(struct ccw_device *cdev);
0116
0117
0118 void ccw_device_sense_id_start(struct ccw_device *);
0119 void ccw_device_sense_id_done(struct ccw_device *, int);
0120
0121
0122 void ccw_device_verify_start(struct ccw_device *);
0123 void ccw_device_verify_done(struct ccw_device *, int);
0124
0125 void ccw_device_disband_start(struct ccw_device *);
0126 void ccw_device_disband_done(struct ccw_device *, int);
0127
0128 int ccw_device_stlck(struct ccw_device *);
0129
0130
0131 void ccw_device_trigger_reprobe(struct ccw_device *);
0132 void ccw_device_kill_io(struct ccw_device *);
0133 int ccw_device_notify(struct ccw_device *, int);
0134 void ccw_device_set_disconnected(struct ccw_device *cdev);
0135 void ccw_device_set_notoper(struct ccw_device *cdev);
0136
0137 void ccw_device_timeout(struct timer_list *t);
0138 void ccw_device_set_timeout(struct ccw_device *, int);
0139 void ccw_device_schedule_recovery(void);
0140
0141
0142 void retry_set_schib(struct ccw_device *cdev);
0143 void cmf_retry_copy_block(struct ccw_device *);
0144 int cmf_reenable(struct ccw_device *);
0145 void cmf_reactivate(void);
0146 extern struct device_attribute dev_attr_cmb_enable;
0147 #endif