Lines Matching refs:inmw
544 struct tool_mw *inmw = filep->private_data; in tool_mw_read() local
546 if (inmw->mm_base == NULL) in tool_mw_read()
550 inmw->mm_base, inmw->size); in tool_mw_read()
556 struct tool_mw *inmw = filep->private_data; in tool_mw_write() local
558 if (inmw->mm_base == NULL) in tool_mw_write()
561 return simple_write_to_buffer(inmw->mm_base, inmw->size, offp, in tool_mw_write()
573 struct tool_mw *inmw = &tc->peers[pidx].inmws[widx]; in tool_setup_mw() local
577 if (inmw->mm_base != NULL) in tool_setup_mw()
585 inmw->size = min_t(resource_size_t, req_size, size); in tool_setup_mw()
586 inmw->size = round_up(inmw->size, addr_align); in tool_setup_mw()
587 inmw->size = round_up(inmw->size, size_align); in tool_setup_mw()
588 inmw->mm_base = dma_alloc_coherent(&tc->ntb->pdev->dev, inmw->size, in tool_setup_mw()
589 &inmw->dma_base, GFP_KERNEL); in tool_setup_mw()
590 if (!inmw->mm_base) in tool_setup_mw()
593 if (!IS_ALIGNED(inmw->dma_base, addr_align)) { in tool_setup_mw()
598 ret = ntb_mw_set_trans(tc->ntb, pidx, widx, inmw->dma_base, inmw->size); in tool_setup_mw()
603 inmw->dbgfs_file = debugfs_create_file(buf, 0600, in tool_setup_mw()
604 tc->peers[pidx].dbgfs_dir, inmw, in tool_setup_mw()
610 dma_free_coherent(&tc->ntb->pdev->dev, inmw->size, inmw->mm_base, in tool_setup_mw()
611 inmw->dma_base); in tool_setup_mw()
612 inmw->mm_base = NULL; in tool_setup_mw()
613 inmw->dma_base = 0; in tool_setup_mw()
614 inmw->size = 0; in tool_setup_mw()
621 struct tool_mw *inmw = &tc->peers[pidx].inmws[widx]; in tool_free_mw() local
623 debugfs_remove(inmw->dbgfs_file); in tool_free_mw()
625 if (inmw->mm_base != NULL) { in tool_free_mw()
627 dma_free_coherent(&tc->ntb->pdev->dev, inmw->size, in tool_free_mw()
628 inmw->mm_base, inmw->dma_base); in tool_free_mw()
631 inmw->mm_base = NULL; in tool_free_mw()
632 inmw->dma_base = 0; in tool_free_mw()
633 inmw->size = 0; in tool_free_mw()
634 inmw->dbgfs_file = NULL; in tool_free_mw()
640 struct tool_mw *inmw = filep->private_data; in tool_mw_trans_read() local
654 ret = ntb_mw_get_align(inmw->tc->ntb, inmw->pidx, inmw->widx, in tool_mw_trans_read()
661 inmw->widx); in tool_mw_trans_read()
665 ntb_peer_port_number(inmw->tc->ntb, inmw->pidx), in tool_mw_trans_read()
666 inmw->pidx); in tool_mw_trans_read()
669 "Window Address \t0x%pK\n", inmw->mm_base); in tool_mw_trans_read()
673 &inmw->dma_base); in tool_mw_trans_read()
677 &inmw->size); in tool_mw_trans_read()
702 struct tool_mw *inmw = filep->private_data; in tool_mw_trans_write() local
710 tool_free_mw(inmw->tc, inmw->pidx, inmw->widx); in tool_mw_trans_write()
712 ret = tool_setup_mw(inmw->tc, inmw->pidx, inmw->widx, val); in tool_mw_trans_write()