Lines Matching refs:sch

276 	struct subchannel *sch;
290 sch = to_subchannel(cdev->dev.parent);
311 io_subchannel_quiesce(sch);
543 struct subchannel *sch;
553 sch = to_subchannel(dev->parent);
554 if (!sch->lpm)
568 struct subchannel *sch = to_subchannel(dev);
571 rc = chsc_siosl(sch->schid);
574 sch->schid.ssid, sch->schid.sch_no, rc);
578 sch->schid.ssid, sch->schid.sch_no);
585 struct subchannel *sch = to_subchannel(dev);
587 return sprintf(buf, "%02x\n", sch->vpm);
683 static struct ccw_device * io_subchannel_allocate_dev(struct subchannel *sch)
701 cdev->dev.dma_mask = sch->dev.dma_mask;
702 ret = dma_set_coherent_mask(&cdev->dev, sch->dev.coherent_dma_mask);
732 static int io_subchannel_initialize_dev(struct subchannel *sch,
741 priv->dev_id.devno = sch->schib.pmcw.dev;
742 priv->dev_id.ssid = sch->schid.ssid;
751 cdev->ccwlock = sch->lock;
752 cdev->dev.parent = &sch->dev;
762 if (!get_device(&sch->dev)) {
767 spin_lock_irq(sch->lock);
768 sch_set_cdev(sch, cdev);
769 spin_unlock_irq(sch->lock);
778 static struct ccw_device * io_subchannel_create_ccwdev(struct subchannel *sch)
783 cdev = io_subchannel_allocate_dev(sch);
785 ret = io_subchannel_initialize_dev(sch, cdev);
794 static void sch_create_and_recog_new_device(struct subchannel *sch)
799 cdev = io_subchannel_create_ccwdev(sch);
802 css_sch_device_unregister(sch);
806 io_subchannel_recog(cdev, sch);
814 struct subchannel *sch;
818 sch = to_subchannel(cdev->dev.parent);
825 if (!device_is_registered(&sch->dev))
827 css_update_ssd_info(sch);
854 spin_lock_irqsave(sch->lock, flags);
855 sch_set_cdev(sch, NULL);
856 spin_unlock_irqrestore(sch->lock, flags);
901 static void io_subchannel_recog(struct ccw_device *cdev, struct subchannel *sch)
907 spin_lock_irq(sch->lock);
909 spin_unlock_irq(sch->lock);
913 struct subchannel *sch)
920 if (!get_device(&sch->dev))
932 put_device(&sch->dev);
937 mutex_lock(&sch->reg_mutex);
938 rc = device_move(&cdev->dev, &sch->dev, DPM_ORDER_PARENT_BEFORE_DEV);
939 mutex_unlock(&sch->reg_mutex);
943 cdev->private->dev_id.devno, sch->schid.ssid,
944 sch->schib.pmcw.dev, rc);
952 put_device(&sch->dev);
965 spin_lock_irq(sch->lock);
966 cdev->ccwlock = sch->lock;
967 if (!sch_is_pseudo_sch(sch))
968 sch_set_cdev(sch, cdev);
969 spin_unlock_irq(sch->lock);
970 if (!sch_is_pseudo_sch(sch))
971 css_update_ssd_info(sch);
977 struct subchannel *sch = to_subchannel(cdev->dev.parent);
978 struct channel_subsystem *css = to_css(sch->dev.parent);
983 static void io_subchannel_irq(struct subchannel *sch)
987 cdev = sch_get_cdev(sch);
990 CIO_TRACE_EVENT(6, dev_name(&sch->dev));
997 void io_subchannel_init_config(struct subchannel *sch)
999 memset(&sch->config, 0, sizeof(sch->config));
1000 sch->config.csense = 1;
1003 static void io_subchannel_init_fields(struct subchannel *sch)
1005 if (cio_is_console(sch->schid))
1006 sch->opm = 0xff;
1008 sch->opm = chp_get_sch_opm(sch);
1009 sch->lpm = sch->schib.pmcw.pam & sch->opm;
1010 sch->isc = cio_is_console(sch->schid) ? CONSOLE_ISC : IO_SCH_ISC;
1014 sch->schib.pmcw.dev, sch->schid.ssid,
1015 sch->schid.sch_no, sch->schib.pmcw.pim,
1016 sch->schib.pmcw.pam, sch->schib.pmcw.pom);
1018 io_subchannel_init_config(sch);
1025 static int io_subchannel_probe(struct subchannel *sch)
1031 if (cio_is_console(sch->schid)) {
1032 rc = sysfs_create_group(&sch->dev.kobj,
1038 sch->schid.ssid, sch->schid.sch_no, rc);
1043 cdev = sch_get_cdev(sch);
1054 io_subchannel_init_fields(sch);
1055 rc = cio_commit_config(sch);
1058 rc = sysfs_create_group(&sch->dev.kobj,
1067 io_priv->dma_area = dma_alloc_coherent(&sch->dev,
1075 set_io_private(sch, io_priv);
1076 css_schedule_eval(sch->schid);
1080 spin_lock_irq(sch->lock);
1081 css_sched_sch_todo(sch, SCH_TODO_UNREG);
1082 spin_unlock_irq(sch->lock);
1086 static void io_subchannel_remove(struct subchannel *sch)
1088 struct io_subchannel_private *io_priv = to_io_private(sch);
1091 cdev = sch_get_cdev(sch);
1096 spin_lock_irq(sch->lock);
1097 sch_set_cdev(sch, NULL);
1098 set_io_private(sch, NULL);
1099 spin_unlock_irq(sch->lock);
1101 dma_free_coherent(&sch->dev, sizeof(*io_priv->dma_area),
1104 sysfs_remove_group(&sch->dev.kobj, &io_subchannel_attr_group);
1107 static void io_subchannel_verify(struct subchannel *sch)
1111 cdev = sch_get_cdev(sch);
1115 css_schedule_eval(sch->schid);
1118 static void io_subchannel_terminate_path(struct subchannel *sch, u8 mask)
1122 cdev = sch_get_cdev(sch);
1125 if (cio_update_schib(sch))
1128 if (scsw_actl(&sch->schib.scsw) == 0 || sch->schib.pmcw.lpum != mask)
1134 if (cio_clear(sch))
1145 static int io_subchannel_chp_event(struct subchannel *sch,
1148 struct ccw_device *cdev = sch_get_cdev(sch);
1152 mask = chp_ssd_get_mask(&sch->ssd_info, link);
1157 sch->opm &= ~mask;
1158 sch->lpm &= ~mask;
1161 io_subchannel_terminate_path(sch, mask);
1164 sch->opm |= mask;
1165 sch->lpm |= mask;
1168 io_subchannel_verify(sch);
1171 if (cio_update_schib(sch))
1175 io_subchannel_terminate_path(sch, mask);
1178 if (cio_update_schib(sch))
1180 sch->lpm |= mask & sch->opm;
1183 io_subchannel_verify(sch);
1201 static void io_subchannel_quiesce(struct subchannel *sch)
1206 spin_lock_irq(sch->lock);
1207 cdev = sch_get_cdev(sch);
1208 if (cio_is_console(sch->schid))
1210 if (!sch->schib.pmcw.ena)
1212 ret = cio_disable_subchannel(sch);
1223 spin_unlock_irq(sch->lock);
1226 spin_lock_irq(sch->lock);
1228 ret = cio_disable_subchannel(sch);
1231 spin_unlock_irq(sch->lock);
1234 static void io_subchannel_shutdown(struct subchannel *sch)
1236 io_subchannel_quiesce(sch);
1250 struct subchannel *sch;
1256 sch = to_subchannel(cdev->dev.parent);
1257 if ((sch->schib.pmcw.pam & sch->opm) == sch->vpm)
1322 struct subchannel *sch = to_subchannel(cdev->dev.parent);
1331 css_sched_sch_todo(sch, SCH_TODO_UNREG);
1367 struct subchannel *sch = to_subchannel(cdev->dev.parent);
1370 CIO_TRACE_EVENT(2, dev_name(&sch->dev));
1372 cio_disable_subchannel(sch);
1389 static enum io_sch_action sch_get_action(struct subchannel *sch)
1393 cdev = sch_get_cdev(sch);
1394 if (cio_update_schib(sch)) {
1405 if (sch->schib.pmcw.dev != cdev->private->dev_id.devno) {
1410 if ((sch->schib.pmcw.pam & sch->opm) == 0) {
1426 * @sch: subchannel
1434 static int io_subchannel_sch_event(struct subchannel *sch, int process)
1442 spin_lock_irqsave(sch->lock, flags);
1443 if (!device_is_registered(&sch->dev))
1445 if (work_pending(&sch->todo_work))
1447 cdev = sch_get_cdev(sch);
1450 action = sch_get_action(sch);
1451 CIO_MSG_EVENT(2, "event: sch 0.%x.%04x, process=%d, action=%d\n",
1452 sch->schid.ssid, sch->schid.sch_no, process,
1463 io_subchannel_verify(sch);
1495 spin_unlock_irqrestore(sch->lock, flags);
1510 spin_lock_irqsave(sch->lock, flags);
1511 sch_set_cdev(sch, NULL);
1512 spin_unlock_irqrestore(sch->lock, flags);
1523 css_sch_device_unregister(sch);
1528 dev_id.ssid = sch->schid.ssid;
1529 dev_id.devno = sch->schib.pmcw.dev;
1532 sch_create_and_recog_new_device(sch);
1535 rc = ccw_device_move_to_sch(cdev, sch);
1541 spin_lock_irqsave(sch->lock, flags);
1543 spin_unlock_irqrestore(sch->lock, flags);
1553 spin_unlock_irqrestore(sch->lock, flags);
1573 struct subchannel *sch = to_subchannel(cdev->dev.parent);
1579 io_subchannel_init_fields(sch);
1580 rc = cio_commit_config(sch);
1583 sch->driver = &io_subchannel_driver;
1584 io_subchannel_recog(cdev, sch);
1614 struct subchannel *sch;
1616 sch = cio_probe_console();
1617 if (IS_ERR(sch))
1618 return ERR_CAST(sch);
1623 io_priv->dma_area = dma_alloc_coherent(&sch->dev,
1628 set_io_private(sch, io_priv);
1629 cdev = io_subchannel_create_ccwdev(sch);
1631 dma_free_coherent(&sch->dev, sizeof(*io_priv->dma_area),
1633 set_io_private(sch, NULL);
1634 put_device(&sch->dev);
1645 put_device(&sch->dev);
1651 struct subchannel *sch = to_subchannel(cdev->dev.parent);
1652 struct io_subchannel_private *io_priv = to_io_private(sch);
1654 set_io_private(sch, NULL);
1655 dma_free_coherent(&sch->dev, sizeof(*io_priv->dma_area),
1657 put_device(&sch->dev);
1672 struct subchannel *sch = to_subchannel(cdev->dev.parent);
1675 cio_tsch(sch);
1676 if (sch->schib.scsw.cmd.actl == 0)
1737 struct subchannel *sch;
1763 sch = to_subchannel(cdev->dev.parent);
1765 io_subchannel_quiesce(sch);
1820 struct subchannel *sch;
1825 sch = to_subchannel(cdev->dev.parent);
1845 if (!sch_is_pseudo_sch(sch))
1846 css_schedule_eval(sch->schid);
1849 spin_lock_irq(sch->lock);
1850 sch_set_cdev(sch, NULL);
1851 spin_unlock_irq(sch->lock);
1896 struct subchannel *sch = to_subchannel(cdev->dev.parent);
1898 return chsc_siosl(sch->schid);