[S390] cio: Remove grace period for vary off chpid.
[linux-2.6/linux-2.6-openrd.git] / drivers / s390 / cio / css.h
blob4c2ff83362887aafe64fea2a5ebf6137b8456b9a
1 #ifndef _CSS_H
2 #define _CSS_H
4 #include <linux/mutex.h>
5 #include <linux/wait.h>
6 #include <linux/workqueue.h>
8 #include <asm/cio.h>
10 #include "schid.h"
13 * path grouping stuff
15 #define SPID_FUNC_SINGLE_PATH 0x00
16 #define SPID_FUNC_MULTI_PATH 0x80
17 #define SPID_FUNC_ESTABLISH 0x00
18 #define SPID_FUNC_RESIGN 0x40
19 #define SPID_FUNC_DISBAND 0x20
21 #define SNID_STATE1_RESET 0
22 #define SNID_STATE1_UNGROUPED 2
23 #define SNID_STATE1_GROUPED 3
25 #define SNID_STATE2_NOT_RESVD 0
26 #define SNID_STATE2_RESVD_ELSE 2
27 #define SNID_STATE2_RESVD_SELF 3
29 #define SNID_STATE3_MULTI_PATH 1
30 #define SNID_STATE3_SINGLE_PATH 0
32 struct path_state {
33 __u8 state1 : 2; /* path state value 1 */
34 __u8 state2 : 2; /* path state value 2 */
35 __u8 state3 : 1; /* path state value 3 */
36 __u8 resvd : 3; /* reserved */
37 } __attribute__ ((packed));
39 struct extended_cssid {
40 u8 version;
41 u8 cssid;
42 } __attribute__ ((packed));
44 struct pgid {
45 union {
46 __u8 fc; /* SPID function code */
47 struct path_state ps; /* SNID path state */
48 } __attribute__ ((packed)) inf;
49 union {
50 __u32 cpu_addr : 16; /* CPU address */
51 struct extended_cssid ext_cssid;
52 } __attribute__ ((packed)) pgid_high;
53 __u32 cpu_id : 24; /* CPU identification */
54 __u32 cpu_model : 16; /* CPU model */
55 __u32 tod_high; /* high word TOD clock */
56 } __attribute__ ((packed));
58 #define MAX_CIWS 8
61 * sense-id response buffer layout
63 struct senseid {
64 /* common part */
65 __u8 reserved; /* always 0x'FF' */
66 __u16 cu_type; /* control unit type */
67 __u8 cu_model; /* control unit model */
68 __u16 dev_type; /* device type */
69 __u8 dev_model; /* device model */
70 __u8 unused; /* padding byte */
71 /* extended part */
72 struct ciw ciw[MAX_CIWS]; /* variable # of CIWs */
73 } __attribute__ ((packed,aligned(4)));
75 struct ccw_device_private {
76 int state; /* device state */
77 atomic_t onoff;
78 unsigned long registered;
79 struct ccw_dev_id dev_id; /* device id */
80 struct subchannel_id schid; /* subchannel number */
81 __u8 imask; /* lpm mask for SNID/SID/SPGID */
82 int iretry; /* retry counter SNID/SID/SPGID */
83 struct {
84 unsigned int fast:1; /* post with "channel end" */
85 unsigned int repall:1; /* report every interrupt status */
86 unsigned int pgroup:1; /* do path grouping */
87 unsigned int force:1; /* allow forced online */
88 } __attribute__ ((packed)) options;
89 struct {
90 unsigned int pgid_single:1; /* use single path for Set PGID */
91 unsigned int esid:1; /* Ext. SenseID supported by HW */
92 unsigned int dosense:1; /* delayed SENSE required */
93 unsigned int doverify:1; /* delayed path verification */
94 unsigned int donotify:1; /* call notify function */
95 unsigned int recog_done:1; /* dev. recog. complete */
96 unsigned int fake_irb:1; /* deliver faked irb */
97 } __attribute__((packed)) flags;
98 unsigned long intparm; /* user interruption parameter */
99 struct qdio_irq *qdio_data;
100 struct irb irb; /* device status */
101 struct senseid senseid; /* SenseID info */
102 struct pgid pgid[8]; /* path group IDs per chpid*/
103 struct ccw1 iccws[2]; /* ccws for SNID/SID/SPGID commands */
104 struct work_struct kick_work;
105 wait_queue_head_t wait_q;
106 struct timer_list timer;
107 void *cmb; /* measurement information */
108 struct list_head cmb_list; /* list of measured devices */
109 u64 cmb_start_time; /* clock value of cmb reset */
110 void *cmb_wait; /* deferred cmb enable/disable */
114 * A css driver handles all subchannels of one type.
115 * Currently, we only care about I/O subchannels (type 0), these
116 * have a ccw_device connected to them.
118 struct subchannel;
119 struct css_driver {
120 unsigned int subchannel_type;
121 struct device_driver drv;
122 void (*irq)(struct device *);
123 int (*notify)(struct device *, int);
124 void (*verify)(struct device *);
125 void (*termination)(struct device *);
126 int (*probe)(struct subchannel *);
127 int (*remove)(struct subchannel *);
128 void (*shutdown)(struct subchannel *);
132 * all css_drivers have the css_bus_type
134 extern struct bus_type css_bus_type;
135 extern struct css_driver io_subchannel_driver;
137 extern int css_probe_device(struct subchannel_id);
138 extern int css_sch_device_register(struct subchannel *);
139 extern void css_sch_device_unregister(struct subchannel *);
140 extern struct subchannel * get_subchannel_by_schid(struct subchannel_id);
141 extern int css_init_done;
142 extern int for_each_subchannel(int(*fn)(struct subchannel_id, void *), void *);
144 #define __MAX_SUBCHANNEL 65535
145 #define __MAX_SSID 3
146 #define __MAX_CHPID 255
147 #define __MAX_CSSID 0
149 struct channel_subsystem {
150 u8 cssid;
151 int valid;
152 struct channel_path *chps[__MAX_CHPID + 1];
153 struct device device;
154 struct pgid global_pgid;
155 struct mutex mutex;
156 /* channel measurement related */
157 int cm_enabled;
158 void *cub_addr1;
159 void *cub_addr2;
161 #define to_css(dev) container_of(dev, struct channel_subsystem, device)
163 extern struct bus_type css_bus_type;
164 extern struct channel_subsystem *css[];
166 /* Some helper functions for disconnected state. */
167 int device_is_disconnected(struct subchannel *);
168 void device_set_disconnected(struct subchannel *);
169 void device_trigger_reprobe(struct subchannel *);
171 /* Helper functions for vary on/off. */
172 int device_is_online(struct subchannel *);
173 void device_kill_io(struct subchannel *);
175 /* Machine check helper function. */
176 void device_kill_pending_timer(struct subchannel *);
178 /* Helper functions to build lists for the slow path. */
179 extern int css_enqueue_subchannel_slow(struct subchannel_id schid);
180 void css_walk_subchannel_slow_list(void (*fn)(unsigned long));
181 void css_clear_subchannel_slow_list(void);
182 int css_slow_subchannels_exist(void);
183 extern int need_rescan;
185 extern struct workqueue_struct *slow_path_wq;
186 extern struct work_struct slow_path_work;
187 #endif