Lines Matching refs:tc
129 struct tool_ctx *tc = ctx; in tool_link_event() local
134 up = ntb_link_is_up(tc->ntb, &speed, &width); in tool_link_event()
136 dev_dbg(&tc->ntb->dev, "link is %s speed %d width %d\n", in tool_link_event()
142 struct tool_ctx *tc = ctx; in tool_db_event() local
145 db_mask = ntb_db_vector_mask(tc->ntb, vec); in tool_db_event()
146 db_bits = ntb_db_read(tc->ntb); in tool_db_event()
148 dev_dbg(&tc->ntb->dev, "doorbell vec %d mask %#llx bits %#llx\n", in tool_db_event()
157 static ssize_t tool_dbfn_read(struct tool_ctx *tc, char __user *ubuf, in tool_dbfn_read() argument
175 db_read_fn(tc->ntb)); in tool_dbfn_read()
184 static ssize_t tool_dbfn_write(struct tool_ctx *tc, in tool_dbfn_write() argument
217 rc = db_set_fn(tc->ntb, db_bits); in tool_dbfn_write()
222 rc = db_clear_fn(tc->ntb, db_bits); in tool_dbfn_write()
230 static ssize_t tool_spadfn_read(struct tool_ctx *tc, char __user *ubuf, in tool_spadfn_read() argument
250 spad_count = ntb_spad_count(tc->ntb); in tool_spadfn_read()
253 i, spad_read_fn(tc->ntb, i)); in tool_spadfn_read()
263 static ssize_t tool_spadfn_write(struct tool_ctx *tc, in tool_spadfn_write() argument
276 dev_dbg(&tc->ntb->dev, "no spad write fn\n"); in tool_spadfn_write()
294 rc = spad_write_fn(tc->ntb, spad_idx, spad_val); in tool_spadfn_write()
312 struct tool_ctx *tc = filep->private_data; in tool_db_read() local
314 return tool_dbfn_read(tc, ubuf, size, offp, in tool_db_read()
315 tc->ntb->ops->db_read); in tool_db_read()
321 struct tool_ctx *tc = filep->private_data; in tool_db_write() local
323 return tool_dbfn_write(tc, ubuf, size, offp, in tool_db_write()
324 tc->ntb->ops->db_set, in tool_db_write()
325 tc->ntb->ops->db_clear); in tool_db_write()
335 struct tool_ctx *tc = filep->private_data; in tool_mask_read() local
337 return tool_dbfn_read(tc, ubuf, size, offp, in tool_mask_read()
338 tc->ntb->ops->db_read_mask); in tool_mask_read()
344 struct tool_ctx *tc = filep->private_data; in tool_mask_write() local
346 return tool_dbfn_write(tc, ubuf, size, offp, in tool_mask_write()
347 tc->ntb->ops->db_set_mask, in tool_mask_write()
348 tc->ntb->ops->db_clear_mask); in tool_mask_write()
358 struct tool_ctx *tc = filep->private_data; in tool_peer_db_read() local
360 return tool_dbfn_read(tc, ubuf, size, offp, in tool_peer_db_read()
361 tc->ntb->ops->peer_db_read); in tool_peer_db_read()
367 struct tool_ctx *tc = filep->private_data; in tool_peer_db_write() local
369 return tool_dbfn_write(tc, ubuf, size, offp, in tool_peer_db_write()
370 tc->ntb->ops->peer_db_set, in tool_peer_db_write()
371 tc->ntb->ops->peer_db_clear); in tool_peer_db_write()
381 struct tool_ctx *tc = filep->private_data; in tool_peer_mask_read() local
383 return tool_dbfn_read(tc, ubuf, size, offp, in tool_peer_mask_read()
384 tc->ntb->ops->peer_db_read_mask); in tool_peer_mask_read()
390 struct tool_ctx *tc = filep->private_data; in tool_peer_mask_write() local
392 return tool_dbfn_write(tc, ubuf, size, offp, in tool_peer_mask_write()
393 tc->ntb->ops->peer_db_set_mask, in tool_peer_mask_write()
394 tc->ntb->ops->peer_db_clear_mask); in tool_peer_mask_write()
404 struct tool_ctx *tc = filep->private_data; in tool_spad_read() local
406 return tool_spadfn_read(tc, ubuf, size, offp, in tool_spad_read()
407 tc->ntb->ops->spad_read); in tool_spad_read()
413 struct tool_ctx *tc = filep->private_data; in tool_spad_write() local
415 return tool_spadfn_write(tc, ubuf, size, offp, in tool_spad_write()
416 tc->ntb->ops->spad_write); in tool_spad_write()
426 struct tool_ctx *tc = filep->private_data; in tool_peer_spad_read() local
428 return tool_spadfn_read(tc, ubuf, size, offp, in tool_peer_spad_read()
429 tc->ntb->ops->peer_spad_read); in tool_peer_spad_read()
435 struct tool_ctx *tc = filep->private_data; in tool_peer_spad_write() local
437 return tool_spadfn_write(tc, ubuf, size, offp, in tool_peer_spad_write()
438 tc->ntb->ops->peer_spad_write); in tool_peer_spad_write()
445 static void tool_setup_dbgfs(struct tool_ctx *tc) in tool_setup_dbgfs() argument
449 tc->dbgfs = NULL; in tool_setup_dbgfs()
453 tc->dbgfs = debugfs_create_dir(dev_name(&tc->ntb->dev), in tool_setup_dbgfs()
455 if (!tc->dbgfs) in tool_setup_dbgfs()
458 debugfs_create_file("db", S_IRUSR | S_IWUSR, tc->dbgfs, in tool_setup_dbgfs()
459 tc, &tool_db_fops); in tool_setup_dbgfs()
461 debugfs_create_file("mask", S_IRUSR | S_IWUSR, tc->dbgfs, in tool_setup_dbgfs()
462 tc, &tool_mask_fops); in tool_setup_dbgfs()
464 debugfs_create_file("peer_db", S_IRUSR | S_IWUSR, tc->dbgfs, in tool_setup_dbgfs()
465 tc, &tool_peer_db_fops); in tool_setup_dbgfs()
467 debugfs_create_file("peer_mask", S_IRUSR | S_IWUSR, tc->dbgfs, in tool_setup_dbgfs()
468 tc, &tool_peer_mask_fops); in tool_setup_dbgfs()
470 debugfs_create_file("spad", S_IRUSR | S_IWUSR, tc->dbgfs, in tool_setup_dbgfs()
471 tc, &tool_spad_fops); in tool_setup_dbgfs()
473 debugfs_create_file("peer_spad", S_IRUSR | S_IWUSR, tc->dbgfs, in tool_setup_dbgfs()
474 tc, &tool_peer_spad_fops); in tool_setup_dbgfs()
479 struct tool_ctx *tc; in tool_probe() local
488 tc = kmalloc(sizeof(*tc), GFP_KERNEL); in tool_probe()
489 if (!tc) { in tool_probe()
494 tc->ntb = ntb; in tool_probe()
496 tool_setup_dbgfs(tc); in tool_probe()
498 rc = ntb_set_ctx(ntb, tc, &tool_ops); in tool_probe()
508 debugfs_remove_recursive(tc->dbgfs); in tool_probe()
509 kfree(tc); in tool_probe()
516 struct tool_ctx *tc = ntb->ctx; in tool_remove() local
521 debugfs_remove_recursive(tc->dbgfs); in tool_remove()
522 kfree(tc); in tool_remove()