scsi: dc395x: use generic DMA API

Convert the driver from the legacy pci_* DMA API to the generic DMA API.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
Christoph Hellwig 2018-10-11 16:17:16 +02:00 committed by Martin K. Petersen
parent 6c404a68bf
commit dfda5e21c9
1 changed files with 15 additions and 22 deletions

View File

@ -946,10 +946,8 @@ static void build_srb(struct scsi_cmnd *cmd, struct DeviceCtlBlk *dcb,
sgp->length++; sgp->length++;
} }
srb->sg_bus_addr = pci_map_single(dcb->acb->dev, srb->sg_bus_addr = dma_map_single(&dcb->acb->dev->dev,
srb->segment_x, srb->segment_x, SEGMENTX_LEN, DMA_TO_DEVICE);
SEGMENTX_LEN,
PCI_DMA_TODEVICE);
dprintkdbg(DBG_SG, "build_srb: [n] map sg %p->%08x(%05x)\n", dprintkdbg(DBG_SG, "build_srb: [n] map sg %p->%08x(%05x)\n",
srb->segment_x, srb->sg_bus_addr, SEGMENTX_LEN); srb->segment_x, srb->sg_bus_addr, SEGMENTX_LEN);
@ -1871,19 +1869,15 @@ static void sg_update_list(struct ScsiReqBlk *srb, u32 left)
xferred -= psge->length; xferred -= psge->length;
} else { } else {
/* Partial SG entry done */ /* Partial SG entry done */
pci_dma_sync_single_for_cpu(srb->dcb-> dma_sync_single_for_cpu(&srb->dcb->acb->dev->dev,
acb->dev, srb->sg_bus_addr, SEGMENTX_LEN,
srb->sg_bus_addr, DMA_TO_DEVICE);
SEGMENTX_LEN,
PCI_DMA_TODEVICE);
psge->length -= xferred; psge->length -= xferred;
psge->address += xferred; psge->address += xferred;
srb->sg_index = idx; srb->sg_index = idx;
pci_dma_sync_single_for_device(srb->dcb-> dma_sync_single_for_device(&srb->dcb->acb->dev->dev,
acb->dev, srb->sg_bus_addr, SEGMENTX_LEN,
srb->sg_bus_addr, DMA_TO_DEVICE);
SEGMENTX_LEN,
PCI_DMA_TODEVICE);
break; break;
} }
psge++; psge++;
@ -3178,9 +3172,8 @@ static void pci_unmap_srb(struct AdapterCtlBlk *acb, struct ScsiReqBlk *srb)
/* unmap DC395x SG list */ /* unmap DC395x SG list */
dprintkdbg(DBG_SG, "pci_unmap_srb: list=%08x(%05x)\n", dprintkdbg(DBG_SG, "pci_unmap_srb: list=%08x(%05x)\n",
srb->sg_bus_addr, SEGMENTX_LEN); srb->sg_bus_addr, SEGMENTX_LEN);
pci_unmap_single(acb->dev, srb->sg_bus_addr, dma_unmap_single(&acb->dev->dev, srb->sg_bus_addr, SEGMENTX_LEN,
SEGMENTX_LEN, DMA_TO_DEVICE);
PCI_DMA_TODEVICE);
dprintkdbg(DBG_SG, "pci_unmap_srb: segs=%i buffer=%p\n", dprintkdbg(DBG_SG, "pci_unmap_srb: segs=%i buffer=%p\n",
scsi_sg_count(cmd), scsi_bufflen(cmd)); scsi_sg_count(cmd), scsi_bufflen(cmd));
/* unmap the sg segments */ /* unmap the sg segments */
@ -3198,8 +3191,8 @@ static void pci_unmap_srb_sense(struct AdapterCtlBlk *acb,
/* Unmap sense buffer */ /* Unmap sense buffer */
dprintkdbg(DBG_SG, "pci_unmap_srb_sense: buffer=%08x\n", dprintkdbg(DBG_SG, "pci_unmap_srb_sense: buffer=%08x\n",
srb->segment_x[0].address); srb->segment_x[0].address);
pci_unmap_single(acb->dev, srb->segment_x[0].address, dma_unmap_single(&acb->dev->dev, srb->segment_x[0].address,
srb->segment_x[0].length, PCI_DMA_FROMDEVICE); srb->segment_x[0].length, DMA_FROM_DEVICE);
/* Restore SG stuff */ /* Restore SG stuff */
srb->total_xfer_length = srb->xferred; srb->total_xfer_length = srb->xferred;
srb->segment_x[0].address = srb->segment_x[0].address =
@ -3594,9 +3587,9 @@ static void request_sense(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb,
srb->total_xfer_length = SCSI_SENSE_BUFFERSIZE; srb->total_xfer_length = SCSI_SENSE_BUFFERSIZE;
srb->segment_x[0].length = SCSI_SENSE_BUFFERSIZE; srb->segment_x[0].length = SCSI_SENSE_BUFFERSIZE;
/* Map sense buffer */ /* Map sense buffer */
srb->segment_x[0].address = srb->segment_x[0].address = dma_map_single(&acb->dev->dev,
pci_map_single(acb->dev, cmd->sense_buffer, cmd->sense_buffer, SCSI_SENSE_BUFFERSIZE,
SCSI_SENSE_BUFFERSIZE, PCI_DMA_FROMDEVICE); DMA_FROM_DEVICE);
dprintkdbg(DBG_SG, "request_sense: map buffer %p->%08x(%05x)\n", dprintkdbg(DBG_SG, "request_sense: map buffer %p->%08x(%05x)\n",
cmd->sense_buffer, srb->segment_x[0].address, cmd->sense_buffer, srb->segment_x[0].address,
SCSI_SENSE_BUFFERSIZE); SCSI_SENSE_BUFFERSIZE);