Lines Matching refs:sch
72 struct subchannel *sch = to_subchannel(dev); in call_fn_known_sch() local
77 idset_sch_del(cb->set, sch->schid); in call_fn_known_sch()
79 rc = cb->fn_known_sch(sch, cb->data); in call_fn_known_sch()
96 struct subchannel *sch; in call_fn_all_sch() local
99 sch = get_subchannel_by_schid(schid); in call_fn_all_sch()
100 if (sch) { in call_fn_all_sch()
102 rc = cb->fn_known_sch(sch, cb->data); in call_fn_all_sch()
103 put_device(&sch->dev); in call_fn_all_sch()
152 static int css_sch_create_locks(struct subchannel *sch) in css_sch_create_locks() argument
154 sch->lock = kmalloc(sizeof(*sch->lock), GFP_KERNEL); in css_sch_create_locks()
155 if (!sch->lock) in css_sch_create_locks()
158 spin_lock_init(sch->lock); in css_sch_create_locks()
159 mutex_init(&sch->reg_mutex); in css_sch_create_locks()
166 struct subchannel *sch = to_subchannel(dev); in css_subchannel_release() local
168 sch->config.intparm = 0; in css_subchannel_release()
169 cio_commit_config(sch); in css_subchannel_release()
170 kfree(sch->driver_override); in css_subchannel_release()
171 kfree(sch->lock); in css_subchannel_release()
172 kfree(sch); in css_subchannel_release()
208 struct subchannel *sch; in css_alloc_subchannel() local
215 sch = kzalloc(sizeof(*sch), GFP_KERNEL | GFP_DMA); in css_alloc_subchannel()
216 if (!sch) in css_alloc_subchannel()
219 sch->schid = schid; in css_alloc_subchannel()
220 sch->schib = *schib; in css_alloc_subchannel()
221 sch->st = schib->pmcw.st; in css_alloc_subchannel()
223 ret = css_sch_create_locks(sch); in css_alloc_subchannel()
227 INIT_WORK(&sch->todo_work, css_sch_todo); in css_alloc_subchannel()
228 sch->dev.release = &css_subchannel_release; in css_alloc_subchannel()
229 device_initialize(&sch->dev); in css_alloc_subchannel()
234 sch->dev.coherent_dma_mask = DMA_BIT_MASK(31); in css_alloc_subchannel()
239 sch->dma_mask = DMA_BIT_MASK(64); in css_alloc_subchannel()
240 sch->dev.dma_mask = &sch->dma_mask; in css_alloc_subchannel()
241 return sch; in css_alloc_subchannel()
244 kfree(sch); in css_alloc_subchannel()
248 static int css_sch_device_register(struct subchannel *sch) in css_sch_device_register() argument
252 mutex_lock(&sch->reg_mutex); in css_sch_device_register()
253 dev_set_name(&sch->dev, "0.%x.%04x", sch->schid.ssid, in css_sch_device_register()
254 sch->schid.sch_no); in css_sch_device_register()
255 ret = device_add(&sch->dev); in css_sch_device_register()
256 mutex_unlock(&sch->reg_mutex); in css_sch_device_register()
264 void css_sch_device_unregister(struct subchannel *sch) in css_sch_device_unregister() argument
266 mutex_lock(&sch->reg_mutex); in css_sch_device_unregister()
267 if (device_is_registered(&sch->dev)) in css_sch_device_unregister()
268 device_unregister(&sch->dev); in css_sch_device_unregister()
269 mutex_unlock(&sch->reg_mutex); in css_sch_device_unregister()
301 void css_update_ssd_info(struct subchannel *sch) in css_update_ssd_info() argument
305 ret = chsc_get_ssd_info(sch->schid, &sch->ssd_info); in css_update_ssd_info()
307 ssd_from_pmcw(&sch->ssd_info, &sch->schib.pmcw); in css_update_ssd_info()
309 ssd_register_chpids(&sch->ssd_info); in css_update_ssd_info()
315 struct subchannel *sch = to_subchannel(dev); in type_show() local
317 return sprintf(buf, "%01x\n", sch->st); in type_show()
325 struct subchannel *sch = to_subchannel(dev); in modalias_show() local
327 return sprintf(buf, "css:t%01X\n", sch->st); in modalias_show()
336 struct subchannel *sch = to_subchannel(dev); in driver_override_store() local
352 old = sch->driver_override; in driver_override_store()
354 sch->driver_override = driver_override; in driver_override_store()
357 sch->driver_override = NULL; in driver_override_store()
369 struct subchannel *sch = to_subchannel(dev); in driver_override_show() local
373 len = snprintf(buf, PAGE_SIZE, "%s\n", sch->driver_override); in driver_override_show()
399 struct subchannel *sch = to_subchannel(dev); in chpids_show() local
400 struct chsc_ssd_info *ssd = &sch->ssd_info; in chpids_show()
421 struct subchannel *sch = to_subchannel(dev); in pimpampom_show() local
422 struct pmcw *pmcw = &sch->schib.pmcw; in pimpampom_show()
433 struct subchannel *sch = to_subchannel(dev); in dev_busid_show() local
434 struct pmcw *pmcw = &sch->schib.pmcw; in dev_busid_show()
438 return sysfs_emit(buf, "0.%x.%04x\n", sch->schid.ssid, in dev_busid_show()
457 int css_register_subchannel(struct subchannel *sch) in css_register_subchannel() argument
462 sch->dev.parent = &channel_subsystems[0]->device; in css_register_subchannel()
463 sch->dev.bus = &css_bus_type; in css_register_subchannel()
464 sch->dev.groups = default_subch_attr_groups; in css_register_subchannel()
466 if (sch->st == SUBCHANNEL_TYPE_IO) in css_register_subchannel()
467 sch->dev.type = &io_subchannel_type; in css_register_subchannel()
478 dev_set_uevent_suppress(&sch->dev, 1); in css_register_subchannel()
479 css_update_ssd_info(sch); in css_register_subchannel()
481 ret = css_sch_device_register(sch); in css_register_subchannel()
484 sch->schid.ssid, sch->schid.sch_no, ret); in css_register_subchannel()
487 if (!sch->driver) { in css_register_subchannel()
493 dev_set_uevent_suppress(&sch->dev, 0); in css_register_subchannel()
494 kobject_uevent(&sch->dev.kobj, KOBJ_ADD); in css_register_subchannel()
501 struct subchannel *sch; in css_probe_device() local
504 sch = css_alloc_subchannel(schid, schib); in css_probe_device()
505 if (IS_ERR(sch)) in css_probe_device()
506 return PTR_ERR(sch); in css_probe_device()
508 ret = css_register_subchannel(sch); in css_probe_device()
510 put_device(&sch->dev); in css_probe_device()
518 struct subchannel *sch; in check_subchannel() local
521 sch = to_subchannel(dev); in check_subchannel()
522 return schid_equal(&sch->schid, schid); in check_subchannel()
572 static int css_evaluate_known_subchannel(struct subchannel *sch, int slow) in css_evaluate_known_subchannel() argument
576 if (sch->driver) { in css_evaluate_known_subchannel()
577 if (sch->driver->sch_event) in css_evaluate_known_subchannel()
578 ret = sch->driver->sch_event(sch, slow); in css_evaluate_known_subchannel()
580 dev_dbg(&sch->dev, in css_evaluate_known_subchannel()
586 sch->schid.ssid, sch->schid.sch_no, ret); in css_evaluate_known_subchannel()
593 struct subchannel *sch; in css_evaluate_subchannel() local
596 sch = get_subchannel_by_schid(schid); in css_evaluate_subchannel()
597 if (sch) { in css_evaluate_subchannel()
598 ret = css_evaluate_known_subchannel(sch, slow); in css_evaluate_subchannel()
599 put_device(&sch->dev); in css_evaluate_subchannel()
615 void css_sched_sch_todo(struct subchannel *sch, enum sch_todo todo) in css_sched_sch_todo() argument
618 sch->schid.ssid, sch->schid.sch_no, todo); in css_sched_sch_todo()
619 if (sch->todo >= todo) in css_sched_sch_todo()
622 if (!get_device(&sch->dev)) in css_sched_sch_todo()
624 sch->todo = todo; in css_sched_sch_todo()
625 if (!queue_work(cio_work_q, &sch->todo_work)) { in css_sched_sch_todo()
627 put_device(&sch->dev); in css_sched_sch_todo()
634 struct subchannel *sch; in css_sch_todo() local
638 sch = container_of(work, struct subchannel, todo_work); in css_sch_todo()
640 spin_lock_irq(sch->lock); in css_sch_todo()
641 todo = sch->todo; in css_sch_todo()
642 CIO_MSG_EVENT(4, "sch_todo: sch=0.%x.%04x, todo=%d\n", sch->schid.ssid, in css_sch_todo()
643 sch->schid.sch_no, todo); in css_sch_todo()
644 sch->todo = SCH_TODO_NOTHING; in css_sch_todo()
645 spin_unlock_irq(sch->lock); in css_sch_todo()
651 ret = css_evaluate_known_subchannel(sch, 1); in css_sch_todo()
653 spin_lock_irq(sch->lock); in css_sch_todo()
654 css_sched_sch_todo(sch, todo); in css_sch_todo()
655 spin_unlock_irq(sch->lock); in css_sch_todo()
659 css_sch_device_unregister(sch); in css_sch_todo()
663 put_device(&sch->dev); in css_sch_todo()
684 static int slow_eval_known_fn(struct subchannel *sch, void *data) in slow_eval_known_fn() argument
690 eval = idset_sch_contains(slow_subchannel_set, sch->schid); in slow_eval_known_fn()
691 idset_sch_del(slow_subchannel_set, sch->schid); in slow_eval_known_fn()
694 rc = css_evaluate_known_subchannel(sch, 1); in slow_eval_known_fn()
696 css_schedule_eval(sch->schid); in slow_eval_known_fn()
783 struct subchannel *sch = to_subchannel(dev); in __unset_registered() local
785 idset_sch_del(set, sch->schid); in __unset_registered()
831 struct subchannel *sch; in css_process_crw() local
852 sch = get_subchannel_by_schid(mchk_schid); in css_process_crw()
853 if (sch) { in css_process_crw()
854 css_update_ssd_info(sch); in css_process_crw()
855 put_device(&sch->dev); in css_process_crw()
1406 int sch_is_pseudo_sch(struct subchannel *sch) in sch_is_pseudo_sch() argument
1408 if (!sch->dev.parent) in sch_is_pseudo_sch()
1410 return sch == to_css(sch->dev.parent)->pseudo_subchannel; in sch_is_pseudo_sch()
1415 struct subchannel *sch = to_subchannel(dev); in css_bus_match() local
1420 if (sch->driver_override && strcmp(sch->driver_override, drv->name)) in css_bus_match()
1424 if (sch->st == id->type) in css_bus_match()
1433 struct subchannel *sch; in css_probe() local
1436 sch = to_subchannel(dev); in css_probe()
1437 sch->driver = to_cssdriver(dev->driver); in css_probe()
1438 ret = sch->driver->probe ? sch->driver->probe(sch) : 0; in css_probe()
1440 sch->driver = NULL; in css_probe()
1446 struct subchannel *sch; in css_remove() local
1449 sch = to_subchannel(dev); in css_remove()
1450 ret = sch->driver->remove ? sch->driver->remove(sch) : 0; in css_remove()
1451 sch->driver = NULL; in css_remove()
1457 struct subchannel *sch; in css_shutdown() local
1459 sch = to_subchannel(dev); in css_shutdown()
1460 if (sch->driver && sch->driver->shutdown) in css_shutdown()
1461 sch->driver->shutdown(sch); in css_shutdown()
1466 struct subchannel *sch = to_subchannel(dev); in css_uevent() local
1469 ret = add_uevent_var(env, "ST=%01X", sch->st); in css_uevent()
1472 ret = add_uevent_var(env, "MODALIAS=css:t%01X", sch->st); in css_uevent()
1478 struct subchannel *sch = to_subchannel(dev); in css_pm_prepare() local
1481 if (mutex_is_locked(&sch->reg_mutex)) in css_pm_prepare()
1483 if (!sch->dev.driver) in css_pm_prepare()
1485 drv = to_cssdriver(sch->dev.driver); in css_pm_prepare()
1487 return drv->prepare ? drv->prepare(sch) : 0; in css_pm_prepare()
1492 struct subchannel *sch = to_subchannel(dev); in css_pm_complete() local
1495 if (!sch->dev.driver) in css_pm_complete()
1497 drv = to_cssdriver(sch->dev.driver); in css_pm_complete()
1499 drv->complete(sch); in css_pm_complete()
1504 struct subchannel *sch = to_subchannel(dev); in css_pm_freeze() local
1507 if (!sch->dev.driver) in css_pm_freeze()
1509 drv = to_cssdriver(sch->dev.driver); in css_pm_freeze()
1510 return drv->freeze ? drv->freeze(sch) : 0; in css_pm_freeze()
1515 struct subchannel *sch = to_subchannel(dev); in css_pm_thaw() local
1518 if (!sch->dev.driver) in css_pm_thaw()
1520 drv = to_cssdriver(sch->dev.driver); in css_pm_thaw()
1521 return drv->thaw ? drv->thaw(sch) : 0; in css_pm_thaw()
1526 struct subchannel *sch = to_subchannel(dev); in css_pm_restore() local
1529 css_update_ssd_info(sch); in css_pm_restore()
1530 if (!sch->dev.driver) in css_pm_restore()
1532 drv = to_cssdriver(sch->dev.driver); in css_pm_restore()
1533 return drv->restore ? drv->restore(sch) : 0; in css_pm_restore()