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 if (dev_get_uevent_suppress(&sch->dev)) { in io_subchannel_register()
853 dev_set_uevent_suppress(&sch->dev, 0); in io_subchannel_register()
854 kobject_uevent(&sch->dev.kobj, KOBJ_ADD); in io_subchannel_register()
862 spin_lock_irqsave(sch->lock, flags); in io_subchannel_register()
863 sch_set_cdev(sch, NULL); in io_subchannel_register()
864 spin_unlock_irqrestore(sch->lock, flags); in io_subchannel_register()
879 struct subchannel *sch; in ccw_device_call_sch_unregister() local
884 sch = to_subchannel(cdev->dev.parent); in ccw_device_call_sch_unregister()
885 css_sch_device_unregister(sch); in ccw_device_call_sch_unregister()
887 put_device(&sch->dev); in ccw_device_call_sch_unregister()
920 static void io_subchannel_recog(struct ccw_device *cdev, struct subchannel *sch) in io_subchannel_recog() argument
926 spin_lock_irq(sch->lock); in io_subchannel_recog()
928 spin_unlock_irq(sch->lock); in io_subchannel_recog()
932 struct subchannel *sch) in ccw_device_move_to_sch() argument
939 if (!get_device(&sch->dev)) in ccw_device_move_to_sch()
951 put_device(&sch->dev); in ccw_device_move_to_sch()
956 mutex_lock(&sch->reg_mutex); in ccw_device_move_to_sch()
957 rc = device_move(&cdev->dev, &sch->dev, DPM_ORDER_PARENT_BEFORE_DEV); in ccw_device_move_to_sch()
958 mutex_unlock(&sch->reg_mutex); in ccw_device_move_to_sch()
962 cdev->private->dev_id.devno, sch->schid.ssid, in ccw_device_move_to_sch()
963 sch->schib.pmcw.dev, rc); in ccw_device_move_to_sch()
971 put_device(&sch->dev); in ccw_device_move_to_sch()
984 spin_lock_irq(sch->lock); in ccw_device_move_to_sch()
985 cdev->ccwlock = sch->lock; in ccw_device_move_to_sch()
986 if (!sch_is_pseudo_sch(sch)) in ccw_device_move_to_sch()
987 sch_set_cdev(sch, cdev); in ccw_device_move_to_sch()
988 spin_unlock_irq(sch->lock); in ccw_device_move_to_sch()
989 if (!sch_is_pseudo_sch(sch)) in ccw_device_move_to_sch()
990 css_update_ssd_info(sch); in ccw_device_move_to_sch()
996 struct subchannel *sch = to_subchannel(cdev->dev.parent); in ccw_device_move_to_orph() local
997 struct channel_subsystem *css = to_css(sch->dev.parent); in ccw_device_move_to_orph()
1002 static void io_subchannel_irq(struct subchannel *sch) in io_subchannel_irq() argument
1006 cdev = sch_get_cdev(sch); in io_subchannel_irq()
1009 CIO_TRACE_EVENT(6, dev_name(&sch->dev)); in io_subchannel_irq()
1016 void io_subchannel_init_config(struct subchannel *sch) in io_subchannel_init_config() argument
1018 memset(&sch->config, 0, sizeof(sch->config)); in io_subchannel_init_config()
1019 sch->config.csense = 1; in io_subchannel_init_config()
1022 static void io_subchannel_init_fields(struct subchannel *sch) in io_subchannel_init_fields() argument
1024 if (cio_is_console(sch->schid)) in io_subchannel_init_fields()
1025 sch->opm = 0xff; in io_subchannel_init_fields()
1027 sch->opm = chp_get_sch_opm(sch); in io_subchannel_init_fields()
1028 sch->lpm = sch->schib.pmcw.pam & sch->opm; in io_subchannel_init_fields()
1029 sch->isc = cio_is_console(sch->schid) ? CONSOLE_ISC : IO_SCH_ISC; in io_subchannel_init_fields()
1033 sch->schib.pmcw.dev, sch->schid.ssid, in io_subchannel_init_fields()
1034 sch->schid.sch_no, sch->schib.pmcw.pim, in io_subchannel_init_fields()
1035 sch->schib.pmcw.pam, sch->schib.pmcw.pom); in io_subchannel_init_fields()
1037 io_subchannel_init_config(sch); in io_subchannel_init_fields()
1044 static int io_subchannel_probe(struct subchannel *sch) in io_subchannel_probe() argument
1050 if (cio_is_console(sch->schid)) { in io_subchannel_probe()
1051 rc = sysfs_create_group(&sch->dev.kobj, in io_subchannel_probe()
1057 sch->schid.ssid, sch->schid.sch_no, rc); in io_subchannel_probe()
1063 if (dev_get_uevent_suppress(&sch->dev)) { in io_subchannel_probe()
1065 dev_set_uevent_suppress(&sch->dev, 0); in io_subchannel_probe()
1066 kobject_uevent(&sch->dev.kobj, KOBJ_ADD); in io_subchannel_probe()
1068 cdev = sch_get_cdev(sch); in io_subchannel_probe()
1079 io_subchannel_init_fields(sch); in io_subchannel_probe()
1080 rc = cio_commit_config(sch); in io_subchannel_probe()
1083 rc = sysfs_create_group(&sch->dev.kobj, in io_subchannel_probe()
1092 io_priv->dma_area = dma_alloc_coherent(&sch->dev, in io_subchannel_probe()
1100 set_io_private(sch, io_priv); in io_subchannel_probe()
1101 css_schedule_eval(sch->schid); in io_subchannel_probe()
1105 spin_lock_irq(sch->lock); in io_subchannel_probe()
1106 css_sched_sch_todo(sch, SCH_TODO_UNREG); in io_subchannel_probe()
1107 spin_unlock_irq(sch->lock); in io_subchannel_probe()
1111 static int io_subchannel_remove(struct subchannel *sch) in io_subchannel_remove() argument
1113 struct io_subchannel_private *io_priv = to_io_private(sch); in io_subchannel_remove()
1116 cdev = sch_get_cdev(sch); in io_subchannel_remove()
1121 spin_lock_irq(sch->lock); in io_subchannel_remove()
1122 sch_set_cdev(sch, NULL); in io_subchannel_remove()
1123 set_io_private(sch, NULL); in io_subchannel_remove()
1124 spin_unlock_irq(sch->lock); in io_subchannel_remove()
1126 dma_free_coherent(&sch->dev, sizeof(*io_priv->dma_area), in io_subchannel_remove()
1129 sysfs_remove_group(&sch->dev.kobj, &io_subchannel_attr_group); in io_subchannel_remove()
1133 static void io_subchannel_verify(struct subchannel *sch) in io_subchannel_verify() argument
1137 cdev = sch_get_cdev(sch); in io_subchannel_verify()
1142 static void io_subchannel_terminate_path(struct subchannel *sch, u8 mask) in io_subchannel_terminate_path() argument
1146 cdev = sch_get_cdev(sch); in io_subchannel_terminate_path()
1149 if (cio_update_schib(sch)) in io_subchannel_terminate_path()
1152 if (scsw_actl(&sch->schib.scsw) == 0 || sch->schib.pmcw.lpum != mask) in io_subchannel_terminate_path()
1158 if (cio_clear(sch)) in io_subchannel_terminate_path()
1169 static int io_subchannel_chp_event(struct subchannel *sch, in io_subchannel_chp_event() argument
1172 struct ccw_device *cdev = sch_get_cdev(sch); in io_subchannel_chp_event()
1175 mask = chp_ssd_get_mask(&sch->ssd_info, link); in io_subchannel_chp_event()
1180 sch->opm &= ~mask; in io_subchannel_chp_event()
1181 sch->lpm &= ~mask; in io_subchannel_chp_event()
1184 io_subchannel_terminate_path(sch, mask); in io_subchannel_chp_event()
1187 sch->opm |= mask; in io_subchannel_chp_event()
1188 sch->lpm |= mask; in io_subchannel_chp_event()
1191 io_subchannel_verify(sch); in io_subchannel_chp_event()
1194 if (cio_update_schib(sch)) in io_subchannel_chp_event()
1198 io_subchannel_terminate_path(sch, mask); in io_subchannel_chp_event()
1201 if (cio_update_schib(sch)) in io_subchannel_chp_event()
1203 sch->lpm |= mask & sch->opm; in io_subchannel_chp_event()
1206 io_subchannel_verify(sch); in io_subchannel_chp_event()
1212 static void io_subchannel_quiesce(struct subchannel *sch) in io_subchannel_quiesce() argument
1217 spin_lock_irq(sch->lock); in io_subchannel_quiesce()
1218 cdev = sch_get_cdev(sch); in io_subchannel_quiesce()
1219 if (cio_is_console(sch->schid)) in io_subchannel_quiesce()
1221 if (!sch->schib.pmcw.ena) in io_subchannel_quiesce()
1223 ret = cio_disable_subchannel(sch); in io_subchannel_quiesce()
1234 spin_unlock_irq(sch->lock); in io_subchannel_quiesce()
1237 spin_lock_irq(sch->lock); in io_subchannel_quiesce()
1239 ret = cio_disable_subchannel(sch); in io_subchannel_quiesce()
1242 spin_unlock_irq(sch->lock); in io_subchannel_quiesce()
1245 static void io_subchannel_shutdown(struct subchannel *sch) in io_subchannel_shutdown() argument
1247 io_subchannel_quiesce(sch); in io_subchannel_shutdown()
1261 struct subchannel *sch; in recovery_check() local
1267 sch = to_subchannel(cdev->dev.parent); in recovery_check()
1268 if ((sch->schib.pmcw.pam & sch->opm) == sch->vpm) in recovery_check()
1376 struct subchannel *sch = to_subchannel(cdev->dev.parent); in ccw_device_set_notoper() local
1379 CIO_TRACE_EVENT(2, dev_name(&sch->dev)); in ccw_device_set_notoper()
1381 cio_disable_subchannel(sch); in ccw_device_set_notoper()
1397 static enum io_sch_action sch_get_action(struct subchannel *sch) in sch_get_action() argument
1401 cdev = sch_get_cdev(sch); in sch_get_action()
1402 if (cio_update_schib(sch)) { in sch_get_action()
1413 if (sch->schib.pmcw.dev != cdev->private->dev_id.devno) { in sch_get_action()
1418 if ((sch->schib.pmcw.pam & sch->opm) == 0) { in sch_get_action()
1442 static int io_subchannel_sch_event(struct subchannel *sch, int process) in io_subchannel_sch_event() argument
1450 spin_lock_irqsave(sch->lock, flags); in io_subchannel_sch_event()
1451 if (!device_is_registered(&sch->dev)) in io_subchannel_sch_event()
1453 if (work_pending(&sch->todo_work)) in io_subchannel_sch_event()
1455 cdev = sch_get_cdev(sch); in io_subchannel_sch_event()
1458 action = sch_get_action(sch); in io_subchannel_sch_event()
1460 sch->schid.ssid, sch->schid.sch_no, process, in io_subchannel_sch_event()
1471 io_subchannel_verify(sch); in io_subchannel_sch_event()
1502 spin_unlock_irqrestore(sch->lock, flags); in io_subchannel_sch_event()
1516 spin_lock_irqsave(sch->lock, flags); in io_subchannel_sch_event()
1522 sch_set_cdev(sch, NULL); in io_subchannel_sch_event()
1523 spin_unlock_irqrestore(sch->lock, flags); in io_subchannel_sch_event()
1535 css_sch_device_unregister(sch); in io_subchannel_sch_event()
1540 dev_id.ssid = sch->schid.ssid; in io_subchannel_sch_event()
1541 dev_id.devno = sch->schib.pmcw.dev; in io_subchannel_sch_event()
1544 sch_create_and_recog_new_device(sch); in io_subchannel_sch_event()
1547 rc = ccw_device_move_to_sch(cdev, sch); in io_subchannel_sch_event()
1553 spin_lock_irqsave(sch->lock, flags); in io_subchannel_sch_event()
1555 spin_unlock_irqrestore(sch->lock, flags); in io_subchannel_sch_event()
1565 spin_unlock_irqrestore(sch->lock, flags); in io_subchannel_sch_event()
1585 struct subchannel *sch = to_subchannel(cdev->dev.parent); in ccw_device_enable_console() local
1591 io_subchannel_init_fields(sch); in ccw_device_enable_console()
1592 rc = cio_commit_config(sch); in ccw_device_enable_console()
1595 sch->driver = &io_subchannel_driver; in ccw_device_enable_console()
1596 io_subchannel_recog(cdev, sch); in ccw_device_enable_console()
1626 struct subchannel *sch; in ccw_device_create_console() local
1628 sch = cio_probe_console(); in ccw_device_create_console()
1629 if (IS_ERR(sch)) in ccw_device_create_console()
1630 return ERR_CAST(sch); in ccw_device_create_console()
1635 io_priv->dma_area = dma_alloc_coherent(&sch->dev, in ccw_device_create_console()
1640 set_io_private(sch, io_priv); in ccw_device_create_console()
1641 cdev = io_subchannel_create_ccwdev(sch); in ccw_device_create_console()
1643 dma_free_coherent(&sch->dev, sizeof(*io_priv->dma_area), in ccw_device_create_console()
1645 set_io_private(sch, NULL); in ccw_device_create_console()
1646 put_device(&sch->dev); in ccw_device_create_console()
1657 put_device(&sch->dev); in ccw_device_create_console()
1663 struct subchannel *sch = to_subchannel(cdev->dev.parent); in ccw_device_destroy_console() local
1664 struct io_subchannel_private *io_priv = to_io_private(sch); in ccw_device_destroy_console()
1666 set_io_private(sch, NULL); in ccw_device_destroy_console()
1667 dma_free_coherent(&sch->dev, sizeof(*io_priv->dma_area), in ccw_device_destroy_console()
1669 put_device(&sch->dev); in ccw_device_destroy_console()
1684 struct subchannel *sch = to_subchannel(cdev->dev.parent); in ccw_device_wait_idle() local
1687 cio_tsch(sch); in ccw_device_wait_idle()
1688 if (sch->schib.scsw.cmd.actl == 0) in ccw_device_wait_idle()
1757 struct subchannel *sch; in ccw_device_remove() local
1783 sch = to_subchannel(cdev->dev.parent); in ccw_device_remove()
1785 io_subchannel_quiesce(sch); in ccw_device_remove()
1828 struct subchannel *sch = to_subchannel(cdev->dev.parent); in ccw_device_pm_freeze() local
1842 spin_lock_irq(sch->lock); in ccw_device_pm_freeze()
1844 spin_unlock_irq(sch->lock); in ccw_device_pm_freeze()
1852 spin_lock_irq(sch->lock); in ccw_device_pm_freeze()
1853 ret = cio_disable_subchannel(sch); in ccw_device_pm_freeze()
1854 spin_unlock_irq(sch->lock); in ccw_device_pm_freeze()
1862 struct subchannel *sch = to_subchannel(cdev->dev.parent); in ccw_device_pm_thaw() local
1868 spin_lock_irq(sch->lock); in ccw_device_pm_thaw()
1870 ret = cio_enable_subchannel(sch, (u32)(addr_t)sch); in ccw_device_pm_thaw()
1872 spin_unlock_irq(sch->lock); in ccw_device_pm_thaw()
1890 struct subchannel *sch = to_subchannel(cdev->dev.parent); in __ccw_device_pm_restore() local
1892 spin_lock_irq(sch->lock); in __ccw_device_pm_restore()
1893 if (cio_is_console(sch->schid)) { in __ccw_device_pm_restore()
1894 cio_enable_subchannel(sch, (u32)(addr_t)sch); in __ccw_device_pm_restore()
1903 css_sched_sch_todo(sch, SCH_TODO_EVAL); in __ccw_device_pm_restore()
1904 spin_unlock_irq(sch->lock); in __ccw_device_pm_restore()
1908 sch = to_subchannel(cdev->dev.parent); in __ccw_device_pm_restore()
1909 spin_lock_irq(sch->lock); in __ccw_device_pm_restore()
1915 spin_unlock_irq(sch->lock); in __ccw_device_pm_restore()
1918 spin_lock_irq(sch->lock); in __ccw_device_pm_restore()
1922 spin_unlock_irq(sch->lock); in __ccw_device_pm_restore()
1946 struct subchannel *sch; in ccw_device_pm_restore() local
1950 sch = to_subchannel(cdev->dev.parent); in ccw_device_pm_restore()
1951 spin_lock_irq(sch->lock); in ccw_device_pm_restore()
1952 if (cio_is_console(sch->schid)) in ccw_device_pm_restore()
1988 spin_unlock_irq(sch->lock); in ccw_device_pm_restore()
1990 spin_lock_irq(sch->lock); in ccw_device_pm_restore()
2000 spin_unlock_irq(sch->lock); in ccw_device_pm_restore()
2002 spin_lock_irq(sch->lock); in ccw_device_pm_restore()
2012 spin_unlock_irq(sch->lock); in ccw_device_pm_restore()
2018 spin_unlock_irq(sch->lock); in ccw_device_pm_restore()
2072 struct subchannel *sch; in ccw_device_todo() local
2077 sch = to_subchannel(cdev->dev.parent); in ccw_device_todo()
2097 if (!sch_is_pseudo_sch(sch)) in ccw_device_todo()
2098 css_schedule_eval(sch->schid); in ccw_device_todo()
2101 if (sch_is_pseudo_sch(sch)) in ccw_device_todo()
2148 struct subchannel *sch = to_subchannel(cdev->dev.parent); in ccw_device_siosl() local
2150 return chsc_siosl(sch->schid); in ccw_device_siosl()