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

1 // SPDX-License-Identifier: GPL-2.0
3 * S/390 common I/O routines -- low level i/o calls
56 * - cio_msg logs generic cio messages
57 * - cio_trace logs the calling of different functions
58 * - cio_crw logs machine check related cio messages
83 return -1; in cio_debug_init()
92 priv->options.suspend = (flags & DOIO_ALLOW_SUSPEND) != 0; in cio_set_options()
93 priv->options.prefetch = (flags & DOIO_DENY_PREFETCH) != 0; in cio_set_options()
94 priv->options.inter = (flags & DOIO_SUPPRESS_INTER) != 0; in cio_set_options()
104 sch->lpm &= ~lpm; in cio_start_handle_notoper()
106 sch->lpm = 0; in cio_start_handle_notoper()
109 "subchannel 0.%x.%04x!\n", sch->schid.ssid, in cio_start_handle_notoper()
110 sch->schid.sch_no); in cio_start_handle_notoper()
113 return -ENODEV; in cio_start_handle_notoper()
115 sprintf(dbf_text, "no%s", dev_name(&sch->dev)); in cio_start_handle_notoper()
117 CIO_HEX_EVENT(0, &sch->schib, sizeof (struct schib)); in cio_start_handle_notoper()
119 return (sch->lpm ? -EACCES : -ENODEV); in cio_start_handle_notoper()
129 union orb *orb = &priv->orb; in cio_start_key()
133 CIO_TRACE_EVENT(5, dev_name(&sch->dev)); in cio_start_key()
137 orb->cmd.intparm = (u32)(addr_t)sch; in cio_start_key()
138 orb->cmd.fmt = 1; in cio_start_key()
140 orb->cmd.pfch = priv->options.prefetch == 0; in cio_start_key()
141 orb->cmd.spnd = priv->options.suspend; in cio_start_key()
142 orb->cmd.ssic = priv->options.suspend && priv->options.inter; in cio_start_key()
143 orb->cmd.lpm = (lpm != 0) ? lpm : sch->lpm; in cio_start_key()
147 orb->cmd.c64 = 1; in cio_start_key()
148 orb->cmd.i2k = 0; in cio_start_key()
149 orb->cmd.key = key >> 4; in cio_start_key()
151 orb->cmd.cpa = (__u32) __pa(cpa); in cio_start_key()
152 ccode = ssch(sch->schid, orb); in cio_start_key()
162 sch->schib.scsw.cmd.actl |= SCSW_ACTL_START_PEND; in cio_start_key()
166 return -EBUSY; in cio_start_key()
167 case 3: /* device/path not operational */ in cio_start_key()
191 CIO_TRACE_EVENT(4, dev_name(&sch->dev)); in cio_resume()
193 ccode = rsch (sch->schid); in cio_resume()
199 sch->schib.scsw.cmd.actl |= SCSW_ACTL_RESUME_PEND; in cio_resume()
202 return -EBUSY; in cio_resume()
204 return -EINVAL; in cio_resume()
208 * as device is no longer operational ! in cio_resume()
210 return -ENODEV; in cio_resume()
224 return -ENODEV; in cio_halt()
227 CIO_TRACE_EVENT(2, dev_name(&sch->dev)); in cio_halt()
232 ccode = hsch (sch->schid); in cio_halt()
238 sch->schib.scsw.cmd.actl |= SCSW_ACTL_HALT_PEND; in cio_halt()
242 return -EBUSY; in cio_halt()
243 default: /* device not operational */ in cio_halt()
244 return -ENODEV; in cio_halt()
258 return -ENODEV; in cio_clear()
261 CIO_TRACE_EVENT(2, dev_name(&sch->dev)); in cio_clear()
266 ccode = csch (sch->schid); in cio_clear()
272 sch->schib.scsw.cmd.actl |= SCSW_ACTL_CLEAR_PEND; in cio_clear()
274 default: /* device not operational */ in cio_clear()
275 return -ENODEV; in cio_clear()
293 return -ENODEV; in cio_cancel()
296 CIO_TRACE_EVENT(2, dev_name(&sch->dev)); in cio_cancel()
298 ccode = xsch (sch->schid); in cio_cancel()
306 return -ENODEV; in cio_cancel()
309 return -EBUSY; in cio_cancel()
311 return -EINVAL; in cio_cancel()
313 return -ENODEV; in cio_cancel()
319 * cio_cancel_halt_clear - Cancel running I/O by performing cancel, halt
328 * @iretry in the subsequent calls until it gets a non -EBUSY return.
330 * Returns 0 if device now idle, -ENODEV for device not operational,
331 * -EBUSY if an interrupt is expected (either from halt/clear or from a
332 * status pending), and -EIO if out of retries.
339 return -ENODEV; in cio_cancel_halt_clear()
340 if (!sch->schib.pmcw.ena) in cio_cancel_halt_clear()
341 /* Not operational -> done. */ in cio_cancel_halt_clear()
344 if (!(scsw_actl(&sch->schib.scsw) & SCSW_ACTL_HALT_PEND) && in cio_cancel_halt_clear()
345 !(scsw_actl(&sch->schib.scsw) & SCSW_ACTL_CLEAR_PEND)) { in cio_cancel_halt_clear()
346 if (!scsw_is_tm(&sch->schib.scsw)) { in cio_cancel_halt_clear()
348 if (ret != -EINVAL) in cio_cancel_halt_clear()
358 if (!(scsw_actl(&sch->schib.scsw) & SCSW_ACTL_CLEAR_PEND)) { in cio_cancel_halt_clear()
360 *iretry -= 1; in cio_cancel_halt_clear()
362 if (ret != -EBUSY) in cio_cancel_halt_clear()
363 return (ret == 0) ? -EBUSY : ret; in cio_cancel_halt_clear()
370 *iretry -= 1; in cio_cancel_halt_clear()
372 return (ret == 0) ? -EBUSY : ret; in cio_cancel_halt_clear()
375 return -EIO; in cio_cancel_halt_clear()
381 schib->pmcw.intparm = sch->config.intparm; in cio_apply_config()
382 schib->pmcw.mbi = sch->config.mbi; in cio_apply_config()
383 schib->pmcw.isc = sch->config.isc; in cio_apply_config()
384 schib->pmcw.ena = sch->config.ena; in cio_apply_config()
385 schib->pmcw.mme = sch->config.mme; in cio_apply_config()
386 schib->pmcw.mp = sch->config.mp; in cio_apply_config()
387 schib->pmcw.csense = sch->config.csense; in cio_apply_config()
388 schib->pmcw.mbfc = sch->config.mbfc; in cio_apply_config()
389 if (sch->config.mbfc) in cio_apply_config()
390 schib->mba = sch->config.mba; in cio_apply_config()
395 return (schib->pmcw.intparm == sch->config.intparm) && in cio_check_config()
396 (schib->pmcw.mbi == sch->config.mbi) && in cio_check_config()
397 (schib->pmcw.isc == sch->config.isc) && in cio_check_config()
398 (schib->pmcw.ena == sch->config.ena) && in cio_check_config()
399 (schib->pmcw.mme == sch->config.mme) && in cio_check_config()
400 (schib->pmcw.mp == sch->config.mp) && in cio_check_config()
401 (schib->pmcw.csense == sch->config.csense) && in cio_check_config()
402 (schib->pmcw.mbfc == sch->config.mbfc) && in cio_check_config()
403 (!sch->config.mbfc || (schib->mba == sch->config.mba)); in cio_check_config()
407 * cio_commit_config - apply configuration to the subchannel
415 if (stsch(sch->schid, &schib) || !css_sch_is_valid(&schib)) in cio_commit_config()
416 return -ENODEV; in cio_commit_config()
421 ccode = msch(sch->schid, &schib); in cio_commit_config()
422 if (ccode < 0) /* -EIO if msch gets a program check. */ in cio_commit_config()
426 if (stsch(sch->schid, &schib) || in cio_commit_config()
428 return -ENODEV; in cio_commit_config()
431 memcpy(&sch->schib, &schib, sizeof(schib)); in cio_commit_config()
434 ret = -EAGAIN; in cio_commit_config()
437 ret = -EBUSY; in cio_commit_config()
438 if (tsch(sch->schid, &irb)) in cio_commit_config()
443 ret = -EBUSY; in cio_commit_config()
445 case 3: /* not operational */ in cio_commit_config()
446 return -ENODEV; in cio_commit_config()
454 * cio_update_schib - Perform stsch and update schib if subchannel is valid.
456 * Return zero on success, -ENODEV otherwise.
462 if (stsch(sch->schid, &schib) || !css_sch_is_valid(&schib)) in cio_update_schib()
463 return -ENODEV; in cio_update_schib()
465 memcpy(&sch->schib, &schib, sizeof(schib)); in cio_update_schib()
471 * cio_enable_subchannel - enable a subchannel.
480 CIO_TRACE_EVENT(2, dev_name(&sch->dev)); in cio_enable_subchannel()
483 return -EINVAL; in cio_enable_subchannel()
485 return -ENODEV; in cio_enable_subchannel()
487 sch->config.ena = 1; in cio_enable_subchannel()
488 sch->config.isc = sch->isc; in cio_enable_subchannel()
489 sch->config.intparm = intparm; in cio_enable_subchannel()
492 if (ret == -EIO) { in cio_enable_subchannel()
497 sch->config.csense = 0; in cio_enable_subchannel()
506 * cio_disable_subchannel - disable a subchannel.
514 CIO_TRACE_EVENT(2, dev_name(&sch->dev)); in cio_disable_subchannel()
519 return -ENODEV; in cio_disable_subchannel()
521 sch->config.ena = 0; in cio_disable_subchannel()
539 tpi_info = &get_irq_regs()->tpi_info; in do_cio_interrupt()
542 sch = (struct subchannel *)(unsigned long) tpi_info->intparm; in do_cio_interrupt()
546 tsch(tpi_info->schid, irb); in do_cio_interrupt()
549 spin_lock(sch->lock); in do_cio_interrupt()
551 if (tsch(tpi_info->schid, irb) == 0) { in do_cio_interrupt()
553 memcpy (&sch->schib.scsw, &irb->scsw, sizeof (irb->scsw)); in do_cio_interrupt()
555 if (sch->driver && sch->driver->irq) in do_cio_interrupt()
556 sch->driver->irq(sch); in do_cio_interrupt()
561 spin_unlock(sch->lock); in do_cio_interrupt()
589 if (tsch(sch->schid, irb) != 0) in cio_tsch()
590 /* Not status pending or not operational. */ in cio_tsch()
592 memcpy(&sch->schib.scsw, &irb->scsw, sizeof(union scsw)); in cio_tsch()
600 if (sch->driver && sch->driver->irq) in cio_tsch()
601 sch->driver->irq(sch); in cio_tsch()
615 return -ENXIO; in cio_test_for_console()
630 if (console_irq != -1) { in cio_get_console_sch_no()
635 return -1; in cio_get_console_sch_no()
637 } else if (console_devno != -1) { in cio_get_console_sch_no()
652 if (sch_no == -1) { in cio_probe_console()
654 return ERR_PTR(-ENODEV); in cio_probe_console()
660 return ERR_PTR(-ENODEV); in cio_probe_console()
666 lockdep_set_class(sch->lock, &console_sch_key); in cio_probe_console()
668 sch->config.isc = CONSOLE_ISC; in cio_probe_console()
669 sch->config.intparm = (u32)(addr_t)sch; in cio_probe_console()
673 put_device(&sch->dev); in cio_probe_console()
684 return schid_equal(&schid, &console_sch->schid); in cio_is_console()
696 put_device(&console_sch->dev); in cio_register_early_subchannels()
701 * cio_tm_start_key - perform start function
703 * @tcw: transport-command word to be started
707 * Start the tcw on the given subchannel. Return zero on success, non-zero
713 union orb *orb = &to_io_private(sch)->orb; in cio_tm_start_key()
716 orb->tm.intparm = (u32) (addr_t) sch; in cio_tm_start_key()
717 orb->tm.key = key >> 4; in cio_tm_start_key()
718 orb->tm.b = 1; in cio_tm_start_key()
719 orb->tm.lpm = lpm ? lpm : sch->lpm; in cio_tm_start_key()
720 orb->tm.tcw = (u32) (addr_t) tcw; in cio_tm_start_key()
721 cc = ssch(sch->schid, orb); in cio_tm_start_key()
727 return -EBUSY; in cio_tm_start_key()
735 * cio_tm_intrg - perform interrogate function
738 * If the specified subchannel is running in transport-mode, perform the
739 * interrogate function. Return zero on success, non-zero otherwie.
745 if (!to_io_private(sch)->orb.tm.b) in cio_tm_intrg()
746 return -EINVAL; in cio_tm_intrg()
747 cc = xsch(sch->schid); in cio_tm_intrg()
753 return -EBUSY; in cio_tm_intrg()
755 return -ENODEV; in cio_tm_intrg()