Lines Matching refs:ntb
257 struct ntb_dev *ntb; member
296 up = ntb_link_is_up(tc->ntb, &speed, &width); in tool_link_event()
298 dev_dbg(&tc->ntb->dev, "link is %s speed %d width %d\n", in tool_link_event()
309 db_mask = ntb_db_vector_mask(tc->ntb, vec); in tool_db_event()
310 db_bits = ntb_db_read(tc->ntb); in tool_db_event()
312 dev_dbg(&tc->ntb->dev, "doorbell vec %d mask %#llx bits %#llx\n", in tool_db_event()
323 msg_sts = ntb_msg_read_sts(tc->ntb); in tool_msg_event()
325 dev_dbg(&tc->ntb->dev, "message bits %#llx\n", msg_sts); in tool_msg_event()
354 pos = scnprintf(buf, buf_size, "%#llx\n", fn_read(tc->ntb)); in tool_fn_read()
394 ret = fn_set(tc->ntb, bits); in tool_fn_write()
399 ret = fn_clear(tc->ntb, bits); in tool_fn_write()
419 pos = scnprintf(buf, sizeof(buf), "%d\n", ntb_port_number(tc->ntb)); in tool_port_read()
437 ntb_peer_port_number(tc->ntb, peer->pidx)); in tool_peer_port_read()
450 tc->peer_cnt = ntb_peer_port_count(tc->ntb); in tool_init_peers()
451 tc->peers = devm_kcalloc(&tc->ntb->dev, tc->peer_cnt, in tool_init_peers()
481 ret = ntb_link_enable(tc->ntb, NTB_SPEED_AUTO, NTB_WIDTH_AUTO); in tool_link_write()
483 ret = ntb_link_disable(tc->ntb); in tool_link_write()
502 if (ntb_link_is_up(tc->ntb, NULL, NULL) & BIT(peer->pidx)) in tool_peer_link_read()
533 !!(ntb_link_is_up(tc->ntb, NULL, NULL) & link_msk) == val)) in tool_peer_link_event_write()
587 ret = ntb_mw_get_align(tc->ntb, pidx, widx, &addr_align, in tool_setup_mw()
595 inmw->mm_base = dma_alloc_coherent(&tc->ntb->pdev->dev, inmw->size, in tool_setup_mw()
605 ret = ntb_mw_set_trans(tc->ntb, pidx, widx, inmw->dma_base, inmw->size); in tool_setup_mw()
617 dma_free_coherent(&tc->ntb->pdev->dev, inmw->size, inmw->mm_base, in tool_setup_mw()
633 ntb_mw_clear_trans(tc->ntb, pidx, widx); in tool_free_mw()
634 dma_free_coherent(&tc->ntb->pdev->dev, inmw->size, in tool_free_mw()
661 ret = ntb_mw_get_align(inmw->tc->ntb, inmw->pidx, inmw->widx, in tool_mw_trans_read()
672 ntb_peer_port_number(inmw->tc->ntb, inmw->pidx), in tool_mw_trans_read()
823 ret = ntb_peer_mw_get_addr(tc->ntb, widx, &map_base, &map_size); in tool_setup_peer_mw()
827 ret = ntb_peer_mw_set_trans(tc->ntb, pidx, widx, req_addr, req_size); in tool_setup_peer_mw()
849 ntb_peer_mw_clear_trans(tc->ntb, pidx, widx); in tool_setup_peer_mw()
862 ntb_peer_mw_clear_trans(tc->ntb, outmw->pidx, widx); in tool_free_peer_mw()
884 ret = ntb_peer_mw_get_addr(outmw->tc->ntb, outmw->widx, in tool_peer_mw_trans_read()
901 ntb_peer_port_number(outmw->tc->ntb, outmw->pidx), in tool_peer_mw_trans_read()
970 tc->outmw_cnt = ntb_peer_mw_count(tc->ntb); in tool_init_mws()
971 tc->outmws = devm_kcalloc(&tc->ntb->dev, tc->outmw_cnt, in tool_init_mws()
984 tc->peers[pidx].inmw_cnt = ntb_mw_count(tc->ntb, pidx); in tool_init_mws()
986 devm_kcalloc(&tc->ntb->dev, tc->peers[pidx].inmw_cnt, in tool_init_mws()
997 tc->peers[pidx].outmw_cnt = ntb_peer_mw_count(tc->ntb); in tool_init_mws()
999 devm_kcalloc(&tc->ntb->dev, tc->peers[pidx].outmw_cnt, in tool_init_mws()
1035 return tool_fn_read(tc, ubuf, size, offp, tc->ntb->ops->db_read); in tool_db_read()
1043 return tool_fn_write(tc, ubuf, size, offp, tc->ntb->ops->db_set, in tool_db_write()
1044 tc->ntb->ops->db_clear); in tool_db_write()
1056 return tool_fn_read(tc, ubuf, size, offp, tc->ntb->ops->db_valid_mask); in tool_db_valid_mask_read()
1068 return tool_fn_read(tc, ubuf, size, offp, tc->ntb->ops->db_read_mask); in tool_db_mask_read()
1076 return tool_fn_write(tc, ubuf, size, offp, tc->ntb->ops->db_set_mask, in tool_db_mask_write()
1077 tc->ntb->ops->db_clear_mask); in tool_db_mask_write()
1089 return tool_fn_read(tc, ubuf, size, offp, tc->ntb->ops->peer_db_read); in tool_peer_db_read()
1097 return tool_fn_write(tc, ubuf, size, offp, tc->ntb->ops->peer_db_set, in tool_peer_db_write()
1098 tc->ntb->ops->peer_db_clear); in tool_peer_db_write()
1111 tc->ntb->ops->peer_db_read_mask); in tool_peer_db_mask_read()
1121 tc->ntb->ops->peer_db_set_mask, in tool_peer_db_mask_write()
1122 tc->ntb->ops->peer_db_clear_mask); in tool_peer_db_mask_write()
1141 if (wait_event_interruptible(tc->db_wq, ntb_db_read(tc->ntb) == val)) in tool_db_event_write()
1163 if (!spad->tc->ntb->ops->spad_read) in tool_spad_read()
1167 ntb_spad_read(spad->tc->ntb, spad->sidx)); in tool_spad_read()
1179 if (!spad->tc->ntb->ops->spad_write) { in tool_spad_write()
1180 dev_dbg(&spad->tc->ntb->dev, "no spad write fn\n"); in tool_spad_write()
1188 ret = ntb_spad_write(spad->tc->ntb, spad->sidx, val); in tool_spad_write()
1204 if (!spad->tc->ntb->ops->peer_spad_read) in tool_peer_spad_read()
1208 ntb_peer_spad_read(spad->tc->ntb, spad->pidx, spad->sidx)); in tool_peer_spad_read()
1220 if (!spad->tc->ntb->ops->peer_spad_write) { in tool_peer_spad_write()
1221 dev_dbg(&spad->tc->ntb->dev, "no spad write fn\n"); in tool_peer_spad_write()
1229 ret = ntb_peer_spad_write(spad->tc->ntb, spad->pidx, spad->sidx, val); in tool_peer_spad_write()
1243 tc->inspad_cnt = ntb_spad_count(tc->ntb); in tool_init_spads()
1244 tc->inspads = devm_kcalloc(&tc->ntb->dev, tc->inspad_cnt, in tool_init_spads()
1257 tc->peers[pidx].outspad_cnt = ntb_spad_count(tc->ntb); in tool_init_spads()
1259 devm_kcalloc(&tc->ntb->dev, tc->peers[pidx].outspad_cnt, in tool_init_spads()
1288 data = ntb_msg_read(msg->tc->ntb, &pidx, msg->midx); in tool_inmsg_read()
1311 ret = ntb_peer_msg_write(msg->tc->ntb, msg->pidx, msg->midx, val); in tool_outmsg_write()
1325 return tool_fn_read(tc, ubuf, size, offp, tc->ntb->ops->msg_read_sts); in tool_msg_sts_read()
1334 tc->ntb->ops->msg_clear_sts); in tool_msg_sts_write()
1346 return tool_fn_read(tc, ubuf, size, offp, tc->ntb->ops->msg_inbits); in tool_msg_inbits_read()
1358 return tool_fn_read(tc, ubuf, size, offp, tc->ntb->ops->msg_outbits); in tool_msg_outbits_read()
1371 tc->ntb->ops->msg_set_mask, in tool_msg_mask_write()
1372 tc->ntb->ops->msg_clear_mask); in tool_msg_mask_write()
1392 ntb_msg_read_sts(tc->ntb) == val)) in tool_msg_event_write()
1407 tc->inmsg_cnt = ntb_msg_count(tc->ntb); in tool_init_msgs()
1408 tc->inmsgs = devm_kcalloc(&tc->ntb->dev, tc->inmsg_cnt, in tool_init_msgs()
1421 tc->peers[pidx].outmsg_cnt = ntb_msg_count(tc->ntb); in tool_init_msgs()
1423 devm_kcalloc(&tc->ntb->dev, tc->peers[pidx].outmsg_cnt, in tool_init_msgs()
1443 static struct tool_ctx *tool_create_data(struct ntb_dev *ntb) in tool_create_data() argument
1447 tc = devm_kzalloc(&ntb->dev, sizeof(*tc), GFP_KERNEL); in tool_create_data()
1451 tc->ntb = ntb; in tool_create_data()
1456 if (ntb_db_is_unsafe(ntb)) in tool_create_data()
1457 dev_dbg(&ntb->dev, "doorbell is unsafe\n"); in tool_create_data()
1459 if (ntb_spad_is_unsafe(ntb)) in tool_create_data()
1460 dev_dbg(&ntb->dev, "scratchpad is unsafe\n"); in tool_create_data()
1474 return ntb_set_ctx(tc->ntb, tc, &tool_ops); in tool_init_ntb()
1479 ntb_clear_ctx(tc->ntb); in tool_clear_ntb()
1480 ntb_link_disable(tc->ntb); in tool_clear_ntb()
1494 tc->dbgfs_dir = debugfs_create_dir(dev_name(&tc->ntb->dev), in tool_setup_dbgfs()
1612 static int tool_probe(struct ntb_client *self, struct ntb_dev *ntb) in tool_probe() argument
1617 tc = tool_create_data(ntb); in tool_probe()
1654 static void tool_remove(struct ntb_client *self, struct ntb_dev *ntb) in tool_remove() argument
1656 struct tool_ctx *tc = ntb->ctx; in tool_remove()