diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-16 03:51:54 +0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-16 03:51:54 +0400 |
commit | bc06cffdec85d487c77109dffcd2f285bdc502d3 (patch) | |
tree | adc6e6398243da87e66c56102840597a329183a0 /drivers/scsi/hptiop.c | |
parent | d3502d7f25b22cfc9762bf1781faa9db1bb3be2e (diff) | |
parent | 9413d7b8aa777dd1fc7db9563ce5e80d769fe7b5 (diff) | |
download | linux-bc06cffdec85d487c77109dffcd2f285bdc502d3.tar.xz |
Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (166 commits)
[SCSI] ibmvscsi: convert to use the data buffer accessors
[SCSI] dc395x: convert to use the data buffer accessors
[SCSI] ncr53c8xx: convert to use the data buffer accessors
[SCSI] sym53c8xx: convert to use the data buffer accessors
[SCSI] ppa: coding police and printk levels
[SCSI] aic7xxx_old: remove redundant GFP_ATOMIC from kmalloc
[SCSI] i2o: remove redundant GFP_ATOMIC from kmalloc from device.c
[SCSI] remove the dead CYBERSTORMIII_SCSI option
[SCSI] don't build scsi_dma_{map,unmap} for !HAS_DMA
[SCSI] Clean up scsi_add_lun a bit
[SCSI] 53c700: Remove printk, which triggers because of low scsi clock on SNI RMs
[SCSI] sni_53c710: Cleanup
[SCSI] qla4xxx: Fix underrun/overrun conditions
[SCSI] megaraid_mbox: use mutex instead of semaphore
[SCSI] aacraid: add 51245, 51645 and 52245 adapters to documentation.
[SCSI] qla2xxx: update version to 8.02.00-k1.
[SCSI] qla2xxx: add support for NPIV
[SCSI] stex: use resid for xfer len information
[SCSI] Add Brownie 1200U3P to blacklist
[SCSI] scsi.c: convert to use the data buffer accessors
...
Diffstat (limited to 'drivers/scsi/hptiop.c')
-rw-r--r-- | drivers/scsi/hptiop.c | 76 |
1 files changed, 23 insertions, 53 deletions
diff --git a/drivers/scsi/hptiop.c b/drivers/scsi/hptiop.c index bec83cbee59a..0e579ca45814 100644 --- a/drivers/scsi/hptiop.c +++ b/drivers/scsi/hptiop.c @@ -339,20 +339,8 @@ static void hptiop_host_request_callback(struct hptiop_hba *hba, u32 tag) scp = hba->reqs[tag].scp; - if (HPT_SCP(scp)->mapped) { - if (scp->use_sg) - pci_unmap_sg(hba->pcidev, - (struct scatterlist *)scp->request_buffer, - scp->use_sg, - scp->sc_data_direction - ); - else - pci_unmap_single(hba->pcidev, - HPT_SCP(scp)->dma_handle, - scp->request_bufflen, - scp->sc_data_direction - ); - } + if (HPT_SCP(scp)->mapped) + scsi_dma_unmap(scp); switch (le32_to_cpu(req->header.result)) { case IOP_RESULT_SUCCESS: @@ -448,43 +436,26 @@ static int hptiop_buildsgl(struct scsi_cmnd *scp, struct hpt_iopsg *psg) { struct Scsi_Host *host = scp->device->host; struct hptiop_hba *hba = (struct hptiop_hba *)host->hostdata; - struct scatterlist *sglist = (struct scatterlist *)scp->request_buffer; - - /* - * though we'll not get non-use_sg fields anymore, - * keep use_sg checking anyway - */ - if (scp->use_sg) { - int idx; - - HPT_SCP(scp)->sgcnt = pci_map_sg(hba->pcidev, - sglist, scp->use_sg, - scp->sc_data_direction); - HPT_SCP(scp)->mapped = 1; - BUG_ON(HPT_SCP(scp)->sgcnt > hba->max_sg_descriptors); - - for (idx = 0; idx < HPT_SCP(scp)->sgcnt; idx++) { - psg[idx].pci_address = - cpu_to_le64(sg_dma_address(&sglist[idx])); - psg[idx].size = cpu_to_le32(sg_dma_len(&sglist[idx])); - psg[idx].eot = (idx == HPT_SCP(scp)->sgcnt - 1) ? - cpu_to_le32(1) : 0; - } + struct scatterlist *sg; + int idx, nseg; + + nseg = scsi_dma_map(scp); + BUG_ON(nseg < 0); + if (!nseg) + return 0; - return HPT_SCP(scp)->sgcnt; - } else { - HPT_SCP(scp)->dma_handle = pci_map_single( - hba->pcidev, - scp->request_buffer, - scp->request_bufflen, - scp->sc_data_direction - ); - HPT_SCP(scp)->mapped = 1; - psg->pci_address = cpu_to_le64(HPT_SCP(scp)->dma_handle); - psg->size = cpu_to_le32(scp->request_bufflen); - psg->eot = cpu_to_le32(1); - return 1; + HPT_SCP(scp)->sgcnt = nseg; + HPT_SCP(scp)->mapped = 1; + + BUG_ON(HPT_SCP(scp)->sgcnt > hba->max_sg_descriptors); + + scsi_for_each_sg(scp, sg, HPT_SCP(scp)->sgcnt, idx) { + psg[idx].pci_address = cpu_to_le64(sg_dma_address(sg)); + psg[idx].size = cpu_to_le32(sg_dma_len(sg)); + psg[idx].eot = (idx == HPT_SCP(scp)->sgcnt - 1) ? + cpu_to_le32(1) : 0; } + return HPT_SCP(scp)->sgcnt; } static int hptiop_queuecommand(struct scsi_cmnd *scp, @@ -529,9 +500,8 @@ static int hptiop_queuecommand(struct scsi_cmnd *scp, req = (struct hpt_iop_request_scsi_command *)_req->req_virt; /* build S/G table */ - if (scp->request_bufflen) - sg_count = hptiop_buildsgl(scp, req->sg_list); - else + sg_count = hptiop_buildsgl(scp, req->sg_list); + if (!sg_count) HPT_SCP(scp)->mapped = 0; req->header.flags = cpu_to_le32(IOP_REQUEST_FLAG_OUTPUT_CONTEXT); @@ -540,7 +510,7 @@ static int hptiop_queuecommand(struct scsi_cmnd *scp, req->header.context = cpu_to_le32(IOPMU_QUEUE_ADDR_HOST_BIT | (u32)_req->index); req->header.context_hi32 = 0; - req->dataxfer_length = cpu_to_le32(scp->request_bufflen); + req->dataxfer_length = cpu_to_le32(scsi_bufflen(scp)); req->channel = scp->device->channel; req->target = scp->device->id; req->lun = scp->device->lun; |