Lines Matching refs:sch

88 int cio_set_options(struct subchannel *sch, int flags)  in cio_set_options()  argument
90 struct io_subchannel_private *priv = to_io_private(sch); in cio_set_options()
99 cio_start_handle_notoper(struct subchannel *sch, __u8 lpm) in cio_start_handle_notoper() argument
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()
112 if (cio_update_schib(sch)) 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()
123 cio_start_key (struct subchannel *sch, /* subchannel structure */ in cio_start_key() argument
128 struct io_subchannel_private *priv = to_io_private(sch); 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()
143 orb->cmd.lpm = (lpm != 0) ? lpm : sch->lpm; 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()
168 return cio_start_handle_notoper(sch, lpm); in cio_start_key()
176 cio_start (struct subchannel *sch, struct ccw1 *cpa, __u8 lpm) in cio_start() argument
178 return cio_start_key(sch, cpa, lpm, PAGE_DEFAULT_KEY); in cio_start()
186 cio_resume (struct subchannel *sch) in cio_resume() argument
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()
219 cio_halt(struct subchannel *sch) in cio_halt() argument
223 if (!sch) 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()
253 cio_clear(struct subchannel *sch) in cio_clear() argument
257 if (!sch) 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()
288 cio_cancel (struct subchannel *sch) in cio_cancel() argument
292 if (!sch) in cio_cancel()
296 CIO_TRACE_EVENT(2, dev_name(&sch->dev)); in cio_cancel()
298 ccode = xsch (sch->schid); in cio_cancel()
305 if (cio_update_schib(sch)) in cio_cancel()
334 int cio_cancel_halt_clear(struct subchannel *sch, int *iretry) in cio_cancel_halt_clear() argument
338 if (cio_update_schib(sch)) in cio_cancel_halt_clear()
340 if (!sch->schib.pmcw.ena) 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()
347 ret = cio_cancel(sch); in cio_cancel_halt_clear()
358 if (!(scsw_actl(&sch->schib.scsw) & SCSW_ACTL_CLEAR_PEND)) { in cio_cancel_halt_clear()
361 ret = cio_halt(sch); in cio_cancel_halt_clear()
371 ret = cio_clear(sch); in cio_cancel_halt_clear()
379 static void cio_apply_config(struct subchannel *sch, struct schib *schib) in cio_apply_config() argument
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()
393 static int cio_check_config(struct subchannel *sch, struct schib *schib) in cio_check_config() argument
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()
409 int cio_commit_config(struct subchannel *sch) in cio_commit_config() argument
415 if (stsch(sch->schid, &schib) || !css_sch_is_valid(&schib)) in cio_commit_config()
420 cio_apply_config(sch, &schib); in cio_commit_config()
421 ccode = msch(sch->schid, &schib); in cio_commit_config()
426 if (stsch(sch->schid, &schib) || in cio_commit_config()
429 if (cio_check_config(sch, &schib)) { in cio_commit_config()
431 memcpy(&sch->schib, &schib, sizeof(schib)); in cio_commit_config()
438 if (tsch(sch->schid, &irb)) in cio_commit_config()
458 int cio_update_schib(struct subchannel *sch) in cio_update_schib() argument
462 if (stsch(sch->schid, &schib) || !css_sch_is_valid(&schib)) in cio_update_schib()
465 memcpy(&sch->schib, &schib, sizeof(schib)); in cio_update_schib()
475 int cio_enable_subchannel(struct subchannel *sch, u32 intparm) in cio_enable_subchannel() argument
480 CIO_TRACE_EVENT(2, dev_name(&sch->dev)); in cio_enable_subchannel()
482 if (sch_is_pseudo_sch(sch)) in cio_enable_subchannel()
484 if (cio_update_schib(sch)) 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()
491 ret = cio_commit_config(sch); in cio_enable_subchannel()
497 sch->config.csense = 0; in cio_enable_subchannel()
498 ret = cio_commit_config(sch); in cio_enable_subchannel()
509 int cio_disable_subchannel(struct subchannel *sch) in cio_disable_subchannel() argument
514 CIO_TRACE_EVENT(2, dev_name(&sch->dev)); in cio_disable_subchannel()
516 if (sch_is_pseudo_sch(sch)) in cio_disable_subchannel()
518 if (cio_update_schib(sch)) in cio_disable_subchannel()
521 sch->config.ena = 0; in cio_disable_subchannel()
522 ret = cio_commit_config(sch); in cio_disable_subchannel()
535 struct subchannel *sch; in do_cio_interrupt() local
542 sch = (struct subchannel *)(unsigned long) tpi_info->intparm; in do_cio_interrupt()
543 if (!sch) { in do_cio_interrupt()
549 spin_lock(sch->lock); 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()
582 void cio_tsch(struct subchannel *sch) in cio_tsch() argument
589 if (tsch(sch->schid, irb) != 0) 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()
647 struct subchannel *sch; in cio_probe_console() local
662 sch = css_alloc_subchannel(schid, &schib); in cio_probe_console()
663 if (IS_ERR(sch)) in cio_probe_console()
664 return sch; 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()
670 ret = cio_commit_config(sch); in cio_probe_console()
673 put_device(&sch->dev); in cio_probe_console()
676 console_sch = sch; in cio_probe_console()
677 return sch; in cio_probe_console()
710 int cio_tm_start_key(struct subchannel *sch, struct tcw *tcw, u8 lpm, u8 key) in cio_tm_start_key() argument
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()
719 orb->tm.lpm = lpm ? lpm : sch->lpm; in cio_tm_start_key()
721 cc = ssch(sch->schid, orb); in cio_tm_start_key()
729 return cio_start_handle_notoper(sch, lpm); in cio_tm_start_key()
741 int cio_tm_intrg(struct subchannel *sch) in cio_tm_intrg() argument
745 if (!to_io_private(sch)->orb.tm.b) in cio_tm_intrg()
747 cc = xsch(sch->schid); in cio_tm_intrg()