Lines Matching refs:sgt
288 int dma_map_sgtable(struct device *dev, struct sg_table *sgt, in dma_map_sgtable() argument
293 nents = __dma_map_sg_attrs(dev, sgt->sgl, sgt->orig_nents, dir, attrs); in dma_map_sgtable()
296 sgt->nents = nents; in dma_map_sgtable()
481 int dma_get_sgtable_attrs(struct device *dev, struct sg_table *sgt, in dma_get_sgtable_attrs() argument
488 return dma_direct_get_sgtable(dev, sgt, cpu_addr, dma_addr, in dma_get_sgtable_attrs()
491 return iommu_dma_get_sgtable(dev, sgt, cpu_addr, dma_addr, in dma_get_sgtable_attrs()
495 return ops->get_sgtable(dev, sgt, cpu_addr, dma_addr, size, attrs); in dma_get_sgtable_attrs()
733 struct sg_table *sgt; in alloc_single_sgt() local
736 sgt = kmalloc(sizeof(*sgt), gfp); in alloc_single_sgt()
737 if (!sgt) in alloc_single_sgt()
739 if (sg_alloc_table(sgt, 1, gfp)) in alloc_single_sgt()
741 page = __dma_alloc_pages(dev, size, &sgt->sgl->dma_address, dir, gfp); in alloc_single_sgt()
744 sg_set_page(sgt->sgl, page, PAGE_ALIGN(size), 0); in alloc_single_sgt()
745 sg_dma_len(sgt->sgl) = sgt->sgl->length; in alloc_single_sgt()
746 return sgt; in alloc_single_sgt()
748 sg_free_table(sgt); in alloc_single_sgt()
750 kfree(sgt); in alloc_single_sgt()
757 struct sg_table *sgt; in dma_alloc_noncontiguous() local
765 sgt = iommu_dma_alloc_noncontiguous(dev, size, dir, gfp, attrs); in dma_alloc_noncontiguous()
767 sgt = alloc_single_sgt(dev, size, dir, gfp); in dma_alloc_noncontiguous()
769 if (sgt) { in dma_alloc_noncontiguous()
770 sgt->nents = 1; in dma_alloc_noncontiguous()
771 trace_dma_map_sg(dev, sgt->sgl, sgt->orig_nents, 1, dir, attrs); in dma_alloc_noncontiguous()
772 debug_dma_map_sg(dev, sgt->sgl, sgt->orig_nents, 1, dir, attrs); in dma_alloc_noncontiguous()
774 return sgt; in dma_alloc_noncontiguous()
779 struct sg_table *sgt, enum dma_data_direction dir) in free_single_sgt() argument
781 __dma_free_pages(dev, size, sg_page(sgt->sgl), sgt->sgl->dma_address, in free_single_sgt()
783 sg_free_table(sgt); in free_single_sgt()
784 kfree(sgt); in free_single_sgt()
788 struct sg_table *sgt, enum dma_data_direction dir) in dma_free_noncontiguous() argument
790 trace_dma_unmap_sg(dev, sgt->sgl, sgt->orig_nents, dir, 0); in dma_free_noncontiguous()
791 debug_dma_unmap_sg(dev, sgt->sgl, sgt->orig_nents, dir); in dma_free_noncontiguous()
794 iommu_dma_free_noncontiguous(dev, size, sgt, dir); in dma_free_noncontiguous()
796 free_single_sgt(dev, size, sgt, dir); in dma_free_noncontiguous()
801 struct sg_table *sgt) in dma_vmap_noncontiguous() argument
805 return iommu_dma_vmap_noncontiguous(dev, size, sgt); in dma_vmap_noncontiguous()
807 return page_address(sg_page(sgt->sgl)); in dma_vmap_noncontiguous()
819 size_t size, struct sg_table *sgt) in dma_mmap_noncontiguous() argument
822 return iommu_dma_mmap_noncontiguous(dev, vma, size, sgt); in dma_mmap_noncontiguous()
823 return dma_mmap_pages(dev, vma, size, sg_page(sgt->sgl)); in dma_mmap_noncontiguous()