2005-04-17 05:20:36 +07:00
|
|
|
#ifndef _CSS_H
|
|
|
|
#define _CSS_H
|
|
|
|
|
2006-03-24 18:15:14 +07:00
|
|
|
#include <linux/mutex.h>
|
2005-04-17 05:20:36 +07:00
|
|
|
#include <linux/wait.h>
|
|
|
|
#include <linux/workqueue.h>
|
2007-04-27 21:01:28 +07:00
|
|
|
#include <linux/device.h>
|
2007-04-27 21:01:31 +07:00
|
|
|
#include <linux/types.h>
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
#include <asm/cio.h>
|
2007-04-27 21:01:31 +07:00
|
|
|
#include <asm/chpid.h>
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2006-01-06 15:19:21 +07:00
|
|
|
#include "schid.h"
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
/*
|
|
|
|
* path grouping stuff
|
|
|
|
*/
|
|
|
|
#define SPID_FUNC_SINGLE_PATH 0x00
|
|
|
|
#define SPID_FUNC_MULTI_PATH 0x80
|
|
|
|
#define SPID_FUNC_ESTABLISH 0x00
|
|
|
|
#define SPID_FUNC_RESIGN 0x40
|
|
|
|
#define SPID_FUNC_DISBAND 0x20
|
|
|
|
|
|
|
|
#define SNID_STATE1_RESET 0
|
|
|
|
#define SNID_STATE1_UNGROUPED 2
|
|
|
|
#define SNID_STATE1_GROUPED 3
|
|
|
|
|
|
|
|
#define SNID_STATE2_NOT_RESVD 0
|
|
|
|
#define SNID_STATE2_RESVD_ELSE 2
|
|
|
|
#define SNID_STATE2_RESVD_SELF 3
|
|
|
|
|
|
|
|
#define SNID_STATE3_MULTI_PATH 1
|
|
|
|
#define SNID_STATE3_SINGLE_PATH 0
|
|
|
|
|
|
|
|
struct path_state {
|
|
|
|
__u8 state1 : 2; /* path state value 1 */
|
|
|
|
__u8 state2 : 2; /* path state value 2 */
|
|
|
|
__u8 state3 : 1; /* path state value 3 */
|
|
|
|
__u8 resvd : 3; /* reserved */
|
|
|
|
} __attribute__ ((packed));
|
|
|
|
|
2006-01-06 15:19:23 +07:00
|
|
|
struct extended_cssid {
|
|
|
|
u8 version;
|
|
|
|
u8 cssid;
|
|
|
|
} __attribute__ ((packed));
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
struct pgid {
|
|
|
|
union {
|
|
|
|
__u8 fc; /* SPID function code */
|
|
|
|
struct path_state ps; /* SNID path state */
|
2006-06-04 16:51:28 +07:00
|
|
|
} __attribute__ ((packed)) inf;
|
2006-01-06 15:19:23 +07:00
|
|
|
union {
|
|
|
|
__u32 cpu_addr : 16; /* CPU address */
|
|
|
|
struct extended_cssid ext_cssid;
|
2006-06-04 16:51:28 +07:00
|
|
|
} __attribute__ ((packed)) pgid_high;
|
2005-04-17 05:20:36 +07:00
|
|
|
__u32 cpu_id : 24; /* CPU identification */
|
|
|
|
__u32 cpu_model : 16; /* CPU model */
|
|
|
|
__u32 tod_high; /* high word TOD clock */
|
|
|
|
} __attribute__ ((packed));
|
|
|
|
|
|
|
|
#define MAX_CIWS 8
|
|
|
|
|
|
|
|
/*
|
|
|
|
* sense-id response buffer layout
|
|
|
|
*/
|
|
|
|
struct senseid {
|
|
|
|
/* common part */
|
|
|
|
__u8 reserved; /* always 0x'FF' */
|
|
|
|
__u16 cu_type; /* control unit type */
|
|
|
|
__u8 cu_model; /* control unit model */
|
|
|
|
__u16 dev_type; /* device type */
|
|
|
|
__u8 dev_model; /* device model */
|
|
|
|
__u8 unused; /* padding byte */
|
|
|
|
/* extended part */
|
|
|
|
struct ciw ciw[MAX_CIWS]; /* variable # of CIWs */
|
|
|
|
} __attribute__ ((packed,aligned(4)));
|
|
|
|
|
|
|
|
struct ccw_device_private {
|
2006-12-08 21:53:57 +07:00
|
|
|
struct ccw_device *cdev;
|
|
|
|
struct subchannel *sch;
|
2005-04-17 05:20:36 +07:00
|
|
|
int state; /* device state */
|
|
|
|
atomic_t onoff;
|
|
|
|
unsigned long registered;
|
2006-10-11 20:31:38 +07:00
|
|
|
struct ccw_dev_id dev_id; /* device id */
|
|
|
|
struct subchannel_id schid; /* subchannel number */
|
2005-04-17 05:20:36 +07:00
|
|
|
__u8 imask; /* lpm mask for SNID/SID/SPGID */
|
|
|
|
int iretry; /* retry counter SNID/SID/SPGID */
|
|
|
|
struct {
|
|
|
|
unsigned int fast:1; /* post with "channel end" */
|
|
|
|
unsigned int repall:1; /* report every interrupt status */
|
|
|
|
unsigned int pgroup:1; /* do path grouping */
|
|
|
|
unsigned int force:1; /* allow forced online */
|
|
|
|
} __attribute__ ((packed)) options;
|
|
|
|
struct {
|
|
|
|
unsigned int pgid_single:1; /* use single path for Set PGID */
|
|
|
|
unsigned int esid:1; /* Ext. SenseID supported by HW */
|
|
|
|
unsigned int dosense:1; /* delayed SENSE required */
|
|
|
|
unsigned int doverify:1; /* delayed path verification */
|
|
|
|
unsigned int donotify:1; /* call notify function */
|
|
|
|
unsigned int recog_done:1; /* dev. recog. complete */
|
|
|
|
unsigned int fake_irb:1; /* deliver faked irb */
|
2006-12-04 21:41:04 +07:00
|
|
|
unsigned int intretry:1; /* retry internal operation */
|
2005-04-17 05:20:36 +07:00
|
|
|
} __attribute__((packed)) flags;
|
|
|
|
unsigned long intparm; /* user interruption parameter */
|
|
|
|
struct qdio_irq *qdio_data;
|
|
|
|
struct irb irb; /* device status */
|
|
|
|
struct senseid senseid; /* SenseID info */
|
2006-07-12 21:40:19 +07:00
|
|
|
struct pgid pgid[8]; /* path group IDs per chpid*/
|
2005-04-17 05:20:36 +07:00
|
|
|
struct ccw1 iccws[2]; /* ccws for SNID/SID/SPGID commands */
|
|
|
|
struct work_struct kick_work;
|
|
|
|
wait_queue_head_t wait_q;
|
|
|
|
struct timer_list timer;
|
|
|
|
void *cmb; /* measurement information */
|
|
|
|
struct list_head cmb_list; /* list of measured devices */
|
|
|
|
u64 cmb_start_time; /* clock value of cmb reset */
|
|
|
|
void *cmb_wait; /* deferred cmb enable/disable */
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* A css driver handles all subchannels of one type.
|
|
|
|
* Currently, we only care about I/O subchannels (type 0), these
|
|
|
|
* have a ccw_device connected to them.
|
|
|
|
*/
|
2006-01-11 16:56:22 +07:00
|
|
|
struct subchannel;
|
2005-04-17 05:20:36 +07:00
|
|
|
struct css_driver {
|
|
|
|
unsigned int subchannel_type;
|
|
|
|
struct device_driver drv;
|
|
|
|
void (*irq)(struct device *);
|
|
|
|
int (*notify)(struct device *, int);
|
|
|
|
void (*verify)(struct device *);
|
|
|
|
void (*termination)(struct device *);
|
2006-01-11 16:56:22 +07:00
|
|
|
int (*probe)(struct subchannel *);
|
|
|
|
int (*remove)(struct subchannel *);
|
|
|
|
void (*shutdown)(struct subchannel *);
|
2005-04-17 05:20:36 +07:00
|
|
|
};
|
|
|
|
|
2008-01-26 20:10:38 +07:00
|
|
|
#define to_cssdriver(n) container_of(n, struct css_driver, drv)
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
/*
|
|
|
|
* all css_drivers have the css_bus_type
|
|
|
|
*/
|
|
|
|
extern struct bus_type css_bus_type;
|
|
|
|
|
2006-07-12 21:39:50 +07:00
|
|
|
extern void css_sch_device_unregister(struct subchannel *);
|
2006-01-06 15:19:21 +07:00
|
|
|
extern struct subchannel * get_subchannel_by_schid(struct subchannel_id);
|
2005-04-17 05:20:36 +07:00
|
|
|
extern int css_init_done;
|
2006-01-06 15:19:22 +07:00
|
|
|
extern int for_each_subchannel(int(*fn)(struct subchannel_id, void *), void *);
|
2007-04-27 21:01:34 +07:00
|
|
|
extern void css_process_crw(int, int);
|
2007-02-06 03:16:47 +07:00
|
|
|
extern void css_reiterate_subchannels(void);
|
2007-04-27 21:01:35 +07:00
|
|
|
void css_update_ssd_info(struct subchannel *sch);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2006-01-06 15:19:21 +07:00
|
|
|
#define __MAX_SUBCHANNEL 65535
|
2006-01-06 15:19:25 +07:00
|
|
|
#define __MAX_SSID 3
|
2006-01-06 15:19:23 +07:00
|
|
|
|
|
|
|
struct channel_subsystem {
|
|
|
|
u8 cssid;
|
|
|
|
int valid;
|
2006-01-15 04:21:03 +07:00
|
|
|
struct channel_path *chps[__MAX_CHPID + 1];
|
2006-01-06 15:19:23 +07:00
|
|
|
struct device device;
|
|
|
|
struct pgid global_pgid;
|
2006-03-24 18:15:14 +07:00
|
|
|
struct mutex mutex;
|
|
|
|
/* channel measurement related */
|
|
|
|
int cm_enabled;
|
|
|
|
void *cub_addr1;
|
|
|
|
void *cub_addr2;
|
2006-12-08 21:54:28 +07:00
|
|
|
/* for orphaned ccw devices */
|
|
|
|
struct subchannel *pseudo_subchannel;
|
2006-01-06 15:19:23 +07:00
|
|
|
};
|
|
|
|
#define to_css(dev) container_of(dev, struct channel_subsystem, device)
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
extern struct bus_type css_bus_type;
|
2007-10-12 21:11:13 +07:00
|
|
|
extern struct channel_subsystem *channel_subsystems[];
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
/* Some helper functions for disconnected state. */
|
|
|
|
int device_is_disconnected(struct subchannel *);
|
|
|
|
void device_set_disconnected(struct subchannel *);
|
|
|
|
void device_trigger_reprobe(struct subchannel *);
|
|
|
|
|
|
|
|
/* Helper functions for vary on/off. */
|
|
|
|
int device_is_online(struct subchannel *);
|
2006-10-11 20:31:41 +07:00
|
|
|
void device_kill_io(struct subchannel *);
|
2006-12-04 21:41:04 +07:00
|
|
|
void device_set_intretry(struct subchannel *sch);
|
2006-12-04 21:41:01 +07:00
|
|
|
int device_trigger_verify(struct subchannel *sch);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
|
|
|
/* Machine check helper function. */
|
|
|
|
void device_kill_pending_timer(struct subchannel *);
|
|
|
|
|
|
|
|
/* Helper functions to build lists for the slow path. */
|
2007-04-27 21:01:34 +07:00
|
|
|
void css_schedule_eval(struct subchannel_id schid);
|
|
|
|
void css_schedule_eval_all(void);
|
2005-04-17 05:20:36 +07:00
|
|
|
|
2006-12-08 21:54:28 +07:00
|
|
|
int sch_is_pseudo_sch(struct subchannel *);
|
|
|
|
|
2005-04-17 05:20:36 +07:00
|
|
|
extern struct workqueue_struct *slow_path_wq;
|
2006-12-08 21:54:21 +07:00
|
|
|
|
2006-12-08 21:55:57 +07:00
|
|
|
extern struct attribute_group *subch_attr_groups[];
|
2005-04-17 05:20:36 +07:00
|
|
|
#endif
|