Lines Matching refs: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 int css_sch_create_locks(struct subchannel *sch) in css_sch_create_locks() argument
153 sch->lock = kmalloc(sizeof(*sch->lock), GFP_KERNEL); in css_sch_create_locks()
154 if (!sch->lock) in css_sch_create_locks()
157 spin_lock_init(sch->lock); in css_sch_create_locks()
158 mutex_init(&sch->reg_mutex); in css_sch_create_locks()
165 struct subchannel *sch = to_subchannel(dev); in css_subchannel_release() local
167 sch->config.intparm = 0; in css_subchannel_release()
168 cio_commit_config(sch); in css_subchannel_release()
169 kfree(sch->driver_override); in css_subchannel_release()
170 kfree(sch->lock); in css_subchannel_release()
171 kfree(sch); in css_subchannel_release()
207 struct subchannel *sch; in css_alloc_subchannel() local
214 sch = kzalloc(sizeof(*sch), GFP_KERNEL | GFP_DMA); in css_alloc_subchannel()
215 if (!sch) in css_alloc_subchannel()
218 sch->schid = schid; in css_alloc_subchannel()
219 sch->schib = *schib; in css_alloc_subchannel()
220 sch->st = schib->pmcw.st; in css_alloc_subchannel()
222 ret = css_sch_create_locks(sch); in css_alloc_subchannel()
226 INIT_WORK(&sch->todo_work, css_sch_todo); in css_alloc_subchannel()
227 sch->dev.release = &css_subchannel_release; in css_alloc_subchannel()
228 sch->dev.dma_mask = &sch->dma_mask; in css_alloc_subchannel()
229 device_initialize(&sch->dev); in css_alloc_subchannel()
234 ret = dma_set_coherent_mask(&sch->dev, DMA_BIT_MASK(31)); in css_alloc_subchannel()
241 ret = dma_set_mask(&sch->dev, DMA_BIT_MASK(64)); in css_alloc_subchannel()
245 return sch; in css_alloc_subchannel()
248 kfree(sch); in css_alloc_subchannel()
252 static int css_sch_device_register(struct subchannel *sch) in css_sch_device_register() argument
256 mutex_lock(&sch->reg_mutex); in css_sch_device_register()
257 dev_set_name(&sch->dev, "0.%x.%04x", sch->schid.ssid, in css_sch_device_register()
258 sch->schid.sch_no); in css_sch_device_register()
259 ret = device_add(&sch->dev); in css_sch_device_register()
260 mutex_unlock(&sch->reg_mutex); in css_sch_device_register()
268 void css_sch_device_unregister(struct subchannel *sch) in css_sch_device_unregister() argument
270 mutex_lock(&sch->reg_mutex); in css_sch_device_unregister()
271 if (device_is_registered(&sch->dev)) in css_sch_device_unregister()
272 device_unregister(&sch->dev); in css_sch_device_unregister()
273 mutex_unlock(&sch->reg_mutex); in css_sch_device_unregister()
305 void css_update_ssd_info(struct subchannel *sch) in css_update_ssd_info() argument
309 ret = chsc_get_ssd_info(sch->schid, &sch->ssd_info); in css_update_ssd_info()
311 ssd_from_pmcw(&sch->ssd_info, &sch->schib.pmcw); in css_update_ssd_info()
313 ssd_register_chpids(&sch->ssd_info); in css_update_ssd_info()
319 struct subchannel *sch = to_subchannel(dev); in type_show() local
321 return sprintf(buf, "%01x\n", sch->st); in type_show()
329 struct subchannel *sch = to_subchannel(dev); in modalias_show() local
331 return sprintf(buf, "css:t%01X\n", sch->st); in modalias_show()
340 struct subchannel *sch = to_subchannel(dev); in driver_override_store() local
356 old = sch->driver_override; in driver_override_store()
358 sch->driver_override = driver_override; in driver_override_store()
361 sch->driver_override = NULL; in driver_override_store()
373 struct subchannel *sch = to_subchannel(dev); in driver_override_show() local
377 len = snprintf(buf, PAGE_SIZE, "%s\n", sch->driver_override); in driver_override_show()
403 struct subchannel *sch = to_subchannel(dev); in chpids_show() local
404 struct chsc_ssd_info *ssd = &sch->ssd_info; in chpids_show()
425 struct subchannel *sch = to_subchannel(dev); in pimpampom_show() local
426 struct pmcw *pmcw = &sch->schib.pmcw; in pimpampom_show()
437 struct subchannel *sch = to_subchannel(dev); in dev_busid_show() local
438 struct pmcw *pmcw = &sch->schib.pmcw; in dev_busid_show()
442 return sysfs_emit(buf, "0.%x.%04x\n", sch->schid.ssid, in dev_busid_show()
461 int css_register_subchannel(struct subchannel *sch) in css_register_subchannel() argument
466 sch->dev.parent = &channel_subsystems[0]->device; in css_register_subchannel()
467 sch->dev.bus = &css_bus_type; in css_register_subchannel()
468 sch->dev.groups = default_subch_attr_groups; in css_register_subchannel()
470 if (sch->st == SUBCHANNEL_TYPE_IO) in css_register_subchannel()
471 sch->dev.type = &io_subchannel_type; in css_register_subchannel()
482 dev_set_uevent_suppress(&sch->dev, 1); in css_register_subchannel()
483 css_update_ssd_info(sch); in css_register_subchannel()
485 ret = css_sch_device_register(sch); in css_register_subchannel()
488 sch->schid.ssid, sch->schid.sch_no, ret); in css_register_subchannel()
491 if (!sch->driver) { in css_register_subchannel()
497 dev_set_uevent_suppress(&sch->dev, 0); in css_register_subchannel()
498 kobject_uevent(&sch->dev.kobj, KOBJ_ADD); in css_register_subchannel()
505 struct subchannel *sch; in css_probe_device() local
508 sch = css_alloc_subchannel(schid, schib); in css_probe_device()
509 if (IS_ERR(sch)) in css_probe_device()
510 return PTR_ERR(sch); in css_probe_device()
512 ret = css_register_subchannel(sch); in css_probe_device()
514 put_device(&sch->dev); in css_probe_device()
522 struct subchannel *sch; in check_subchannel() local
525 sch = to_subchannel(dev); in check_subchannel()
526 return schid_equal(&sch->schid, schid); in check_subchannel()
576 static int css_evaluate_known_subchannel(struct subchannel *sch, int slow) in css_evaluate_known_subchannel() argument
580 if (sch->driver) { in css_evaluate_known_subchannel()
581 if (sch->driver->sch_event) in css_evaluate_known_subchannel()
582 ret = sch->driver->sch_event(sch, slow); in css_evaluate_known_subchannel()
584 dev_dbg(&sch->dev, in css_evaluate_known_subchannel()
590 sch->schid.ssid, sch->schid.sch_no, ret); in css_evaluate_known_subchannel()
597 struct subchannel *sch; in css_evaluate_subchannel() local
600 sch = get_subchannel_by_schid(schid); in css_evaluate_subchannel()
601 if (sch) { in css_evaluate_subchannel()
602 ret = css_evaluate_known_subchannel(sch, slow); in css_evaluate_subchannel()
603 put_device(&sch->dev); in css_evaluate_subchannel()
619 void css_sched_sch_todo(struct subchannel *sch, enum sch_todo todo) in css_sched_sch_todo() argument
622 sch->schid.ssid, sch->schid.sch_no, todo); in css_sched_sch_todo()
623 if (sch->todo >= todo) in css_sched_sch_todo()
626 if (!get_device(&sch->dev)) in css_sched_sch_todo()
628 sch->todo = todo; in css_sched_sch_todo()
629 if (!queue_work(cio_work_q, &sch->todo_work)) { in css_sched_sch_todo()
631 put_device(&sch->dev); in css_sched_sch_todo()
638 struct subchannel *sch; in css_sch_todo() local
642 sch = container_of(work, struct subchannel, todo_work); in css_sch_todo()
644 spin_lock_irq(sch->lock); in css_sch_todo()
645 todo = sch->todo; in css_sch_todo()
646 CIO_MSG_EVENT(4, "sch_todo: sch=0.%x.%04x, todo=%d\n", sch->schid.ssid, in css_sch_todo()
647 sch->schid.sch_no, todo); in css_sch_todo()
648 sch->todo = SCH_TODO_NOTHING; in css_sch_todo()
649 spin_unlock_irq(sch->lock); in css_sch_todo()
655 ret = css_evaluate_known_subchannel(sch, 1); in css_sch_todo()
657 spin_lock_irq(sch->lock); in css_sch_todo()
658 css_sched_sch_todo(sch, todo); in css_sch_todo()
659 spin_unlock_irq(sch->lock); in css_sch_todo()
663 css_sch_device_unregister(sch); in css_sch_todo()
667 put_device(&sch->dev); in css_sch_todo()
686 static int slow_eval_known_fn(struct subchannel *sch, void *data) in slow_eval_known_fn() argument
692 eval = idset_sch_contains(slow_subchannel_set, sch->schid); in slow_eval_known_fn()
693 idset_sch_del(slow_subchannel_set, sch->schid); in slow_eval_known_fn()
696 rc = css_evaluate_known_subchannel(sch, 1); in slow_eval_known_fn()
698 css_schedule_eval(sch->schid); in slow_eval_known_fn()
785 struct subchannel *sch = to_subchannel(dev); in __unset_registered() local
787 idset_sch_del(set, sch->schid); in __unset_registered()
794 struct subchannel *sch = to_subchannel(dev); in __unset_online() local
797 if (sch->st == SUBCHANNEL_TYPE_IO) { in __unset_online()
798 cdev = sch_get_cdev(sch); in __unset_online()
800 idset_sch_del(set, sch->schid); in __unset_online()
858 struct subchannel *sch; in css_process_crw() local
879 sch = get_subchannel_by_schid(mchk_schid); in css_process_crw()
880 if (sch) { in css_process_crw()
881 css_update_ssd_info(sch); in css_process_crw()
882 put_device(&sch->dev); in css_process_crw()
1391 int sch_is_pseudo_sch(struct subchannel *sch) in sch_is_pseudo_sch() argument
1393 if (!sch->dev.parent) in sch_is_pseudo_sch()
1395 return sch == to_css(sch->dev.parent)->pseudo_subchannel; in sch_is_pseudo_sch()
1400 struct subchannel *sch = to_subchannel(dev); in css_bus_match() local
1405 if (sch->driver_override && strcmp(sch->driver_override, drv->name)) in css_bus_match()
1409 if (sch->st == id->type) in css_bus_match()
1418 struct subchannel *sch; in css_probe() local
1421 sch = to_subchannel(dev); in css_probe()
1422 sch->driver = to_cssdriver(dev->driver); in css_probe()
1423 ret = sch->driver->probe ? sch->driver->probe(sch) : 0; in css_probe()
1425 sch->driver = NULL; in css_probe()
1431 struct subchannel *sch; in css_remove() local
1433 sch = to_subchannel(dev); in css_remove()
1434 if (sch->driver->remove) in css_remove()
1435 sch->driver->remove(sch); in css_remove()
1436 sch->driver = NULL; in css_remove()
1441 struct subchannel *sch; in css_shutdown() local
1443 sch = to_subchannel(dev); in css_shutdown()
1444 if (sch->driver && sch->driver->shutdown) in css_shutdown()
1445 sch->driver->shutdown(sch); in css_shutdown()
1450 struct subchannel *sch = to_subchannel(dev); in css_uevent() local
1453 ret = add_uevent_var(env, "ST=%01X", sch->st); in css_uevent()
1456 ret = add_uevent_var(env, "MODALIAS=css:t%01X", sch->st); in css_uevent()