aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/aic7xxx/aic79xx_osm.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/aic7xxx/aic79xx_osm.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/aic7xxx/aic79xx_osm.c')
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_osm.c51
1 files changed, 13 insertions, 38 deletions
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c
index 6054881f21f1..286ab83116f9 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.c
@@ -376,21 +376,10 @@ static __inline void
376ahd_linux_unmap_scb(struct ahd_softc *ahd, struct scb *scb) 376ahd_linux_unmap_scb(struct ahd_softc *ahd, struct scb *scb)
377{ 377{
378 struct scsi_cmnd *cmd; 378 struct scsi_cmnd *cmd;
379 int direction;
380 379
381 cmd = scb->io_ctx; 380 cmd = scb->io_ctx;
382 direction = cmd->sc_data_direction;
383 ahd_sync_sglist(ahd, scb, BUS_DMASYNC_POSTWRITE); 381 ahd_sync_sglist(ahd, scb, BUS_DMASYNC_POSTWRITE);
384 if (cmd->use_sg != 0) { 382 scsi_dma_unmap(cmd);
385 struct scatterlist *sg;
386
387 sg = (struct scatterlist *)cmd->request_buffer;
388 pci_unmap_sg(ahd->dev_softc, sg, cmd->use_sg, direction);
389 } else if (cmd->request_bufflen != 0) {
390 pci_unmap_single(ahd->dev_softc,
391 scb->platform_data->buf_busaddr,
392 cmd->request_bufflen, direction);
393 }
394} 383}
395 384
396/******************************** Macros **************************************/ 385/******************************** Macros **************************************/
@@ -1422,6 +1411,7 @@ ahd_linux_run_command(struct ahd_softc *ahd, struct ahd_linux_device *dev,
1422 u_int col_idx; 1411 u_int col_idx;
1423 uint16_t mask; 1412 uint16_t mask;
1424 unsigned long flags; 1413 unsigned long flags;
1414 int nseg;
1425 1415
1426 ahd_lock(ahd, &flags); 1416 ahd_lock(ahd, &flags);
1427 1417
@@ -1494,18 +1484,17 @@ ahd_linux_run_command(struct ahd_softc *ahd, struct ahd_linux_device *dev,
1494 ahd_set_residual(scb, 0); 1484 ahd_set_residual(scb, 0);
1495 ahd_set_sense_residual(scb, 0); 1485 ahd_set_sense_residual(scb, 0);
1496 scb->sg_count = 0; 1486 scb->sg_count = 0;
1497 if (cmd->use_sg != 0) { 1487
1498 void *sg; 1488 nseg = scsi_dma_map(cmd);
1499 struct scatterlist *cur_seg; 1489 BUG_ON(nseg < 0);
1500 u_int nseg; 1490 if (nseg > 0) {
1501 int dir; 1491 void *sg = scb->sg_list;
1502 1492 struct scatterlist *cur_seg;
1503 cur_seg = (struct scatterlist *)cmd->request_buffer; 1493 int i;
1504 dir = cmd->sc_data_direction; 1494
1505 nseg = pci_map_sg(ahd->dev_softc, cur_seg,
1506 cmd->use_sg, dir);
1507 scb->platform_data->xfer_len = 0; 1495 scb->platform_data->xfer_len = 0;
1508 for (sg = scb->sg_list; nseg > 0; nseg--, cur_seg++) { 1496
1497 scsi_for_each_sg(cmd, cur_seg, nseg, i) {
1509 dma_addr_t addr; 1498 dma_addr_t addr;
1510 bus_size_t len; 1499 bus_size_t len;
1511 1500
@@ -1513,22 +1502,8 @@ ahd_linux_run_command(struct ahd_softc *ahd, struct ahd_linux_device *dev,
1513 len = sg_dma_len(cur_seg); 1502 len = sg_dma_len(cur_seg);
1514 scb->platform_data->xfer_len += len; 1503 scb->platform_data->xfer_len += len;
1515 sg = ahd_sg_setup(ahd, scb, sg, addr, len, 1504 sg = ahd_sg_setup(ahd, scb, sg, addr, len,
1516 /*last*/nseg == 1); 1505 i == (nseg - 1));
1517 } 1506 }
1518 } else if (cmd->request_bufflen != 0) {
1519 void *sg;
1520 dma_addr_t addr;
1521 int dir;
1522
1523 sg = scb->sg_list;
1524 dir = cmd->sc_data_direction;
1525 addr = pci_map_single(ahd->dev_softc,
1526 cmd->request_buffer,
1527 cmd->request_bufflen, dir);
1528 scb->platform_data->xfer_len = cmd->request_bufflen;
1529 scb->platform_data->buf_busaddr = addr;
1530 sg = ahd_sg_setup(ahd, scb, sg, addr,
1531 cmd->request_bufflen, /*last*/TRUE);
1532 } 1507 }
1533 1508
1534 LIST_INSERT_HEAD(&ahd->pending_scbs, scb, pending_links); 1509 LIST_INSERT_HEAD(&ahd->pending_scbs, scb, pending_links);