Lines Matching full:sch

71 	struct subchannel *sch = to_subchannel(dev);  in call_fn_known_sch()  local
76 idset_sch_del(cb->set, sch->schid); in call_fn_known_sch()
78 rc = cb->fn_known_sch(sch, cb->data); in call_fn_known_sch()
95 struct subchannel *sch; in call_fn_all_sch() local
98 sch = get_subchannel_by_schid(schid); in call_fn_all_sch()
99 if (sch) { in call_fn_all_sch()
101 rc = cb->fn_known_sch(sch, cb->data); in call_fn_all_sch()
102 put_device(&sch->dev); in call_fn_all_sch()
151 static void css_sch_create_locks(struct subchannel *sch) in css_sch_create_locks() argument
153 spin_lock_init(&sch->lock); in css_sch_create_locks()
154 mutex_init(&sch->reg_mutex); in css_sch_create_locks()
159 struct subchannel *sch = to_subchannel(dev); in css_subchannel_release() local
161 sch->config.intparm = 0; in css_subchannel_release()
162 cio_commit_config(sch); in css_subchannel_release()
163 kfree(sch->driver_override); in css_subchannel_release()
164 kfree(sch); in css_subchannel_release()
200 struct subchannel *sch; in css_alloc_subchannel() local
207 sch = kzalloc(sizeof(*sch), GFP_KERNEL | GFP_DMA); in css_alloc_subchannel()
208 if (!sch) in css_alloc_subchannel()
211 sch->schid = schid; in css_alloc_subchannel()
212 sch->schib = *schib; in css_alloc_subchannel()
213 sch->st = schib->pmcw.st; in css_alloc_subchannel()
215 css_sch_create_locks(sch); in css_alloc_subchannel()
217 INIT_WORK(&sch->todo_work, css_sch_todo); in css_alloc_subchannel()
218 sch->dev.release = &css_subchannel_release; in css_alloc_subchannel()
219 sch->dev.dma_mask = &sch->dma_mask; in css_alloc_subchannel()
220 device_initialize(&sch->dev); in css_alloc_subchannel()
225 ret = dma_set_coherent_mask(&sch->dev, DMA_BIT_MASK(31)); in css_alloc_subchannel()
232 ret = dma_set_mask(&sch->dev, DMA_BIT_MASK(64)); in css_alloc_subchannel()
236 return sch; in css_alloc_subchannel()
239 kfree(sch); in css_alloc_subchannel()
243 static int css_sch_device_register(struct subchannel *sch) in css_sch_device_register() argument
247 mutex_lock(&sch->reg_mutex); in css_sch_device_register()
248 dev_set_name(&sch->dev, "0.%x.%04x", sch->schid.ssid, in css_sch_device_register()
249 sch->schid.sch_no); in css_sch_device_register()
250 ret = device_add(&sch->dev); in css_sch_device_register()
251 mutex_unlock(&sch->reg_mutex); in css_sch_device_register()
257 * @sch: subchannel to be unregistered
259 void css_sch_device_unregister(struct subchannel *sch) in css_sch_device_unregister() argument
261 mutex_lock(&sch->reg_mutex); in css_sch_device_unregister()
262 if (device_is_registered(&sch->dev)) in css_sch_device_unregister()
263 device_unregister(&sch->dev); in css_sch_device_unregister()
264 mutex_unlock(&sch->reg_mutex); in css_sch_device_unregister()
296 void css_update_ssd_info(struct subchannel *sch) in css_update_ssd_info() argument
300 ret = chsc_get_ssd_info(sch->schid, &sch->ssd_info); in css_update_ssd_info()
302 ssd_from_pmcw(&sch->ssd_info, &sch->schib.pmcw); in css_update_ssd_info()
304 ssd_register_chpids(&sch->ssd_info); in css_update_ssd_info()
310 struct subchannel *sch = to_subchannel(dev); in type_show() local
312 return sysfs_emit(buf, "%01x\n", sch->st); in type_show()
320 struct subchannel *sch = to_subchannel(dev); in modalias_show() local
322 return sysfs_emit(buf, "css:t%01X\n", sch->st); in modalias_show()
331 struct subchannel *sch = to_subchannel(dev); in driver_override_store() local
334 ret = driver_set_override(dev, &sch->driver_override, buf, count); in driver_override_store()
344 struct subchannel *sch = to_subchannel(dev); in driver_override_show() local
348 len = sysfs_emit(buf, "%s\n", sch->driver_override); in driver_override_show()
374 struct subchannel *sch = to_subchannel(dev); in chpids_show() local
375 struct chsc_ssd_info *ssd = &sch->ssd_info; in chpids_show()
396 struct subchannel *sch = to_subchannel(dev); in pimpampom_show() local
397 struct pmcw *pmcw = &sch->schib.pmcw; in pimpampom_show()
408 struct subchannel *sch = to_subchannel(dev); in dev_busid_show() local
409 struct pmcw *pmcw = &sch->schib.pmcw; in dev_busid_show()
413 return sysfs_emit(buf, "0.%x.%04x\n", sch->schid.ssid, in dev_busid_show()
432 int css_register_subchannel(struct subchannel *sch) in css_register_subchannel() argument
437 sch->dev.parent = &channel_subsystems[0]->device; in css_register_subchannel()
438 sch->dev.bus = &css_bus_type; in css_register_subchannel()
439 sch->dev.groups = default_subch_attr_groups; in css_register_subchannel()
441 if (sch->st == SUBCHANNEL_TYPE_IO) in css_register_subchannel()
442 sch->dev.type = &io_subchannel_type; in css_register_subchannel()
444 css_update_ssd_info(sch); in css_register_subchannel()
446 ret = css_sch_device_register(sch); in css_register_subchannel()
448 CIO_MSG_EVENT(0, "Could not register sch 0.%x.%04x: %d\n", in css_register_subchannel()
449 sch->schid.ssid, sch->schid.sch_no, ret); in css_register_subchannel()
457 struct subchannel *sch; in css_probe_device() local
460 sch = css_alloc_subchannel(schid, schib); in css_probe_device()
461 if (IS_ERR(sch)) in css_probe_device()
462 return PTR_ERR(sch); in css_probe_device()
464 ret = css_register_subchannel(sch); in css_probe_device()
466 put_device(&sch->dev); in css_probe_device()
474 struct subchannel *sch; in check_subchannel() local
477 sch = to_subchannel(dev); in check_subchannel()
478 return schid_equal(&sch->schid, schid); in check_subchannel()
528 static int css_evaluate_known_subchannel(struct subchannel *sch, int slow) in css_evaluate_known_subchannel() argument
532 if (sch->driver) { in css_evaluate_known_subchannel()
533 if (sch->driver->sch_event) in css_evaluate_known_subchannel()
534 ret = sch->driver->sch_event(sch, slow); in css_evaluate_known_subchannel()
536 dev_dbg(&sch->dev, in css_evaluate_known_subchannel()
541 CIO_MSG_EVENT(2, "eval: sch 0.%x.%04x, rc=%d\n", in css_evaluate_known_subchannel()
542 sch->schid.ssid, sch->schid.sch_no, ret); in css_evaluate_known_subchannel()
549 struct subchannel *sch; in css_evaluate_subchannel() local
552 sch = get_subchannel_by_schid(schid); in css_evaluate_subchannel()
553 if (sch) { in css_evaluate_subchannel()
554 ret = css_evaluate_known_subchannel(sch, slow); in css_evaluate_subchannel()
555 put_device(&sch->dev); in css_evaluate_subchannel()
564 * @sch: subchannel
571 void css_sched_sch_todo(struct subchannel *sch, enum sch_todo todo) in css_sched_sch_todo() argument
573 CIO_MSG_EVENT(4, "sch_todo: sched sch=0.%x.%04x todo=%d\n", in css_sched_sch_todo()
574 sch->schid.ssid, sch->schid.sch_no, todo); in css_sched_sch_todo()
575 if (sch->todo >= todo) in css_sched_sch_todo()
578 if (!get_device(&sch->dev)) in css_sched_sch_todo()
580 sch->todo = todo; in css_sched_sch_todo()
581 if (!queue_work(cio_work_q, &sch->todo_work)) { in css_sched_sch_todo()
583 put_device(&sch->dev); in css_sched_sch_todo()
590 struct subchannel *sch; in css_sch_todo() local
594 sch = container_of(work, struct subchannel, todo_work); in css_sch_todo()
596 spin_lock_irq(&sch->lock); in css_sch_todo()
597 todo = sch->todo; in css_sch_todo()
598 CIO_MSG_EVENT(4, "sch_todo: sch=0.%x.%04x, todo=%d\n", sch->schid.ssid, in css_sch_todo()
599 sch->schid.sch_no, todo); in css_sch_todo()
600 sch->todo = SCH_TODO_NOTHING; in css_sch_todo()
601 spin_unlock_irq(&sch->lock); in css_sch_todo()
607 ret = css_evaluate_known_subchannel(sch, 1); in css_sch_todo()
609 spin_lock_irq(&sch->lock); in css_sch_todo()
610 css_sched_sch_todo(sch, todo); in css_sch_todo()
611 spin_unlock_irq(&sch->lock); in css_sch_todo()
615 css_sch_device_unregister(sch); in css_sch_todo()
619 put_device(&sch->dev); in css_sch_todo()
638 static int slow_eval_known_fn(struct subchannel *sch, void *data) in slow_eval_known_fn() argument
644 eval = idset_sch_contains(slow_subchannel_set, sch->schid); in slow_eval_known_fn()
645 idset_sch_del(slow_subchannel_set, sch->schid); in slow_eval_known_fn()
648 rc = css_evaluate_known_subchannel(sch, 1); in slow_eval_known_fn()
650 css_schedule_eval(sch->schid); in slow_eval_known_fn()
737 struct subchannel *sch = to_subchannel(dev); in __unset_validpath() local
738 struct pmcw *pmcw = &sch->schib.pmcw; in __unset_validpath()
745 if (sch->st == SUBCHANNEL_TYPE_IO && in __unset_validpath()
746 (sch->opm & pmcw->pam & pmcw->pom)) in __unset_validpath()
747 idset_sch_del(set, sch->schid); in __unset_validpath()
755 struct subchannel *sch = to_subchannel(dev); in __unset_online() local
757 if (sch->st == SUBCHANNEL_TYPE_IO && sch->config.ena) in __unset_online()
758 idset_sch_del(set, sch->schid); in __unset_online()
815 struct subchannel *sch; in css_process_crw() local
836 sch = get_subchannel_by_schid(mchk_schid); in css_process_crw()
837 if (sch) { in css_process_crw()
838 css_update_ssd_info(sch); in css_process_crw()
839 put_device(&sch->dev); in css_process_crw()
1349 int sch_is_pseudo_sch(struct subchannel *sch) in sch_is_pseudo_sch() argument
1351 if (!sch->dev.parent) in sch_is_pseudo_sch()
1353 return sch == to_css(sch->dev.parent)->pseudo_subchannel; in sch_is_pseudo_sch()
1358 struct subchannel *sch = to_subchannel(dev); in css_bus_match() local
1363 if (sch->driver_override && strcmp(sch->driver_override, drv->name)) in css_bus_match()
1367 if (sch->st == id->type) in css_bus_match()
1376 struct subchannel *sch; in css_probe() local
1379 sch = to_subchannel(dev); in css_probe()
1380 sch->driver = to_cssdriver(dev->driver); in css_probe()
1381 ret = sch->driver->probe ? sch->driver->probe(sch) : 0; in css_probe()
1383 sch->driver = NULL; in css_probe()
1389 struct subchannel *sch; in css_remove() local
1391 sch = to_subchannel(dev); in css_remove()
1392 if (sch->driver->remove) in css_remove()
1393 sch->driver->remove(sch); in css_remove()
1394 sch->driver = NULL; in css_remove()
1399 struct subchannel *sch; in css_shutdown() local
1401 sch = to_subchannel(dev); in css_shutdown()
1402 if (sch->driver && sch->driver->shutdown) in css_shutdown()
1403 sch->driver->shutdown(sch); in css_shutdown()
1408 const struct subchannel *sch = to_subchannel(dev); in css_uevent() local
1411 ret = add_uevent_var(env, "ST=%01X", sch->st); in css_uevent()
1414 ret = add_uevent_var(env, "MODALIAS=css:t%01X", sch->st); in css_uevent()