This source file includes following definitions.
- ccw_device_id_match
1
2
3
4
5
6
7
8
9 #ifndef _S390_CCWDEV_H_
10 #define _S390_CCWDEV_H_
11
12 #include <linux/device.h>
13 #include <linux/mod_devicetable.h>
14 #include <asm/fcx.h>
15 #include <asm/irq.h>
16 #include <asm/schid.h>
17
18
19 struct irb;
20 struct ccw1;
21 struct ccw_dev_id;
22
23
24
25
26 #define CCW_DEVICE(cu, cum) \
27 .cu_type=(cu), .cu_model=(cum), \
28 .match_flags=(CCW_DEVICE_ID_MATCH_CU_TYPE \
29 | (cum ? CCW_DEVICE_ID_MATCH_CU_MODEL : 0))
30
31 #define CCW_DEVICE_DEVTYPE(cu, cum, dev, devm) \
32 .cu_type=(cu), .cu_model=(cum), .dev_type=(dev), .dev_model=(devm),\
33 .match_flags=CCW_DEVICE_ID_MATCH_CU_TYPE \
34 | ((cum) ? CCW_DEVICE_ID_MATCH_CU_MODEL : 0) \
35 | CCW_DEVICE_ID_MATCH_DEVICE_TYPE \
36 | ((devm) ? CCW_DEVICE_ID_MATCH_DEVICE_MODEL : 0)
37
38
39
40
41
42
43 static inline const struct ccw_device_id *
44 ccw_device_id_match(const struct ccw_device_id *array,
45 const struct ccw_device_id *match)
46 {
47 const struct ccw_device_id *id = array;
48
49 for (id = array; id->match_flags; id++) {
50 if ((id->match_flags & CCW_DEVICE_ID_MATCH_CU_TYPE)
51 && (id->cu_type != match->cu_type))
52 continue;
53
54 if ((id->match_flags & CCW_DEVICE_ID_MATCH_CU_MODEL)
55 && (id->cu_model != match->cu_model))
56 continue;
57
58 if ((id->match_flags & CCW_DEVICE_ID_MATCH_DEVICE_TYPE)
59 && (id->dev_type != match->dev_type))
60 continue;
61
62 if ((id->match_flags & CCW_DEVICE_ID_MATCH_DEVICE_MODEL)
63 && (id->dev_model != match->dev_model))
64 continue;
65
66 return id;
67 }
68
69 return NULL;
70 }
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85 struct ccw_device {
86 spinlock_t *ccwlock;
87
88 struct ccw_device_private *private;
89
90 struct ccw_device_id id;
91 struct ccw_driver *drv;
92 struct device dev;
93 int online;
94 void (*handler) (struct ccw_device *, unsigned long, struct irb *);
95 };
96
97
98
99
100 #define PE_NONE 0x0
101 #define PE_PATH_GONE 0x1
102 #define PE_PATH_AVAILABLE 0x2
103
104 #define PE_PATHGROUP_ESTABLISHED 0x4
105
106
107
108
109
110 enum uc_todo {
111 UC_TODO_RETRY,
112 UC_TODO_RETRY_ON_NEW_PATH,
113 UC_TODO_STOP
114 };
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135 struct ccw_driver {
136 struct ccw_device_id *ids;
137 int (*probe) (struct ccw_device *);
138 void (*remove) (struct ccw_device *);
139 int (*set_online) (struct ccw_device *);
140 int (*set_offline) (struct ccw_device *);
141 int (*notify) (struct ccw_device *, int);
142 void (*path_event) (struct ccw_device *, int *);
143 void (*shutdown) (struct ccw_device *);
144 int (*prepare) (struct ccw_device *);
145 void (*complete) (struct ccw_device *);
146 int (*freeze)(struct ccw_device *);
147 int (*thaw) (struct ccw_device *);
148 int (*restore)(struct ccw_device *);
149 enum uc_todo (*uc_handler) (struct ccw_device *, struct irb *);
150 struct device_driver driver;
151 enum interruption_class int_class;
152 };
153
154 extern struct ccw_device *get_ccwdev_by_busid(struct ccw_driver *cdrv,
155 const char *bus_id);
156
157
158
159
160 extern int ccw_driver_register (struct ccw_driver *driver);
161 extern void ccw_driver_unregister (struct ccw_driver *driver);
162
163 struct ccw1;
164
165 extern int ccw_device_set_options_mask(struct ccw_device *, unsigned long);
166 extern int ccw_device_set_options(struct ccw_device *, unsigned long);
167 extern void ccw_device_clear_options(struct ccw_device *, unsigned long);
168 int ccw_device_is_pathgroup(struct ccw_device *cdev);
169 int ccw_device_is_multipath(struct ccw_device *cdev);
170
171
172 #define CCWDEV_EARLY_NOTIFICATION 0x0001
173
174 #define CCWDEV_REPORT_ALL 0x0002
175
176 #define CCWDEV_DO_PATHGROUP 0x0004
177
178 #define CCWDEV_ALLOW_FORCE 0x0008
179
180 #define CCWDEV_DO_MULTIPATH 0x0010
181
182 extern int ccw_device_start(struct ccw_device *, struct ccw1 *,
183 unsigned long, __u8, unsigned long);
184 extern int ccw_device_start_timeout(struct ccw_device *, struct ccw1 *,
185 unsigned long, __u8, unsigned long, int);
186 extern int ccw_device_start_key(struct ccw_device *, struct ccw1 *,
187 unsigned long, __u8, __u8, unsigned long);
188 extern int ccw_device_start_timeout_key(struct ccw_device *, struct ccw1 *,
189 unsigned long, __u8, __u8,
190 unsigned long, int);
191
192
193 extern int ccw_device_resume(struct ccw_device *);
194 extern int ccw_device_halt(struct ccw_device *, unsigned long);
195 extern int ccw_device_clear(struct ccw_device *, unsigned long);
196 int ccw_device_tm_start_key(struct ccw_device *cdev, struct tcw *tcw,
197 unsigned long intparm, u8 lpm, u8 key);
198 int ccw_device_tm_start_key(struct ccw_device *, struct tcw *,
199 unsigned long, u8, u8);
200 int ccw_device_tm_start_timeout_key(struct ccw_device *, struct tcw *,
201 unsigned long, u8, u8, int);
202 int ccw_device_tm_start(struct ccw_device *, struct tcw *,
203 unsigned long, u8);
204 int ccw_device_tm_start_timeout(struct ccw_device *, struct tcw *,
205 unsigned long, u8, int);
206 int ccw_device_tm_intrg(struct ccw_device *cdev);
207
208 int ccw_device_get_mdc(struct ccw_device *cdev, u8 mask);
209
210 extern int ccw_device_set_online(struct ccw_device *cdev);
211 extern int ccw_device_set_offline(struct ccw_device *cdev);
212
213
214 extern struct ciw *ccw_device_get_ciw(struct ccw_device *, __u32 cmd);
215 extern __u8 ccw_device_get_path_mask(struct ccw_device *);
216 extern void ccw_device_get_id(struct ccw_device *, struct ccw_dev_id *);
217
218 #define get_ccwdev_lock(x) (x)->ccwlock
219
220 #define to_ccwdev(n) container_of(n, struct ccw_device, dev)
221 #define to_ccwdrv(n) container_of(n, struct ccw_driver, driver)
222
223 extern struct ccw_device *ccw_device_create_console(struct ccw_driver *);
224 extern void ccw_device_destroy_console(struct ccw_device *);
225 extern int ccw_device_enable_console(struct ccw_device *);
226 extern void ccw_device_wait_idle(struct ccw_device *);
227 extern int ccw_device_force_console(struct ccw_device *);
228
229 extern void *ccw_device_dma_zalloc(struct ccw_device *cdev, size_t size);
230 extern void ccw_device_dma_free(struct ccw_device *cdev,
231 void *cpu_addr, size_t size);
232
233 int ccw_device_siosl(struct ccw_device *);
234
235 extern void ccw_device_get_schid(struct ccw_device *, struct subchannel_id *);
236
237 struct channel_path_desc_fmt0 *ccw_device_get_chp_desc(struct ccw_device *, int);
238 u8 *ccw_device_get_util_str(struct ccw_device *cdev, int chp_idx);
239 #endif