aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/aha1740.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-15 19:51:54 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-15 19:51:54 -0400
commitbc06cffdec85d487c77109dffcd2f285bdc502d3 (patch)
treeadc6e6398243da87e66c56102840597a329183a0 /drivers/scsi/aha1740.c
parentd3502d7f25b22cfc9762bf1781faa9db1bb3be2e (diff)
parent9413d7b8aa777dd1fc7db9563ce5e80d769fe7b5 (diff)
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/aha1740.c')
-rw-r--r--drivers/scsi/aha1740.c48
1 files changed, 15 insertions, 33 deletions
diff --git a/drivers/scsi/aha1740.c b/drivers/scsi/aha1740.c
index d7af9c63a04d..e4a4f3a965d9 100644
--- a/drivers/scsi/aha1740.c
+++ b/drivers/scsi/aha1740.c
@@ -271,20 +271,8 @@ static irqreturn_t aha1740_intr_handle(int irq, void *dev_id)
271 continue; 271 continue;
272 } 272 }
273 sgptr = (struct aha1740_sg *) SCtmp->host_scribble; 273 sgptr = (struct aha1740_sg *) SCtmp->host_scribble;
274 if (SCtmp->use_sg) { 274 scsi_dma_unmap(SCtmp);
275 /* We used scatter-gather. 275
276 Do the unmapping dance. */
277 dma_unmap_sg (&edev->dev,
278 (struct scatterlist *) SCtmp->request_buffer,
279 SCtmp->use_sg,
280 SCtmp->sc_data_direction);
281 } else {
282 dma_unmap_single (&edev->dev,
283 sgptr->buf_dma_addr,
284 SCtmp->request_bufflen,
285 DMA_BIDIRECTIONAL);
286 }
287
288 /* Free the sg block */ 276 /* Free the sg block */
289 dma_free_coherent (&edev->dev, 277 dma_free_coherent (&edev->dev,
290 sizeof (struct aha1740_sg), 278 sizeof (struct aha1740_sg),
@@ -349,11 +337,9 @@ static int aha1740_queuecommand(Scsi_Cmnd * SCpnt, void (*done)(Scsi_Cmnd *))
349 unchar target = scmd_id(SCpnt); 337 unchar target = scmd_id(SCpnt);
350 struct aha1740_hostdata *host = HOSTDATA(SCpnt->device->host); 338 struct aha1740_hostdata *host = HOSTDATA(SCpnt->device->host);
351 unsigned long flags; 339 unsigned long flags;
352 void *buff = SCpnt->request_buffer;
353 int bufflen = SCpnt->request_bufflen;
354 dma_addr_t sg_dma; 340 dma_addr_t sg_dma;
355 struct aha1740_sg *sgptr; 341 struct aha1740_sg *sgptr;
356 int ecbno; 342 int ecbno, nseg;
357 DEB(int i); 343 DEB(int i);
358 344
359 if(*cmd == REQUEST_SENSE) { 345 if(*cmd == REQUEST_SENSE) {
@@ -423,24 +409,23 @@ static int aha1740_queuecommand(Scsi_Cmnd * SCpnt, void (*done)(Scsi_Cmnd *))
423 } 409 }
424 sgptr = (struct aha1740_sg *) SCpnt->host_scribble; 410 sgptr = (struct aha1740_sg *) SCpnt->host_scribble;
425 sgptr->sg_dma_addr = sg_dma; 411 sgptr->sg_dma_addr = sg_dma;
426 412
427 if (SCpnt->use_sg) { 413 nseg = scsi_dma_map(SCpnt);
428 struct scatterlist * sgpnt; 414 BUG_ON(nseg < 0);
415 if (nseg) {
416 struct scatterlist *sg;
429 struct aha1740_chain * cptr; 417 struct aha1740_chain * cptr;
430 int i, count; 418 int i;
431 DEB(unsigned char * ptr); 419 DEB(unsigned char * ptr);
432 420
433 host->ecb[ecbno].sg = 1; /* SCSI Initiator Command 421 host->ecb[ecbno].sg = 1; /* SCSI Initiator Command
434 * w/scatter-gather*/ 422 * w/scatter-gather*/
435 sgpnt = (struct scatterlist *) SCpnt->request_buffer;
436 cptr = sgptr->sg_chain; 423 cptr = sgptr->sg_chain;
437 count = dma_map_sg (&host->edev->dev, sgpnt, SCpnt->use_sg, 424 scsi_for_each_sg(SCpnt, sg, nseg, i) {
438 SCpnt->sc_data_direction); 425 cptr[i].datalen = sg_dma_len (sg);
439 for(i=0; i < count; i++) { 426 cptr[i].dataptr = sg_dma_address (sg);
440 cptr[i].datalen = sg_dma_len (sgpnt + i);
441 cptr[i].dataptr = sg_dma_address (sgpnt + i);
442 } 427 }
443 host->ecb[ecbno].datalen = count*sizeof(struct aha1740_chain); 428 host->ecb[ecbno].datalen = nseg * sizeof(struct aha1740_chain);
444 host->ecb[ecbno].dataptr = sg_dma; 429 host->ecb[ecbno].dataptr = sg_dma;
445#ifdef DEBUG 430#ifdef DEBUG
446 printk("cptr %x: ",cptr); 431 printk("cptr %x: ",cptr);
@@ -448,11 +433,8 @@ static int aha1740_queuecommand(Scsi_Cmnd * SCpnt, void (*done)(Scsi_Cmnd *))
448 for(i=0;i<24;i++) printk("%02x ", ptr[i]); 433 for(i=0;i<24;i++) printk("%02x ", ptr[i]);
449#endif 434#endif
450 } else { 435 } else {
451 host->ecb[ecbno].datalen = bufflen; 436 host->ecb[ecbno].datalen = 0;
452 sgptr->buf_dma_addr = dma_map_single (&host->edev->dev, 437 host->ecb[ecbno].dataptr = 0;
453 buff, bufflen,
454 DMA_BIDIRECTIONAL);
455 host->ecb[ecbno].dataptr = sgptr->buf_dma_addr;
456 } 438 }
457 host->ecb[ecbno].lun = SCpnt->device->lun; 439 host->ecb[ecbno].lun = SCpnt->device->lun;
458 host->ecb[ecbno].ses = 1; /* Suppress underrun errors */ 440 host->ecb[ecbno].ses = 1; /* Suppress underrun errors */