aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author <hch@lst.de>2005-04-17 16:26:13 -0400
committerJames Bottomley <jejb@titanic>2005-04-18 14:49:58 -0400
commitbe7db055dd7261522557046370f49160728e3847 (patch)
tree314689dfb551ee9ad5ef8c27576762489a51897d
parent80e2ca3dcb1043420ac4b06de8eed3d6fedaddda (diff)
[PATCH] remove old scsi data direction macros
these have been wrappers for the generic dma direction bits since 2.5.x. This patch converts the few remaining drivers and removes the macros. Arjan noticed there's some hunk in here that shouldn't. Updated patch below: Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
-rw-r--r--Documentation/DMA-mapping.txt12
-rw-r--r--Documentation/scsi/scsi_mid_low_api.txt44
-rw-r--r--drivers/scsi/aic7xxx/aic79xx_osm.c18
-rw-r--r--drivers/scsi/aic7xxx/aic7xxx_osm.c20
-rw-r--r--drivers/scsi/aic7xxx/cam.h6
-rw-r--r--drivers/scsi/aic7xxx_old.c8
-rw-r--r--drivers/scsi/arm/fas216.c2
-rw-r--r--drivers/scsi/cpqfcTSinit.c6
-rw-r--r--drivers/scsi/cpqfcTSworker.c16
-rw-r--r--drivers/scsi/ips.c10
-rw-r--r--drivers/scsi/libata-scsi.c12
-rw-r--r--drivers/scsi/pci2000.c16
-rw-r--r--drivers/scsi/qlogicfc.c18
-rw-r--r--drivers/scsi/qlogicisp.c8
-rw-r--r--drivers/scsi/scsi.h15
-rw-r--r--drivers/scsi/sg.c8
16 files changed, 77 insertions, 142 deletions
diff --git a/Documentation/DMA-mapping.txt b/Documentation/DMA-mapping.txt
index f4ac37f157e..684557474c1 100644
--- a/Documentation/DMA-mapping.txt
+++ b/Documentation/DMA-mapping.txt
@@ -443,15 +443,9 @@ Only streaming mappings specify a direction, consistent mappings
443implicitly have a direction attribute setting of 443implicitly have a direction attribute setting of
444PCI_DMA_BIDIRECTIONAL. 444PCI_DMA_BIDIRECTIONAL.
445 445
446The SCSI subsystem provides mechanisms for you to easily obtain 446The SCSI subsystem tells you the direction to use in the
447the direction to use, in the SCSI command: 447'sc_data_direction' member of the SCSI command your driver is
448 448working on.
449 scsi_to_pci_dma_dir(SCSI_DIRECTION)
450
451Where SCSI_DIRECTION is obtained from the 'sc_data_direction'
452member of the SCSI command your driver is working on. The
453mentioned interface above returns a value suitable for passing
454into the streaming DMA mapping interfaces below.
455 449
456For Networking drivers, it's a rather simple affair. For transmit 450For Networking drivers, it's a rather simple affair. For transmit
457packets, map/unmap them with the PCI_DMA_TODEVICE direction 451packets, map/unmap them with the PCI_DMA_TODEVICE direction
diff --git a/Documentation/scsi/scsi_mid_low_api.txt b/Documentation/scsi/scsi_mid_low_api.txt
index 1f24129a309..e41703d7d24 100644
--- a/Documentation/scsi/scsi_mid_low_api.txt
+++ b/Documentation/scsi/scsi_mid_low_api.txt
@@ -389,8 +389,6 @@ Summary:
389 scsi_remove_host - detach and remove all SCSI devices owned by host 389 scsi_remove_host - detach and remove all SCSI devices owned by host
390 scsi_report_bus_reset - report scsi _bus_ reset observed 390 scsi_report_bus_reset - report scsi _bus_ reset observed
391 scsi_set_device - place device reference in host structure 391 scsi_set_device - place device reference in host structure
392 scsi_to_pci_dma_dir - convert SCSI subsystem direction flag to PCI
393 scsi_to_sbus_dma_dir - convert SCSI subsystem direction flag to SBUS
394 scsi_track_queue_full - track successive QUEUE_FULL events 392 scsi_track_queue_full - track successive QUEUE_FULL events
395 scsi_unblock_requests - allow further commands to be queued to given host 393 scsi_unblock_requests - allow further commands to be queued to given host
396 scsi_unregister - [calls scsi_host_put()] 394 scsi_unregister - [calls scsi_host_put()]
@@ -757,48 +755,6 @@ void scsi_set_device(struct Scsi_Host * shost, struct device * dev)
757 755
758 756
759/** 757/**
760 * scsi_to_pci_dma_dir - convert SCSI subsystem direction flag to PCI
761 * @scsi_data_direction: SCSI subsystem direction flag
762 *
763 * Returns DMA_TO_DEVICE given SCSI_DATA_WRITE,
764 * DMA_FROM_DEVICE given SCSI_DATA_READ
765 * DMA_BIDIRECTIONAL given SCSI_DATA_UNKNOWN
766 * else returns DMA_NONE
767 *
768 * Might block: no
769 *
770 * Notes: The SCSI subsystem now uses the same values for these
771 * constants as the PCI subsystem so this function is a nop.
772 * The recommendation is not to use this conversion function anymore
773 * (in the 2.6 kernel series) as it is not needed.
774 *
775 * Defined in: drivers/scsi/scsi.h .
776 **/
777int scsi_to_pci_dma_dir(unsigned char scsi_data_direction)
778
779
780/**
781 * scsi_to_sbus_dma_dir - convert SCSI subsystem direction flag to SBUS
782 * @scsi_data_direction: SCSI subsystem direction flag
783 *
784 * Returns DMA_TO_DEVICE given SCSI_DATA_WRITE,
785 * FROM_DEVICE given SCSI_DATA_READ
786 * DMA_BIDIRECTIONAL given SCSI_DATA_UNKNOWN
787 * else returns DMA_NONE
788 *
789 * Notes: The SCSI subsystem now uses the same values for these
790 * constants as the SBUS subsystem so this function is a nop.
791 * The recommendation is not to use this conversion function anymore
792 * (in the 2.6 kernel series) as it is not needed.
793 *
794 * Might block: no
795 *
796 * Defined in: drivers/scsi/scsi.h .
797 **/
798int scsi_to_sbus_dma_dir(unsigned char scsi_data_direction)
799
800
801/**
802 * scsi_track_queue_full - track successive QUEUE_FULL events on given 758 * scsi_track_queue_full - track successive QUEUE_FULL events on given
803 * device to determine if and when there is a need 759 * device to determine if and when there is a need
804 * to adjust the queue depth on the device. 760 * to adjust the queue depth on the device.
diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c
index fb2877c303f..550c9921691 100644
--- a/drivers/scsi/aic7xxx/aic79xx_osm.c
+++ b/drivers/scsi/aic7xxx/aic79xx_osm.c
@@ -687,7 +687,7 @@ ahd_linux_unmap_scb(struct ahd_softc *ahd, struct scb *scb)
687 int direction; 687 int direction;
688 688
689 cmd = scb->io_ctx; 689 cmd = scb->io_ctx;
690 direction = scsi_to_pci_dma_dir(cmd->sc_data_direction); 690 direction = cmd->sc_data_direction;
691 ahd_sync_sglist(ahd, scb, BUS_DMASYNC_POSTWRITE); 691 ahd_sync_sglist(ahd, scb, BUS_DMASYNC_POSTWRITE);
692 if (cmd->use_sg != 0) { 692 if (cmd->use_sg != 0) {
693 struct scatterlist *sg; 693 struct scatterlist *sg;
@@ -3338,7 +3338,7 @@ ahd_linux_dv_inq(struct ahd_softc *ahd, struct scsi_cmnd *cmd,
3338 } 3338 }
3339 3339
3340 ahd_linux_dv_fill_cmd(ahd, cmd, devinfo); 3340 ahd_linux_dv_fill_cmd(ahd, cmd, devinfo);
3341 cmd->sc_data_direction = SCSI_DATA_READ; 3341 cmd->sc_data_direction = DMA_FROM_DEVICE;
3342 cmd->cmd_len = 6; 3342 cmd->cmd_len = 6;
3343 cmd->cmnd[0] = INQUIRY; 3343 cmd->cmnd[0] = INQUIRY;
3344 cmd->cmnd[4] = request_length; 3344 cmd->cmnd[4] = request_length;
@@ -3363,7 +3363,7 @@ ahd_linux_dv_tur(struct ahd_softc *ahd, struct scsi_cmnd *cmd,
3363#endif 3363#endif
3364 /* Do a TUR to clear out any non-fatal transitional state */ 3364 /* Do a TUR to clear out any non-fatal transitional state */
3365 ahd_linux_dv_fill_cmd(ahd, cmd, devinfo); 3365 ahd_linux_dv_fill_cmd(ahd, cmd, devinfo);
3366 cmd->sc_data_direction = SCSI_DATA_NONE; 3366 cmd->sc_data_direction = DMA_NONE;
3367 cmd->cmd_len = 6; 3367 cmd->cmd_len = 6;
3368 cmd->cmnd[0] = TEST_UNIT_READY; 3368 cmd->cmnd[0] = TEST_UNIT_READY;
3369} 3369}
@@ -3385,7 +3385,7 @@ ahd_linux_dv_rebd(struct ahd_softc *ahd, struct scsi_cmnd *cmd,
3385 free(targ->dv_buffer, M_DEVBUF); 3385 free(targ->dv_buffer, M_DEVBUF);
3386 targ->dv_buffer = malloc(AHD_REBD_LEN, M_DEVBUF, M_WAITOK); 3386 targ->dv_buffer = malloc(AHD_REBD_LEN, M_DEVBUF, M_WAITOK);
3387 ahd_linux_dv_fill_cmd(ahd, cmd, devinfo); 3387 ahd_linux_dv_fill_cmd(ahd, cmd, devinfo);
3388 cmd->sc_data_direction = SCSI_DATA_READ; 3388 cmd->sc_data_direction = DMA_FROM_DEVICE;
3389 cmd->cmd_len = 10; 3389 cmd->cmd_len = 10;
3390 cmd->cmnd[0] = READ_BUFFER; 3390 cmd->cmnd[0] = READ_BUFFER;
3391 cmd->cmnd[1] = 0x0b; 3391 cmd->cmnd[1] = 0x0b;
@@ -3407,7 +3407,7 @@ ahd_linux_dv_web(struct ahd_softc *ahd, struct scsi_cmnd *cmd,
3407 } 3407 }
3408#endif 3408#endif
3409 ahd_linux_dv_fill_cmd(ahd, cmd, devinfo); 3409 ahd_linux_dv_fill_cmd(ahd, cmd, devinfo);
3410 cmd->sc_data_direction = SCSI_DATA_WRITE; 3410 cmd->sc_data_direction = DMA_TO_DEVICE;
3411 cmd->cmd_len = 10; 3411 cmd->cmd_len = 10;
3412 cmd->cmnd[0] = WRITE_BUFFER; 3412 cmd->cmnd[0] = WRITE_BUFFER;
3413 cmd->cmnd[1] = 0x0a; 3413 cmd->cmnd[1] = 0x0a;
@@ -3429,7 +3429,7 @@ ahd_linux_dv_reb(struct ahd_softc *ahd, struct scsi_cmnd *cmd,
3429 } 3429 }
3430#endif 3430#endif
3431 ahd_linux_dv_fill_cmd(ahd, cmd, devinfo); 3431 ahd_linux_dv_fill_cmd(ahd, cmd, devinfo);
3432 cmd->sc_data_direction = SCSI_DATA_READ; 3432 cmd->sc_data_direction = DMA_FROM_DEVICE;
3433 cmd->cmd_len = 10; 3433 cmd->cmd_len = 10;
3434 cmd->cmnd[0] = READ_BUFFER; 3434 cmd->cmnd[0] = READ_BUFFER;
3435 cmd->cmnd[1] = 0x0a; 3435 cmd->cmnd[1] = 0x0a;
@@ -3455,7 +3455,7 @@ ahd_linux_dv_su(struct ahd_softc *ahd, struct scsi_cmnd *cmd,
3455 } 3455 }
3456#endif 3456#endif
3457 ahd_linux_dv_fill_cmd(ahd, cmd, devinfo); 3457 ahd_linux_dv_fill_cmd(ahd, cmd, devinfo);
3458 cmd->sc_data_direction = SCSI_DATA_NONE; 3458 cmd->sc_data_direction = DMA_NONE;
3459 cmd->cmd_len = 6; 3459 cmd->cmd_len = 6;
3460 cmd->cmnd[0] = START_STOP_UNIT; 3460 cmd->cmnd[0] = START_STOP_UNIT;
3461 cmd->cmnd[4] = le | SSS_START; 3461 cmd->cmnd[4] = le | SSS_START;
@@ -4018,7 +4018,7 @@ ahd_linux_run_device_queue(struct ahd_softc *ahd, struct ahd_linux_device *dev)
4018 int dir; 4018 int dir;
4019 4019
4020 cur_seg = (struct scatterlist *)cmd->request_buffer; 4020 cur_seg = (struct scatterlist *)cmd->request_buffer;
4021 dir = scsi_to_pci_dma_dir(cmd->sc_data_direction); 4021 dir = cmd->sc_data_direction;
4022 nseg = pci_map_sg(ahd->dev_softc, cur_seg, 4022 nseg = pci_map_sg(ahd->dev_softc, cur_seg,
4023 cmd->use_sg, dir); 4023 cmd->use_sg, dir);
4024 scb->platform_data->xfer_len = 0; 4024 scb->platform_data->xfer_len = 0;
@@ -4038,7 +4038,7 @@ ahd_linux_run_device_queue(struct ahd_softc *ahd, struct ahd_linux_device *dev)
4038 int dir; 4038 int dir;
4039 4039
4040 sg = scb->sg_list; 4040 sg = scb->sg_list;
4041 dir = scsi_to_pci_dma_dir(cmd->sc_data_direction); 4041 dir = cmd->sc_data_direction;
4042 addr = pci_map_single(ahd->dev_softc, 4042 addr = pci_map_single(ahd->dev_softc,
4043 cmd->request_buffer, 4043 cmd->request_buffer,
4044 cmd->request_bufflen, dir); 4044 cmd->request_bufflen, dir);
diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c
index 031c6aaa5ca..35d6de5a4c9 100644
--- a/drivers/scsi/aic7xxx/aic7xxx_osm.c
+++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c
@@ -693,12 +693,12 @@ ahc_linux_unmap_scb(struct ahc_softc *ahc, struct scb *scb)
693 693
694 sg = (struct scatterlist *)cmd->request_buffer; 694 sg = (struct scatterlist *)cmd->request_buffer;
695 pci_unmap_sg(ahc->dev_softc, sg, cmd->use_sg, 695 pci_unmap_sg(ahc->dev_softc, sg, cmd->use_sg,
696 scsi_to_pci_dma_dir(cmd->sc_data_direction)); 696 cmd->sc_data_direction);
697 } else if (cmd->request_bufflen != 0) { 697 } else if (cmd->request_bufflen != 0) {
698 pci_unmap_single(ahc->dev_softc, 698 pci_unmap_single(ahc->dev_softc,
699 scb->platform_data->buf_busaddr, 699 scb->platform_data->buf_busaddr,
700 cmd->request_bufflen, 700 cmd->request_bufflen,
701 scsi_to_pci_dma_dir(cmd->sc_data_direction)); 701 cmd->sc_data_direction);
702 } 702 }
703} 703}
704 704
@@ -3007,7 +3007,7 @@ ahc_linux_dv_inq(struct ahc_softc *ahc, struct scsi_cmnd *cmd,
3007 } 3007 }
3008 3008
3009 ahc_linux_dv_fill_cmd(ahc, cmd, devinfo); 3009 ahc_linux_dv_fill_cmd(ahc, cmd, devinfo);
3010 cmd->sc_data_direction = SCSI_DATA_READ; 3010 cmd->sc_data_direction = DMA_FROM_DEVICE;
3011 cmd->cmd_len = 6; 3011 cmd->cmd_len = 6;
3012 cmd->cmnd[0] = INQUIRY; 3012 cmd->cmnd[0] = INQUIRY;
3013 cmd->cmnd[4] = request_length; 3013 cmd->cmnd[4] = request_length;
@@ -3032,7 +3032,7 @@ ahc_linux_dv_tur(struct ahc_softc *ahc, struct scsi_cmnd *cmd,
3032#endif 3032#endif
3033 /* Do a TUR to clear out any non-fatal transitional state */ 3033 /* Do a TUR to clear out any non-fatal transitional state */
3034 ahc_linux_dv_fill_cmd(ahc, cmd, devinfo); 3034 ahc_linux_dv_fill_cmd(ahc, cmd, devinfo);
3035 cmd->sc_data_direction = SCSI_DATA_NONE; 3035 cmd->sc_data_direction = DMA_NONE;
3036 cmd->cmd_len = 6; 3036 cmd->cmd_len = 6;
3037 cmd->cmnd[0] = TEST_UNIT_READY; 3037 cmd->cmnd[0] = TEST_UNIT_READY;
3038} 3038}
@@ -3054,7 +3054,7 @@ ahc_linux_dv_rebd(struct ahc_softc *ahc, struct scsi_cmnd *cmd,
3054 free(targ->dv_buffer, M_DEVBUF); 3054 free(targ->dv_buffer, M_DEVBUF);
3055 targ->dv_buffer = malloc(AHC_REBD_LEN, M_DEVBUF, M_WAITOK); 3055 targ->dv_buffer = malloc(AHC_REBD_LEN, M_DEVBUF, M_WAITOK);
3056 ahc_linux_dv_fill_cmd(ahc, cmd, devinfo); 3056 ahc_linux_dv_fill_cmd(ahc, cmd, devinfo);
3057 cmd->sc_data_direction = SCSI_DATA_READ; 3057 cmd->sc_data_direction = DMA_FROM_DEVICE;
3058 cmd->cmd_len = 10; 3058 cmd->cmd_len = 10;
3059 cmd->cmnd[0] = READ_BUFFER; 3059 cmd->cmnd[0] = READ_BUFFER;
3060 cmd->cmnd[1] = 0x0b; 3060 cmd->cmnd[1] = 0x0b;
@@ -3076,7 +3076,7 @@ ahc_linux_dv_web(struct ahc_softc *ahc, struct scsi_cmnd *cmd,
3076 } 3076 }
3077#endif 3077#endif
3078 ahc_linux_dv_fill_cmd(ahc, cmd, devinfo); 3078 ahc_linux_dv_fill_cmd(ahc, cmd, devinfo);
3079 cmd->sc_data_direction = SCSI_DATA_WRITE; 3079 cmd->sc_data_direction = DMA_TO_DEVICE;
3080 cmd->cmd_len = 10; 3080 cmd->cmd_len = 10;
3081 cmd->cmnd[0] = WRITE_BUFFER; 3081 cmd->cmnd[0] = WRITE_BUFFER;
3082 cmd->cmnd[1] = 0x0a; 3082 cmd->cmnd[1] = 0x0a;
@@ -3098,7 +3098,7 @@ ahc_linux_dv_reb(struct ahc_softc *ahc, struct scsi_cmnd *cmd,
3098 } 3098 }
3099#endif 3099#endif
3100 ahc_linux_dv_fill_cmd(ahc, cmd, devinfo); 3100 ahc_linux_dv_fill_cmd(ahc, cmd, devinfo);
3101 cmd->sc_data_direction = SCSI_DATA_READ; 3101 cmd->sc_data_direction = DMA_FROM_DEVICE;
3102 cmd->cmd_len = 10; 3102 cmd->cmd_len = 10;
3103 cmd->cmnd[0] = READ_BUFFER; 3103 cmd->cmnd[0] = READ_BUFFER;
3104 cmd->cmnd[1] = 0x0a; 3104 cmd->cmnd[1] = 0x0a;
@@ -3124,7 +3124,7 @@ ahc_linux_dv_su(struct ahc_softc *ahc, struct scsi_cmnd *cmd,
3124 } 3124 }
3125#endif 3125#endif
3126 ahc_linux_dv_fill_cmd(ahc, cmd, devinfo); 3126 ahc_linux_dv_fill_cmd(ahc, cmd, devinfo);
3127 cmd->sc_data_direction = SCSI_DATA_NONE; 3127 cmd->sc_data_direction = DMA_NONE;
3128 cmd->cmd_len = 6; 3128 cmd->cmd_len = 6;
3129 cmd->cmnd[0] = START_STOP_UNIT; 3129 cmd->cmnd[0] = START_STOP_UNIT;
3130 cmd->cmnd[4] = le | SSS_START; 3130 cmd->cmnd[4] = le | SSS_START;
@@ -3659,7 +3659,7 @@ ahc_linux_run_device_queue(struct ahc_softc *ahc, struct ahc_linux_device *dev)
3659 3659
3660 cur_seg = (struct scatterlist *)cmd->request_buffer; 3660 cur_seg = (struct scatterlist *)cmd->request_buffer;
3661 nseg = pci_map_sg(ahc->dev_softc, cur_seg, cmd->use_sg, 3661 nseg = pci_map_sg(ahc->dev_softc, cur_seg, cmd->use_sg,
3662 scsi_to_pci_dma_dir(cmd->sc_data_direction)); 3662 cmd->sc_data_direction);
3663 end_seg = cur_seg + nseg; 3663 end_seg = cur_seg + nseg;
3664 /* Copy the segments into the SG list. */ 3664 /* Copy the segments into the SG list. */
3665 sg = scb->sg_list; 3665 sg = scb->sg_list;
@@ -3703,7 +3703,7 @@ ahc_linux_run_device_queue(struct ahc_softc *ahc, struct ahc_linux_device *dev)
3703 addr = pci_map_single(ahc->dev_softc, 3703 addr = pci_map_single(ahc->dev_softc,
3704 cmd->request_buffer, 3704 cmd->request_buffer,
3705 cmd->request_bufflen, 3705 cmd->request_bufflen,
3706 scsi_to_pci_dma_dir(cmd->sc_data_direction)); 3706 cmd->sc_data_direction);
3707 scb->platform_data->buf_busaddr = addr; 3707 scb->platform_data->buf_busaddr = addr;
3708 scb->sg_count = ahc_linux_map_seg(ahc, scb, 3708 scb->sg_count = ahc_linux_map_seg(ahc, scb,
3709 sg, addr, 3709 sg, addr,
diff --git a/drivers/scsi/aic7xxx/cam.h b/drivers/scsi/aic7xxx/cam.h
index d40ba0760c7..26f17e3fc45 100644
--- a/drivers/scsi/aic7xxx/cam.h
+++ b/drivers/scsi/aic7xxx/cam.h
@@ -103,9 +103,9 @@ typedef enum {
103} ac_code; 103} ac_code;
104 104
105typedef enum { 105typedef enum {
106 CAM_DIR_IN = SCSI_DATA_READ, 106 CAM_DIR_IN = DMA_FROM_DEVICE,
107 CAM_DIR_OUT = SCSI_DATA_WRITE, 107 CAM_DIR_OUT = DMA_TO_DEVICE,
108 CAM_DIR_NONE = SCSI_DATA_NONE 108 CAM_DIR_NONE = DMA_NONE,
109} ccb_flags; 109} ccb_flags;
110 110
111#endif /* _AIC7XXX_CAM_H */ 111#endif /* _AIC7XXX_CAM_H */
diff --git a/drivers/scsi/aic7xxx_old.c b/drivers/scsi/aic7xxx_old.c
index a6e7bb0d53f..9e9d0c40187 100644
--- a/drivers/scsi/aic7xxx_old.c
+++ b/drivers/scsi/aic7xxx_old.c
@@ -2700,12 +2700,12 @@ aic7xxx_done(struct aic7xxx_host *p, struct aic7xxx_scb *scb)
2700 struct scatterlist *sg; 2700 struct scatterlist *sg;
2701 2701
2702 sg = (struct scatterlist *)cmd->request_buffer; 2702 sg = (struct scatterlist *)cmd->request_buffer;
2703 pci_unmap_sg(p->pdev, sg, cmd->use_sg, scsi_to_pci_dma_dir(cmd->sc_data_direction)); 2703 pci_unmap_sg(p->pdev, sg, cmd->use_sg, cmd->sc_data_direction);
2704 } 2704 }
2705 else if (cmd->request_bufflen) 2705 else if (cmd->request_bufflen)
2706 pci_unmap_single(p->pdev, aic7xxx_mapping(cmd), 2706 pci_unmap_single(p->pdev, aic7xxx_mapping(cmd),
2707 cmd->request_bufflen, 2707 cmd->request_bufflen,
2708 scsi_to_pci_dma_dir(cmd->sc_data_direction)); 2708 cmd->sc_data_direction);
2709 if (scb->flags & SCB_SENSE) 2709 if (scb->flags & SCB_SENSE)
2710 { 2710 {
2711 pci_unmap_single(p->pdev, 2711 pci_unmap_single(p->pdev,
@@ -10228,7 +10228,7 @@ aic7xxx_buildscb(struct aic7xxx_host *p, Scsi_Cmnd *cmd,
10228 10228
10229 sg = (struct scatterlist *)cmd->request_buffer; 10229 sg = (struct scatterlist *)cmd->request_buffer;
10230 scb->sg_length = 0; 10230 scb->sg_length = 0;
10231 use_sg = pci_map_sg(p->pdev, sg, cmd->use_sg, scsi_to_pci_dma_dir(cmd->sc_data_direction)); 10231 use_sg = pci_map_sg(p->pdev, sg, cmd->use_sg, cmd->sc_data_direction);
10232 /* 10232 /*
10233 * Copy the segments into the SG array. NOTE!!! - We used to 10233 * Copy the segments into the SG array. NOTE!!! - We used to
10234 * have the first entry both in the data_pointer area and the first 10234 * have the first entry both in the data_pointer area and the first
@@ -10256,7 +10256,7 @@ aic7xxx_buildscb(struct aic7xxx_host *p, Scsi_Cmnd *cmd,
10256 { 10256 {
10257 unsigned int address = pci_map_single(p->pdev, cmd->request_buffer, 10257 unsigned int address = pci_map_single(p->pdev, cmd->request_buffer,
10258 cmd->request_bufflen, 10258 cmd->request_bufflen,
10259 scsi_to_pci_dma_dir(cmd->sc_data_direction)); 10259 cmd->sc_data_direction);
10260 aic7xxx_mapping(cmd) = address; 10260 aic7xxx_mapping(cmd) = address;
10261 scb->sg_list[0].address = cpu_to_le32(address); 10261 scb->sg_list[0].address = cpu_to_le32(address);
10262 scb->sg_list[0].length = cpu_to_le32(cmd->request_bufflen); 10262 scb->sg_list[0].length = cpu_to_le32(cmd->request_bufflen);
diff --git a/drivers/scsi/arm/fas216.c b/drivers/scsi/arm/fas216.c
index 0a172c1e9f7..3838f88e1fe 100644
--- a/drivers/scsi/arm/fas216.c
+++ b/drivers/scsi/arm/fas216.c
@@ -2117,7 +2117,7 @@ request_sense:
2117 SCpnt->SCp.Message = 0; 2117 SCpnt->SCp.Message = 0;
2118 SCpnt->SCp.Status = 0; 2118 SCpnt->SCp.Status = 0;
2119 SCpnt->request_bufflen = sizeof(SCpnt->sense_buffer); 2119 SCpnt->request_bufflen = sizeof(SCpnt->sense_buffer);
2120 SCpnt->sc_data_direction = SCSI_DATA_READ; 2120 SCpnt->sc_data_direction = DMA_FROM_DEVICE;
2121 SCpnt->use_sg = 0; 2121 SCpnt->use_sg = 0;
2122 SCpnt->tag = 0; 2122 SCpnt->tag = 0;
2123 SCpnt->host_scribble = (void *)fas216_rq_sns_done; 2123 SCpnt->host_scribble = (void *)fas216_rq_sns_done;
diff --git a/drivers/scsi/cpqfcTSinit.c b/drivers/scsi/cpqfcTSinit.c
index 2eeb493f5a2..5674ada6d5c 100644
--- a/drivers/scsi/cpqfcTSinit.c
+++ b/drivers/scsi/cpqfcTSinit.c
@@ -642,12 +642,12 @@ int cpqfcTS_ioctl( struct scsi_device *ScsiDev, int Cmnd, void *arg)
642 return( -EFAULT); 642 return( -EFAULT);
643 } 643 }
644 } 644 }
645 ScsiPassThruReq->sr_data_direction = SCSI_DATA_WRITE; 645 ScsiPassThruReq->sr_data_direction = DMA_TO_DEVICE;
646 } else if (vendor_cmd->rw_flag == VENDOR_READ_OPCODE) { 646 } else if (vendor_cmd->rw_flag == VENDOR_READ_OPCODE) {
647 ScsiPassThruReq->sr_data_direction = SCSI_DATA_READ; 647 ScsiPassThruReq->sr_data_direction = DMA_FROM_DEVICE;
648 } else 648 } else
649 // maybe this means a bug in the user app 649 // maybe this means a bug in the user app
650 ScsiPassThruReq->sr_data_direction = SCSI_DATA_NONE; 650 ScsiPassThruReq->sr_data_direction = DMA_BIDIRECTIONAL;
651 651
652 ScsiPassThruReq->sr_cmd_len = 0; // set correctly by scsi_do_req() 652 ScsiPassThruReq->sr_cmd_len = 0; // set correctly by scsi_do_req()
653 ScsiPassThruReq->sr_sense_buffer[0] = 0; 653 ScsiPassThruReq->sr_sense_buffer[0] = 0;
diff --git a/drivers/scsi/cpqfcTSworker.c b/drivers/scsi/cpqfcTSworker.c
index a5fd7427e9d..d822ddcc52b 100644
--- a/drivers/scsi/cpqfcTSworker.c
+++ b/drivers/scsi/cpqfcTSworker.c
@@ -5129,7 +5129,7 @@ cpqfc_undo_SEST_mappings(struct pci_dev *pcidev,
5129 for (i=*sgPages_head; i != NULL ;i = next) 5129 for (i=*sgPages_head; i != NULL ;i = next)
5130 { 5130 {
5131 pci_unmap_single(pcidev, i->busaddr, i->maplen, 5131 pci_unmap_single(pcidev, i->busaddr, i->maplen,
5132 scsi_to_pci_dma_dir(PCI_DMA_TODEVICE)); 5132 PCI_DMA_TODEVICE);
5133 i->busaddr = (dma_addr_t) NULL; 5133 i->busaddr = (dma_addr_t) NULL;
5134 i->maplen = 0L; 5134 i->maplen = 0L;
5135 next = i->next; 5135 next = i->next;
@@ -5195,7 +5195,7 @@ static ULONG build_SEST_sgList(
5195 contigaddr = ulBuff = pci_map_single(pcidev, 5195 contigaddr = ulBuff = pci_map_single(pcidev,
5196 Cmnd->request_buffer, 5196 Cmnd->request_buffer,
5197 Cmnd->request_bufflen, 5197 Cmnd->request_bufflen,
5198 scsi_to_pci_dma_dir(Cmnd->sc_data_direction)); 5198 Cmnd->sc_data_direction);
5199 // printk("ms %p ", ulBuff); 5199 // printk("ms %p ", ulBuff);
5200 } 5200 }
5201 else { 5201 else {
@@ -5224,7 +5224,7 @@ static ULONG build_SEST_sgList(
5224 unsigned long btg; 5224 unsigned long btg;
5225 contigaddr = pci_map_single(pcidev, Cmnd->request_buffer, 5225 contigaddr = pci_map_single(pcidev, Cmnd->request_buffer,
5226 Cmnd->request_bufflen, 5226 Cmnd->request_bufflen,
5227 scsi_to_pci_dma_dir(Cmnd->sc_data_direction)); 5227 Cmnd->sc_data_direction);
5228 5228
5229 // printk("contigaddr = %p, len = %d\n", 5229 // printk("contigaddr = %p, len = %d\n",
5230 // (void *) contigaddr, bytes_to_go); 5230 // (void *) contigaddr, bytes_to_go);
@@ -5247,7 +5247,7 @@ static ULONG build_SEST_sgList(
5247 5247
5248 sgl = (struct scatterlist*)Cmnd->request_buffer; 5248 sgl = (struct scatterlist*)Cmnd->request_buffer;
5249 sg_count = pci_map_sg(pcidev, sgl, Cmnd->use_sg, 5249 sg_count = pci_map_sg(pcidev, sgl, Cmnd->use_sg,
5250 scsi_to_pci_dma_dir(Cmnd->sc_data_direction)); 5250 Cmnd->sc_data_direction);
5251 if( sg_count <= 3 ) { 5251 if( sg_count <= 3 ) {
5252 5252
5253 // we need to be careful here that no individual mapping 5253 // we need to be careful here that no individual mapping
@@ -5400,7 +5400,7 @@ static ULONG build_SEST_sgList(
5400 5400
5401 cpqfc_undo_SEST_mappings(pcidev, contigaddr, 5401 cpqfc_undo_SEST_mappings(pcidev, contigaddr,
5402 Cmnd->request_bufflen, 5402 Cmnd->request_bufflen,
5403 scsi_to_pci_dma_dir(Cmnd->sc_data_direction), 5403 Cmnd->sc_data_direction,
5404 sgl, Cmnd->use_sg, sgPages_head, AllocatedPages+1); 5404 sgl, Cmnd->use_sg, sgPages_head, AllocatedPages+1);
5405 5405
5406 // FIXME: testing shows that if we get here, 5406 // FIXME: testing shows that if we get here,
@@ -5946,7 +5946,7 @@ cpqfc_pci_unmap_extended_sg(struct pci_dev *pcidev,
5946 // for each extended scatter gather region needing unmapping... 5946 // for each extended scatter gather region needing unmapping...
5947 for (i=fcChip->SEST->sgPages[x_ID] ; i != NULL ; i = i->next) 5947 for (i=fcChip->SEST->sgPages[x_ID] ; i != NULL ; i = i->next)
5948 pci_unmap_single(pcidev, i->busaddr, i->maplen, 5948 pci_unmap_single(pcidev, i->busaddr, i->maplen,
5949 scsi_to_pci_dma_dir(PCI_DMA_TODEVICE)); 5949 PCI_DMA_TODEVICE);
5950} 5950}
5951 5951
5952// Called also from cpqfcTScontrol.o, so can't be static 5952// Called also from cpqfcTScontrol.o, so can't be static
@@ -5960,14 +5960,14 @@ cpqfc_pci_unmap(struct pci_dev *pcidev,
5960 if (cmd->use_sg) { // Used scatter gather list for data buffer? 5960 if (cmd->use_sg) { // Used scatter gather list for data buffer?
5961 cpqfc_pci_unmap_extended_sg(pcidev, fcChip, x_ID); 5961 cpqfc_pci_unmap_extended_sg(pcidev, fcChip, x_ID);
5962 pci_unmap_sg(pcidev, cmd->buffer, cmd->use_sg, 5962 pci_unmap_sg(pcidev, cmd->buffer, cmd->use_sg,
5963 scsi_to_pci_dma_dir(cmd->sc_data_direction)); 5963 cmd->sc_data_direction);
5964 // printk("umsg %d\n", cmd->use_sg); 5964 // printk("umsg %d\n", cmd->use_sg);
5965 } 5965 }
5966 else if (cmd->request_bufflen) { 5966 else if (cmd->request_bufflen) {
5967 // printk("ums %p ", fcChip->SEST->u[ x_ID ].IWE.GAddr1); 5967 // printk("ums %p ", fcChip->SEST->u[ x_ID ].IWE.GAddr1);
5968 pci_unmap_single(pcidev, fcChip->SEST->u[ x_ID ].IWE.GAddr1, 5968 pci_unmap_single(pcidev, fcChip->SEST->u[ x_ID ].IWE.GAddr1,
5969 cmd->request_bufflen, 5969 cmd->request_bufflen,
5970 scsi_to_pci_dma_dir(cmd->sc_data_direction)); 5970 cmd->sc_data_direction);
5971 } 5971 }
5972} 5972}
5973 5973
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c
index 47c263e5cd3..fbc2cb6667a 100644
--- a/drivers/scsi/ips.c
+++ b/drivers/scsi/ips.c
@@ -231,9 +231,9 @@ module_param(ips, charp, 0);
231#endif 231#endif
232 232
233#define IPS_DMA_DIR(scb) ((!scb->scsi_cmd || ips_is_passthru(scb->scsi_cmd) || \ 233#define IPS_DMA_DIR(scb) ((!scb->scsi_cmd || ips_is_passthru(scb->scsi_cmd) || \
234 SCSI_DATA_NONE == scb->scsi_cmd->sc_data_direction) ? \ 234 DMA_NONE == scb->scsi_cmd->sc_data_direction) ? \
235 PCI_DMA_BIDIRECTIONAL : \ 235 PCI_DMA_BIDIRECTIONAL : \
236 scsi_to_pci_dma_dir(scb->scsi_cmd->sc_data_direction)) 236 scb->scsi_cmd->sc_data_direction)
237 237
238#ifdef IPS_DEBUG 238#ifdef IPS_DEBUG
239#define METHOD_TRACE(s, i) if (ips_debug >= (i+10)) printk(KERN_NOTICE s "\n"); 239#define METHOD_TRACE(s, i) if (ips_debug >= (i+10)) printk(KERN_NOTICE s "\n");
@@ -2849,8 +2849,7 @@ ips_next(ips_ha_t * ha, int intr)
2849 2849
2850 sg = SC->request_buffer; 2850 sg = SC->request_buffer;
2851 scb->sg_count = pci_map_sg(ha->pcidev, sg, SC->use_sg, 2851 scb->sg_count = pci_map_sg(ha->pcidev, sg, SC->use_sg,
2852 scsi_to_pci_dma_dir(SC-> 2852 SC->sc_data_direction);
2853 sc_data_direction));
2854 scb->flags |= IPS_SCB_MAP_SG; 2853 scb->flags |= IPS_SCB_MAP_SG;
2855 for (i = 0; i < scb->sg_count; i++) { 2854 for (i = 0; i < scb->sg_count; i++) {
2856 if (ips_fill_scb_sg_single 2855 if (ips_fill_scb_sg_single
@@ -2865,8 +2864,7 @@ ips_next(ips_ha_t * ha, int intr)
2865 pci_map_single(ha->pcidev, 2864 pci_map_single(ha->pcidev,
2866 SC->request_buffer, 2865 SC->request_buffer,
2867 SC->request_bufflen, 2866 SC->request_bufflen,
2868 scsi_to_pci_dma_dir(SC-> 2867 SC->sc_data_direction);
2869 sc_data_direction));
2870 scb->flags |= IPS_SCB_MAP_SINGLE; 2868 scb->flags |= IPS_SCB_MAP_SINGLE;
2871 ips_fill_scb_sg_single(ha, scb->data_busaddr, 2869 ips_fill_scb_sg_single(ha, scb->data_busaddr,
2872 scb, 0, 2870 scb, 0,
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
index 4e5e54a1564..4c96df060c3 100644
--- a/drivers/scsi/libata-scsi.c
+++ b/drivers/scsi/libata-scsi.c
@@ -305,7 +305,7 @@ void ata_to_sense_error(struct ata_queued_cmd *qc, u8 drv_stat)
305 sb[0] = 0x70; 305 sb[0] = 0x70;
306 sb[2] = MEDIUM_ERROR; 306 sb[2] = MEDIUM_ERROR;
307 sb[7] = 0x0A; 307 sb[7] = 0x0A;
308 if (cmd->sc_data_direction == SCSI_DATA_READ) { 308 if (cmd->sc_data_direction == DMA_FROM_DEVICE) {
309 sb[12] = 0x11; /* "unrecovered read error" */ 309 sb[12] = 0x11; /* "unrecovered read error" */
310 sb[13] = 0x04; 310 sb[13] = 0x04;
311 } else { 311 } else {
@@ -671,8 +671,8 @@ static void ata_scsi_translate(struct ata_port *ap, struct ata_device *dev,
671 return; 671 return;
672 672
673 /* data is present; dma-map it */ 673 /* data is present; dma-map it */
674 if (cmd->sc_data_direction == SCSI_DATA_READ || 674 if (cmd->sc_data_direction == DMA_FROM_DEVICE ||
675 cmd->sc_data_direction == SCSI_DATA_WRITE) { 675 cmd->sc_data_direction == DMA_TO_DEVICE) {
676 if (unlikely(cmd->request_bufflen < 1)) { 676 if (unlikely(cmd->request_bufflen < 1)) {
677 printk(KERN_WARNING "ata%u(%u): WARNING: zero len r/w req\n", 677 printk(KERN_WARNING "ata%u(%u): WARNING: zero len r/w req\n",
678 ap->id, dev->devno); 678 ap->id, dev->devno);
@@ -1304,7 +1304,7 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc, u8 *scsicmd)
1304 struct scsi_cmnd *cmd = qc->scsicmd; 1304 struct scsi_cmnd *cmd = qc->scsicmd;
1305 struct ata_device *dev = qc->dev; 1305 struct ata_device *dev = qc->dev;
1306 int using_pio = (dev->flags & ATA_DFLAG_PIO); 1306 int using_pio = (dev->flags & ATA_DFLAG_PIO);
1307 int nodata = (cmd->sc_data_direction == SCSI_DATA_NONE); 1307 int nodata = (cmd->sc_data_direction == DMA_NONE);
1308 1308
1309 if (!using_pio) 1309 if (!using_pio)
1310 /* Check whether ATAPI DMA is safe */ 1310 /* Check whether ATAPI DMA is safe */
@@ -1316,7 +1316,7 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc, u8 *scsicmd)
1316 qc->complete_fn = atapi_qc_complete; 1316 qc->complete_fn = atapi_qc_complete;
1317 1317
1318 qc->tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; 1318 qc->tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
1319 if (cmd->sc_data_direction == SCSI_DATA_WRITE) { 1319 if (cmd->sc_data_direction == DMA_TO_DEVICE) {
1320 qc->tf.flags |= ATA_TFLAG_WRITE; 1320 qc->tf.flags |= ATA_TFLAG_WRITE;
1321 DPRINTK("direction: write\n"); 1321 DPRINTK("direction: write\n");
1322 } 1322 }
@@ -1340,7 +1340,7 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc, u8 *scsicmd)
1340 1340
1341#ifdef ATAPI_ENABLE_DMADIR 1341#ifdef ATAPI_ENABLE_DMADIR
1342 /* some SATA bridges need us to indicate data xfer direction */ 1342 /* some SATA bridges need us to indicate data xfer direction */
1343 if (cmd->sc_data_direction != SCSI_DATA_WRITE) 1343 if (cmd->sc_data_direction != DMA_TO_DEVICE)
1344 qc->tf.feature |= ATAPI_DMADIR; 1344 qc->tf.feature |= ATAPI_DMADIR;
1345#endif 1345#endif
1346 } 1346 }
diff --git a/drivers/scsi/pci2000.c b/drivers/scsi/pci2000.c
index d58f303127f..377a4666b56 100644
--- a/drivers/scsi/pci2000.c
+++ b/drivers/scsi/pci2000.c
@@ -209,7 +209,7 @@ static int BuildSgList (Scsi_Cmnd *SCpnt, PADAPTER2000 padapter, PDEV2000 pdev)
209 if ( SCpnt->use_sg ) 209 if ( SCpnt->use_sg )
210 { 210 {
211 sg = (struct scatterlist *)SCpnt->request_buffer; 211 sg = (struct scatterlist *)SCpnt->request_buffer;
212 zc = pci_map_sg (padapter->pdev, sg, SCpnt->use_sg, scsi_to_pci_dma_dir (SCpnt->sc_data_direction)); 212 zc = pci_map_sg (padapter->pdev, sg, SCpnt->use_sg, SCpnt->sc_data_direction);
213 for ( z = 0; z < zc; z++ ) 213 for ( z = 0; z < zc; z++ )
214 { 214 {
215 pdev->scatGath[z].address = cpu_to_le32 (sg_dma_address (sg)); 215 pdev->scatGath[z].address = cpu_to_le32 (sg_dma_address (sg));
@@ -225,7 +225,9 @@ static int BuildSgList (Scsi_Cmnd *SCpnt, PADAPTER2000 padapter, PDEV2000 pdev)
225 outl (0, padapter->mb3); 225 outl (0, padapter->mb3);
226 return TRUE; 226 return TRUE;
227 } 227 }
228 SCpnt->SCp.have_data_in = pci_map_single (padapter->pdev, SCpnt->request_buffer, SCpnt->request_bufflen, scsi_to_pci_dma_dir (SCpnt->sc_data_direction)); 228 SCpnt->SCp.have_data_in = pci_map_single (padapter->pdev,
229 SCpnt->request_buffer, SCpnt->request_bufflen,
230 SCpnt->sc_data_direction);
229 outl (SCpnt->SCp.have_data_in, padapter->mb2); 231 outl (SCpnt->SCp.have_data_in, padapter->mb2);
230 outl (SCpnt->request_bufflen, padapter->mb3); 232 outl (SCpnt->request_bufflen, padapter->mb3);
231 return TRUE; 233 return TRUE;
@@ -340,11 +342,11 @@ unmapProceed:;
340 } 342 }
341 } 343 }
342 if ( SCpnt->SCp.have_data_in ) 344 if ( SCpnt->SCp.have_data_in )
343 pci_unmap_single (padapter->pdev, SCpnt->SCp.have_data_in, SCpnt->request_bufflen, scsi_to_pci_dma_dir(SCpnt->sc_data_direction)); 345 pci_unmap_single (padapter->pdev, SCpnt->SCp.have_data_in, SCpnt->request_bufflen, SCpnt->sc_data_direction);
344 else 346 else
345 { 347 {
346 if ( SCpnt->use_sg ) 348 if ( SCpnt->use_sg )
347 pci_unmap_sg (padapter->pdev, (struct scatterlist *)SCpnt->request_buffer, SCpnt->use_sg, scsi_to_pci_dma_dir(SCpnt->sc_data_direction)); 349 pci_unmap_sg (padapter->pdev, (struct scatterlist *)SCpnt->request_buffer, SCpnt->use_sg, SCpnt->sc_data_direction);
348 } 350 }
349 351
350irqProceed:; 352irqProceed:;
@@ -495,7 +497,7 @@ int Pci2000_QueueCommand (Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *))
495 else 497 else
496 { 498 {
497 SCpnt->SCp.have_data_in = pci_map_single (padapter->pdev, SCpnt->request_buffer, SCpnt->request_bufflen, 499 SCpnt->SCp.have_data_in = pci_map_single (padapter->pdev, SCpnt->request_buffer, SCpnt->request_bufflen,
498 scsi_to_pci_dma_dir(SCpnt->sc_data_direction)); 500 SCpnt->sc_data_direction);
499 outl (SCpnt->SCp.have_data_in, padapter->mb2); 501 outl (SCpnt->SCp.have_data_in, padapter->mb2);
500 } 502 }
501 outl (cdb[5], padapter->mb0); 503 outl (cdb[5], padapter->mb0);
@@ -511,13 +513,13 @@ int Pci2000_QueueCommand (Scsi_Cmnd *SCpnt, void (*done)(Scsi_Cmnd *))
511 SCpnt->SCp.have_data_in = pci_map_single (padapter->pdev, 513 SCpnt->SCp.have_data_in = pci_map_single (padapter->pdev,
512 ((struct scatterlist *)SCpnt->request_buffer)->address, 514 ((struct scatterlist *)SCpnt->request_buffer)->address,
513 SCpnt->request_bufflen, 515 SCpnt->request_bufflen,
514 scsi_to_pci_dma_dir (SCpnt->sc_data_direction)); 516 SCpnt->sc_data_direction);
515 } 517 }
516 else 518 else
517 { 519 {
518 SCpnt->SCp.have_data_in = pci_map_single (padapter->pdev, SCpnt->request_buffer, 520 SCpnt->SCp.have_data_in = pci_map_single (padapter->pdev, SCpnt->request_buffer,
519 SCpnt->request_bufflen, 521 SCpnt->request_bufflen,
520 scsi_to_pci_dma_dir (SCpnt->sc_data_direction)); 522 SCpnt->sc_data_direction);
521 } 523 }
522 outl (SCpnt->SCp.have_data_in, padapter->mb2); 524 outl (SCpnt->SCp.have_data_in, padapter->mb2);
523 outl (SCpnt->request_bufflen, padapter->mb3); 525 outl (SCpnt->request_bufflen, padapter->mb3);
diff --git a/drivers/scsi/qlogicfc.c b/drivers/scsi/qlogicfc.c
index 24c1174b0c2..ddf0f4277ee 100644
--- a/drivers/scsi/qlogicfc.c
+++ b/drivers/scsi/qlogicfc.c
@@ -1261,7 +1261,7 @@ static int isp2x00_queuecommand(Scsi_Cmnd * Cmnd, void (*done) (Scsi_Cmnd *))
1261 1261
1262 if (Cmnd->use_sg) { 1262 if (Cmnd->use_sg) {
1263 sg = (struct scatterlist *) Cmnd->request_buffer; 1263 sg = (struct scatterlist *) Cmnd->request_buffer;
1264 sg_count = pci_map_sg(hostdata->pci_dev, sg, Cmnd->use_sg, scsi_to_pci_dma_dir(Cmnd->sc_data_direction)); 1264 sg_count = pci_map_sg(hostdata->pci_dev, sg, Cmnd->use_sg, Cmnd->sc_data_direction);
1265 cmd->segment_cnt = cpu_to_le16(sg_count); 1265 cmd->segment_cnt = cpu_to_le16(sg_count);
1266 ds = cmd->dataseg; 1266 ds = cmd->dataseg;
1267 /* fill in first two sg entries: */ 1267 /* fill in first two sg entries: */
@@ -1307,7 +1307,7 @@ static int isp2x00_queuecommand(Scsi_Cmnd * Cmnd, void (*done) (Scsi_Cmnd *))
1307 dma_addr_t busaddr = pci_map_page(hostdata->pci_dev, 1307 dma_addr_t busaddr = pci_map_page(hostdata->pci_dev,
1308 page, offset, 1308 page, offset,
1309 Cmnd->request_bufflen, 1309 Cmnd->request_bufflen,
1310 scsi_to_pci_dma_dir(Cmnd->sc_data_direction)); 1310 Cmnd->sc_data_direction);
1311 Cmnd->SCp.dma_handle = busaddr; 1311 Cmnd->SCp.dma_handle = busaddr;
1312 1312
1313 cmd->dataseg[0].d_base = cpu_to_le32(pci64_dma_lo32(busaddr)); 1313 cmd->dataseg[0].d_base = cpu_to_le32(pci64_dma_lo32(busaddr));
@@ -1320,7 +1320,7 @@ static int isp2x00_queuecommand(Scsi_Cmnd * Cmnd, void (*done) (Scsi_Cmnd *))
1320 cmd->segment_cnt = cpu_to_le16(1); /* Shouldn't this be 0? */ 1320 cmd->segment_cnt = cpu_to_le16(1); /* Shouldn't this be 0? */
1321 } 1321 }
1322 1322
1323 if (Cmnd->sc_data_direction == SCSI_DATA_WRITE) 1323 if (Cmnd->sc_data_direction == DMA_TO_DEVICE)
1324 cmd->control_flags = cpu_to_le16(CFLAG_WRITE); 1324 cmd->control_flags = cpu_to_le16(CFLAG_WRITE);
1325 else 1325 else
1326 cmd->control_flags = cpu_to_le16(CFLAG_READ); 1326 cmd->control_flags = cpu_to_le16(CFLAG_READ);
@@ -1405,13 +1405,13 @@ static void redo_port_db(unsigned long arg)
1405 pci_unmap_sg(hostdata->pci_dev, 1405 pci_unmap_sg(hostdata->pci_dev,
1406 (struct scatterlist *)Cmnd->buffer, 1406 (struct scatterlist *)Cmnd->buffer,
1407 Cmnd->use_sg, 1407 Cmnd->use_sg,
1408 scsi_to_pci_dma_dir(Cmnd->sc_data_direction)); 1408 Cmnd->sc_data_direction);
1409 else if (Cmnd->request_bufflen && 1409 else if (Cmnd->request_bufflen &&
1410 Cmnd->sc_data_direction != PCI_DMA_NONE) { 1410 Cmnd->sc_data_direction != PCI_DMA_NONE) {
1411 pci_unmap_page(hostdata->pci_dev, 1411 pci_unmap_page(hostdata->pci_dev,
1412 Cmnd->SCp.dma_handle, 1412 Cmnd->SCp.dma_handle,
1413 Cmnd->request_bufflen, 1413 Cmnd->request_bufflen,
1414 scsi_to_pci_dma_dir(Cmnd->sc_data_direction)); 1414 Cmnd->sc_data_direction);
1415 } 1415 }
1416 1416
1417 hostdata->handle_ptrs[i]->result = DID_SOFT_ERROR << 16; 1417 hostdata->handle_ptrs[i]->result = DID_SOFT_ERROR << 16;
@@ -1515,13 +1515,13 @@ void isp2x00_intr_handler(int irq, void *dev_id, struct pt_regs *regs)
1515 pci_unmap_sg(hostdata->pci_dev, 1515 pci_unmap_sg(hostdata->pci_dev,
1516 (struct scatterlist *)Cmnd->buffer, 1516 (struct scatterlist *)Cmnd->buffer,
1517 Cmnd->use_sg, 1517 Cmnd->use_sg,
1518 scsi_to_pci_dma_dir(Cmnd->sc_data_direction)); 1518 Cmnd->sc_data_direction);
1519 else if (Cmnd->request_bufflen && 1519 else if (Cmnd->request_bufflen &&
1520 Cmnd->sc_data_direction != PCI_DMA_NONE) 1520 Cmnd->sc_data_direction != PCI_DMA_NONE)
1521 pci_unmap_page(hostdata->pci_dev, 1521 pci_unmap_page(hostdata->pci_dev,
1522 Cmnd->SCp.dma_handle, 1522 Cmnd->SCp.dma_handle,
1523 Cmnd->request_bufflen, 1523 Cmnd->request_bufflen,
1524 scsi_to_pci_dma_dir(Cmnd->sc_data_direction)); 1524 Cmnd->sc_data_direction);
1525 Cmnd->result = 0x0; 1525 Cmnd->result = 0x0;
1526 (*Cmnd->scsi_done) (Cmnd); 1526 (*Cmnd->scsi_done) (Cmnd);
1527 } else 1527 } else
@@ -1569,12 +1569,12 @@ void isp2x00_intr_handler(int irq, void *dev_id, struct pt_regs *regs)
1569 if (Cmnd->use_sg) 1569 if (Cmnd->use_sg)
1570 pci_unmap_sg(hostdata->pci_dev, 1570 pci_unmap_sg(hostdata->pci_dev,
1571 (struct scatterlist *)Cmnd->buffer, Cmnd->use_sg, 1571 (struct scatterlist *)Cmnd->buffer, Cmnd->use_sg,
1572 scsi_to_pci_dma_dir(Cmnd->sc_data_direction)); 1572 Cmnd->sc_data_direction);
1573 else if (Cmnd->request_bufflen && Cmnd->sc_data_direction != PCI_DMA_NONE) 1573 else if (Cmnd->request_bufflen && Cmnd->sc_data_direction != PCI_DMA_NONE)
1574 pci_unmap_page(hostdata->pci_dev, 1574 pci_unmap_page(hostdata->pci_dev,
1575 Cmnd->SCp.dma_handle, 1575 Cmnd->SCp.dma_handle,
1576 Cmnd->request_bufflen, 1576 Cmnd->request_bufflen,
1577 scsi_to_pci_dma_dir(Cmnd->sc_data_direction)); 1577 Cmnd->sc_data_direction);
1578 1578
1579 /* 1579 /*
1580 * if any of the following are true we do not 1580 * if any of the following are true we do not
diff --git a/drivers/scsi/qlogicisp.c b/drivers/scsi/qlogicisp.c
index 71d597a9b0b..6d29e1b864e 100644
--- a/drivers/scsi/qlogicisp.c
+++ b/drivers/scsi/qlogicisp.c
@@ -877,7 +877,7 @@ static int isp1020_queuecommand(Scsi_Cmnd *Cmnd, void (*done)(Scsi_Cmnd *))
877 ds = cmd->dataseg; 877 ds = cmd->dataseg;
878 878
879 sg_count = pci_map_sg(hostdata->pci_dev, sg, Cmnd->use_sg, 879 sg_count = pci_map_sg(hostdata->pci_dev, sg, Cmnd->use_sg,
880 scsi_to_pci_dma_dir(Cmnd->sc_data_direction)); 880 Cmnd->sc_data_direction);
881 881
882 cmd->segment_cnt = cpu_to_le16(sg_count); 882 cmd->segment_cnt = cpu_to_le16(sg_count);
883 883
@@ -934,7 +934,7 @@ static int isp1020_queuecommand(Scsi_Cmnd *Cmnd, void (*done)(Scsi_Cmnd *))
934 dma_addr = pci_map_single(hostdata->pci_dev, 934 dma_addr = pci_map_single(hostdata->pci_dev,
935 Cmnd->request_buffer, 935 Cmnd->request_buffer,
936 Cmnd->request_bufflen, 936 Cmnd->request_bufflen,
937 scsi_to_pci_dma_dir(Cmnd->sc_data_direction)); 937 Cmnd->sc_data_direction);
938 Cmnd->SCp.ptr = (char *)(unsigned long) dma_addr; 938 Cmnd->SCp.ptr = (char *)(unsigned long) dma_addr;
939 939
940 cmd->dataseg[0].d_base = 940 cmd->dataseg[0].d_base =
@@ -1067,7 +1067,7 @@ void isp1020_intr_handler(int irq, void *dev_id, struct pt_regs *regs)
1067 pci_unmap_sg(hostdata->pci_dev, 1067 pci_unmap_sg(hostdata->pci_dev,
1068 (struct scatterlist *)Cmnd->buffer, 1068 (struct scatterlist *)Cmnd->buffer,
1069 Cmnd->use_sg, 1069 Cmnd->use_sg,
1070 scsi_to_pci_dma_dir(Cmnd->sc_data_direction)); 1070 Cmnd->sc_data_direction);
1071 else if (Cmnd->request_bufflen) 1071 else if (Cmnd->request_bufflen)
1072 pci_unmap_single(hostdata->pci_dev, 1072 pci_unmap_single(hostdata->pci_dev,
1073#ifdef CONFIG_QL_ISP_A64 1073#ifdef CONFIG_QL_ISP_A64
@@ -1076,7 +1076,7 @@ void isp1020_intr_handler(int irq, void *dev_id, struct pt_regs *regs)
1076 (u32)((long)Cmnd->SCp.ptr), 1076 (u32)((long)Cmnd->SCp.ptr),
1077#endif 1077#endif
1078 Cmnd->request_bufflen, 1078 Cmnd->request_bufflen,
1079 scsi_to_pci_dma_dir(Cmnd->sc_data_direction)); 1079 Cmnd->sc_data_direction);
1080 1080
1081 isp_outw(out_ptr, host, MBOX5); 1081 isp_outw(out_ptr, host, MBOX5);
1082 (*Cmnd->scsi_done)(Cmnd); 1082 (*Cmnd->scsi_done)(Cmnd);
diff --git a/drivers/scsi/scsi.h b/drivers/scsi/scsi.h
index e2360c26ef0..5ee5d80a993 100644
--- a/drivers/scsi/scsi.h
+++ b/drivers/scsi/scsi.h
@@ -45,21 +45,6 @@ struct scsi_device;
45struct scsi_target; 45struct scsi_target;
46struct scatterlist; 46struct scatterlist;
47 47
48/*
49 * Legacy dma direction interfaces.
50 *
51 * This assumes the pci/sbus dma mapping flags have the same numercial
52 * values as the generic dma-mapping ones. Currently they have but there's
53 * no way to check. Better don't use these interfaces!
54 */
55#define SCSI_DATA_UNKNOWN (DMA_BIDIRECTIONAL)
56#define SCSI_DATA_WRITE (DMA_TO_DEVICE)
57#define SCSI_DATA_READ (DMA_FROM_DEVICE)
58#define SCSI_DATA_NONE (DMA_NONE)
59
60#define scsi_to_pci_dma_dir(scsi_dir) ((int)(scsi_dir))
61#define scsi_to_sbus_dma_dir(scsi_dir) ((int)(scsi_dir))
62
63/* obsolete typedef junk. */ 48/* obsolete typedef junk. */
64#include "scsi_typedefs.h" 49#include "scsi_typedefs.h"
65 50
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index ce8332297df..7936aafc3d0 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -747,16 +747,16 @@ sg_common_write(Sg_fd * sfp, Sg_request * srp,
747 switch (hp->dxfer_direction) { 747 switch (hp->dxfer_direction) {
748 case SG_DXFER_TO_FROM_DEV: 748 case SG_DXFER_TO_FROM_DEV:
749 case SG_DXFER_FROM_DEV: 749 case SG_DXFER_FROM_DEV:
750 SRpnt->sr_data_direction = SCSI_DATA_READ; 750 SRpnt->sr_data_direction = DMA_FROM_DEVICE;
751 break; 751 break;
752 case SG_DXFER_TO_DEV: 752 case SG_DXFER_TO_DEV:
753 SRpnt->sr_data_direction = SCSI_DATA_WRITE; 753 SRpnt->sr_data_direction = DMA_TO_DEVICE;
754 break; 754 break;
755 case SG_DXFER_UNKNOWN: 755 case SG_DXFER_UNKNOWN:
756 SRpnt->sr_data_direction = SCSI_DATA_UNKNOWN; 756 SRpnt->sr_data_direction = DMA_BIDIRECTIONAL;
757 break; 757 break;
758 default: 758 default:
759 SRpnt->sr_data_direction = SCSI_DATA_NONE; 759 SRpnt->sr_data_direction = DMA_NONE;
760 break; 760 break;
761 } 761 }
762 SRpnt->upper_private_data = srp; 762 SRpnt->upper_private_data = srp;