Lines Matching refs:sch

150 static int io_subchannel_prepare(struct subchannel *sch)  in io_subchannel_prepare()  argument
157 cdev = sch_get_cdev(sch); in io_subchannel_prepare()
220 struct subchannel *sch = to_subchannel(dev); in chpids_show() local
221 struct chsc_ssd_info *ssd = &sch->ssd_info; in chpids_show()
240 struct subchannel *sch = to_subchannel(dev); in pimpampom_show() local
241 struct pmcw *pmcw = &sch->schib.pmcw; in pimpampom_show()
323 struct subchannel *sch; in ccw_device_set_offline() local
337 sch = to_subchannel(cdev->dev.parent); in ccw_device_set_offline()
358 io_subchannel_quiesce(sch); in ccw_device_set_offline()
592 struct subchannel *sch; in available_show() local
602 sch = to_subchannel(dev->parent); in available_show()
603 if (!sch->lpm) in available_show()
617 struct subchannel *sch = to_subchannel(dev); in initiate_logging() local
620 rc = chsc_siosl(sch->schid); in initiate_logging()
624 sch->schid.ssid, sch->schid.sch_no, rc); in initiate_logging()
628 sch->schid.ssid, sch->schid.sch_no); in initiate_logging()
635 struct subchannel *sch = to_subchannel(dev); in vpm_show() local
637 return sprintf(buf, "%02x\n", sch->vpm); in vpm_show()
740 static struct ccw_device * io_subchannel_allocate_dev(struct subchannel *sch) in io_subchannel_allocate_dev() argument
757 static int io_subchannel_initialize_dev(struct subchannel *sch, in io_subchannel_initialize_dev() argument
766 priv->dev_id.devno = sch->schib.pmcw.dev; in io_subchannel_initialize_dev()
767 priv->dev_id.ssid = sch->schid.ssid; in io_subchannel_initialize_dev()
768 priv->schid = sch->schid; in io_subchannel_initialize_dev()
776 cdev->ccwlock = sch->lock; in io_subchannel_initialize_dev()
777 cdev->dev.parent = &sch->dev; in io_subchannel_initialize_dev()
786 if (!get_device(&sch->dev)) { in io_subchannel_initialize_dev()
791 spin_lock_irq(sch->lock); in io_subchannel_initialize_dev()
792 sch_set_cdev(sch, cdev); in io_subchannel_initialize_dev()
793 spin_unlock_irq(sch->lock); in io_subchannel_initialize_dev()
802 static struct ccw_device * io_subchannel_create_ccwdev(struct subchannel *sch) in io_subchannel_create_ccwdev() argument
807 cdev = io_subchannel_allocate_dev(sch); in io_subchannel_create_ccwdev()
809 ret = io_subchannel_initialize_dev(sch, cdev); in io_subchannel_create_ccwdev()
818 static void sch_create_and_recog_new_device(struct subchannel *sch) in sch_create_and_recog_new_device() argument
823 cdev = io_subchannel_create_ccwdev(sch); in sch_create_and_recog_new_device()
826 css_sch_device_unregister(sch); in sch_create_and_recog_new_device()
830 io_subchannel_recog(cdev, sch); in sch_create_and_recog_new_device()
838 struct subchannel *sch; in io_subchannel_register() local
842 sch = to_subchannel(cdev->dev.parent); in io_subchannel_register()
849 if (!device_is_registered(&sch->dev)) in io_subchannel_register()
851 css_update_ssd_info(sch); in io_subchannel_register()
875 dev_set_uevent_suppress(&sch->dev, 0); in io_subchannel_register()
876 kobject_uevent(&sch->dev.kobj, KOBJ_ADD); in io_subchannel_register()
883 spin_lock_irqsave(sch->lock, flags); in io_subchannel_register()
884 sch_set_cdev(sch, NULL); in io_subchannel_register()
885 spin_unlock_irqrestore(sch->lock, flags); in io_subchannel_register()
900 struct subchannel *sch; in ccw_device_call_sch_unregister() local
905 sch = to_subchannel(cdev->dev.parent); in ccw_device_call_sch_unregister()
906 css_sch_device_unregister(sch); in ccw_device_call_sch_unregister()
908 put_device(&sch->dev); in ccw_device_call_sch_unregister()
941 static void io_subchannel_recog(struct ccw_device *cdev, struct subchannel *sch) in io_subchannel_recog() argument
947 spin_lock_irq(sch->lock); in io_subchannel_recog()
949 spin_unlock_irq(sch->lock); in io_subchannel_recog()
953 struct subchannel *sch) in ccw_device_move_to_sch() argument
960 if (!get_device(&sch->dev)) in ccw_device_move_to_sch()
972 put_device(&sch->dev); in ccw_device_move_to_sch()
977 mutex_lock(&sch->reg_mutex); in ccw_device_move_to_sch()
978 rc = device_move(&cdev->dev, &sch->dev, DPM_ORDER_PARENT_BEFORE_DEV); in ccw_device_move_to_sch()
979 mutex_unlock(&sch->reg_mutex); in ccw_device_move_to_sch()
983 cdev->private->dev_id.devno, sch->schid.ssid, in ccw_device_move_to_sch()
984 sch->schib.pmcw.dev, rc); in ccw_device_move_to_sch()
992 put_device(&sch->dev); in ccw_device_move_to_sch()
1005 spin_lock_irq(sch->lock); in ccw_device_move_to_sch()
1006 cdev->private->schid = sch->schid; in ccw_device_move_to_sch()
1007 cdev->ccwlock = sch->lock; in ccw_device_move_to_sch()
1008 if (!sch_is_pseudo_sch(sch)) in ccw_device_move_to_sch()
1009 sch_set_cdev(sch, cdev); in ccw_device_move_to_sch()
1010 spin_unlock_irq(sch->lock); in ccw_device_move_to_sch()
1011 if (!sch_is_pseudo_sch(sch)) in ccw_device_move_to_sch()
1012 css_update_ssd_info(sch); in ccw_device_move_to_sch()
1018 struct subchannel *sch = to_subchannel(cdev->dev.parent); in ccw_device_move_to_orph() local
1019 struct channel_subsystem *css = to_css(sch->dev.parent); in ccw_device_move_to_orph()
1024 static void io_subchannel_irq(struct subchannel *sch) in io_subchannel_irq() argument
1028 cdev = sch_get_cdev(sch); in io_subchannel_irq()
1031 CIO_TRACE_EVENT(6, dev_name(&sch->dev)); in io_subchannel_irq()
1038 void io_subchannel_init_config(struct subchannel *sch) in io_subchannel_init_config() argument
1040 memset(&sch->config, 0, sizeof(sch->config)); in io_subchannel_init_config()
1041 sch->config.csense = 1; in io_subchannel_init_config()
1044 static void io_subchannel_init_fields(struct subchannel *sch) in io_subchannel_init_fields() argument
1046 if (cio_is_console(sch->schid)) in io_subchannel_init_fields()
1047 sch->opm = 0xff; in io_subchannel_init_fields()
1049 sch->opm = chp_get_sch_opm(sch); in io_subchannel_init_fields()
1050 sch->lpm = sch->schib.pmcw.pam & sch->opm; in io_subchannel_init_fields()
1051 sch->isc = cio_is_console(sch->schid) ? CONSOLE_ISC : IO_SCH_ISC; in io_subchannel_init_fields()
1055 sch->schib.pmcw.dev, sch->schid.ssid, in io_subchannel_init_fields()
1056 sch->schid.sch_no, sch->schib.pmcw.pim, in io_subchannel_init_fields()
1057 sch->schib.pmcw.pam, sch->schib.pmcw.pom); in io_subchannel_init_fields()
1059 io_subchannel_init_config(sch); in io_subchannel_init_fields()
1066 static int io_subchannel_probe(struct subchannel *sch) in io_subchannel_probe() argument
1072 if (cio_is_console(sch->schid)) { in io_subchannel_probe()
1073 rc = sysfs_create_group(&sch->dev.kobj, in io_subchannel_probe()
1079 sch->schid.ssid, sch->schid.sch_no, rc); in io_subchannel_probe()
1085 dev_set_uevent_suppress(&sch->dev, 0); in io_subchannel_probe()
1086 kobject_uevent(&sch->dev.kobj, KOBJ_ADD); in io_subchannel_probe()
1087 cdev = sch_get_cdev(sch); in io_subchannel_probe()
1098 io_subchannel_init_fields(sch); in io_subchannel_probe()
1099 rc = cio_commit_config(sch); in io_subchannel_probe()
1102 rc = sysfs_create_group(&sch->dev.kobj, in io_subchannel_probe()
1111 set_io_private(sch, io_priv); in io_subchannel_probe()
1112 css_schedule_eval(sch->schid); in io_subchannel_probe()
1116 spin_lock_irq(sch->lock); in io_subchannel_probe()
1117 css_sched_sch_todo(sch, SCH_TODO_UNREG); in io_subchannel_probe()
1118 spin_unlock_irq(sch->lock); in io_subchannel_probe()
1123 io_subchannel_remove (struct subchannel *sch) in io_subchannel_remove() argument
1125 struct io_subchannel_private *io_priv = to_io_private(sch); in io_subchannel_remove()
1128 cdev = sch_get_cdev(sch); in io_subchannel_remove()
1131 io_subchannel_quiesce(sch); in io_subchannel_remove()
1134 sch_set_cdev(sch, NULL); in io_subchannel_remove()
1135 set_io_private(sch, NULL); in io_subchannel_remove()
1141 sysfs_remove_group(&sch->dev.kobj, &io_subchannel_attr_group); in io_subchannel_remove()
1145 static void io_subchannel_verify(struct subchannel *sch) in io_subchannel_verify() argument
1149 cdev = sch_get_cdev(sch); in io_subchannel_verify()
1154 static void io_subchannel_terminate_path(struct subchannel *sch, u8 mask) in io_subchannel_terminate_path() argument
1158 cdev = sch_get_cdev(sch); in io_subchannel_terminate_path()
1161 if (cio_update_schib(sch)) in io_subchannel_terminate_path()
1164 if (scsw_actl(&sch->schib.scsw) == 0 || sch->schib.pmcw.lpum != mask) in io_subchannel_terminate_path()
1170 if (cio_clear(sch)) in io_subchannel_terminate_path()
1181 static int io_subchannel_chp_event(struct subchannel *sch, in io_subchannel_chp_event() argument
1184 struct ccw_device *cdev = sch_get_cdev(sch); in io_subchannel_chp_event()
1187 mask = chp_ssd_get_mask(&sch->ssd_info, link); in io_subchannel_chp_event()
1192 sch->opm &= ~mask; in io_subchannel_chp_event()
1193 sch->lpm &= ~mask; in io_subchannel_chp_event()
1196 io_subchannel_terminate_path(sch, mask); in io_subchannel_chp_event()
1199 sch->opm |= mask; in io_subchannel_chp_event()
1200 sch->lpm |= mask; in io_subchannel_chp_event()
1203 io_subchannel_verify(sch); in io_subchannel_chp_event()
1206 if (cio_update_schib(sch)) in io_subchannel_chp_event()
1210 io_subchannel_terminate_path(sch, mask); in io_subchannel_chp_event()
1213 if (cio_update_schib(sch)) in io_subchannel_chp_event()
1215 sch->lpm |= mask & sch->opm; in io_subchannel_chp_event()
1218 io_subchannel_verify(sch); in io_subchannel_chp_event()
1224 static void io_subchannel_quiesce(struct subchannel *sch) in io_subchannel_quiesce() argument
1229 spin_lock_irq(sch->lock); in io_subchannel_quiesce()
1230 cdev = sch_get_cdev(sch); in io_subchannel_quiesce()
1231 if (cio_is_console(sch->schid)) in io_subchannel_quiesce()
1233 if (!sch->schib.pmcw.ena) in io_subchannel_quiesce()
1235 ret = cio_disable_subchannel(sch); in io_subchannel_quiesce()
1246 spin_unlock_irq(sch->lock); in io_subchannel_quiesce()
1249 spin_lock_irq(sch->lock); in io_subchannel_quiesce()
1251 ret = cio_disable_subchannel(sch); in io_subchannel_quiesce()
1254 spin_unlock_irq(sch->lock); in io_subchannel_quiesce()
1257 static void io_subchannel_shutdown(struct subchannel *sch) in io_subchannel_shutdown() argument
1259 io_subchannel_quiesce(sch); in io_subchannel_shutdown()
1382 struct subchannel *sch = to_subchannel(cdev->dev.parent); in ccw_device_set_notoper() local
1385 CIO_TRACE_EVENT(2, dev_name(&sch->dev)); in ccw_device_set_notoper()
1387 cio_disable_subchannel(sch); in ccw_device_set_notoper()
1403 static enum io_sch_action sch_get_action(struct subchannel *sch) in sch_get_action() argument
1407 cdev = sch_get_cdev(sch); in sch_get_action()
1408 if (cio_update_schib(sch)) { in sch_get_action()
1419 if (sch->schib.pmcw.dev != cdev->private->dev_id.devno) { in sch_get_action()
1424 if ((sch->schib.pmcw.pam & sch->opm) == 0) { in sch_get_action()
1448 static int io_subchannel_sch_event(struct subchannel *sch, int process) in io_subchannel_sch_event() argument
1456 spin_lock_irqsave(sch->lock, flags); in io_subchannel_sch_event()
1457 if (!device_is_registered(&sch->dev)) in io_subchannel_sch_event()
1459 if (work_pending(&sch->todo_work)) in io_subchannel_sch_event()
1461 cdev = sch_get_cdev(sch); in io_subchannel_sch_event()
1464 action = sch_get_action(sch); in io_subchannel_sch_event()
1466 sch->schid.ssid, sch->schid.sch_no, process, in io_subchannel_sch_event()
1477 io_subchannel_verify(sch); in io_subchannel_sch_event()
1508 spin_unlock_irqrestore(sch->lock, flags); in io_subchannel_sch_event()
1522 spin_lock_irqsave(sch->lock, flags); in io_subchannel_sch_event()
1528 sch_set_cdev(sch, NULL); in io_subchannel_sch_event()
1529 spin_unlock_irqrestore(sch->lock, flags); in io_subchannel_sch_event()
1541 css_sch_device_unregister(sch); in io_subchannel_sch_event()
1546 dev_id.ssid = sch->schid.ssid; in io_subchannel_sch_event()
1547 dev_id.devno = sch->schib.pmcw.dev; in io_subchannel_sch_event()
1550 sch_create_and_recog_new_device(sch); in io_subchannel_sch_event()
1553 rc = ccw_device_move_to_sch(cdev, sch); in io_subchannel_sch_event()
1559 spin_lock_irqsave(sch->lock, flags); in io_subchannel_sch_event()
1561 spin_unlock_irqrestore(sch->lock, flags); in io_subchannel_sch_event()
1571 spin_unlock_irqrestore(sch->lock, flags); in io_subchannel_sch_event()
1591 struct subchannel *sch = to_subchannel(cdev->dev.parent); in ccw_device_enable_console() local
1597 io_subchannel_init_fields(sch); in ccw_device_enable_console()
1598 rc = cio_commit_config(sch); in ccw_device_enable_console()
1601 sch->driver = &io_subchannel_driver; in ccw_device_enable_console()
1602 io_subchannel_recog(cdev, sch); in ccw_device_enable_console()
1632 struct subchannel *sch; in ccw_device_create_console() local
1634 sch = cio_probe_console(); in ccw_device_create_console()
1635 if (IS_ERR(sch)) in ccw_device_create_console()
1636 return ERR_CAST(sch); in ccw_device_create_console()
1640 put_device(&sch->dev); in ccw_device_create_console()
1643 set_io_private(sch, io_priv); in ccw_device_create_console()
1644 cdev = io_subchannel_create_ccwdev(sch); in ccw_device_create_console()
1646 put_device(&sch->dev); in ccw_device_create_console()
1657 struct subchannel *sch = to_subchannel(cdev->dev.parent); in ccw_device_destroy_console() local
1658 struct io_subchannel_private *io_priv = to_io_private(sch); in ccw_device_destroy_console()
1660 set_io_private(sch, NULL); in ccw_device_destroy_console()
1661 put_device(&sch->dev); in ccw_device_destroy_console()
1676 struct subchannel *sch = to_subchannel(cdev->dev.parent); in ccw_device_wait_idle() local
1679 cio_tsch(sch); in ccw_device_wait_idle()
1680 if (sch->schib.scsw.cmd.actl == 0) in ccw_device_wait_idle()
1832 struct subchannel *sch = to_subchannel(cdev->dev.parent); in ccw_device_pm_freeze() local
1846 spin_lock_irq(sch->lock); in ccw_device_pm_freeze()
1848 spin_unlock_irq(sch->lock); in ccw_device_pm_freeze()
1856 spin_lock_irq(sch->lock); in ccw_device_pm_freeze()
1857 ret = cio_disable_subchannel(sch); in ccw_device_pm_freeze()
1858 spin_unlock_irq(sch->lock); in ccw_device_pm_freeze()
1866 struct subchannel *sch = to_subchannel(cdev->dev.parent); in ccw_device_pm_thaw() local
1872 spin_lock_irq(sch->lock); in ccw_device_pm_thaw()
1874 ret = cio_enable_subchannel(sch, (u32)(addr_t)sch); in ccw_device_pm_thaw()
1876 spin_unlock_irq(sch->lock); in ccw_device_pm_thaw()
1894 struct subchannel *sch = to_subchannel(cdev->dev.parent); in __ccw_device_pm_restore() local
1896 spin_lock_irq(sch->lock); in __ccw_device_pm_restore()
1897 if (cio_is_console(sch->schid)) { in __ccw_device_pm_restore()
1898 cio_enable_subchannel(sch, (u32)(addr_t)sch); in __ccw_device_pm_restore()
1907 css_sched_sch_todo(sch, SCH_TODO_EVAL); in __ccw_device_pm_restore()
1908 spin_unlock_irq(sch->lock); in __ccw_device_pm_restore()
1912 sch = to_subchannel(cdev->dev.parent); in __ccw_device_pm_restore()
1913 spin_lock_irq(sch->lock); in __ccw_device_pm_restore()
1919 spin_unlock_irq(sch->lock); in __ccw_device_pm_restore()
1922 spin_lock_irq(sch->lock); in __ccw_device_pm_restore()
1926 spin_unlock_irq(sch->lock); in __ccw_device_pm_restore()
1950 struct subchannel *sch; in ccw_device_pm_restore() local
1954 sch = to_subchannel(cdev->dev.parent); in ccw_device_pm_restore()
1955 spin_lock_irq(sch->lock); in ccw_device_pm_restore()
1956 if (cio_is_console(sch->schid)) in ccw_device_pm_restore()
1992 spin_unlock_irq(sch->lock); in ccw_device_pm_restore()
1994 spin_lock_irq(sch->lock); in ccw_device_pm_restore()
2004 spin_unlock_irq(sch->lock); in ccw_device_pm_restore()
2006 spin_lock_irq(sch->lock); in ccw_device_pm_restore()
2016 spin_unlock_irq(sch->lock); in ccw_device_pm_restore()
2022 spin_unlock_irq(sch->lock); in ccw_device_pm_restore()
2076 struct subchannel *sch; in ccw_device_todo() local
2081 sch = to_subchannel(cdev->dev.parent); in ccw_device_todo()
2101 if (!sch_is_pseudo_sch(sch)) in ccw_device_todo()
2102 css_schedule_eval(sch->schid); in ccw_device_todo()
2105 if (sch_is_pseudo_sch(sch)) in ccw_device_todo()
2152 struct subchannel *sch = to_subchannel(cdev->dev.parent); in ccw_device_siosl() local
2154 return chsc_siosl(sch->schid); in ccw_device_siosl()