diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-15 19:51:54 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-15 19:51:54 -0400 |
commit | bc06cffdec85d487c77109dffcd2f285bdc502d3 (patch) | |
tree | adc6e6398243da87e66c56102840597a329183a0 /drivers/scsi/aic7xxx | |
parent | d3502d7f25b22cfc9762bf1781faa9db1bb3be2e (diff) | |
parent | 9413d7b8aa777dd1fc7db9563ce5e80d769fe7b5 (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')
-rw-r--r-- | drivers/scsi/aic7xxx/aic79xx_osm.c | 51 | ||||
-rw-r--r-- | drivers/scsi/aic7xxx/aic79xx_osm.h | 4 | ||||
-rw-r--r-- | drivers/scsi/aic7xxx/aic7xxx_osm.c | 59 | ||||
-rw-r--r-- | drivers/scsi/aic7xxx/aic7xxx_osm.h | 4 |
4 files changed, 27 insertions, 91 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 | |||
376 | ahd_linux_unmap_scb(struct ahd_softc *ahd, struct scb *scb) | 376 | ahd_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) | |||
781 | static __inline | 781 | static __inline |
782 | void ahd_set_residual(struct scb *scb, u_long resid) | 782 | void 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 | ||
787 | static __inline | 787 | static __inline |
@@ -793,7 +793,7 @@ void ahd_set_sense_residual(struct scb *scb, u_long resid) | |||
793 | static __inline | 793 | static __inline |
794 | u_long ahd_get_residual(struct scb *scb) | 794 | u_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 | ||
799 | static __inline | 799 | static __inline |
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c index 660f26e23a38..1803ab6fc21c 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.c +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c | |||
@@ -402,18 +402,8 @@ ahc_linux_unmap_scb(struct ahc_softc *ahc, struct scb *scb) | |||
402 | 402 | ||
403 | cmd = scb->io_ctx; | 403 | cmd = scb->io_ctx; |
404 | ahc_sync_sglist(ahc, scb, BUS_DMASYNC_POSTWRITE); | 404 | ahc_sync_sglist(ahc, scb, BUS_DMASYNC_POSTWRITE); |
405 | if (cmd->use_sg != 0) { | 405 | |
406 | struct scatterlist *sg; | 406 | scsi_dma_unmap(cmd); |
407 | |||
408 | sg = (struct scatterlist *)cmd->request_buffer; | ||
409 | pci_unmap_sg(ahc->dev_softc, sg, cmd->use_sg, | ||
410 | cmd->sc_data_direction); | ||
411 | } else if (cmd->request_bufflen != 0) { | ||
412 | pci_unmap_single(ahc->dev_softc, | ||
413 | scb->platform_data->buf_busaddr, | ||
414 | cmd->request_bufflen, | ||
415 | cmd->sc_data_direction); | ||
416 | } | ||
417 | } | 407 | } |
418 | 408 | ||
419 | static __inline int | 409 | static __inline int |
@@ -1381,6 +1371,7 @@ ahc_linux_run_command(struct ahc_softc *ahc, struct ahc_linux_device *dev, | |||
1381 | struct ahc_tmode_tstate *tstate; | 1371 | struct ahc_tmode_tstate *tstate; |
1382 | uint16_t mask; | 1372 | uint16_t mask; |
1383 | struct scb_tailq *untagged_q = NULL; | 1373 | struct scb_tailq *untagged_q = NULL; |
1374 | int nseg; | ||
1384 | 1375 | ||
1385 | /* | 1376 | /* |
1386 | * Schedule us to run later. The only reason we are not | 1377 | * Schedule us to run later. The only reason we are not |
@@ -1472,23 +1463,21 @@ ahc_linux_run_command(struct ahc_softc *ahc, struct ahc_linux_device *dev, | |||
1472 | ahc_set_residual(scb, 0); | 1463 | ahc_set_residual(scb, 0); |
1473 | ahc_set_sense_residual(scb, 0); | 1464 | ahc_set_sense_residual(scb, 0); |
1474 | scb->sg_count = 0; | 1465 | scb->sg_count = 0; |
1475 | if (cmd->use_sg != 0) { | 1466 | |
1467 | nseg = scsi_dma_map(cmd); | ||
1468 | BUG_ON(nseg < 0); | ||
1469 | if (nseg > 0) { | ||
1476 | struct ahc_dma_seg *sg; | 1470 | struct ahc_dma_seg *sg; |
1477 | struct scatterlist *cur_seg; | 1471 | struct scatterlist *cur_seg; |
1478 | struct scatterlist *end_seg; | 1472 | int i; |
1479 | int nseg; | ||
1480 | 1473 | ||
1481 | cur_seg = (struct scatterlist *)cmd->request_buffer; | ||
1482 | nseg = pci_map_sg(ahc->dev_softc, cur_seg, cmd->use_sg, | ||
1483 | cmd->sc_data_direction); | ||
1484 | end_seg = cur_seg + nseg; | ||
1485 | /* Copy the segments into the SG list. */ | 1474 | /* Copy the segments into the SG list. */ |
1486 | sg = scb->sg_list; | 1475 | sg = scb->sg_list; |
1487 | /* | 1476 | /* |
1488 | * The sg_count may be larger than nseg if | 1477 | * The sg_count may be larger than nseg if |
1489 | * a transfer crosses a 32bit page. | 1478 | * a transfer crosses a 32bit page. |
1490 | */ | 1479 | */ |
1491 | while (cur_seg < end_seg) { | 1480 | scsi_for_each_sg(cmd, cur_seg, nseg, i) { |
1492 | dma_addr_t addr; | 1481 | dma_addr_t addr; |
1493 | bus_size_t len; | 1482 | bus_size_t len; |
1494 | int consumed; | 1483 | int consumed; |
@@ -1499,7 +1488,6 @@ ahc_linux_run_command(struct ahc_softc *ahc, struct ahc_linux_device *dev, | |||
1499 | sg, addr, len); | 1488 | sg, addr, len); |
1500 | sg += consumed; | 1489 | sg += consumed; |
1501 | scb->sg_count += consumed; | 1490 | scb->sg_count += consumed; |
1502 | cur_seg++; | ||
1503 | } | 1491 | } |
1504 | sg--; | 1492 | sg--; |
1505 | sg->len |= ahc_htole32(AHC_DMA_LAST_SEG); | 1493 | sg->len |= ahc_htole32(AHC_DMA_LAST_SEG); |
@@ -1516,33 +1504,6 @@ ahc_linux_run_command(struct ahc_softc *ahc, struct ahc_linux_device *dev, | |||
1516 | */ | 1504 | */ |
1517 | scb->hscb->dataptr = scb->sg_list->addr; | 1505 | scb->hscb->dataptr = scb->sg_list->addr; |
1518 | scb->hscb->datacnt = scb->sg_list->len; | 1506 | scb->hscb->datacnt = scb->sg_list->len; |
1519 | } else if (cmd->request_bufflen != 0) { | ||
1520 | struct ahc_dma_seg *sg; | ||
1521 | dma_addr_t addr; | ||
1522 | |||
1523 | sg = scb->sg_list; | ||
1524 | addr = pci_map_single(ahc->dev_softc, | ||
1525 | cmd->request_buffer, | ||
1526 | cmd->request_bufflen, | ||
1527 | cmd->sc_data_direction); | ||
1528 | scb->platform_data->buf_busaddr = addr; | ||
1529 | scb->sg_count = ahc_linux_map_seg(ahc, scb, | ||
1530 | sg, addr, | ||
1531 | cmd->request_bufflen); | ||
1532 | sg->len |= ahc_htole32(AHC_DMA_LAST_SEG); | ||
1533 | |||
1534 | /* | ||
1535 | * Reset the sg list pointer. | ||
1536 | */ | ||
1537 | scb->hscb->sgptr = | ||
1538 | ahc_htole32(scb->sg_list_phys | SG_FULL_RESID); | ||
1539 | |||
1540 | /* | ||
1541 | * Copy the first SG into the "current" | ||
1542 | * data pointer area. | ||
1543 | */ | ||
1544 | scb->hscb->dataptr = sg->addr; | ||
1545 | scb->hscb->datacnt = sg->len; | ||
1546 | } else { | 1507 | } else { |
1547 | scb->hscb->sgptr = ahc_htole32(SG_LIST_NULL); | 1508 | scb->hscb->sgptr = ahc_htole32(SG_LIST_NULL); |
1548 | scb->hscb->dataptr = 0; | 1509 | scb->hscb->dataptr = 0; |
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.h b/drivers/scsi/aic7xxx/aic7xxx_osm.h index 8fee7edc6eb3..b48dab447bde 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.h +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.h | |||
@@ -751,7 +751,7 @@ int ahc_get_transfer_dir(struct scb *scb) | |||
751 | static __inline | 751 | static __inline |
752 | void ahc_set_residual(struct scb *scb, u_long resid) | 752 | void ahc_set_residual(struct scb *scb, u_long resid) |
753 | { | 753 | { |
754 | scb->io_ctx->resid = resid; | 754 | scsi_set_resid(scb->io_ctx, resid); |
755 | } | 755 | } |
756 | 756 | ||
757 | static __inline | 757 | static __inline |
@@ -763,7 +763,7 @@ void ahc_set_sense_residual(struct scb *scb, u_long resid) | |||
763 | static __inline | 763 | static __inline |
764 | u_long ahc_get_residual(struct scb *scb) | 764 | u_long ahc_get_residual(struct scb *scb) |
765 | { | 765 | { |
766 | return (scb->io_ctx->resid); | 766 | return scsi_get_resid(scb->io_ctx); |
767 | } | 767 | } |
768 | 768 | ||
769 | static __inline | 769 | static __inline |