Lines Matching refs:dev
35 static int ps3_is_device(struct ps3_system_bus_device *dev, u64 bus_id, in ps3_is_device() argument
38 return dev->bus_id == bus_id && dev->dev_id == dev_id; in ps3_is_device()
41 static int ps3_open_hv_device_sb(struct ps3_system_bus_device *dev) in ps3_open_hv_device_sb() argument
45 BUG_ON(!dev->bus_id); in ps3_open_hv_device_sb()
48 if (ps3_is_device(dev, 1, 1)) { in ps3_open_hv_device_sb()
56 if (ps3_is_device(dev, 1, 2)) { in ps3_open_hv_device_sb()
64 result = lv1_open_device(dev->bus_id, dev->dev_id, 0); in ps3_open_hv_device_sb()
68 __func__, __LINE__, dev->match_id, dev->match_sub_id, in ps3_open_hv_device_sb()
69 dev_name(&dev->core), ps3_result(result)); in ps3_open_hv_device_sb()
78 static int ps3_close_hv_device_sb(struct ps3_system_bus_device *dev) in ps3_close_hv_device_sb() argument
82 BUG_ON(!dev->bus_id); in ps3_close_hv_device_sb()
85 if (ps3_is_device(dev, 1, 1)) { in ps3_close_hv_device_sb()
93 if (ps3_is_device(dev, 1, 2)) { in ps3_close_hv_device_sb()
101 result = lv1_close_device(dev->bus_id, dev->dev_id); in ps3_close_hv_device_sb()
109 static int ps3_open_hv_device_gpu(struct ps3_system_bus_device *dev) in ps3_open_hv_device_gpu() argument
134 static int ps3_close_hv_device_gpu(struct ps3_system_bus_device *dev) in ps3_close_hv_device_gpu() argument
154 int ps3_open_hv_device(struct ps3_system_bus_device *dev) in ps3_open_hv_device() argument
156 BUG_ON(!dev); in ps3_open_hv_device()
157 pr_debug("%s:%d: match_id: %u\n", __func__, __LINE__, dev->match_id); in ps3_open_hv_device()
159 switch (dev->match_id) { in ps3_open_hv_device()
166 return ps3_open_hv_device_sb(dev); in ps3_open_hv_device()
170 return ps3_open_hv_device_gpu(dev); in ps3_open_hv_device()
175 __LINE__, dev->match_id); in ps3_open_hv_device()
177 dev->bus_id); in ps3_open_hv_device()
186 dev->match_id); in ps3_open_hv_device()
192 int ps3_close_hv_device(struct ps3_system_bus_device *dev) in ps3_close_hv_device() argument
194 BUG_ON(!dev); in ps3_close_hv_device()
195 pr_debug("%s:%d: match_id: %u\n", __func__, __LINE__, dev->match_id); in ps3_close_hv_device()
197 switch (dev->match_id) { in ps3_close_hv_device()
204 return ps3_close_hv_device_sb(dev); in ps3_close_hv_device()
208 return ps3_close_hv_device_gpu(dev); in ps3_close_hv_device()
213 __LINE__, dev->match_id); in ps3_close_hv_device()
215 dev->bus_id); in ps3_close_hv_device()
224 dev->match_id); in ps3_close_hv_device()
234 pr_debug("%s:%d: dev %llu:%llu\n", func, line, r->dev->bus_id, in _dump_mmio_region()
235 r->dev->dev_id); in _dump_mmio_region()
246 result = lv1_map_device_mmio_region(r->dev->bus_id, r->dev->dev_id, in ps3_sb_mmio_region_create()
277 result = lv1_unmap_device_mmio_region(r->dev->bus_id, r->dev->dev_id, in ps3_sb_free_mmio_region()
312 int ps3_mmio_region_init(struct ps3_system_bus_device *dev, in ps3_mmio_region_init() argument
316 r->dev = dev; in ps3_mmio_region_init()
320 switch (dev->dev_type) { in ps3_mmio_region_init()
340 struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev); in ps3_system_bus_match() local
342 if (!dev->match_sub_id) in ps3_system_bus_match()
343 result = dev->match_id == drv->match_id; in ps3_system_bus_match()
345 result = dev->match_sub_id == drv->match_sub_id && in ps3_system_bus_match()
346 dev->match_id == drv->match_id; in ps3_system_bus_match()
351 dev->match_id, dev->match_sub_id, dev_name(&dev->core), in ps3_system_bus_match()
356 dev->match_id, dev->match_sub_id, dev_name(&dev->core), in ps3_system_bus_match()
365 struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev); in ps3_system_bus_probe() local
368 BUG_ON(!dev); in ps3_system_bus_probe()
371 drv = ps3_system_bus_dev_to_system_bus_drv(dev); in ps3_system_bus_probe()
375 result = drv->probe(dev); in ps3_system_bus_probe()
378 dev_name(&dev->core)); in ps3_system_bus_probe()
380 pr_debug(" <- %s:%d: %s\n", __func__, __LINE__, dev_name(&dev->core)); in ps3_system_bus_probe()
386 struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev); in ps3_system_bus_remove() local
389 BUG_ON(!dev); in ps3_system_bus_remove()
392 drv = ps3_system_bus_dev_to_system_bus_drv(dev); in ps3_system_bus_remove()
396 drv->remove(dev); in ps3_system_bus_remove()
398 dev_dbg(&dev->core, "%s:%d %s: no remove method\n", in ps3_system_bus_remove()
401 pr_debug(" <- %s:%d: %s\n", __func__, __LINE__, dev_name(&dev->core)); in ps3_system_bus_remove()
406 struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev); in ps3_system_bus_shutdown() local
409 BUG_ON(!dev); in ps3_system_bus_shutdown()
411 dev_dbg(&dev->core, " -> %s:%d: match_id %d\n", __func__, __LINE__, in ps3_system_bus_shutdown()
412 dev->match_id); in ps3_system_bus_shutdown()
414 if (!dev->core.driver) { in ps3_system_bus_shutdown()
415 dev_dbg(&dev->core, "%s:%d: no driver bound\n", __func__, in ps3_system_bus_shutdown()
420 drv = ps3_system_bus_dev_to_system_bus_drv(dev); in ps3_system_bus_shutdown()
424 dev_dbg(&dev->core, "%s:%d: %s -> %s\n", __func__, __LINE__, in ps3_system_bus_shutdown()
425 dev_name(&dev->core), drv->core.name); in ps3_system_bus_shutdown()
428 drv->shutdown(dev); in ps3_system_bus_shutdown()
430 dev_dbg(&dev->core, "%s:%d %s: no shutdown, calling remove\n", in ps3_system_bus_shutdown()
432 drv->remove(dev); in ps3_system_bus_shutdown()
434 dev_dbg(&dev->core, "%s:%d %s: no shutdown method\n", in ps3_system_bus_shutdown()
439 dev_dbg(&dev->core, " <- %s:%d\n", __func__, __LINE__); in ps3_system_bus_shutdown()
444 struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev); in ps3_system_bus_uevent() local
446 if (add_uevent_var(env, "MODALIAS=ps3:%d:%d", dev->match_id, in ps3_system_bus_uevent()
447 dev->match_sub_id)) in ps3_system_bus_uevent()
455 struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev); in modalias_show() local
457 return sysfs_emit(buf, "ps3:%d:%d\n", dev->match_id, in modalias_show()
458 dev->match_sub_id); in modalias_show()
510 struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev); in ps3_alloc_coherent() local
523 result = ps3_dma_map(dev->d_region, virt_addr, size, dma_handle, in ps3_alloc_coherent()
546 struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev); in ps3_free_coherent() local
548 ps3_dma_unmap(dev->d_region, dma_handle, size); in ps3_free_coherent()
562 struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev); in ps3_sb_map_page() local
567 result = ps3_dma_map(dev->d_region, (unsigned long)ptr, size, in ps3_sb_map_page()
585 struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev); in ps3_ioc0_map_page() local
606 result = ps3_dma_map(dev->d_region, (unsigned long)ptr, size, in ps3_ioc0_map_page()
619 struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev); in ps3_unmap_page() local
622 result = ps3_dma_unmap(dev->d_region, dma_addr, size); in ps3_unmap_page()
637 struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev); in ps3_sb_map_sg()
642 int result = ps3_dma_map(dev->d_region, sg_phys(sg), in ps3_sb_map_sg()
721 struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev); in ps3_system_bus_release_device() local
722 kfree(dev); in ps3_system_bus_release_device()
733 int ps3_system_bus_device_register(struct ps3_system_bus_device *dev) in ps3_system_bus_device_register() argument
741 if (!dev->core.parent) in ps3_system_bus_device_register()
742 dev->core.parent = &ps3_system_bus; in ps3_system_bus_device_register()
743 dev->core.bus = &ps3_system_bus_type; in ps3_system_bus_device_register()
744 dev->core.release = ps3_system_bus_release_device; in ps3_system_bus_device_register()
746 switch (dev->dev_type) { in ps3_system_bus_device_register()
748 dev->core.dma_ops = &ps3_ioc0_dma_ops; in ps3_system_bus_device_register()
749 dev_set_name(&dev->core, "ioc0_%02x", ++dev_ioc0_count); in ps3_system_bus_device_register()
752 dev->core.dma_ops = &ps3_sb_dma_ops; in ps3_system_bus_device_register()
753 dev_set_name(&dev->core, "sb_%02x", ++dev_sb_count); in ps3_system_bus_device_register()
757 dev_set_name(&dev->core, "vuart_%02x", ++dev_vuart_count); in ps3_system_bus_device_register()
760 dev_set_name(&dev->core, "lpm_%02x", ++dev_lpm_count); in ps3_system_bus_device_register()
766 dev->core.of_node = NULL; in ps3_system_bus_device_register()
767 set_dev_node(&dev->core, 0); in ps3_system_bus_device_register()
769 pr_debug("%s:%d add %s\n", __func__, __LINE__, dev_name(&dev->core)); in ps3_system_bus_device_register()
771 result = device_register(&dev->core); in ps3_system_bus_device_register()