Lines Matching refs:sch
89 int cio_set_options(struct subchannel *sch, int flags)
91 struct io_subchannel_private *priv = to_io_private(sch);
100 cio_start_handle_notoper(struct subchannel *sch, __u8 lpm)
105 sch->lpm &= ~lpm;
107 sch->lpm = 0;
110 "subchannel 0.%x.%04x!\n", sch->schid.ssid,
111 sch->schid.sch_no);
113 if (cio_update_schib(sch))
116 sprintf(dbf_text, "no%s", dev_name(&sch->dev));
118 CIO_HEX_EVENT(0, &sch->schib, sizeof (struct schib));
120 return (sch->lpm ? -EACCES : -ENODEV);
124 cio_start_key (struct subchannel *sch, /* subchannel structure */
129 struct io_subchannel_private *priv = to_io_private(sch);
134 CIO_TRACE_EVENT(5, dev_name(&sch->dev));
137 /* sch is always under 2G. */
138 orb->cmd.intparm = (u32)virt_to_phys(sch);
144 orb->cmd.lpm = (lpm != 0) ? lpm : sch->lpm;
153 ccode = ssch(sch->schid, orb);
163 sch->schib.scsw.cmd.actl |= SCSW_ACTL_START_PEND;
169 return cio_start_handle_notoper(sch, lpm);
177 cio_start (struct subchannel *sch, struct ccw1 *cpa, __u8 lpm)
179 return cio_start_key(sch, cpa, lpm, PAGE_DEFAULT_KEY);
187 cio_resume (struct subchannel *sch)
192 CIO_TRACE_EVENT(4, dev_name(&sch->dev));
194 ccode = rsch (sch->schid);
200 sch->schib.scsw.cmd.actl |= SCSW_ACTL_RESUME_PEND;
220 cio_halt(struct subchannel *sch)
224 if (!sch)
228 CIO_TRACE_EVENT(2, dev_name(&sch->dev));
233 ccode = hsch (sch->schid);
239 sch->schib.scsw.cmd.actl |= SCSW_ACTL_HALT_PEND;
254 cio_clear(struct subchannel *sch)
258 if (!sch)
262 CIO_TRACE_EVENT(2, dev_name(&sch->dev));
267 ccode = csch (sch->schid);
273 sch->schib.scsw.cmd.actl |= SCSW_ACTL_CLEAR_PEND;
289 cio_cancel (struct subchannel *sch)
293 if (!sch)
297 CIO_TRACE_EVENT(2, dev_name(&sch->dev));
299 ccode = xsch (sch->schid);
306 if (cio_update_schib(sch))
322 * @sch: subchannel on which to perform the cancel_halt_clear operation
335 int cio_cancel_halt_clear(struct subchannel *sch, int *iretry)
339 if (cio_update_schib(sch))
341 if (!sch->schib.pmcw.ena)
345 if (!(scsw_actl(&sch->schib.scsw) & SCSW_ACTL_HALT_PEND) &&
346 !(scsw_actl(&sch->schib.scsw) & SCSW_ACTL_CLEAR_PEND)) {
347 if (!scsw_is_tm(&sch->schib.scsw)) {
348 ret = cio_cancel(sch);
359 if (!(scsw_actl(&sch->schib.scsw) & SCSW_ACTL_CLEAR_PEND)) {
362 ret = cio_halt(sch);
372 ret = cio_clear(sch);
380 static void cio_apply_config(struct subchannel *sch, struct schib *schib)
382 schib->pmcw.intparm = sch->config.intparm;
383 schib->pmcw.mbi = sch->config.mbi;
384 schib->pmcw.isc = sch->config.isc;
385 schib->pmcw.ena = sch->config.ena;
386 schib->pmcw.mme = sch->config.mme;
387 schib->pmcw.mp = sch->config.mp;
388 schib->pmcw.csense = sch->config.csense;
389 schib->pmcw.mbfc = sch->config.mbfc;
390 if (sch->config.mbfc)
391 schib->mba = sch->config.mba;
394 static int cio_check_config(struct subchannel *sch, struct schib *schib)
396 return (schib->pmcw.intparm == sch->config.intparm) &&
397 (schib->pmcw.mbi == sch->config.mbi) &&
398 (schib->pmcw.isc == sch->config.isc) &&
399 (schib->pmcw.ena == sch->config.ena) &&
400 (schib->pmcw.mme == sch->config.mme) &&
401 (schib->pmcw.mp == sch->config.mp) &&
402 (schib->pmcw.csense == sch->config.csense) &&
403 (schib->pmcw.mbfc == sch->config.mbfc) &&
404 (!sch->config.mbfc || (schib->mba == sch->config.mba));
410 int cio_commit_config(struct subchannel *sch)
416 if (stsch(sch->schid, &schib) || !css_sch_is_valid(&schib))
421 cio_apply_config(sch, &schib);
422 ccode = msch(sch->schid, &schib);
427 if (stsch(sch->schid, &schib) ||
430 if (cio_check_config(sch, &schib)) {
432 memcpy(&sch->schib, &schib, sizeof(schib));
439 if (tsch(sch->schid, &irb))
456 * @sch: subchannel on which to perform stsch
459 int cio_update_schib(struct subchannel *sch)
463 if (stsch(sch->schid, &schib))
466 memcpy(&sch->schib, &schib, sizeof(schib));
477 * @sch: subchannel to be enabled
480 int cio_enable_subchannel(struct subchannel *sch, u32 intparm)
485 CIO_TRACE_EVENT(2, dev_name(&sch->dev));
487 if (sch_is_pseudo_sch(sch))
489 if (cio_update_schib(sch))
492 sch->config.ena = 1;
493 sch->config.isc = sch->isc;
494 sch->config.intparm = intparm;
496 ret = cio_commit_config(sch);
502 sch->config.csense = 0;
503 ret = cio_commit_config(sch);
512 * @sch: subchannel to disable
514 int cio_disable_subchannel(struct subchannel *sch)
519 CIO_TRACE_EVENT(2, dev_name(&sch->dev));
521 if (sch_is_pseudo_sch(sch))
523 if (cio_update_schib(sch))
526 sch->config.ena = 0;
527 ret = cio_commit_config(sch);
540 struct subchannel *sch;
552 sch = phys_to_virt(tpi_info->intparm);
553 spin_lock(&sch->lock);
557 memcpy (&sch->schib.scsw, &irb->scsw, sizeof (irb->scsw));
559 if (sch->driver && sch->driver->irq)
560 sch->driver->irq(sch);
565 spin_unlock(&sch->lock);
586 void cio_tsch(struct subchannel *sch)
593 if (tsch(sch->schid, irb) != 0)
596 memcpy(&sch->schib.scsw, &irb->scsw, sizeof(union scsw));
604 if (sch->driver && sch->driver->irq)
605 sch->driver->irq(sch);
651 struct subchannel *sch;
666 sch = css_alloc_subchannel(schid, &schib);
667 if (IS_ERR(sch))
668 return sch;
670 lockdep_set_class(&sch->lock, &console_sch_key);
672 sch->config.isc = CONSOLE_ISC;
673 sch->config.intparm = (u32)virt_to_phys(sch);
674 ret = cio_commit_config(sch);
677 put_device(&sch->dev);
680 console_sch = sch;
681 return sch;
706 * @sch: subchannel on which to perform the start function
714 int cio_tm_start_key(struct subchannel *sch, struct tcw *tcw, u8 lpm, u8 key)
717 union orb *orb = &to_io_private(sch)->orb;
720 orb->tm.intparm = (u32)virt_to_phys(sch);
723 orb->tm.lpm = lpm ? lpm : sch->lpm;
725 cc = ssch(sch->schid, orb);
733 return cio_start_handle_notoper(sch, lpm);
740 * @sch: subchannel on which to perform the interrogate function
745 int cio_tm_intrg(struct subchannel *sch)
749 if (!to_io_private(sch)->orb.tm.b)
751 cc = xsch(sch->schid);