Lines Matching refs:dma
26 #include <linux/dma-mapping.h>
663 static void cnic_free_dma(struct cnic_dev *dev, struct cnic_dma *dma)
667 if (!dma->pg_arr)
670 for (i = 0; i < dma->num_pages; i++) {
671 if (dma->pg_arr[i]) {
673 dma->pg_arr[i], dma->pg_map_arr[i]);
674 dma->pg_arr[i] = NULL;
677 if (dma->pgtbl) {
678 dma_free_coherent(&dev->pcidev->dev, dma->pgtbl_size,
679 dma->pgtbl, dma->pgtbl_map);
680 dma->pgtbl = NULL;
682 kfree(dma->pg_arr);
683 dma->pg_arr = NULL;
684 dma->num_pages = 0;
687 static void cnic_setup_page_tbl(struct cnic_dev *dev, struct cnic_dma *dma)
690 u32 *page_table = dma->pgtbl;
692 for (i = 0; i < dma->num_pages; i++) {
694 *page_table = (u32) ((u64) dma->pg_map_arr[i] >> 32);
696 *page_table = (u32) dma->pg_map_arr[i];
701 static void cnic_setup_page_tbl_le(struct cnic_dev *dev, struct cnic_dma *dma)
704 u32 *page_table = dma->pgtbl;
706 for (i = 0; i < dma->num_pages; i++) {
708 *page_table = dma->pg_map_arr[i] & 0xffffffff;
710 *page_table = (u32) ((u64) dma->pg_map_arr[i] >> 32);
715 static int cnic_alloc_dma(struct cnic_dev *dev, struct cnic_dma *dma,
722 dma->pg_arr = kzalloc(size, GFP_ATOMIC);
723 if (dma->pg_arr == NULL)
726 dma->pg_map_arr = (dma_addr_t *) (dma->pg_arr + pages);
727 dma->num_pages = pages;
730 dma->pg_arr[i] = dma_alloc_coherent(&dev->pcidev->dev,
732 &dma->pg_map_arr[i],
734 if (dma->pg_arr[i] == NULL)
740 dma->pgtbl_size = ((pages * 8) + BCM_PAGE_SIZE - 1) &
742 dma->pgtbl = dma_alloc_coherent(&dev->pcidev->dev, dma->pgtbl_size,
743 &dma->pgtbl_map, GFP_ATOMIC);
744 if (dma->pgtbl == NULL)
747 cp->setup_pgtbl(dev, dma);
752 cnic_free_dma(dev, dma);
807 cnic_free_dma(dev, &cp->kcq1.dma);
874 err = cnic_alloc_dma(dev, &info->dma, KCQ_PAGE_CNT, is_bnx2);
878 kcq = (struct kcqe **) info->dma.pg_arr;
891 next->addr_hi = (u64) info->dma.pg_map_arr[j] >> 32;
892 next->addr_lo = info->dma.pg_map_arr[j] & 0xffffffff;
3770 val = (u32) ((u64) cp->kcq1.dma.pgtbl_map >> 32);
3773 val = (u32) cp->kcq1.dma.pgtbl_map;
4156 cp->kcq1.dma.pg_map_arr[1] & 0xffffffff);
4159 (u64) cp->kcq1.dma.pg_map_arr[1] >> 32);
4162 cp->kcq1.dma.pg_map_arr[0] & 0xffffffff);
4165 (u64) cp->kcq1.dma.pg_map_arr[0] >> 32);