2005-04-17 00:20:36 +02:00
|
|
|
#ifndef S390_DEVICE_H
|
|
|
|
#define S390_DEVICE_H
|
|
|
|
|
2006-06-29 14:57:03 +02:00
|
|
|
#include <asm/ccwdev.h>
|
|
|
|
#include <asm/atomic.h>
|
|
|
|
#include <linux/wait.h>
|
|
|
|
|
2008-01-26 14:10:43 +01:00
|
|
|
#include "io_sch.h"
|
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
/*
|
|
|
|
* states of the device statemachine
|
|
|
|
*/
|
|
|
|
enum dev_state {
|
|
|
|
DEV_STATE_NOT_OPER,
|
|
|
|
DEV_STATE_SENSE_PGID,
|
|
|
|
DEV_STATE_SENSE_ID,
|
|
|
|
DEV_STATE_OFFLINE,
|
|
|
|
DEV_STATE_VERIFY,
|
|
|
|
DEV_STATE_ONLINE,
|
|
|
|
DEV_STATE_W4SENSE,
|
|
|
|
DEV_STATE_DISBAND_PGID,
|
|
|
|
DEV_STATE_BOXED,
|
|
|
|
/* states to wait for i/o completion before doing something */
|
|
|
|
DEV_STATE_TIMEOUT_KILL,
|
|
|
|
DEV_STATE_QUIESCE,
|
|
|
|
/* special states for devices gone not operational */
|
|
|
|
DEV_STATE_DISCONNECTED,
|
|
|
|
DEV_STATE_DISCONNECTED_SENSE_ID,
|
|
|
|
DEV_STATE_CMFCHANGE,
|
2006-06-29 15:08:41 +02:00
|
|
|
DEV_STATE_CMFUPDATE,
|
2009-12-07 12:51:32 +01:00
|
|
|
DEV_STATE_STEAL_LOCK,
|
2005-04-17 00:20:36 +02:00
|
|
|
/* last element! */
|
|
|
|
NR_DEV_STATES
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* asynchronous events of the device statemachine
|
|
|
|
*/
|
|
|
|
enum dev_event {
|
|
|
|
DEV_EVENT_NOTOPER,
|
|
|
|
DEV_EVENT_INTERRUPT,
|
|
|
|
DEV_EVENT_TIMEOUT,
|
|
|
|
DEV_EVENT_VERIFY,
|
|
|
|
/* last element! */
|
|
|
|
NR_DEV_EVENTS
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ccw_device;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* action called through jumptable
|
|
|
|
*/
|
|
|
|
typedef void (fsm_func_t)(struct ccw_device *, enum dev_event);
|
|
|
|
extern fsm_func_t *dev_jumptable[NR_DEV_STATES][NR_DEV_EVENTS];
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
dev_fsm_event(struct ccw_device *cdev, enum dev_event dev_event)
|
|
|
|
{
|
|
|
|
dev_jumptable[cdev->private->state][dev_event](cdev, dev_event);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Delivers 1 if the device state is final.
|
|
|
|
*/
|
|
|
|
static inline int
|
|
|
|
dev_fsm_final_state(struct ccw_device *cdev)
|
|
|
|
{
|
|
|
|
return (cdev->private->state == DEV_STATE_NOT_OPER ||
|
|
|
|
cdev->private->state == DEV_STATE_OFFLINE ||
|
|
|
|
cdev->private->state == DEV_STATE_ONLINE ||
|
|
|
|
cdev->private->state == DEV_STATE_BOXED);
|
|
|
|
}
|
|
|
|
|
2006-06-29 14:57:03 +02:00
|
|
|
extern wait_queue_head_t ccw_device_init_wq;
|
|
|
|
extern atomic_t ccw_device_init_count;
|
2009-09-22 22:58:33 +02:00
|
|
|
int __init io_subchannel_init(void);
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
void io_subchannel_recog_done(struct ccw_device *cdev);
|
2008-12-25 13:39:13 +01:00
|
|
|
void io_subchannel_init_config(struct subchannel *sch);
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
int ccw_device_cancel_halt_clear(struct ccw_device *);
|
|
|
|
|
2006-12-08 15:54:28 +01:00
|
|
|
int ccw_device_is_orphan(struct ccw_device *);
|
2005-04-17 00:20:36 +02:00
|
|
|
|
2009-12-07 12:51:21 +01:00
|
|
|
void ccw_device_recognition(struct ccw_device *);
|
2005-04-17 00:20:36 +02:00
|
|
|
int ccw_device_online(struct ccw_device *);
|
|
|
|
int ccw_device_offline(struct ccw_device *);
|
2009-06-16 10:30:20 +02:00
|
|
|
void ccw_device_update_sense_data(struct ccw_device *);
|
|
|
|
int ccw_device_test_sense_data(struct ccw_device *);
|
2009-03-31 19:16:04 +02:00
|
|
|
void ccw_device_schedule_sch_unregister(struct ccw_device *);
|
2008-10-10 21:33:06 +02:00
|
|
|
int ccw_purge_blacklisted(void);
|
2009-12-07 12:51:19 +01:00
|
|
|
void ccw_device_sched_todo(struct ccw_device *cdev, enum cdev_todo todo);
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
/* Function prototypes for device status and basic sense stuff. */
|
|
|
|
void ccw_device_accumulate_irb(struct ccw_device *, struct irb *);
|
|
|
|
void ccw_device_accumulate_basic_sense(struct ccw_device *, struct irb *);
|
|
|
|
int ccw_device_accumulate_and_sense(struct ccw_device *, struct irb *);
|
|
|
|
int ccw_device_do_sense(struct ccw_device *, struct irb *);
|
|
|
|
|
2009-12-07 12:51:25 +01:00
|
|
|
/* Function prototype for internal request handling. */
|
|
|
|
int lpm_adjust(int lpm, int mask);
|
|
|
|
void ccw_request_start(struct ccw_device *);
|
|
|
|
int ccw_request_cancel(struct ccw_device *cdev);
|
|
|
|
void ccw_request_handler(struct ccw_device *cdev);
|
|
|
|
void ccw_request_timeout(struct ccw_device *cdev);
|
|
|
|
void ccw_request_notoper(struct ccw_device *cdev);
|
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
/* Function prototypes for sense id stuff. */
|
|
|
|
void ccw_device_sense_id_start(struct ccw_device *);
|
|
|
|
void ccw_device_sense_id_done(struct ccw_device *, int);
|
|
|
|
|
|
|
|
/* Function prototypes for path grouping stuff. */
|
|
|
|
void ccw_device_verify_start(struct ccw_device *);
|
|
|
|
void ccw_device_verify_done(struct ccw_device *, int);
|
|
|
|
|
|
|
|
void ccw_device_disband_start(struct ccw_device *);
|
|
|
|
void ccw_device_disband_done(struct ccw_device *, int);
|
|
|
|
|
2009-12-07 12:51:32 +01:00
|
|
|
void ccw_device_stlck_start(struct ccw_device *, void *, void *, void *);
|
|
|
|
void ccw_device_stlck_done(struct ccw_device *, void *, int);
|
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
int ccw_device_call_handler(struct ccw_device *);
|
|
|
|
|
|
|
|
int ccw_device_stlck(struct ccw_device *);
|
|
|
|
|
2008-07-14 09:58:45 +02:00
|
|
|
/* Helper function for machine check handling. */
|
|
|
|
void ccw_device_trigger_reprobe(struct ccw_device *);
|
|
|
|
void ccw_device_kill_io(struct ccw_device *);
|
|
|
|
int ccw_device_notify(struct ccw_device *, int);
|
2009-10-06 10:34:02 +02:00
|
|
|
void ccw_device_set_disconnected(struct ccw_device *cdev);
|
2008-08-21 19:46:39 +02:00
|
|
|
void ccw_device_set_notoper(struct ccw_device *cdev);
|
2008-07-14 09:58:45 +02:00
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
/* qdio needs this. */
|
|
|
|
void ccw_device_set_timeout(struct ccw_device *, int);
|
2006-01-06 09:19:21 +01:00
|
|
|
extern struct subchannel_id ccw_device_get_subchannel_id(struct ccw_device *);
|
2007-02-05 21:16:47 +01:00
|
|
|
extern struct bus_type ccw_bus_type;
|
2005-04-17 00:20:36 +02:00
|
|
|
|
2006-06-29 15:08:41 +02:00
|
|
|
/* Channel measurement facility related */
|
2005-04-17 00:20:36 +02:00
|
|
|
void retry_set_schib(struct ccw_device *cdev);
|
2006-06-29 15:08:41 +02:00
|
|
|
void cmf_retry_copy_block(struct ccw_device *);
|
|
|
|
int cmf_reenable(struct ccw_device *);
|
2009-06-16 10:30:20 +02:00
|
|
|
int ccw_set_cmf(struct ccw_device *cdev, int enable);
|
2008-04-17 07:46:26 +02:00
|
|
|
extern struct device_attribute dev_attr_cmb_enable;
|
2005-04-17 00:20:36 +02:00
|
|
|
#endif
|