Lines Matching full:dma
3 User DMA
25 int ivtv_udma_fill_sg_list (struct ivtv_user_dma *dma, struct ivtv_dma_page_info *dma_page, int map… in ivtv_udma_fill_sg_list() argument
40 if (PageHighMem(dma->map[map_offset])) { in ivtv_udma_fill_sg_list()
43 if (dma->bouncemap[map_offset] == NULL) in ivtv_udma_fill_sg_list()
44 dma->bouncemap[map_offset] = alloc_page(GFP_KERNEL); in ivtv_udma_fill_sg_list()
45 if (dma->bouncemap[map_offset] == NULL) in ivtv_udma_fill_sg_list()
48 src = kmap_atomic(dma->map[map_offset]) + offset; in ivtv_udma_fill_sg_list()
49 memcpy(page_address(dma->bouncemap[map_offset]) + offset, src, len); in ivtv_udma_fill_sg_list()
52 sg_set_page(&dma->SGlist[map_offset], dma->bouncemap[map_offset], len, offset); in ivtv_udma_fill_sg_list()
55 sg_set_page(&dma->SGlist[map_offset], dma->map[map_offset], len, offset); in ivtv_udma_fill_sg_list()
63 void ivtv_udma_fill_sg_array (struct ivtv_user_dma *dma, u32 buffer_offset, u32 buffer_offset_2, u3… in ivtv_udma_fill_sg_array() argument
67 for_each_sg(dma->SGlist, sg, dma->SG_length, i) { in ivtv_udma_fill_sg_array()
68 dma->SGarray[i].size = cpu_to_le32(sg_dma_len(sg)); in ivtv_udma_fill_sg_array()
69 dma->SGarray[i].src = cpu_to_le32(sg_dma_address(sg)); in ivtv_udma_fill_sg_array()
70 dma->SGarray[i].dst = cpu_to_le32(buffer_offset); in ivtv_udma_fill_sg_array()
79 /* User DMA Buffers */
83 /* Map DMA Page Array Buffer */ in ivtv_udma_alloc()
96 struct ivtv_user_dma *dma = &itv->udma; in ivtv_udma_setup() local
102 if (dma->SG_length || dma->page_count) { in ivtv_udma_setup()
104 dma->SG_length, dma->page_count); in ivtv_udma_setup()
116 /* Pin user pages for DMA Xfer */ in ivtv_udma_setup()
118 dma->map, FOLL_FORCE); in ivtv_udma_setup()
124 unpin_user_pages(dma->map, err); in ivtv_udma_setup()
130 dma->page_count = user_dma.page_count; in ivtv_udma_setup()
133 if (ivtv_udma_fill_sg_list(dma, &user_dma, 0) < 0) { in ivtv_udma_setup()
134 unpin_user_pages(dma->map, dma->page_count); in ivtv_udma_setup()
135 dma->page_count = 0; in ivtv_udma_setup()
140 dma->SG_length = dma_map_sg(&itv->pdev->dev, dma->SGlist, in ivtv_udma_setup()
141 dma->page_count, DMA_TO_DEVICE); in ivtv_udma_setup()
144 ivtv_udma_fill_sg_array (dma, ivtv_dest_addr, 0, -1); in ivtv_udma_setup()
147 dma->SGarray[dma->SG_length - 1].size |= cpu_to_le32(0x80000000); in ivtv_udma_setup()
150 return dma->page_count; in ivtv_udma_setup()
155 struct ivtv_user_dma *dma = &itv->udma; in ivtv_udma_unmap() local
160 if (dma->page_count == 0) in ivtv_udma_unmap()
164 if (dma->SG_length) { in ivtv_udma_unmap()
165 dma_unmap_sg(&itv->pdev->dev, dma->SGlist, dma->page_count, in ivtv_udma_unmap()
167 dma->SG_length = 0; in ivtv_udma_unmap()
169 /* sync DMA */ in ivtv_udma_unmap()
172 unpin_user_pages(dma->map, dma->page_count); in ivtv_udma_unmap()
173 dma->page_count = 0; in ivtv_udma_unmap()