md/raid5: correctly update sync_completed when we reach max_resync
[deliverable/linux.git] / drivers / s390 / cio / device_ops.c
1 /*
2 * drivers/s390/cio/device_ops.c
3 *
4 * Copyright (C) 2002 IBM Deutschland Entwicklung GmbH,
5 * IBM Corporation
6 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
7 * Cornelia Huck (cornelia.huck@de.ibm.com)
8 */
9 #include <linux/module.h>
10 #include <linux/init.h>
11 #include <linux/errno.h>
12 #include <linux/slab.h>
13 #include <linux/list.h>
14 #include <linux/device.h>
15 #include <linux/delay.h>
16
17 #include <asm/ccwdev.h>
18 #include <asm/idals.h>
19 #include <asm/chpid.h>
20 #include <asm/fcx.h>
21
22 #include "cio.h"
23 #include "cio_debug.h"
24 #include "css.h"
25 #include "chsc.h"
26 #include "device.h"
27 #include "chp.h"
28
29 /**
30 * ccw_device_set_options_mask() - set some options and unset the rest
31 * @cdev: device for which the options are to be set
32 * @flags: options to be set
33 *
34 * All flags specified in @flags are set, all flags not specified in @flags
35 * are cleared.
36 * Returns:
37 * %0 on success, -%EINVAL on an invalid flag combination.
38 */
39 int ccw_device_set_options_mask(struct ccw_device *cdev, unsigned long flags)
40 {
41 /*
42 * The flag usage is mutal exclusive ...
43 */
44 if ((flags & CCWDEV_EARLY_NOTIFICATION) &&
45 (flags & CCWDEV_REPORT_ALL))
46 return -EINVAL;
47 cdev->private->options.fast = (flags & CCWDEV_EARLY_NOTIFICATION) != 0;
48 cdev->private->options.repall = (flags & CCWDEV_REPORT_ALL) != 0;
49 cdev->private->options.pgroup = (flags & CCWDEV_DO_PATHGROUP) != 0;
50 cdev->private->options.force = (flags & CCWDEV_ALLOW_FORCE) != 0;
51 return 0;
52 }
53
54 /**
55 * ccw_device_set_options() - set some options
56 * @cdev: device for which the options are to be set
57 * @flags: options to be set
58 *
59 * All flags specified in @flags are set, the remainder is left untouched.
60 * Returns:
61 * %0 on success, -%EINVAL if an invalid flag combination would ensue.
62 */
63 int ccw_device_set_options(struct ccw_device *cdev, unsigned long flags)
64 {
65 /*
66 * The flag usage is mutal exclusive ...
67 */
68 if (((flags & CCWDEV_EARLY_NOTIFICATION) &&
69 (flags & CCWDEV_REPORT_ALL)) ||
70 ((flags & CCWDEV_EARLY_NOTIFICATION) &&
71 cdev->private->options.repall) ||
72 ((flags & CCWDEV_REPORT_ALL) &&
73 cdev->private->options.fast))
74 return -EINVAL;
75 cdev->private->options.fast |= (flags & CCWDEV_EARLY_NOTIFICATION) != 0;
76 cdev->private->options.repall |= (flags & CCWDEV_REPORT_ALL) != 0;
77 cdev->private->options.pgroup |= (flags & CCWDEV_DO_PATHGROUP) != 0;
78 cdev->private->options.force |= (flags & CCWDEV_ALLOW_FORCE) != 0;
79 return 0;
80 }
81
82 /**
83 * ccw_device_clear_options() - clear some options
84 * @cdev: device for which the options are to be cleared
85 * @flags: options to be cleared
86 *
87 * All flags specified in @flags are cleared, the remainder is left untouched.
88 */
89 void ccw_device_clear_options(struct ccw_device *cdev, unsigned long flags)
90 {
91 cdev->private->options.fast &= (flags & CCWDEV_EARLY_NOTIFICATION) == 0;
92 cdev->private->options.repall &= (flags & CCWDEV_REPORT_ALL) == 0;
93 cdev->private->options.pgroup &= (flags & CCWDEV_DO_PATHGROUP) == 0;
94 cdev->private->options.force &= (flags & CCWDEV_ALLOW_FORCE) == 0;
95 }
96
97 /**
98 * ccw_device_clear() - terminate I/O request processing
99 * @cdev: target ccw device
100 * @intparm: interruption parameter; value is only used if no I/O is
101 * outstanding, otherwise the intparm associated with the I/O request
102 * is returned
103 *
104 * ccw_device_clear() calls csch on @cdev's subchannel.
105 * Returns:
106 * %0 on success,
107 * -%ENODEV on device not operational,
108 * -%EINVAL on invalid device state.
109 * Context:
110 * Interrupts disabled, ccw device lock held
111 */
112 int ccw_device_clear(struct ccw_device *cdev, unsigned long intparm)
113 {
114 struct subchannel *sch;
115 int ret;
116
117 if (!cdev || !cdev->dev.parent)
118 return -ENODEV;
119 if (cdev->private->state == DEV_STATE_NOT_OPER)
120 return -ENODEV;
121 if (cdev->private->state != DEV_STATE_ONLINE &&
122 cdev->private->state != DEV_STATE_W4SENSE)
123 return -EINVAL;
124 sch = to_subchannel(cdev->dev.parent);
125 ret = cio_clear(sch);
126 if (ret == 0)
127 cdev->private->intparm = intparm;
128 return ret;
129 }
130
131 /**
132 * ccw_device_start_key() - start a s390 channel program with key
133 * @cdev: target ccw device
134 * @cpa: logical start address of channel program
135 * @intparm: user specific interruption parameter; will be presented back to
136 * @cdev's interrupt handler. Allows a device driver to associate
137 * the interrupt with a particular I/O request.
138 * @lpm: defines the channel path to be used for a specific I/O request. A
139 * value of 0 will make cio use the opm.
140 * @key: storage key to be used for the I/O
141 * @flags: additional flags; defines the action to be performed for I/O
142 * processing.
143 *
144 * Start a S/390 channel program. When the interrupt arrives, the
145 * IRQ handler is called, either immediately, delayed (dev-end missing,
146 * or sense required) or never (no IRQ handler registered).
147 * Returns:
148 * %0, if the operation was successful;
149 * -%EBUSY, if the device is busy, or status pending;
150 * -%EACCES, if no path specified in @lpm is operational;
151 * -%ENODEV, if the device is not operational.
152 * Context:
153 * Interrupts disabled, ccw device lock held
154 */
155 int ccw_device_start_key(struct ccw_device *cdev, struct ccw1 *cpa,
156 unsigned long intparm, __u8 lpm, __u8 key,
157 unsigned long flags)
158 {
159 struct subchannel *sch;
160 int ret;
161
162 if (!cdev || !cdev->dev.parent)
163 return -ENODEV;
164 sch = to_subchannel(cdev->dev.parent);
165 if (cdev->private->state == DEV_STATE_NOT_OPER)
166 return -ENODEV;
167 if (cdev->private->state == DEV_STATE_VERIFY ||
168 cdev->private->state == DEV_STATE_CLEAR_VERIFY) {
169 /* Remember to fake irb when finished. */
170 if (!cdev->private->flags.fake_irb) {
171 cdev->private->flags.fake_irb = 1;
172 cdev->private->intparm = intparm;
173 return 0;
174 } else
175 /* There's already a fake I/O around. */
176 return -EBUSY;
177 }
178 if (cdev->private->state != DEV_STATE_ONLINE ||
179 ((sch->schib.scsw.cmd.stctl & SCSW_STCTL_PRIM_STATUS) &&
180 !(sch->schib.scsw.cmd.stctl & SCSW_STCTL_SEC_STATUS)) ||
181 cdev->private->flags.doverify)
182 return -EBUSY;
183 ret = cio_set_options (sch, flags);
184 if (ret)
185 return ret;
186 /* Adjust requested path mask to excluded varied off paths. */
187 if (lpm) {
188 lpm &= sch->opm;
189 if (lpm == 0)
190 return -EACCES;
191 }
192 ret = cio_start_key (sch, cpa, lpm, key);
193 switch (ret) {
194 case 0:
195 cdev->private->intparm = intparm;
196 break;
197 case -EACCES:
198 case -ENODEV:
199 dev_fsm_event(cdev, DEV_EVENT_VERIFY);
200 break;
201 }
202 return ret;
203 }
204
205 /**
206 * ccw_device_start_timeout_key() - start a s390 channel program with timeout and key
207 * @cdev: target ccw device
208 * @cpa: logical start address of channel program
209 * @intparm: user specific interruption parameter; will be presented back to
210 * @cdev's interrupt handler. Allows a device driver to associate
211 * the interrupt with a particular I/O request.
212 * @lpm: defines the channel path to be used for a specific I/O request. A
213 * value of 0 will make cio use the opm.
214 * @key: storage key to be used for the I/O
215 * @flags: additional flags; defines the action to be performed for I/O
216 * processing.
217 * @expires: timeout value in jiffies
218 *
219 * Start a S/390 channel program. When the interrupt arrives, the
220 * IRQ handler is called, either immediately, delayed (dev-end missing,
221 * or sense required) or never (no IRQ handler registered).
222 * This function notifies the device driver if the channel program has not
223 * completed during the time specified by @expires. If a timeout occurs, the
224 * channel program is terminated via xsch, hsch or csch, and the device's
225 * interrupt handler will be called with an irb containing ERR_PTR(-%ETIMEDOUT).
226 * Returns:
227 * %0, if the operation was successful;
228 * -%EBUSY, if the device is busy, or status pending;
229 * -%EACCES, if no path specified in @lpm is operational;
230 * -%ENODEV, if the device is not operational.
231 * Context:
232 * Interrupts disabled, ccw device lock held
233 */
234 int ccw_device_start_timeout_key(struct ccw_device *cdev, struct ccw1 *cpa,
235 unsigned long intparm, __u8 lpm, __u8 key,
236 unsigned long flags, int expires)
237 {
238 int ret;
239
240 if (!cdev)
241 return -ENODEV;
242 ccw_device_set_timeout(cdev, expires);
243 ret = ccw_device_start_key(cdev, cpa, intparm, lpm, key, flags);
244 if (ret != 0)
245 ccw_device_set_timeout(cdev, 0);
246 return ret;
247 }
248
249 /**
250 * ccw_device_start() - start a s390 channel program
251 * @cdev: target ccw device
252 * @cpa: logical start address of channel program
253 * @intparm: user specific interruption parameter; will be presented back to
254 * @cdev's interrupt handler. Allows a device driver to associate
255 * the interrupt with a particular I/O request.
256 * @lpm: defines the channel path to be used for a specific I/O request. A
257 * value of 0 will make cio use the opm.
258 * @flags: additional flags; defines the action to be performed for I/O
259 * processing.
260 *
261 * Start a S/390 channel program. When the interrupt arrives, the
262 * IRQ handler is called, either immediately, delayed (dev-end missing,
263 * or sense required) or never (no IRQ handler registered).
264 * Returns:
265 * %0, if the operation was successful;
266 * -%EBUSY, if the device is busy, or status pending;
267 * -%EACCES, if no path specified in @lpm is operational;
268 * -%ENODEV, if the device is not operational.
269 * Context:
270 * Interrupts disabled, ccw device lock held
271 */
272 int ccw_device_start(struct ccw_device *cdev, struct ccw1 *cpa,
273 unsigned long intparm, __u8 lpm, unsigned long flags)
274 {
275 return ccw_device_start_key(cdev, cpa, intparm, lpm,
276 PAGE_DEFAULT_KEY, flags);
277 }
278
279 /**
280 * ccw_device_start_timeout() - start a s390 channel program with timeout
281 * @cdev: target ccw device
282 * @cpa: logical start address of channel program
283 * @intparm: user specific interruption parameter; will be presented back to
284 * @cdev's interrupt handler. Allows a device driver to associate
285 * the interrupt with a particular I/O request.
286 * @lpm: defines the channel path to be used for a specific I/O request. A
287 * value of 0 will make cio use the opm.
288 * @flags: additional flags; defines the action to be performed for I/O
289 * processing.
290 * @expires: timeout value in jiffies
291 *
292 * Start a S/390 channel program. When the interrupt arrives, the
293 * IRQ handler is called, either immediately, delayed (dev-end missing,
294 * or sense required) or never (no IRQ handler registered).
295 * This function notifies the device driver if the channel program has not
296 * completed during the time specified by @expires. If a timeout occurs, the
297 * channel program is terminated via xsch, hsch or csch, and the device's
298 * interrupt handler will be called with an irb containing ERR_PTR(-%ETIMEDOUT).
299 * Returns:
300 * %0, if the operation was successful;
301 * -%EBUSY, if the device is busy, or status pending;
302 * -%EACCES, if no path specified in @lpm is operational;
303 * -%ENODEV, if the device is not operational.
304 * Context:
305 * Interrupts disabled, ccw device lock held
306 */
307 int ccw_device_start_timeout(struct ccw_device *cdev, struct ccw1 *cpa,
308 unsigned long intparm, __u8 lpm,
309 unsigned long flags, int expires)
310 {
311 return ccw_device_start_timeout_key(cdev, cpa, intparm, lpm,
312 PAGE_DEFAULT_KEY, flags,
313 expires);
314 }
315
316
317 /**
318 * ccw_device_halt() - halt I/O request processing
319 * @cdev: target ccw device
320 * @intparm: interruption parameter; value is only used if no I/O is
321 * outstanding, otherwise the intparm associated with the I/O request
322 * is returned
323 *
324 * ccw_device_halt() calls hsch on @cdev's subchannel.
325 * Returns:
326 * %0 on success,
327 * -%ENODEV on device not operational,
328 * -%EINVAL on invalid device state,
329 * -%EBUSY on device busy or interrupt pending.
330 * Context:
331 * Interrupts disabled, ccw device lock held
332 */
333 int ccw_device_halt(struct ccw_device *cdev, unsigned long intparm)
334 {
335 struct subchannel *sch;
336 int ret;
337
338 if (!cdev || !cdev->dev.parent)
339 return -ENODEV;
340 if (cdev->private->state == DEV_STATE_NOT_OPER)
341 return -ENODEV;
342 if (cdev->private->state != DEV_STATE_ONLINE &&
343 cdev->private->state != DEV_STATE_W4SENSE)
344 return -EINVAL;
345 sch = to_subchannel(cdev->dev.parent);
346 ret = cio_halt(sch);
347 if (ret == 0)
348 cdev->private->intparm = intparm;
349 return ret;
350 }
351
352 /**
353 * ccw_device_resume() - resume channel program execution
354 * @cdev: target ccw device
355 *
356 * ccw_device_resume() calls rsch on @cdev's subchannel.
357 * Returns:
358 * %0 on success,
359 * -%ENODEV on device not operational,
360 * -%EINVAL on invalid device state,
361 * -%EBUSY on device busy or interrupt pending.
362 * Context:
363 * Interrupts disabled, ccw device lock held
364 */
365 int ccw_device_resume(struct ccw_device *cdev)
366 {
367 struct subchannel *sch;
368
369 if (!cdev || !cdev->dev.parent)
370 return -ENODEV;
371 sch = to_subchannel(cdev->dev.parent);
372 if (cdev->private->state == DEV_STATE_NOT_OPER)
373 return -ENODEV;
374 if (cdev->private->state != DEV_STATE_ONLINE ||
375 !(sch->schib.scsw.cmd.actl & SCSW_ACTL_SUSPENDED))
376 return -EINVAL;
377 return cio_resume(sch);
378 }
379
380 /*
381 * Pass interrupt to device driver.
382 */
383 int
384 ccw_device_call_handler(struct ccw_device *cdev)
385 {
386 struct subchannel *sch;
387 unsigned int stctl;
388 int ending_status;
389
390 sch = to_subchannel(cdev->dev.parent);
391
392 /*
393 * we allow for the device action handler if .
394 * - we received ending status
395 * - the action handler requested to see all interrupts
396 * - we received an intermediate status
397 * - fast notification was requested (primary status)
398 * - unsolicited interrupts
399 */
400 stctl = scsw_stctl(&cdev->private->irb.scsw);
401 ending_status = (stctl & SCSW_STCTL_SEC_STATUS) ||
402 (stctl == (SCSW_STCTL_ALERT_STATUS | SCSW_STCTL_STATUS_PEND)) ||
403 (stctl == SCSW_STCTL_STATUS_PEND);
404 if (!ending_status &&
405 !cdev->private->options.repall &&
406 !(stctl & SCSW_STCTL_INTER_STATUS) &&
407 !(cdev->private->options.fast &&
408 (stctl & SCSW_STCTL_PRIM_STATUS)))
409 return 0;
410
411 /* Clear pending timers for device driver initiated I/O. */
412 if (ending_status)
413 ccw_device_set_timeout(cdev, 0);
414 /*
415 * Now we are ready to call the device driver interrupt handler.
416 */
417 if (cdev->handler)
418 cdev->handler(cdev, cdev->private->intparm,
419 &cdev->private->irb);
420
421 /*
422 * Clear the old and now useless interrupt response block.
423 */
424 memset(&cdev->private->irb, 0, sizeof(struct irb));
425
426 return 1;
427 }
428
429 /**
430 * ccw_device_get_ciw() - Search for CIW command in extended sense data.
431 * @cdev: ccw device to inspect
432 * @ct: command type to look for
433 *
434 * During SenseID, command information words (CIWs) describing special
435 * commands available to the device may have been stored in the extended
436 * sense data. This function searches for CIWs of a specified command
437 * type in the extended sense data.
438 * Returns:
439 * %NULL if no extended sense data has been stored or if no CIW of the
440 * specified command type could be found,
441 * else a pointer to the CIW of the specified command type.
442 */
443 struct ciw *ccw_device_get_ciw(struct ccw_device *cdev, __u32 ct)
444 {
445 int ciw_cnt;
446
447 if (cdev->private->flags.esid == 0)
448 return NULL;
449 for (ciw_cnt = 0; ciw_cnt < MAX_CIWS; ciw_cnt++)
450 if (cdev->private->senseid.ciw[ciw_cnt].ct == ct)
451 return cdev->private->senseid.ciw + ciw_cnt;
452 return NULL;
453 }
454
455 /**
456 * ccw_device_get_path_mask() - get currently available paths
457 * @cdev: ccw device to be queried
458 * Returns:
459 * %0 if no subchannel for the device is available,
460 * else the mask of currently available paths for the ccw device's subchannel.
461 */
462 __u8 ccw_device_get_path_mask(struct ccw_device *cdev)
463 {
464 struct subchannel *sch;
465
466 if (!cdev->dev.parent)
467 return 0;
468
469 sch = to_subchannel(cdev->dev.parent);
470 return sch->lpm;
471 }
472
473 /*
474 * Try to break the lock on a boxed device.
475 */
476 int
477 ccw_device_stlck(struct ccw_device *cdev)
478 {
479 void *buf, *buf2;
480 unsigned long flags;
481 struct subchannel *sch;
482 int ret;
483
484 if (!cdev)
485 return -ENODEV;
486
487 if (cdev->drv && !cdev->private->options.force)
488 return -EINVAL;
489
490 sch = to_subchannel(cdev->dev.parent);
491
492 CIO_TRACE_EVENT(2, "stl lock");
493 CIO_TRACE_EVENT(2, dev_name(&cdev->dev));
494
495 buf = kmalloc(32*sizeof(char), GFP_DMA|GFP_KERNEL);
496 if (!buf)
497 return -ENOMEM;
498 buf2 = kmalloc(32*sizeof(char), GFP_DMA|GFP_KERNEL);
499 if (!buf2) {
500 kfree(buf);
501 return -ENOMEM;
502 }
503 spin_lock_irqsave(sch->lock, flags);
504 ret = cio_enable_subchannel(sch, (u32)(addr_t)sch);
505 if (ret)
506 goto out_unlock;
507 /*
508 * Setup ccw. We chain an unconditional reserve and a release so we
509 * only break the lock.
510 */
511 cdev->private->iccws[0].cmd_code = CCW_CMD_STLCK;
512 cdev->private->iccws[0].cda = (__u32) __pa(buf);
513 cdev->private->iccws[0].count = 32;
514 cdev->private->iccws[0].flags = CCW_FLAG_CC;
515 cdev->private->iccws[1].cmd_code = CCW_CMD_RELEASE;
516 cdev->private->iccws[1].cda = (__u32) __pa(buf2);
517 cdev->private->iccws[1].count = 32;
518 cdev->private->iccws[1].flags = 0;
519 ret = cio_start(sch, cdev->private->iccws, 0);
520 if (ret) {
521 cio_disable_subchannel(sch); //FIXME: return code?
522 goto out_unlock;
523 }
524 cdev->private->irb.scsw.cmd.actl |= SCSW_ACTL_START_PEND;
525 spin_unlock_irqrestore(sch->lock, flags);
526 wait_event(cdev->private->wait_q,
527 cdev->private->irb.scsw.cmd.actl == 0);
528 spin_lock_irqsave(sch->lock, flags);
529 cio_disable_subchannel(sch); //FIXME: return code?
530 if ((cdev->private->irb.scsw.cmd.dstat !=
531 (DEV_STAT_CHN_END|DEV_STAT_DEV_END)) ||
532 (cdev->private->irb.scsw.cmd.cstat != 0))
533 ret = -EIO;
534 /* Clear irb. */
535 memset(&cdev->private->irb, 0, sizeof(struct irb));
536 out_unlock:
537 kfree(buf);
538 kfree(buf2);
539 spin_unlock_irqrestore(sch->lock, flags);
540 return ret;
541 }
542
543 void *ccw_device_get_chp_desc(struct ccw_device *cdev, int chp_no)
544 {
545 struct subchannel *sch;
546 struct chp_id chpid;
547
548 sch = to_subchannel(cdev->dev.parent);
549 chp_id_init(&chpid);
550 chpid.id = sch->schib.pmcw.chpid[chp_no];
551 return chp_get_chp_desc(chpid);
552 }
553
554 /**
555 * ccw_device_get_id - obtain a ccw device id
556 * @cdev: device to obtain the id for
557 * @dev_id: where to fill in the values
558 */
559 void ccw_device_get_id(struct ccw_device *cdev, struct ccw_dev_id *dev_id)
560 {
561 *dev_id = cdev->private->dev_id;
562 }
563 EXPORT_SYMBOL(ccw_device_get_id);
564
565 /**
566 * ccw_device_tm_start_key - perform start function
567 * @cdev: ccw device on which to perform the start function
568 * @tcw: transport-command word to be started
569 * @intparm: user defined parameter to be passed to the interrupt handler
570 * @lpm: mask of paths to use
571 * @key: storage key to use for storage access
572 *
573 * Start the tcw on the given ccw device. Return zero on success, non-zero
574 * otherwise.
575 */
576 int ccw_device_tm_start_key(struct ccw_device *cdev, struct tcw *tcw,
577 unsigned long intparm, u8 lpm, u8 key)
578 {
579 struct subchannel *sch;
580 int rc;
581
582 sch = to_subchannel(cdev->dev.parent);
583 if (cdev->private->state != DEV_STATE_ONLINE)
584 return -EIO;
585 /* Adjust requested path mask to excluded varied off paths. */
586 if (lpm) {
587 lpm &= sch->opm;
588 if (lpm == 0)
589 return -EACCES;
590 }
591 rc = cio_tm_start_key(sch, tcw, lpm, key);
592 if (rc == 0)
593 cdev->private->intparm = intparm;
594 return rc;
595 }
596 EXPORT_SYMBOL(ccw_device_tm_start_key);
597
598 /**
599 * ccw_device_tm_start_timeout_key - perform start function
600 * @cdev: ccw device on which to perform the start function
601 * @tcw: transport-command word to be started
602 * @intparm: user defined parameter to be passed to the interrupt handler
603 * @lpm: mask of paths to use
604 * @key: storage key to use for storage access
605 * @expires: time span in jiffies after which to abort request
606 *
607 * Start the tcw on the given ccw device. Return zero on success, non-zero
608 * otherwise.
609 */
610 int ccw_device_tm_start_timeout_key(struct ccw_device *cdev, struct tcw *tcw,
611 unsigned long intparm, u8 lpm, u8 key,
612 int expires)
613 {
614 int ret;
615
616 ccw_device_set_timeout(cdev, expires);
617 ret = ccw_device_tm_start_key(cdev, tcw, intparm, lpm, key);
618 if (ret != 0)
619 ccw_device_set_timeout(cdev, 0);
620 return ret;
621 }
622 EXPORT_SYMBOL(ccw_device_tm_start_timeout_key);
623
624 /**
625 * ccw_device_tm_start - perform start function
626 * @cdev: ccw device on which to perform the start function
627 * @tcw: transport-command word to be started
628 * @intparm: user defined parameter to be passed to the interrupt handler
629 * @lpm: mask of paths to use
630 *
631 * Start the tcw on the given ccw device. Return zero on success, non-zero
632 * otherwise.
633 */
634 int ccw_device_tm_start(struct ccw_device *cdev, struct tcw *tcw,
635 unsigned long intparm, u8 lpm)
636 {
637 return ccw_device_tm_start_key(cdev, tcw, intparm, lpm,
638 PAGE_DEFAULT_KEY);
639 }
640 EXPORT_SYMBOL(ccw_device_tm_start);
641
642 /**
643 * ccw_device_tm_start_timeout - perform start function
644 * @cdev: ccw device on which to perform the start function
645 * @tcw: transport-command word to be started
646 * @intparm: user defined parameter to be passed to the interrupt handler
647 * @lpm: mask of paths to use
648 * @expires: time span in jiffies after which to abort request
649 *
650 * Start the tcw on the given ccw device. Return zero on success, non-zero
651 * otherwise.
652 */
653 int ccw_device_tm_start_timeout(struct ccw_device *cdev, struct tcw *tcw,
654 unsigned long intparm, u8 lpm, int expires)
655 {
656 return ccw_device_tm_start_timeout_key(cdev, tcw, intparm, lpm,
657 PAGE_DEFAULT_KEY, expires);
658 }
659 EXPORT_SYMBOL(ccw_device_tm_start_timeout);
660
661 /**
662 * ccw_device_tm_intrg - perform interrogate function
663 * @cdev: ccw device on which to perform the interrogate function
664 *
665 * Perform an interrogate function on the given ccw device. Return zero on
666 * success, non-zero otherwise.
667 */
668 int ccw_device_tm_intrg(struct ccw_device *cdev)
669 {
670 struct subchannel *sch = to_subchannel(cdev->dev.parent);
671
672 if (cdev->private->state != DEV_STATE_ONLINE)
673 return -EIO;
674 if (!scsw_is_tm(&sch->schib.scsw) ||
675 !(scsw_actl(&sch->schib.scsw) & SCSW_ACTL_START_PEND))
676 return -EINVAL;
677 return cio_tm_intrg(sch);
678 }
679 EXPORT_SYMBOL(ccw_device_tm_intrg);
680
681 // FIXME: these have to go:
682
683 int
684 _ccw_device_get_subchannel_number(struct ccw_device *cdev)
685 {
686 return cdev->private->schid.sch_no;
687 }
688
689
690 MODULE_LICENSE("GPL");
691 EXPORT_SYMBOL(ccw_device_set_options_mask);
692 EXPORT_SYMBOL(ccw_device_set_options);
693 EXPORT_SYMBOL(ccw_device_clear_options);
694 EXPORT_SYMBOL(ccw_device_clear);
695 EXPORT_SYMBOL(ccw_device_halt);
696 EXPORT_SYMBOL(ccw_device_resume);
697 EXPORT_SYMBOL(ccw_device_start_timeout);
698 EXPORT_SYMBOL(ccw_device_start);
699 EXPORT_SYMBOL(ccw_device_start_timeout_key);
700 EXPORT_SYMBOL(ccw_device_start_key);
701 EXPORT_SYMBOL(ccw_device_get_ciw);
702 EXPORT_SYMBOL(ccw_device_get_path_mask);
703 EXPORT_SYMBOL(_ccw_device_get_subchannel_number);
704 EXPORT_SYMBOL_GPL(ccw_device_get_chp_desc);
This page took 0.044912 seconds and 5 git commands to generate.