scsi: csiostor: switch to generic DMA API
Switch from the legacy PCI DMA API to the generic DMA API. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
26a4c991af
commit
c22b332d81
|
@ -210,11 +210,8 @@ csio_pci_init(struct pci_dev *pdev, int *bars)
|
||||||
pci_set_master(pdev);
|
pci_set_master(pdev);
|
||||||
pci_try_set_mwi(pdev);
|
pci_try_set_mwi(pdev);
|
||||||
|
|
||||||
if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) {
|
if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) ||
|
||||||
pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64));
|
dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) {
|
||||||
} else if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) {
|
|
||||||
pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
|
|
||||||
} else {
|
|
||||||
dev_err(&pdev->dev, "No suitable DMA available.\n");
|
dev_err(&pdev->dev, "No suitable DMA available.\n");
|
||||||
goto err_release_regions;
|
goto err_release_regions;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1845,8 +1845,8 @@ csio_ln_fdmi_init(struct csio_lnode *ln)
|
||||||
/* Allocate Dma buffers for FDMI response Payload */
|
/* Allocate Dma buffers for FDMI response Payload */
|
||||||
dma_buf = &ln->mgmt_req->dma_buf;
|
dma_buf = &ln->mgmt_req->dma_buf;
|
||||||
dma_buf->len = 2048;
|
dma_buf->len = 2048;
|
||||||
dma_buf->vaddr = pci_alloc_consistent(hw->pdev, dma_buf->len,
|
dma_buf->vaddr = dma_alloc_coherent(&hw->pdev->dev, dma_buf->len,
|
||||||
&dma_buf->paddr);
|
&dma_buf->paddr, GFP_KERNEL);
|
||||||
if (!dma_buf->vaddr) {
|
if (!dma_buf->vaddr) {
|
||||||
csio_err(hw, "Failed to alloc DMA buffer for FDMI!\n");
|
csio_err(hw, "Failed to alloc DMA buffer for FDMI!\n");
|
||||||
kfree(ln->mgmt_req);
|
kfree(ln->mgmt_req);
|
||||||
|
@ -1873,7 +1873,7 @@ csio_ln_fdmi_exit(struct csio_lnode *ln)
|
||||||
|
|
||||||
dma_buf = &ln->mgmt_req->dma_buf;
|
dma_buf = &ln->mgmt_req->dma_buf;
|
||||||
if (dma_buf->vaddr)
|
if (dma_buf->vaddr)
|
||||||
pci_free_consistent(hw->pdev, dma_buf->len, dma_buf->vaddr,
|
dma_free_coherent(&hw->pdev->dev, dma_buf->len, dma_buf->vaddr,
|
||||||
dma_buf->paddr);
|
dma_buf->paddr);
|
||||||
|
|
||||||
kfree(ln->mgmt_req);
|
kfree(ln->mgmt_req);
|
||||||
|
|
|
@ -2349,8 +2349,8 @@ csio_scsi_alloc_ddp_bufs(struct csio_scsim *scm, struct csio_hw *hw,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate Dma buffers for DDP */
|
/* Allocate Dma buffers for DDP */
|
||||||
ddp_desc->vaddr = pci_alloc_consistent(hw->pdev, unit_size,
|
ddp_desc->vaddr = dma_alloc_coherent(&hw->pdev->dev, unit_size,
|
||||||
&ddp_desc->paddr);
|
&ddp_desc->paddr, GFP_KERNEL);
|
||||||
if (!ddp_desc->vaddr) {
|
if (!ddp_desc->vaddr) {
|
||||||
csio_err(hw,
|
csio_err(hw,
|
||||||
"SCSI response DMA buffer (ddp) allocation"
|
"SCSI response DMA buffer (ddp) allocation"
|
||||||
|
@ -2372,8 +2372,8 @@ csio_scsi_alloc_ddp_bufs(struct csio_scsim *scm, struct csio_hw *hw,
|
||||||
list_for_each(tmp, &scm->ddp_freelist) {
|
list_for_each(tmp, &scm->ddp_freelist) {
|
||||||
ddp_desc = (struct csio_dma_buf *) tmp;
|
ddp_desc = (struct csio_dma_buf *) tmp;
|
||||||
tmp = csio_list_prev(tmp);
|
tmp = csio_list_prev(tmp);
|
||||||
pci_free_consistent(hw->pdev, ddp_desc->len, ddp_desc->vaddr,
|
dma_free_coherent(&hw->pdev->dev, ddp_desc->len,
|
||||||
ddp_desc->paddr);
|
ddp_desc->vaddr, ddp_desc->paddr);
|
||||||
list_del_init(&ddp_desc->list);
|
list_del_init(&ddp_desc->list);
|
||||||
kfree(ddp_desc);
|
kfree(ddp_desc);
|
||||||
}
|
}
|
||||||
|
@ -2399,8 +2399,8 @@ csio_scsi_free_ddp_bufs(struct csio_scsim *scm, struct csio_hw *hw)
|
||||||
list_for_each(tmp, &scm->ddp_freelist) {
|
list_for_each(tmp, &scm->ddp_freelist) {
|
||||||
ddp_desc = (struct csio_dma_buf *) tmp;
|
ddp_desc = (struct csio_dma_buf *) tmp;
|
||||||
tmp = csio_list_prev(tmp);
|
tmp = csio_list_prev(tmp);
|
||||||
pci_free_consistent(hw->pdev, ddp_desc->len, ddp_desc->vaddr,
|
dma_free_coherent(&hw->pdev->dev, ddp_desc->len,
|
||||||
ddp_desc->paddr);
|
ddp_desc->vaddr, ddp_desc->paddr);
|
||||||
list_del_init(&ddp_desc->list);
|
list_del_init(&ddp_desc->list);
|
||||||
kfree(ddp_desc);
|
kfree(ddp_desc);
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,8 +124,8 @@ csio_wr_fill_fl(struct csio_hw *hw, struct csio_q *flq)
|
||||||
|
|
||||||
while (n--) {
|
while (n--) {
|
||||||
buf->len = sge->sge_fl_buf_size[sreg];
|
buf->len = sge->sge_fl_buf_size[sreg];
|
||||||
buf->vaddr = pci_alloc_consistent(hw->pdev, buf->len,
|
buf->vaddr = dma_alloc_coherent(&hw->pdev->dev, buf->len,
|
||||||
&buf->paddr);
|
&buf->paddr, GFP_KERNEL);
|
||||||
if (!buf->vaddr) {
|
if (!buf->vaddr) {
|
||||||
csio_err(hw, "Could only fill %d buffers!\n", n + 1);
|
csio_err(hw, "Could only fill %d buffers!\n", n + 1);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
@ -233,7 +233,8 @@ csio_wr_alloc_q(struct csio_hw *hw, uint32_t qsize, uint32_t wrsize,
|
||||||
|
|
||||||
q = wrm->q_arr[free_idx];
|
q = wrm->q_arr[free_idx];
|
||||||
|
|
||||||
q->vstart = pci_zalloc_consistent(hw->pdev, qsz, &q->pstart);
|
q->vstart = dma_zalloc_coherent(&hw->pdev->dev, qsz, &q->pstart,
|
||||||
|
GFP_KERNEL);
|
||||||
if (!q->vstart) {
|
if (!q->vstart) {
|
||||||
csio_err(hw,
|
csio_err(hw,
|
||||||
"Failed to allocate DMA memory for "
|
"Failed to allocate DMA memory for "
|
||||||
|
@ -1703,13 +1704,13 @@ csio_wrm_exit(struct csio_wrm *wrm, struct csio_hw *hw)
|
||||||
buf = &q->un.fl.bufs[j];
|
buf = &q->un.fl.bufs[j];
|
||||||
if (!buf->vaddr)
|
if (!buf->vaddr)
|
||||||
continue;
|
continue;
|
||||||
pci_free_consistent(hw->pdev, buf->len,
|
dma_free_coherent(&hw->pdev->dev,
|
||||||
buf->vaddr,
|
buf->len, buf->vaddr,
|
||||||
buf->paddr);
|
buf->paddr);
|
||||||
}
|
}
|
||||||
kfree(q->un.fl.bufs);
|
kfree(q->un.fl.bufs);
|
||||||
}
|
}
|
||||||
pci_free_consistent(hw->pdev, q->size,
|
dma_free_coherent(&hw->pdev->dev, q->size,
|
||||||
q->vstart, q->pstart);
|
q->vstart, q->pstart);
|
||||||
}
|
}
|
||||||
kfree(q);
|
kfree(q);
|
||||||
|
|
Loading…
Reference in New Issue