Lines Matching refs:sch

152 static int io_subchannel_prepare(struct subchannel *sch)  in io_subchannel_prepare()  argument
159 cdev = sch_get_cdev(sch); in io_subchannel_prepare()
287 struct subchannel *sch; in ccw_device_set_offline() local
301 sch = to_subchannel(cdev->dev.parent); in ccw_device_set_offline()
322 io_subchannel_quiesce(sch); in ccw_device_set_offline()
554 struct subchannel *sch; in available_show() local
564 sch = to_subchannel(dev->parent); in available_show()
565 if (!sch->lpm) in available_show()
579 struct subchannel *sch = to_subchannel(dev); in initiate_logging() local
582 rc = chsc_siosl(sch->schid); in initiate_logging()
585 sch->schid.ssid, sch->schid.sch_no, rc); in initiate_logging()
589 sch->schid.ssid, sch->schid.sch_no); in initiate_logging()
596 struct subchannel *sch = to_subchannel(dev); in vpm_show() local
598 return sprintf(buf, "%02x\n", sch->vpm); in vpm_show()
700 static struct ccw_device * io_subchannel_allocate_dev(struct subchannel *sch) in io_subchannel_allocate_dev() argument
712 cdev->dev.coherent_dma_mask = sch->dev.coherent_dma_mask; in io_subchannel_allocate_dev()
713 cdev->dev.dma_mask = sch->dev.dma_mask; in io_subchannel_allocate_dev()
735 static int io_subchannel_initialize_dev(struct subchannel *sch, in io_subchannel_initialize_dev() argument
744 priv->dev_id.devno = sch->schib.pmcw.dev; in io_subchannel_initialize_dev()
745 priv->dev_id.ssid = sch->schid.ssid; in io_subchannel_initialize_dev()
753 cdev->ccwlock = sch->lock; in io_subchannel_initialize_dev()
754 cdev->dev.parent = &sch->dev; in io_subchannel_initialize_dev()
763 if (!get_device(&sch->dev)) { in io_subchannel_initialize_dev()
768 spin_lock_irq(sch->lock); in io_subchannel_initialize_dev()
769 sch_set_cdev(sch, cdev); in io_subchannel_initialize_dev()
770 spin_unlock_irq(sch->lock); in io_subchannel_initialize_dev()
779 static struct ccw_device * io_subchannel_create_ccwdev(struct subchannel *sch) in io_subchannel_create_ccwdev() argument
784 cdev = io_subchannel_allocate_dev(sch); in io_subchannel_create_ccwdev()
786 ret = io_subchannel_initialize_dev(sch, cdev); in io_subchannel_create_ccwdev()
795 static void sch_create_and_recog_new_device(struct subchannel *sch) in sch_create_and_recog_new_device() argument
800 cdev = io_subchannel_create_ccwdev(sch); in sch_create_and_recog_new_device()
803 css_sch_device_unregister(sch); in sch_create_and_recog_new_device()
807 io_subchannel_recog(cdev, sch); in sch_create_and_recog_new_device()
815 struct subchannel *sch; in io_subchannel_register() local
819 sch = to_subchannel(cdev->dev.parent); in io_subchannel_register()
826 if (!device_is_registered(&sch->dev)) in io_subchannel_register()
828 css_update_ssd_info(sch); in io_subchannel_register()
852 dev_set_uevent_suppress(&sch->dev, 0); in io_subchannel_register()
853 kobject_uevent(&sch->dev.kobj, KOBJ_ADD); in io_subchannel_register()
860 spin_lock_irqsave(sch->lock, flags); in io_subchannel_register()
861 sch_set_cdev(sch, NULL); in io_subchannel_register()
862 spin_unlock_irqrestore(sch->lock, flags); in io_subchannel_register()
877 struct subchannel *sch; in ccw_device_call_sch_unregister() local
882 sch = to_subchannel(cdev->dev.parent); in ccw_device_call_sch_unregister()
883 css_sch_device_unregister(sch); in ccw_device_call_sch_unregister()
885 put_device(&sch->dev); in ccw_device_call_sch_unregister()
918 static void io_subchannel_recog(struct ccw_device *cdev, struct subchannel *sch) in io_subchannel_recog() argument
924 spin_lock_irq(sch->lock); in io_subchannel_recog()
926 spin_unlock_irq(sch->lock); in io_subchannel_recog()
930 struct subchannel *sch) in ccw_device_move_to_sch() argument
937 if (!get_device(&sch->dev)) in ccw_device_move_to_sch()
949 put_device(&sch->dev); in ccw_device_move_to_sch()
954 mutex_lock(&sch->reg_mutex); in ccw_device_move_to_sch()
955 rc = device_move(&cdev->dev, &sch->dev, DPM_ORDER_PARENT_BEFORE_DEV); in ccw_device_move_to_sch()
956 mutex_unlock(&sch->reg_mutex); in ccw_device_move_to_sch()
960 cdev->private->dev_id.devno, sch->schid.ssid, in ccw_device_move_to_sch()
961 sch->schib.pmcw.dev, rc); in ccw_device_move_to_sch()
969 put_device(&sch->dev); in ccw_device_move_to_sch()
982 spin_lock_irq(sch->lock); in ccw_device_move_to_sch()
983 cdev->ccwlock = sch->lock; in ccw_device_move_to_sch()
984 if (!sch_is_pseudo_sch(sch)) in ccw_device_move_to_sch()
985 sch_set_cdev(sch, cdev); in ccw_device_move_to_sch()
986 spin_unlock_irq(sch->lock); in ccw_device_move_to_sch()
987 if (!sch_is_pseudo_sch(sch)) in ccw_device_move_to_sch()
988 css_update_ssd_info(sch); in ccw_device_move_to_sch()
994 struct subchannel *sch = to_subchannel(cdev->dev.parent); in ccw_device_move_to_orph() local
995 struct channel_subsystem *css = to_css(sch->dev.parent); in ccw_device_move_to_orph()
1000 static void io_subchannel_irq(struct subchannel *sch) in io_subchannel_irq() argument
1004 cdev = sch_get_cdev(sch); in io_subchannel_irq()
1007 CIO_TRACE_EVENT(6, dev_name(&sch->dev)); in io_subchannel_irq()
1014 void io_subchannel_init_config(struct subchannel *sch) in io_subchannel_init_config() argument
1016 memset(&sch->config, 0, sizeof(sch->config)); in io_subchannel_init_config()
1017 sch->config.csense = 1; in io_subchannel_init_config()
1020 static void io_subchannel_init_fields(struct subchannel *sch) in io_subchannel_init_fields() argument
1022 if (cio_is_console(sch->schid)) in io_subchannel_init_fields()
1023 sch->opm = 0xff; in io_subchannel_init_fields()
1025 sch->opm = chp_get_sch_opm(sch); in io_subchannel_init_fields()
1026 sch->lpm = sch->schib.pmcw.pam & sch->opm; in io_subchannel_init_fields()
1027 sch->isc = cio_is_console(sch->schid) ? CONSOLE_ISC : IO_SCH_ISC; in io_subchannel_init_fields()
1031 sch->schib.pmcw.dev, sch->schid.ssid, in io_subchannel_init_fields()
1032 sch->schid.sch_no, sch->schib.pmcw.pim, in io_subchannel_init_fields()
1033 sch->schib.pmcw.pam, sch->schib.pmcw.pom); in io_subchannel_init_fields()
1035 io_subchannel_init_config(sch); in io_subchannel_init_fields()
1042 static int io_subchannel_probe(struct subchannel *sch) in io_subchannel_probe() argument
1048 if (cio_is_console(sch->schid)) { in io_subchannel_probe()
1049 rc = sysfs_create_group(&sch->dev.kobj, in io_subchannel_probe()
1055 sch->schid.ssid, sch->schid.sch_no, rc); in io_subchannel_probe()
1061 dev_set_uevent_suppress(&sch->dev, 0); in io_subchannel_probe()
1062 kobject_uevent(&sch->dev.kobj, KOBJ_ADD); in io_subchannel_probe()
1063 cdev = sch_get_cdev(sch); in io_subchannel_probe()
1074 io_subchannel_init_fields(sch); in io_subchannel_probe()
1075 rc = cio_commit_config(sch); in io_subchannel_probe()
1078 rc = sysfs_create_group(&sch->dev.kobj, in io_subchannel_probe()
1087 io_priv->dma_area = dma_alloc_coherent(&sch->dev, in io_subchannel_probe()
1095 set_io_private(sch, io_priv); in io_subchannel_probe()
1096 css_schedule_eval(sch->schid); in io_subchannel_probe()
1100 spin_lock_irq(sch->lock); in io_subchannel_probe()
1101 css_sched_sch_todo(sch, SCH_TODO_UNREG); in io_subchannel_probe()
1102 spin_unlock_irq(sch->lock); in io_subchannel_probe()
1106 static int io_subchannel_remove(struct subchannel *sch) in io_subchannel_remove() argument
1108 struct io_subchannel_private *io_priv = to_io_private(sch); in io_subchannel_remove()
1111 cdev = sch_get_cdev(sch); in io_subchannel_remove()
1116 spin_lock_irq(sch->lock); in io_subchannel_remove()
1117 sch_set_cdev(sch, NULL); in io_subchannel_remove()
1118 set_io_private(sch, NULL); in io_subchannel_remove()
1119 spin_unlock_irq(sch->lock); in io_subchannel_remove()
1121 dma_free_coherent(&sch->dev, sizeof(*io_priv->dma_area), in io_subchannel_remove()
1124 sysfs_remove_group(&sch->dev.kobj, &io_subchannel_attr_group); in io_subchannel_remove()
1128 static void io_subchannel_verify(struct subchannel *sch) in io_subchannel_verify() argument
1132 cdev = sch_get_cdev(sch); in io_subchannel_verify()
1137 static void io_subchannel_terminate_path(struct subchannel *sch, u8 mask) in io_subchannel_terminate_path() argument
1141 cdev = sch_get_cdev(sch); in io_subchannel_terminate_path()
1144 if (cio_update_schib(sch)) in io_subchannel_terminate_path()
1147 if (scsw_actl(&sch->schib.scsw) == 0 || sch->schib.pmcw.lpum != mask) in io_subchannel_terminate_path()
1153 if (cio_clear(sch)) in io_subchannel_terminate_path()
1164 static int io_subchannel_chp_event(struct subchannel *sch, in io_subchannel_chp_event() argument
1167 struct ccw_device *cdev = sch_get_cdev(sch); in io_subchannel_chp_event()
1170 mask = chp_ssd_get_mask(&sch->ssd_info, link); in io_subchannel_chp_event()
1175 sch->opm &= ~mask; in io_subchannel_chp_event()
1176 sch->lpm &= ~mask; in io_subchannel_chp_event()
1179 io_subchannel_terminate_path(sch, mask); in io_subchannel_chp_event()
1182 sch->opm |= mask; in io_subchannel_chp_event()
1183 sch->lpm |= mask; in io_subchannel_chp_event()
1186 io_subchannel_verify(sch); in io_subchannel_chp_event()
1189 if (cio_update_schib(sch)) in io_subchannel_chp_event()
1193 io_subchannel_terminate_path(sch, mask); in io_subchannel_chp_event()
1196 if (cio_update_schib(sch)) in io_subchannel_chp_event()
1198 sch->lpm |= mask & sch->opm; in io_subchannel_chp_event()
1201 io_subchannel_verify(sch); in io_subchannel_chp_event()
1207 static void io_subchannel_quiesce(struct subchannel *sch) in io_subchannel_quiesce() argument
1212 spin_lock_irq(sch->lock); in io_subchannel_quiesce()
1213 cdev = sch_get_cdev(sch); in io_subchannel_quiesce()
1214 if (cio_is_console(sch->schid)) in io_subchannel_quiesce()
1216 if (!sch->schib.pmcw.ena) in io_subchannel_quiesce()
1218 ret = cio_disable_subchannel(sch); in io_subchannel_quiesce()
1229 spin_unlock_irq(sch->lock); in io_subchannel_quiesce()
1232 spin_lock_irq(sch->lock); in io_subchannel_quiesce()
1234 ret = cio_disable_subchannel(sch); in io_subchannel_quiesce()
1237 spin_unlock_irq(sch->lock); in io_subchannel_quiesce()
1240 static void io_subchannel_shutdown(struct subchannel *sch) in io_subchannel_shutdown() argument
1242 io_subchannel_quiesce(sch); in io_subchannel_shutdown()
1256 struct subchannel *sch; in recovery_check() local
1262 sch = to_subchannel(cdev->dev.parent); in recovery_check()
1263 if ((sch->schib.pmcw.pam & sch->opm) == sch->vpm) in recovery_check()
1371 struct subchannel *sch = to_subchannel(cdev->dev.parent); in ccw_device_set_notoper() local
1374 CIO_TRACE_EVENT(2, dev_name(&sch->dev)); in ccw_device_set_notoper()
1376 cio_disable_subchannel(sch); in ccw_device_set_notoper()
1392 static enum io_sch_action sch_get_action(struct subchannel *sch) in sch_get_action() argument
1396 cdev = sch_get_cdev(sch); in sch_get_action()
1397 if (cio_update_schib(sch)) { in sch_get_action()
1408 if (sch->schib.pmcw.dev != cdev->private->dev_id.devno) { in sch_get_action()
1413 if ((sch->schib.pmcw.pam & sch->opm) == 0) { in sch_get_action()
1437 static int io_subchannel_sch_event(struct subchannel *sch, int process) in io_subchannel_sch_event() argument
1445 spin_lock_irqsave(sch->lock, flags); in io_subchannel_sch_event()
1446 if (!device_is_registered(&sch->dev)) in io_subchannel_sch_event()
1448 if (work_pending(&sch->todo_work)) in io_subchannel_sch_event()
1450 cdev = sch_get_cdev(sch); in io_subchannel_sch_event()
1453 action = sch_get_action(sch); in io_subchannel_sch_event()
1455 sch->schid.ssid, sch->schid.sch_no, process, in io_subchannel_sch_event()
1466 io_subchannel_verify(sch); in io_subchannel_sch_event()
1497 spin_unlock_irqrestore(sch->lock, flags); in io_subchannel_sch_event()
1511 spin_lock_irqsave(sch->lock, flags); in io_subchannel_sch_event()
1517 sch_set_cdev(sch, NULL); in io_subchannel_sch_event()
1518 spin_unlock_irqrestore(sch->lock, flags); in io_subchannel_sch_event()
1530 css_sch_device_unregister(sch); in io_subchannel_sch_event()
1535 dev_id.ssid = sch->schid.ssid; in io_subchannel_sch_event()
1536 dev_id.devno = sch->schib.pmcw.dev; in io_subchannel_sch_event()
1539 sch_create_and_recog_new_device(sch); in io_subchannel_sch_event()
1542 rc = ccw_device_move_to_sch(cdev, sch); in io_subchannel_sch_event()
1548 spin_lock_irqsave(sch->lock, flags); in io_subchannel_sch_event()
1550 spin_unlock_irqrestore(sch->lock, flags); in io_subchannel_sch_event()
1560 spin_unlock_irqrestore(sch->lock, flags); in io_subchannel_sch_event()
1580 struct subchannel *sch = to_subchannel(cdev->dev.parent); in ccw_device_enable_console() local
1586 io_subchannel_init_fields(sch); in ccw_device_enable_console()
1587 rc = cio_commit_config(sch); in ccw_device_enable_console()
1590 sch->driver = &io_subchannel_driver; in ccw_device_enable_console()
1591 io_subchannel_recog(cdev, sch); in ccw_device_enable_console()
1621 struct subchannel *sch; in ccw_device_create_console() local
1623 sch = cio_probe_console(); in ccw_device_create_console()
1624 if (IS_ERR(sch)) in ccw_device_create_console()
1625 return ERR_CAST(sch); in ccw_device_create_console()
1630 io_priv->dma_area = dma_alloc_coherent(&sch->dev, in ccw_device_create_console()
1635 set_io_private(sch, io_priv); in ccw_device_create_console()
1636 cdev = io_subchannel_create_ccwdev(sch); in ccw_device_create_console()
1638 dma_free_coherent(&sch->dev, sizeof(*io_priv->dma_area), in ccw_device_create_console()
1640 set_io_private(sch, NULL); in ccw_device_create_console()
1641 put_device(&sch->dev); in ccw_device_create_console()
1652 put_device(&sch->dev); in ccw_device_create_console()
1658 struct subchannel *sch = to_subchannel(cdev->dev.parent); in ccw_device_destroy_console() local
1659 struct io_subchannel_private *io_priv = to_io_private(sch); in ccw_device_destroy_console()
1661 set_io_private(sch, NULL); in ccw_device_destroy_console()
1662 put_device(&sch->dev); in ccw_device_destroy_console()
1664 dma_free_coherent(&sch->dev, sizeof(*io_priv->dma_area), in ccw_device_destroy_console()
1679 struct subchannel *sch = to_subchannel(cdev->dev.parent); in ccw_device_wait_idle() local
1682 cio_tsch(sch); in ccw_device_wait_idle()
1683 if (sch->schib.scsw.cmd.actl == 0) in ccw_device_wait_idle()
1752 struct subchannel *sch; in ccw_device_remove() local
1778 sch = to_subchannel(cdev->dev.parent); in ccw_device_remove()
1780 io_subchannel_quiesce(sch); in ccw_device_remove()
1823 struct subchannel *sch = to_subchannel(cdev->dev.parent); in ccw_device_pm_freeze() local
1837 spin_lock_irq(sch->lock); in ccw_device_pm_freeze()
1839 spin_unlock_irq(sch->lock); in ccw_device_pm_freeze()
1847 spin_lock_irq(sch->lock); in ccw_device_pm_freeze()
1848 ret = cio_disable_subchannel(sch); in ccw_device_pm_freeze()
1849 spin_unlock_irq(sch->lock); in ccw_device_pm_freeze()
1857 struct subchannel *sch = to_subchannel(cdev->dev.parent); in ccw_device_pm_thaw() local
1863 spin_lock_irq(sch->lock); in ccw_device_pm_thaw()
1865 ret = cio_enable_subchannel(sch, (u32)(addr_t)sch); in ccw_device_pm_thaw()
1867 spin_unlock_irq(sch->lock); in ccw_device_pm_thaw()
1885 struct subchannel *sch = to_subchannel(cdev->dev.parent); in __ccw_device_pm_restore() local
1887 spin_lock_irq(sch->lock); in __ccw_device_pm_restore()
1888 if (cio_is_console(sch->schid)) { in __ccw_device_pm_restore()
1889 cio_enable_subchannel(sch, (u32)(addr_t)sch); in __ccw_device_pm_restore()
1898 css_sched_sch_todo(sch, SCH_TODO_EVAL); in __ccw_device_pm_restore()
1899 spin_unlock_irq(sch->lock); in __ccw_device_pm_restore()
1903 sch = to_subchannel(cdev->dev.parent); in __ccw_device_pm_restore()
1904 spin_lock_irq(sch->lock); in __ccw_device_pm_restore()
1910 spin_unlock_irq(sch->lock); in __ccw_device_pm_restore()
1913 spin_lock_irq(sch->lock); in __ccw_device_pm_restore()
1917 spin_unlock_irq(sch->lock); in __ccw_device_pm_restore()
1941 struct subchannel *sch; in ccw_device_pm_restore() local
1945 sch = to_subchannel(cdev->dev.parent); in ccw_device_pm_restore()
1946 spin_lock_irq(sch->lock); in ccw_device_pm_restore()
1947 if (cio_is_console(sch->schid)) in ccw_device_pm_restore()
1983 spin_unlock_irq(sch->lock); in ccw_device_pm_restore()
1985 spin_lock_irq(sch->lock); in ccw_device_pm_restore()
1995 spin_unlock_irq(sch->lock); in ccw_device_pm_restore()
1997 spin_lock_irq(sch->lock); in ccw_device_pm_restore()
2007 spin_unlock_irq(sch->lock); in ccw_device_pm_restore()
2013 spin_unlock_irq(sch->lock); in ccw_device_pm_restore()
2067 struct subchannel *sch; in ccw_device_todo() local
2072 sch = to_subchannel(cdev->dev.parent); in ccw_device_todo()
2092 if (!sch_is_pseudo_sch(sch)) in ccw_device_todo()
2093 css_schedule_eval(sch->schid); in ccw_device_todo()
2096 if (sch_is_pseudo_sch(sch)) in ccw_device_todo()
2143 struct subchannel *sch = to_subchannel(cdev->dev.parent); in ccw_device_siosl() local
2145 return chsc_siosl(sch->schid); in ccw_device_siosl()