1
2#ifndef S390_IO_SCH_H
3#define S390_IO_SCH_H
4
5#include <linux/types.h>
6#include <asm/schid.h>
7#include <asm/ccwdev.h>
8#include <asm/irq.h>
9#include "css.h"
10#include "orb.h"
11
12struct io_subchannel_private {
13 union orb orb;
14 struct ccw1 sense_ccw;
15 struct ccw_device *cdev;
16 struct {
17 unsigned int suspend:1;
18 unsigned int prefetch:1;
19 unsigned int inter:1;
20 } __packed options;
21} __aligned(8);
22
23#define to_io_private(n) ((struct io_subchannel_private *) \
24 dev_get_drvdata(&(n)->dev))
25#define set_io_private(n, p) (dev_set_drvdata(&(n)->dev, p))
26
27static inline struct ccw_device *sch_get_cdev(struct subchannel *sch)
28{
29 struct io_subchannel_private *priv = to_io_private(sch);
30 return priv ? priv->cdev : NULL;
31}
32
33static inline void sch_set_cdev(struct subchannel *sch,
34 struct ccw_device *cdev)
35{
36 struct io_subchannel_private *priv = to_io_private(sch);
37 if (priv)
38 priv->cdev = cdev;
39}
40
41#define MAX_CIWS 8
42
43
44
45
46enum io_status {
47 IO_DONE,
48 IO_RUNNING,
49 IO_STATUS_ERROR,
50 IO_PATH_ERROR,
51 IO_REJECTED,
52 IO_KILLED
53};
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72struct ccw_request {
73 struct ccw1 *cp;
74 unsigned long timeout;
75 u16 maxretries;
76 u8 lpm;
77 int (*check)(struct ccw_device *, void *);
78 enum io_status (*filter)(struct ccw_device *, void *, struct irb *,
79 enum io_status);
80 void (*callback)(struct ccw_device *, void *, int);
81 void *data;
82 unsigned int singlepath:1;
83
84 unsigned int cancel:1;
85 unsigned int done:1;
86 u16 mask;
87 u16 retries;
88 int drc;
89} __attribute__((packed));
90
91
92
93
94struct senseid {
95
96 u8 reserved;
97 u16 cu_type;
98 u8 cu_model;
99 u16 dev_type;
100 u8 dev_model;
101 u8 unused;
102
103 struct ciw ciw[MAX_CIWS];
104} __attribute__ ((packed, aligned(4)));
105
106enum cdev_todo {
107 CDEV_TODO_NOTHING,
108 CDEV_TODO_ENABLE_CMF,
109 CDEV_TODO_REBIND,
110 CDEV_TODO_REGISTER,
111 CDEV_TODO_UNREG,
112 CDEV_TODO_UNREG_EVAL,
113};
114
115#define FAKE_CMD_IRB 1
116#define FAKE_TM_IRB 2
117
118struct ccw_device_private {
119 struct ccw_device *cdev;
120 struct subchannel *sch;
121 int state;
122 atomic_t onoff;
123 struct ccw_dev_id dev_id;
124 struct ccw_request req;
125 int iretry;
126 u8 pgid_valid_mask;
127 u8 pgid_todo_mask;
128 u8 pgid_reset_mask;
129 u8 path_noirq_mask;
130
131 u8 path_notoper_mask;
132
133 u8 path_gone_mask;
134 u8 path_new_mask;
135 u8 path_broken_mask;
136
137 struct {
138 unsigned int fast:1;
139 unsigned int repall:1;
140 unsigned int pgroup:1;
141 unsigned int force:1;
142 unsigned int mpath:1;
143 } __attribute__ ((packed)) options;
144 struct {
145 unsigned int esid:1;
146 unsigned int dosense:1;
147 unsigned int doverify:1;
148 unsigned int donotify:1;
149 unsigned int recog_done:1;
150 unsigned int fake_irb:2;
151 unsigned int resuming:1;
152 unsigned int pgroup:1;
153 unsigned int mpath:1;
154 unsigned int pgid_unknown:1;
155 unsigned int initialized:1;
156 } __attribute__((packed)) flags;
157 unsigned long intparm;
158 struct qdio_irq *qdio_data;
159 struct irb irb;
160 struct senseid senseid;
161 struct pgid pgid[8];
162 struct ccw1 iccws[2];
163 struct work_struct todo_work;
164 enum cdev_todo todo;
165 wait_queue_head_t wait_q;
166 struct timer_list timer;
167 void *cmb;
168 struct list_head cmb_list;
169 u64 cmb_start_time;
170 void *cmb_wait;
171 enum interruption_class int_class;
172};
173
174#endif
175