aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2007-05-25 13:02:34 -0400
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2007-05-26 17:30:12 -0400
commit4c688fc7df61874997be4588c889e2248c4ca195 (patch)
tree79ed94c73caf4070817c420a49a78b23648cecf1
parent3a57c4a5aaee8d9d61b05d95d96f3fc4068b0518 (diff)
[SCSI] aic79xx: convert to use the data buffer accessors
- remove the unnecessary map_single path. - convert to use the new accessors for the sg lists and the parameters. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_osm.c51
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_osm.h4
2 files changed, 15 insertions, 40 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);
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.h b/drivers/scsi/aic7xxx/aic79xx_osm.h
index ad9761b237dc..853998be1474 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.h
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.h
@@ -781,7 +781,7 @@ int ahd_get_transfer_dir(struct scb *scb)
781static __inline 781static __inline
782void ahd_set_residual(struct scb *scb, u_long resid) 782void ahd_set_residual(struct scb *scb, u_long resid)
783{ 783{
784 scb->io_ctx->resid = resid; 784 scsi_set_resid(scb->io_ctx, resid);
785} 785}
786 786
787static __inline 787static __inline
@@ -793,7 +793,7 @@ void ahd_set_sense_residual(struct scb *scb, u_long resid)
793static __inline 793static __inline
794u_long ahd_get_residual(struct scb *scb) 794u_long ahd_get_residual(struct scb *scb)
795{ 795{
796 return (scb->io_ctx->resid); 796 return scsi_get_resid(scb->io_ctx);
797} 797}
798 798
799static __inline 799static __inline