Lines Matching refs:mem
59 struct scatterlist mem; member
69 pci_unmap_sg(dev->pdev, chunk->mem, chunk->npages, in mthca_free_icm_pages()
73 __free_pages(sg_page(&chunk->mem[i]), in mthca_free_icm_pages()
74 get_order(chunk->mem[i].length)); in mthca_free_icm_pages()
82 dma_free_coherent(&dev->pdev->dev, chunk->mem[i].length, in mthca_free_icm_coherent()
83 lowmem_page_address(sg_page(&chunk->mem[i])), in mthca_free_icm_coherent()
84 sg_dma_address(&chunk->mem[i])); in mthca_free_icm_coherent()
107 static int mthca_alloc_icm_pages(struct scatterlist *mem, int order, gfp_t gfp_mask) in mthca_alloc_icm_pages() argument
119 sg_set_page(mem, page, PAGE_SIZE << order, 0); in mthca_alloc_icm_pages()
123 static int mthca_alloc_icm_coherent(struct device *dev, struct scatterlist *mem, in mthca_alloc_icm_coherent() argument
126 void *buf = dma_alloc_coherent(dev, PAGE_SIZE << order, &sg_dma_address(mem), in mthca_alloc_icm_coherent()
131 sg_set_buf(mem, buf, PAGE_SIZE << order); in mthca_alloc_icm_coherent()
132 BUG_ON(mem->offset); in mthca_alloc_icm_coherent()
133 sg_dma_len(mem) = PAGE_SIZE << order; in mthca_alloc_icm_coherent()
164 sg_init_table(chunk->mem, MTHCA_ICM_CHUNK_LEN); in mthca_alloc_icm()
175 &chunk->mem[chunk->npages], in mthca_alloc_icm()
178 ret = mthca_alloc_icm_pages(&chunk->mem[chunk->npages], in mthca_alloc_icm()
187 chunk->nsg = pci_map_sg(dev->pdev, chunk->mem, in mthca_alloc_icm()
207 chunk->nsg = pci_map_sg(dev->pdev, chunk->mem, in mthca_alloc_icm()
300 if (sg_dma_len(&chunk->mem[i]) > dma_offset) in mthca_table_find()
301 *dma_handle = sg_dma_address(&chunk->mem[i]) + in mthca_table_find()
303 dma_offset -= sg_dma_len(&chunk->mem[i]); in mthca_table_find()
308 if (chunk->mem[i].length > offset) { in mthca_table_find()
309 page = sg_page(&chunk->mem[i]); in mthca_table_find()
312 offset -= chunk->mem[i].length; in mthca_table_find()
480 sg_set_page(&db_tab->page[i].mem, pages[0], MTHCA_ICM_PAGE_SIZE, in mthca_map_user_db()
483 ret = pci_map_sg(dev->pdev, &db_tab->page[i].mem, 1, PCI_DMA_TODEVICE); in mthca_map_user_db()
489 ret = mthca_MAP_ICM_page(dev, sg_dma_address(&db_tab->page[i].mem), in mthca_map_user_db()
492 pci_unmap_sg(dev->pdev, &db_tab->page[i].mem, 1, PCI_DMA_TODEVICE); in mthca_map_user_db()
493 put_page(sg_page(&db_tab->page[i].mem)); in mthca_map_user_db()
541 sg_init_table(&db_tab->page[i].mem, 1); in mthca_init_user_db_tab()
558 pci_unmap_sg(dev->pdev, &db_tab->page[i].mem, 1, PCI_DMA_TODEVICE); in mthca_cleanup_user_db_tab()
559 put_page(sg_page(&db_tab->page[i].mem)); in mthca_cleanup_user_db_tab()