Lines Matching +full:non +full:- +full:operational

1 // SPDX-License-Identifier: GPL-1.0+
30 * ccw_device_set_options_mask() - set some options and unset the rest
37 * %0 on success, -%EINVAL on an invalid flag combination.
46 return -EINVAL; in ccw_device_set_options_mask()
47 cdev->private->options.fast = (flags & CCWDEV_EARLY_NOTIFICATION) != 0; in ccw_device_set_options_mask()
48 cdev->private->options.repall = (flags & CCWDEV_REPORT_ALL) != 0; in ccw_device_set_options_mask()
49 cdev->private->options.pgroup = (flags & CCWDEV_DO_PATHGROUP) != 0; in ccw_device_set_options_mask()
50 cdev->private->options.force = (flags & CCWDEV_ALLOW_FORCE) != 0; in ccw_device_set_options_mask()
51 cdev->private->options.mpath = (flags & CCWDEV_DO_MULTIPATH) != 0; in ccw_device_set_options_mask()
56 * ccw_device_set_options() - set some options
62 * %0 on success, -%EINVAL if an invalid flag combination would ensue.
72 cdev->private->options.repall) || in ccw_device_set_options()
74 cdev->private->options.fast)) in ccw_device_set_options()
75 return -EINVAL; in ccw_device_set_options()
76 cdev->private->options.fast |= (flags & CCWDEV_EARLY_NOTIFICATION) != 0; in ccw_device_set_options()
77 cdev->private->options.repall |= (flags & CCWDEV_REPORT_ALL) != 0; in ccw_device_set_options()
78 cdev->private->options.pgroup |= (flags & CCWDEV_DO_PATHGROUP) != 0; in ccw_device_set_options()
79 cdev->private->options.force |= (flags & CCWDEV_ALLOW_FORCE) != 0; in ccw_device_set_options()
80 cdev->private->options.mpath |= (flags & CCWDEV_DO_MULTIPATH) != 0; in ccw_device_set_options()
85 * ccw_device_clear_options() - clear some options
93 cdev->private->options.fast &= (flags & CCWDEV_EARLY_NOTIFICATION) == 0; in ccw_device_clear_options()
94 cdev->private->options.repall &= (flags & CCWDEV_REPORT_ALL) == 0; in ccw_device_clear_options()
95 cdev->private->options.pgroup &= (flags & CCWDEV_DO_PATHGROUP) == 0; in ccw_device_clear_options()
96 cdev->private->options.force &= (flags & CCWDEV_ALLOW_FORCE) == 0; in ccw_device_clear_options()
97 cdev->private->options.mpath &= (flags & CCWDEV_DO_MULTIPATH) == 0; in ccw_device_clear_options()
101 * ccw_device_is_pathgroup() - determine if paths to this device are grouped
104 * Return non-zero if there is a path group, zero otherwise.
108 return cdev->private->flags.pgroup; in ccw_device_is_pathgroup()
113 * ccw_device_is_multipath() - determine if device is operating in multipath mode
116 * Return non-zero if device is operating in multipath mode, zero otherwise.
120 return cdev->private->flags.mpath; in ccw_device_is_multipath()
125 * ccw_device_clear() - terminate I/O request processing
132 * -%ENODEV on device not operational,
133 * -%EINVAL on invalid device state.
142 if (!cdev || !cdev->dev.parent) in ccw_device_clear()
143 return -ENODEV; in ccw_device_clear()
144 sch = to_subchannel(cdev->dev.parent); in ccw_device_clear()
145 if (!sch->schib.pmcw.ena) in ccw_device_clear()
146 return -EINVAL; in ccw_device_clear()
147 if (cdev->private->state == DEV_STATE_NOT_OPER) in ccw_device_clear()
148 return -ENODEV; in ccw_device_clear()
149 if (cdev->private->state != DEV_STATE_ONLINE && in ccw_device_clear()
150 cdev->private->state != DEV_STATE_W4SENSE) in ccw_device_clear()
151 return -EINVAL; in ccw_device_clear()
155 cdev->private->intparm = intparm; in ccw_device_clear()
160 * ccw_device_start_timeout_key() - start a s390 channel program with timeout and key
174 * IRQ handler is called, either immediately, delayed (dev-end missing,
179 * interrupt handler will be called with an irb containing ERR_PTR(-%ETIMEDOUT).
185 * -%EBUSY, if the device is busy, or status pending;
186 * -%EACCES, if no path specified in @lpm is operational;
187 * -%ENODEV, if the device is not operational.
198 if (!cdev || !cdev->dev.parent) in ccw_device_start_timeout_key()
199 return -ENODEV; in ccw_device_start_timeout_key()
200 sch = to_subchannel(cdev->dev.parent); in ccw_device_start_timeout_key()
201 if (!sch->schib.pmcw.ena) in ccw_device_start_timeout_key()
202 return -EINVAL; in ccw_device_start_timeout_key()
203 if (cdev->private->state == DEV_STATE_NOT_OPER) in ccw_device_start_timeout_key()
204 return -ENODEV; in ccw_device_start_timeout_key()
205 if (cdev->private->state == DEV_STATE_VERIFY || in ccw_device_start_timeout_key()
206 cdev->private->flags.doverify) { in ccw_device_start_timeout_key()
208 if (!cdev->private->flags.fake_irb) { in ccw_device_start_timeout_key()
209 cdev->private->flags.fake_irb = FAKE_CMD_IRB; in ccw_device_start_timeout_key()
210 cdev->private->intparm = intparm; in ccw_device_start_timeout_key()
214 return -EBUSY; in ccw_device_start_timeout_key()
216 if (cdev->private->state != DEV_STATE_ONLINE || in ccw_device_start_timeout_key()
217 ((sch->schib.scsw.cmd.stctl & SCSW_STCTL_PRIM_STATUS) && in ccw_device_start_timeout_key()
218 !(sch->schib.scsw.cmd.stctl & SCSW_STCTL_SEC_STATUS))) in ccw_device_start_timeout_key()
219 return -EBUSY; in ccw_device_start_timeout_key()
225 lpm &= sch->lpm; in ccw_device_start_timeout_key()
227 return -EACCES; in ccw_device_start_timeout_key()
232 cdev->private->intparm = intparm; in ccw_device_start_timeout_key()
236 case -EACCES: in ccw_device_start_timeout_key()
237 case -ENODEV: in ccw_device_start_timeout_key()
245 * ccw_device_start_key() - start a s390 channel program with key
258 * IRQ handler is called, either immediately, delayed (dev-end missing,
265 * -%EBUSY, if the device is busy, or status pending;
266 * -%EACCES, if no path specified in @lpm is operational;
267 * -%ENODEV, if the device is not operational.
280 * ccw_device_start() - start a s390 channel program
292 * IRQ handler is called, either immediately, delayed (dev-end missing,
299 * -%EBUSY, if the device is busy, or status pending;
300 * -%EACCES, if no path specified in @lpm is operational;
301 * -%ENODEV, if the device is not operational.
313 * ccw_device_start_timeout() - start a s390 channel program with timeout
326 * IRQ handler is called, either immediately, delayed (dev-end missing,
331 * interrupt handler will be called with an irb containing ERR_PTR(-%ETIMEDOUT).
337 * -%EBUSY, if the device is busy, or status pending;
338 * -%EACCES, if no path specified in @lpm is operational;
339 * -%ENODEV, if the device is not operational.
354 * ccw_device_halt() - halt I/O request processing
364 * -%ENODEV on device not operational,
365 * -%EINVAL on invalid device state,
366 * -%EBUSY on device busy or interrupt pending.
375 if (!cdev || !cdev->dev.parent) in ccw_device_halt()
376 return -ENODEV; in ccw_device_halt()
377 sch = to_subchannel(cdev->dev.parent); in ccw_device_halt()
378 if (!sch->schib.pmcw.ena) in ccw_device_halt()
379 return -EINVAL; in ccw_device_halt()
380 if (cdev->private->state == DEV_STATE_NOT_OPER) in ccw_device_halt()
381 return -ENODEV; in ccw_device_halt()
382 if (cdev->private->state != DEV_STATE_ONLINE && in ccw_device_halt()
383 cdev->private->state != DEV_STATE_W4SENSE) in ccw_device_halt()
384 return -EINVAL; in ccw_device_halt()
388 cdev->private->intparm = intparm; in ccw_device_halt()
393 * ccw_device_resume() - resume channel program execution
399 * -%ENODEV on device not operational,
400 * -%EINVAL on invalid device state,
401 * -%EBUSY on device busy or interrupt pending.
409 if (!cdev || !cdev->dev.parent) in ccw_device_resume()
410 return -ENODEV; in ccw_device_resume()
411 sch = to_subchannel(cdev->dev.parent); in ccw_device_resume()
412 if (!sch->schib.pmcw.ena) in ccw_device_resume()
413 return -EINVAL; in ccw_device_resume()
414 if (cdev->private->state == DEV_STATE_NOT_OPER) in ccw_device_resume()
415 return -ENODEV; in ccw_device_resume()
416 if (cdev->private->state != DEV_STATE_ONLINE || in ccw_device_resume()
417 !(sch->schib.scsw.cmd.actl & SCSW_ACTL_SUSPENDED)) in ccw_device_resume()
418 return -EINVAL; in ccw_device_resume()
423 * ccw_device_get_ciw() - Search for CIW command in extended sense data.
440 if (cdev->private->flags.esid == 0) in ccw_device_get_ciw()
443 if (cdev->private->dma_area->senseid.ciw[ciw_cnt].ct == ct) in ccw_device_get_ciw()
444 return cdev->private->dma_area->senseid.ciw + ciw_cnt; in ccw_device_get_ciw()
449 * ccw_device_get_path_mask() - get currently available paths
459 if (!cdev->dev.parent) in ccw_device_get_path_mask()
462 sch = to_subchannel(cdev->dev.parent); in ccw_device_get_path_mask()
463 return sch->lpm; in ccw_device_get_path_mask()
467 * ccw_device_get_chp_desc() - return newly allocated channel-path descriptor
471 * On success return a newly allocated copy of the channel-path description
480 sch = to_subchannel(cdev->dev.parent); in ccw_device_get_chp_desc()
482 chpid.id = sch->schib.pmcw.chpid[chp_idx]; in ccw_device_get_chp_desc()
487 * ccw_device_get_util_str() - return newly allocated utility strings
496 struct subchannel *sch = to_subchannel(cdev->dev.parent); in ccw_device_get_util_str()
502 chpid.id = sch->schib.pmcw.chpid[chp_idx]; in ccw_device_get_util_str()
505 util_str = kmalloc(sizeof(chp->desc_fmt3.util_str), GFP_KERNEL); in ccw_device_get_util_str()
509 mutex_lock(&chp->lock); in ccw_device_get_util_str()
510 memcpy(util_str, chp->desc_fmt3.util_str, sizeof(chp->desc_fmt3.util_str)); in ccw_device_get_util_str()
511 mutex_unlock(&chp->lock); in ccw_device_get_util_str()
517 * ccw_device_get_id() - obtain a ccw device id
523 *dev_id = cdev->private->dev_id; in ccw_device_get_id()
528 * ccw_device_tm_start_timeout_key() - perform start function
530 * @tcw: transport-command word to be started
536 * Start the tcw on the given ccw device. Return zero on success, non-zero
546 sch = to_subchannel(cdev->dev.parent); in ccw_device_tm_start_timeout_key()
547 if (!sch->schib.pmcw.ena) in ccw_device_tm_start_timeout_key()
548 return -EINVAL; in ccw_device_tm_start_timeout_key()
549 if (cdev->private->state == DEV_STATE_VERIFY) { in ccw_device_tm_start_timeout_key()
551 if (!cdev->private->flags.fake_irb) { in ccw_device_tm_start_timeout_key()
552 cdev->private->flags.fake_irb = FAKE_TM_IRB; in ccw_device_tm_start_timeout_key()
553 cdev->private->intparm = intparm; in ccw_device_tm_start_timeout_key()
557 return -EBUSY; in ccw_device_tm_start_timeout_key()
559 if (cdev->private->state != DEV_STATE_ONLINE) in ccw_device_tm_start_timeout_key()
560 return -EIO; in ccw_device_tm_start_timeout_key()
563 lpm &= sch->lpm; in ccw_device_tm_start_timeout_key()
565 return -EACCES; in ccw_device_tm_start_timeout_key()
569 cdev->private->intparm = intparm; in ccw_device_tm_start_timeout_key()
578 * ccw_device_tm_start_key() - perform start function
580 * @tcw: transport-command word to be started
585 * Start the tcw on the given ccw device. Return zero on success, non-zero
596 * ccw_device_tm_start() - perform start function
598 * @tcw: transport-command word to be started
602 * Start the tcw on the given ccw device. Return zero on success, non-zero
614 * ccw_device_tm_start_timeout() - perform start function
616 * @tcw: transport-command word to be started
621 * Start the tcw on the given ccw device. Return zero on success, non-zero
633 * ccw_device_get_mdc() - accumulate max data count
637 * Return the number of 64K-bytes blocks all paths at least support
642 struct subchannel *sch = to_subchannel(cdev->dev.parent); in ccw_device_get_mdc()
649 mask &= sch->lpm; in ccw_device_get_mdc()
651 mask = sch->lpm; in ccw_device_get_mdc()
657 chpid.id = sch->schib.pmcw.chpid[i]; in ccw_device_get_mdc()
662 mutex_lock(&chp->lock); in ccw_device_get_mdc()
663 if (!chp->desc_fmt1.f) { in ccw_device_get_mdc()
664 mutex_unlock(&chp->lock); in ccw_device_get_mdc()
667 if (!chp->desc_fmt1.r) in ccw_device_get_mdc()
669 mdc = mdc ? min_t(int, mdc, chp->desc_fmt1.mdc) : in ccw_device_get_mdc()
670 chp->desc_fmt1.mdc; in ccw_device_get_mdc()
671 mutex_unlock(&chp->lock); in ccw_device_get_mdc()
679 * ccw_device_tm_intrg() - perform interrogate function
683 * success, non-zero otherwise.
687 struct subchannel *sch = to_subchannel(cdev->dev.parent); in ccw_device_tm_intrg()
689 if (!sch->schib.pmcw.ena) in ccw_device_tm_intrg()
690 return -EINVAL; in ccw_device_tm_intrg()
691 if (cdev->private->state != DEV_STATE_ONLINE) in ccw_device_tm_intrg()
692 return -EIO; in ccw_device_tm_intrg()
693 if (!scsw_is_tm(&sch->schib.scsw) || in ccw_device_tm_intrg()
694 !(scsw_actl(&sch->schib.scsw) & SCSW_ACTL_START_PEND)) in ccw_device_tm_intrg()
695 return -EINVAL; in ccw_device_tm_intrg()
701 * ccw_device_get_schid() - obtain a subchannel id
707 struct subchannel *sch = to_subchannel(cdev->dev.parent); in ccw_device_get_schid()
709 *schid = sch->schid; in ccw_device_get_schid()
714 * ccw_device_pnso() - Perform Network-Subchannel Operation
719 * @cnc: Boolean change-notification control
737 * ccw_device_get_cssid() - obtain Channel Subsystem ID
743 struct device *sch_dev = cdev->dev.parent; in ccw_device_get_cssid()
744 struct channel_subsystem *css = to_css(sch_dev->parent); in ccw_device_get_cssid()
746 if (css->id_valid) in ccw_device_get_cssid()
747 *cssid = css->cssid; in ccw_device_get_cssid()
748 return css->id_valid ? 0 : -ENODEV; in ccw_device_get_cssid()
753 * ccw_device_get_iid() - obtain MIF-image ID
754 * @cdev: device to obtain the MIF-image ID for
755 * @iid: The resulting MIF-image ID
759 struct device *sch_dev = cdev->dev.parent; in ccw_device_get_iid()
760 struct channel_subsystem *css = to_css(sch_dev->parent); in ccw_device_get_iid()
762 if (css->id_valid) in ccw_device_get_iid()
763 *iid = css->iid; in ccw_device_get_iid()
764 return css->id_valid ? 0 : -ENODEV; in ccw_device_get_iid()
769 * ccw_device_get_chpid() - obtain Channel Path ID
776 struct subchannel *sch = to_subchannel(cdev->dev.parent); in ccw_device_get_chpid()
780 return -EINVAL; in ccw_device_get_chpid()
782 if (!(sch->schib.pmcw.pim & mask)) in ccw_device_get_chpid()
783 return -ENODEV; in ccw_device_get_chpid()
785 *chpid = sch->schib.pmcw.chpid[chp_idx]; in ccw_device_get_chpid()
791 * ccw_device_get_chid() - obtain Channel ID associated with specified CHPID
808 return -ENODEV; in ccw_device_get_chid()
810 mutex_lock(&chp->lock); in ccw_device_get_chid()
811 if (chp->desc_fmt1.flags & 0x10) in ccw_device_get_chid()
812 *chid = chp->desc_fmt1.chid; in ccw_device_get_chid()
814 rc = -ENODEV; in ccw_device_get_chid()
815 mutex_unlock(&chp->lock); in ccw_device_get_chid()
830 if (!get_device(&cdev->dev)) in ccw_device_dma_zalloc()
832 addr = cio_gp_dma_zalloc(cdev->private->dma_pool, &cdev->dev, size); in ccw_device_dma_zalloc()
834 put_device(&cdev->dev); in ccw_device_dma_zalloc()
843 cio_gp_dma_free(cdev->private->dma_pool, cpu_addr, size); in ccw_device_dma_free()
844 put_device(&cdev->dev); in ccw_device_dma_free()