Lines Matching defs:sch

276 	struct subchannel *sch;
290 sch = to_subchannel(cdev->dev.parent);
311 io_subchannel_quiesce(sch);
546 struct subchannel *sch;
556 sch = to_subchannel(dev->parent);
557 if (!sch->lpm)
571 struct subchannel *sch = to_subchannel(dev);
574 rc = chsc_siosl(sch->schid);
577 sch->schid.ssid, sch->schid.sch_no, rc);
581 sch->schid.ssid, sch->schid.sch_no);
588 struct subchannel *sch = to_subchannel(dev);
590 return sprintf(buf, "%02x\n", sch->vpm);
686 static struct ccw_device * io_subchannel_allocate_dev(struct subchannel *sch)
704 cdev->dev.dma_mask = sch->dev.dma_mask;
705 ret = dma_set_coherent_mask(&cdev->dev, sch->dev.coherent_dma_mask);
735 static int io_subchannel_initialize_dev(struct subchannel *sch,
744 priv->dev_id.devno = sch->schib.pmcw.dev;
745 priv->dev_id.ssid = sch->schid.ssid;
754 cdev->ccwlock = &sch->lock;
755 cdev->dev.parent = &sch->dev;
765 if (!get_device(&sch->dev)) {
770 spin_lock_irq(&sch->lock);
771 sch_set_cdev(sch, cdev);
772 spin_unlock_irq(&sch->lock);
781 static struct ccw_device * io_subchannel_create_ccwdev(struct subchannel *sch)
786 cdev = io_subchannel_allocate_dev(sch);
788 ret = io_subchannel_initialize_dev(sch, cdev);
797 static void sch_create_and_recog_new_device(struct subchannel *sch)
802 cdev = io_subchannel_create_ccwdev(sch);
805 css_sch_device_unregister(sch);
809 io_subchannel_recog(cdev, sch);
817 struct subchannel *sch;
821 sch = to_subchannel(cdev->dev.parent);
828 if (!device_is_registered(&sch->dev))
830 css_update_ssd_info(sch);
857 spin_lock_irqsave(&sch->lock, flags);
858 sch_set_cdev(sch, NULL);
859 spin_unlock_irqrestore(&sch->lock, flags);
904 static void io_subchannel_recog(struct ccw_device *cdev, struct subchannel *sch)
910 spin_lock_irq(&sch->lock);
912 spin_unlock_irq(&sch->lock);
916 struct subchannel *sch)
923 if (!get_device(&sch->dev))
935 put_device(&sch->dev);
940 mutex_lock(&sch->reg_mutex);
941 rc = device_move(&cdev->dev, &sch->dev, DPM_ORDER_PARENT_BEFORE_DEV);
942 mutex_unlock(&sch->reg_mutex);
946 cdev->private->dev_id.devno, sch->schid.ssid,
947 sch->schib.pmcw.dev, rc);
955 put_device(&sch->dev);
968 spin_lock_irq(&sch->lock);
969 cdev->ccwlock = &sch->lock;
970 if (!sch_is_pseudo_sch(sch))
971 sch_set_cdev(sch, cdev);
972 spin_unlock_irq(&sch->lock);
973 if (!sch_is_pseudo_sch(sch))
974 css_update_ssd_info(sch);
980 struct subchannel *sch = to_subchannel(cdev->dev.parent);
981 struct channel_subsystem *css = to_css(sch->dev.parent);
986 static void io_subchannel_irq(struct subchannel *sch)
990 cdev = sch_get_cdev(sch);
993 CIO_TRACE_EVENT(6, dev_name(&sch->dev));
1000 void io_subchannel_init_config(struct subchannel *sch)
1002 memset(&sch->config, 0, sizeof(sch->config));
1003 sch->config.csense = 1;
1006 static void io_subchannel_init_fields(struct subchannel *sch)
1008 if (cio_is_console(sch->schid))
1009 sch->opm = 0xff;
1011 sch->opm = chp_get_sch_opm(sch);
1012 sch->lpm = sch->schib.pmcw.pam & sch->opm;
1013 sch->isc = cio_is_console(sch->schid) ? CONSOLE_ISC : IO_SCH_ISC;
1017 sch->schib.pmcw.dev, sch->schid.ssid,
1018 sch->schid.sch_no, sch->schib.pmcw.pim,
1019 sch->schib.pmcw.pam, sch->schib.pmcw.pom);
1021 io_subchannel_init_config(sch);
1028 static int io_subchannel_probe(struct subchannel *sch)
1034 if (cio_is_console(sch->schid)) {
1035 rc = sysfs_create_group(&sch->dev.kobj,
1041 sch->schid.ssid, sch->schid.sch_no, rc);
1046 cdev = sch_get_cdev(sch);
1057 io_subchannel_init_fields(sch);
1058 rc = cio_commit_config(sch);
1061 rc = sysfs_create_group(&sch->dev.kobj,
1070 io_priv->dma_area = dma_alloc_coherent(&sch->dev,
1078 set_io_private(sch, io_priv);
1079 css_schedule_eval(sch->schid);
1083 spin_lock_irq(&sch->lock);
1084 css_sched_sch_todo(sch, SCH_TODO_UNREG);
1085 spin_unlock_irq(&sch->lock);
1089 static void io_subchannel_remove(struct subchannel *sch)
1091 struct io_subchannel_private *io_priv = to_io_private(sch);
1094 cdev = sch_get_cdev(sch);
1099 spin_lock_irq(&sch->lock);
1100 sch_set_cdev(sch, NULL);
1101 set_io_private(sch, NULL);
1102 spin_unlock_irq(&sch->lock);
1104 dma_free_coherent(&sch->dev, sizeof(*io_priv->dma_area),
1107 sysfs_remove_group(&sch->dev.kobj, &io_subchannel_attr_group);
1110 static void io_subchannel_verify(struct subchannel *sch)
1114 cdev = sch_get_cdev(sch);
1118 css_schedule_eval(sch->schid);
1121 static void io_subchannel_terminate_path(struct subchannel *sch, u8 mask)
1125 cdev = sch_get_cdev(sch);
1128 if (cio_update_schib(sch))
1131 if (scsw_actl(&sch->schib.scsw) == 0 || sch->schib.pmcw.lpum != mask)
1137 if (cio_clear(sch))
1148 static int io_subchannel_chp_event(struct subchannel *sch,
1151 struct ccw_device *cdev = sch_get_cdev(sch);
1155 mask = chp_ssd_get_mask(&sch->ssd_info, link);
1160 sch->opm &= ~mask;
1161 sch->lpm &= ~mask;
1164 io_subchannel_terminate_path(sch, mask);
1167 sch->opm |= mask;
1168 sch->lpm |= mask;
1171 io_subchannel_verify(sch);
1174 if (cio_update_schib(sch))
1178 io_subchannel_terminate_path(sch, mask);
1181 if (cio_update_schib(sch))
1183 sch->lpm |= mask & sch->opm;
1186 io_subchannel_verify(sch);
1204 static void io_subchannel_quiesce(struct subchannel *sch)
1209 spin_lock_irq(&sch->lock);
1210 cdev = sch_get_cdev(sch);
1211 if (cio_is_console(sch->schid))
1213 if (!sch->schib.pmcw.ena)
1215 ret = cio_disable_subchannel(sch);
1226 spin_unlock_irq(&sch->lock);
1229 spin_lock_irq(&sch->lock);
1231 ret = cio_disable_subchannel(sch);
1234 spin_unlock_irq(&sch->lock);
1237 static void io_subchannel_shutdown(struct subchannel *sch)
1239 io_subchannel_quiesce(sch);
1253 struct subchannel *sch;
1259 sch = to_subchannel(cdev->dev.parent);
1260 if ((sch->schib.pmcw.pam & sch->opm) == sch->vpm)
1325 struct subchannel *sch = to_subchannel(cdev->dev.parent);
1334 css_sched_sch_todo(sch, SCH_TODO_UNREG);
1370 struct subchannel *sch = to_subchannel(cdev->dev.parent);
1373 CIO_TRACE_EVENT(2, dev_name(&sch->dev));
1375 cio_disable_subchannel(sch);
1392 static enum io_sch_action sch_get_action(struct subchannel *sch)
1396 cdev = sch_get_cdev(sch);
1397 if (cio_update_schib(sch)) {
1408 if (sch->schib.pmcw.dev != cdev->private->dev_id.devno) {
1413 if ((sch->schib.pmcw.pam & sch->opm) == 0) {
1429 * @sch: subchannel
1437 static int io_subchannel_sch_event(struct subchannel *sch, int process)
1445 spin_lock_irqsave(&sch->lock, flags);
1446 if (!device_is_registered(&sch->dev))
1448 if (work_pending(&sch->todo_work))
1450 cdev = sch_get_cdev(sch);
1453 action = sch_get_action(sch);
1454 CIO_MSG_EVENT(2, "event: sch 0.%x.%04x, process=%d, action=%d\n",
1455 sch->schid.ssid, sch->schid.sch_no, process,
1466 io_subchannel_verify(sch);
1498 spin_unlock_irqrestore(&sch->lock, flags);
1513 spin_lock_irqsave(&sch->lock, flags);
1514 sch_set_cdev(sch, NULL);
1515 spin_unlock_irqrestore(&sch->lock, flags);
1526 css_sch_device_unregister(sch);
1531 dev_id.ssid = sch->schid.ssid;
1532 dev_id.devno = sch->schib.pmcw.dev;
1535 sch_create_and_recog_new_device(sch);
1538 rc = ccw_device_move_to_sch(cdev, sch);
1544 spin_lock_irqsave(&sch->lock, flags);
1546 spin_unlock_irqrestore(&sch->lock, flags);
1556 spin_unlock_irqrestore(&sch->lock, flags);
1576 struct subchannel *sch = to_subchannel(cdev->dev.parent);
1582 io_subchannel_init_fields(sch);
1583 rc = cio_commit_config(sch);
1586 sch->driver = &io_subchannel_driver;
1587 io_subchannel_recog(cdev, sch);
1617 struct subchannel *sch;
1619 sch = cio_probe_console();
1620 if (IS_ERR(sch))
1621 return ERR_CAST(sch);
1626 io_priv->dma_area = dma_alloc_coherent(&sch->dev,
1631 set_io_private(sch, io_priv);
1632 cdev = io_subchannel_create_ccwdev(sch);
1634 dma_free_coherent(&sch->dev, sizeof(*io_priv->dma_area),
1636 set_io_private(sch, NULL);
1637 put_device(&sch->dev);
1648 put_device(&sch->dev);
1654 struct subchannel *sch = to_subchannel(cdev->dev.parent);
1655 struct io_subchannel_private *io_priv = to_io_private(sch);
1657 set_io_private(sch, NULL);
1658 dma_free_coherent(&sch->dev, sizeof(*io_priv->dma_area),
1660 put_device(&sch->dev);
1675 struct subchannel *sch = to_subchannel(cdev->dev.parent);
1678 cio_tsch(sch);
1679 if (sch->schib.scsw.cmd.actl == 0)
1740 struct subchannel *sch;
1766 sch = to_subchannel(cdev->dev.parent);
1768 io_subchannel_quiesce(sch);
1823 struct subchannel *sch;
1828 sch = to_subchannel(cdev->dev.parent);
1848 if (!sch_is_pseudo_sch(sch))
1849 css_schedule_eval(sch->schid);
1852 spin_lock_irq(&sch->lock);
1853 sch_set_cdev(sch, NULL);
1854 spin_unlock_irq(&sch->lock);
1899 struct subchannel *sch = to_subchannel(cdev->dev.parent);
1901 return chsc_siosl(sch->schid);