Lines Matching refs:sch

151 static int io_subchannel_prepare(struct subchannel *sch)  in io_subchannel_prepare()  argument
158 cdev = sch_get_cdev(sch); in io_subchannel_prepare()
286 struct subchannel *sch; in ccw_device_set_offline() local
300 sch = to_subchannel(cdev->dev.parent); in ccw_device_set_offline()
321 io_subchannel_quiesce(sch); in ccw_device_set_offline()
553 struct subchannel *sch; in available_show() local
563 sch = to_subchannel(dev->parent); in available_show()
564 if (!sch->lpm) in available_show()
578 struct subchannel *sch = to_subchannel(dev); in initiate_logging() local
581 rc = chsc_siosl(sch->schid); in initiate_logging()
584 sch->schid.ssid, sch->schid.sch_no, rc); in initiate_logging()
588 sch->schid.ssid, sch->schid.sch_no); in initiate_logging()
595 struct subchannel *sch = to_subchannel(dev); in vpm_show() local
597 return sprintf(buf, "%02x\n", sch->vpm); in vpm_show()
696 static struct ccw_device * io_subchannel_allocate_dev(struct subchannel *sch) in io_subchannel_allocate_dev() argument
713 static int io_subchannel_initialize_dev(struct subchannel *sch, in io_subchannel_initialize_dev() argument
722 priv->dev_id.devno = sch->schib.pmcw.dev; in io_subchannel_initialize_dev()
723 priv->dev_id.ssid = sch->schid.ssid; in io_subchannel_initialize_dev()
731 cdev->ccwlock = sch->lock; in io_subchannel_initialize_dev()
732 cdev->dev.parent = &sch->dev; in io_subchannel_initialize_dev()
741 if (!get_device(&sch->dev)) { in io_subchannel_initialize_dev()
746 spin_lock_irq(sch->lock); in io_subchannel_initialize_dev()
747 sch_set_cdev(sch, cdev); in io_subchannel_initialize_dev()
748 spin_unlock_irq(sch->lock); in io_subchannel_initialize_dev()
757 static struct ccw_device * io_subchannel_create_ccwdev(struct subchannel *sch) in io_subchannel_create_ccwdev() argument
762 cdev = io_subchannel_allocate_dev(sch); in io_subchannel_create_ccwdev()
764 ret = io_subchannel_initialize_dev(sch, cdev); in io_subchannel_create_ccwdev()
773 static void sch_create_and_recog_new_device(struct subchannel *sch) in sch_create_and_recog_new_device() argument
778 cdev = io_subchannel_create_ccwdev(sch); in sch_create_and_recog_new_device()
781 css_sch_device_unregister(sch); in sch_create_and_recog_new_device()
785 io_subchannel_recog(cdev, sch); in sch_create_and_recog_new_device()
793 struct subchannel *sch; in io_subchannel_register() local
797 sch = to_subchannel(cdev->dev.parent); in io_subchannel_register()
804 if (!device_is_registered(&sch->dev)) in io_subchannel_register()
806 css_update_ssd_info(sch); in io_subchannel_register()
830 dev_set_uevent_suppress(&sch->dev, 0); in io_subchannel_register()
831 kobject_uevent(&sch->dev.kobj, KOBJ_ADD); in io_subchannel_register()
838 spin_lock_irqsave(sch->lock, flags); in io_subchannel_register()
839 sch_set_cdev(sch, NULL); in io_subchannel_register()
840 spin_unlock_irqrestore(sch->lock, flags); in io_subchannel_register()
855 struct subchannel *sch; in ccw_device_call_sch_unregister() local
860 sch = to_subchannel(cdev->dev.parent); in ccw_device_call_sch_unregister()
861 css_sch_device_unregister(sch); in ccw_device_call_sch_unregister()
863 put_device(&sch->dev); in ccw_device_call_sch_unregister()
896 static void io_subchannel_recog(struct ccw_device *cdev, struct subchannel *sch) in io_subchannel_recog() argument
902 spin_lock_irq(sch->lock); in io_subchannel_recog()
904 spin_unlock_irq(sch->lock); in io_subchannel_recog()
908 struct subchannel *sch) in ccw_device_move_to_sch() argument
915 if (!get_device(&sch->dev)) in ccw_device_move_to_sch()
927 put_device(&sch->dev); in ccw_device_move_to_sch()
932 mutex_lock(&sch->reg_mutex); in ccw_device_move_to_sch()
933 rc = device_move(&cdev->dev, &sch->dev, DPM_ORDER_PARENT_BEFORE_DEV); in ccw_device_move_to_sch()
934 mutex_unlock(&sch->reg_mutex); in ccw_device_move_to_sch()
938 cdev->private->dev_id.devno, sch->schid.ssid, in ccw_device_move_to_sch()
939 sch->schib.pmcw.dev, rc); in ccw_device_move_to_sch()
947 put_device(&sch->dev); in ccw_device_move_to_sch()
960 spin_lock_irq(sch->lock); in ccw_device_move_to_sch()
961 cdev->ccwlock = sch->lock; in ccw_device_move_to_sch()
962 if (!sch_is_pseudo_sch(sch)) in ccw_device_move_to_sch()
963 sch_set_cdev(sch, cdev); in ccw_device_move_to_sch()
964 spin_unlock_irq(sch->lock); in ccw_device_move_to_sch()
965 if (!sch_is_pseudo_sch(sch)) in ccw_device_move_to_sch()
966 css_update_ssd_info(sch); in ccw_device_move_to_sch()
972 struct subchannel *sch = to_subchannel(cdev->dev.parent); in ccw_device_move_to_orph() local
973 struct channel_subsystem *css = to_css(sch->dev.parent); in ccw_device_move_to_orph()
978 static void io_subchannel_irq(struct subchannel *sch) in io_subchannel_irq() argument
982 cdev = sch_get_cdev(sch); in io_subchannel_irq()
985 CIO_TRACE_EVENT(6, dev_name(&sch->dev)); in io_subchannel_irq()
992 void io_subchannel_init_config(struct subchannel *sch) in io_subchannel_init_config() argument
994 memset(&sch->config, 0, sizeof(sch->config)); in io_subchannel_init_config()
995 sch->config.csense = 1; in io_subchannel_init_config()
998 static void io_subchannel_init_fields(struct subchannel *sch) in io_subchannel_init_fields() argument
1000 if (cio_is_console(sch->schid)) in io_subchannel_init_fields()
1001 sch->opm = 0xff; in io_subchannel_init_fields()
1003 sch->opm = chp_get_sch_opm(sch); in io_subchannel_init_fields()
1004 sch->lpm = sch->schib.pmcw.pam & sch->opm; in io_subchannel_init_fields()
1005 sch->isc = cio_is_console(sch->schid) ? CONSOLE_ISC : IO_SCH_ISC; in io_subchannel_init_fields()
1009 sch->schib.pmcw.dev, sch->schid.ssid, in io_subchannel_init_fields()
1010 sch->schid.sch_no, sch->schib.pmcw.pim, in io_subchannel_init_fields()
1011 sch->schib.pmcw.pam, sch->schib.pmcw.pom); in io_subchannel_init_fields()
1013 io_subchannel_init_config(sch); in io_subchannel_init_fields()
1020 static int io_subchannel_probe(struct subchannel *sch) in io_subchannel_probe() argument
1026 if (cio_is_console(sch->schid)) { in io_subchannel_probe()
1027 rc = sysfs_create_group(&sch->dev.kobj, in io_subchannel_probe()
1033 sch->schid.ssid, sch->schid.sch_no, rc); in io_subchannel_probe()
1039 dev_set_uevent_suppress(&sch->dev, 0); in io_subchannel_probe()
1040 kobject_uevent(&sch->dev.kobj, KOBJ_ADD); in io_subchannel_probe()
1041 cdev = sch_get_cdev(sch); in io_subchannel_probe()
1052 io_subchannel_init_fields(sch); in io_subchannel_probe()
1053 rc = cio_commit_config(sch); in io_subchannel_probe()
1056 rc = sysfs_create_group(&sch->dev.kobj, in io_subchannel_probe()
1065 set_io_private(sch, io_priv); in io_subchannel_probe()
1066 css_schedule_eval(sch->schid); in io_subchannel_probe()
1070 spin_lock_irq(sch->lock); in io_subchannel_probe()
1071 css_sched_sch_todo(sch, SCH_TODO_UNREG); in io_subchannel_probe()
1072 spin_unlock_irq(sch->lock); in io_subchannel_probe()
1076 static int io_subchannel_remove(struct subchannel *sch) in io_subchannel_remove() argument
1078 struct io_subchannel_private *io_priv = to_io_private(sch); in io_subchannel_remove()
1081 cdev = sch_get_cdev(sch); in io_subchannel_remove()
1086 spin_lock_irq(sch->lock); in io_subchannel_remove()
1087 sch_set_cdev(sch, NULL); in io_subchannel_remove()
1088 set_io_private(sch, NULL); in io_subchannel_remove()
1089 spin_unlock_irq(sch->lock); in io_subchannel_remove()
1092 sysfs_remove_group(&sch->dev.kobj, &io_subchannel_attr_group); in io_subchannel_remove()
1096 static void io_subchannel_verify(struct subchannel *sch) in io_subchannel_verify() argument
1100 cdev = sch_get_cdev(sch); in io_subchannel_verify()
1105 static void io_subchannel_terminate_path(struct subchannel *sch, u8 mask) in io_subchannel_terminate_path() argument
1109 cdev = sch_get_cdev(sch); in io_subchannel_terminate_path()
1112 if (cio_update_schib(sch)) in io_subchannel_terminate_path()
1115 if (scsw_actl(&sch->schib.scsw) == 0 || sch->schib.pmcw.lpum != mask) in io_subchannel_terminate_path()
1121 if (cio_clear(sch)) in io_subchannel_terminate_path()
1132 static int io_subchannel_chp_event(struct subchannel *sch, in io_subchannel_chp_event() argument
1135 struct ccw_device *cdev = sch_get_cdev(sch); in io_subchannel_chp_event()
1138 mask = chp_ssd_get_mask(&sch->ssd_info, link); in io_subchannel_chp_event()
1143 sch->opm &= ~mask; in io_subchannel_chp_event()
1144 sch->lpm &= ~mask; in io_subchannel_chp_event()
1147 io_subchannel_terminate_path(sch, mask); in io_subchannel_chp_event()
1150 sch->opm |= mask; in io_subchannel_chp_event()
1151 sch->lpm |= mask; in io_subchannel_chp_event()
1154 io_subchannel_verify(sch); in io_subchannel_chp_event()
1157 if (cio_update_schib(sch)) in io_subchannel_chp_event()
1161 io_subchannel_terminate_path(sch, mask); in io_subchannel_chp_event()
1164 if (cio_update_schib(sch)) in io_subchannel_chp_event()
1166 sch->lpm |= mask & sch->opm; in io_subchannel_chp_event()
1169 io_subchannel_verify(sch); in io_subchannel_chp_event()
1175 static void io_subchannel_quiesce(struct subchannel *sch) in io_subchannel_quiesce() argument
1180 spin_lock_irq(sch->lock); in io_subchannel_quiesce()
1181 cdev = sch_get_cdev(sch); in io_subchannel_quiesce()
1182 if (cio_is_console(sch->schid)) in io_subchannel_quiesce()
1184 if (!sch->schib.pmcw.ena) in io_subchannel_quiesce()
1186 ret = cio_disable_subchannel(sch); in io_subchannel_quiesce()
1197 spin_unlock_irq(sch->lock); in io_subchannel_quiesce()
1200 spin_lock_irq(sch->lock); in io_subchannel_quiesce()
1202 ret = cio_disable_subchannel(sch); in io_subchannel_quiesce()
1205 spin_unlock_irq(sch->lock); in io_subchannel_quiesce()
1208 static void io_subchannel_shutdown(struct subchannel *sch) in io_subchannel_shutdown() argument
1210 io_subchannel_quiesce(sch); in io_subchannel_shutdown()
1224 struct subchannel *sch; in recovery_check() local
1230 sch = to_subchannel(cdev->dev.parent); in recovery_check()
1231 if ((sch->schib.pmcw.pam & sch->opm) == sch->vpm) in recovery_check()
1339 struct subchannel *sch = to_subchannel(cdev->dev.parent); in ccw_device_set_notoper() local
1342 CIO_TRACE_EVENT(2, dev_name(&sch->dev)); in ccw_device_set_notoper()
1344 cio_disable_subchannel(sch); in ccw_device_set_notoper()
1360 static enum io_sch_action sch_get_action(struct subchannel *sch) in sch_get_action() argument
1364 cdev = sch_get_cdev(sch); in sch_get_action()
1365 if (cio_update_schib(sch)) { in sch_get_action()
1376 if (sch->schib.pmcw.dev != cdev->private->dev_id.devno) { in sch_get_action()
1381 if ((sch->schib.pmcw.pam & sch->opm) == 0) { in sch_get_action()
1405 static int io_subchannel_sch_event(struct subchannel *sch, int process) in io_subchannel_sch_event() argument
1413 spin_lock_irqsave(sch->lock, flags); in io_subchannel_sch_event()
1414 if (!device_is_registered(&sch->dev)) in io_subchannel_sch_event()
1416 if (work_pending(&sch->todo_work)) in io_subchannel_sch_event()
1418 cdev = sch_get_cdev(sch); in io_subchannel_sch_event()
1421 action = sch_get_action(sch); in io_subchannel_sch_event()
1423 sch->schid.ssid, sch->schid.sch_no, process, in io_subchannel_sch_event()
1434 io_subchannel_verify(sch); in io_subchannel_sch_event()
1465 spin_unlock_irqrestore(sch->lock, flags); in io_subchannel_sch_event()
1479 spin_lock_irqsave(sch->lock, flags); in io_subchannel_sch_event()
1485 sch_set_cdev(sch, NULL); in io_subchannel_sch_event()
1486 spin_unlock_irqrestore(sch->lock, flags); in io_subchannel_sch_event()
1498 css_sch_device_unregister(sch); in io_subchannel_sch_event()
1503 dev_id.ssid = sch->schid.ssid; in io_subchannel_sch_event()
1504 dev_id.devno = sch->schib.pmcw.dev; in io_subchannel_sch_event()
1507 sch_create_and_recog_new_device(sch); in io_subchannel_sch_event()
1510 rc = ccw_device_move_to_sch(cdev, sch); in io_subchannel_sch_event()
1516 spin_lock_irqsave(sch->lock, flags); in io_subchannel_sch_event()
1518 spin_unlock_irqrestore(sch->lock, flags); in io_subchannel_sch_event()
1528 spin_unlock_irqrestore(sch->lock, flags); in io_subchannel_sch_event()
1548 struct subchannel *sch = to_subchannel(cdev->dev.parent); in ccw_device_enable_console() local
1554 io_subchannel_init_fields(sch); in ccw_device_enable_console()
1555 rc = cio_commit_config(sch); in ccw_device_enable_console()
1558 sch->driver = &io_subchannel_driver; in ccw_device_enable_console()
1559 io_subchannel_recog(cdev, sch); in ccw_device_enable_console()
1589 struct subchannel *sch; in ccw_device_create_console() local
1591 sch = cio_probe_console(); in ccw_device_create_console()
1592 if (IS_ERR(sch)) in ccw_device_create_console()
1593 return ERR_CAST(sch); in ccw_device_create_console()
1597 put_device(&sch->dev); in ccw_device_create_console()
1600 set_io_private(sch, io_priv); in ccw_device_create_console()
1601 cdev = io_subchannel_create_ccwdev(sch); in ccw_device_create_console()
1603 put_device(&sch->dev); in ccw_device_create_console()
1614 struct subchannel *sch = to_subchannel(cdev->dev.parent); in ccw_device_destroy_console() local
1615 struct io_subchannel_private *io_priv = to_io_private(sch); in ccw_device_destroy_console()
1617 set_io_private(sch, NULL); in ccw_device_destroy_console()
1618 put_device(&sch->dev); in ccw_device_destroy_console()
1633 struct subchannel *sch = to_subchannel(cdev->dev.parent); in ccw_device_wait_idle() local
1636 cio_tsch(sch); in ccw_device_wait_idle()
1637 if (sch->schib.scsw.cmd.actl == 0) in ccw_device_wait_idle()
1721 struct subchannel *sch; in ccw_device_remove() local
1747 sch = to_subchannel(cdev->dev.parent); in ccw_device_remove()
1749 io_subchannel_quiesce(sch); in ccw_device_remove()
1792 struct subchannel *sch = to_subchannel(cdev->dev.parent); in ccw_device_pm_freeze() local
1806 spin_lock_irq(sch->lock); in ccw_device_pm_freeze()
1808 spin_unlock_irq(sch->lock); in ccw_device_pm_freeze()
1816 spin_lock_irq(sch->lock); in ccw_device_pm_freeze()
1817 ret = cio_disable_subchannel(sch); in ccw_device_pm_freeze()
1818 spin_unlock_irq(sch->lock); in ccw_device_pm_freeze()
1826 struct subchannel *sch = to_subchannel(cdev->dev.parent); in ccw_device_pm_thaw() local
1832 spin_lock_irq(sch->lock); in ccw_device_pm_thaw()
1834 ret = cio_enable_subchannel(sch, (u32)(addr_t)sch); in ccw_device_pm_thaw()
1836 spin_unlock_irq(sch->lock); in ccw_device_pm_thaw()
1854 struct subchannel *sch = to_subchannel(cdev->dev.parent); in __ccw_device_pm_restore() local
1856 spin_lock_irq(sch->lock); in __ccw_device_pm_restore()
1857 if (cio_is_console(sch->schid)) { in __ccw_device_pm_restore()
1858 cio_enable_subchannel(sch, (u32)(addr_t)sch); in __ccw_device_pm_restore()
1867 css_sched_sch_todo(sch, SCH_TODO_EVAL); in __ccw_device_pm_restore()
1868 spin_unlock_irq(sch->lock); in __ccw_device_pm_restore()
1872 sch = to_subchannel(cdev->dev.parent); in __ccw_device_pm_restore()
1873 spin_lock_irq(sch->lock); in __ccw_device_pm_restore()
1879 spin_unlock_irq(sch->lock); in __ccw_device_pm_restore()
1882 spin_lock_irq(sch->lock); in __ccw_device_pm_restore()
1886 spin_unlock_irq(sch->lock); in __ccw_device_pm_restore()
1910 struct subchannel *sch; in ccw_device_pm_restore() local
1914 sch = to_subchannel(cdev->dev.parent); in ccw_device_pm_restore()
1915 spin_lock_irq(sch->lock); in ccw_device_pm_restore()
1916 if (cio_is_console(sch->schid)) in ccw_device_pm_restore()
1952 spin_unlock_irq(sch->lock); in ccw_device_pm_restore()
1954 spin_lock_irq(sch->lock); in ccw_device_pm_restore()
1964 spin_unlock_irq(sch->lock); in ccw_device_pm_restore()
1966 spin_lock_irq(sch->lock); in ccw_device_pm_restore()
1976 spin_unlock_irq(sch->lock); in ccw_device_pm_restore()
1982 spin_unlock_irq(sch->lock); in ccw_device_pm_restore()
2036 struct subchannel *sch; in ccw_device_todo() local
2041 sch = to_subchannel(cdev->dev.parent); in ccw_device_todo()
2061 if (!sch_is_pseudo_sch(sch)) in ccw_device_todo()
2062 css_schedule_eval(sch->schid); in ccw_device_todo()
2065 if (sch_is_pseudo_sch(sch)) in ccw_device_todo()
2112 struct subchannel *sch = to_subchannel(cdev->dev.parent); in ccw_device_siosl() local
2114 return chsc_siosl(sch->schid); in ccw_device_siosl()