aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/fc4
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-15 11:19:33 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-15 11:19:33 -0400
commitdf3d80f5a5c74168be42788364d13cf6c83c7b9c (patch)
tree892a964c2fd28d028f2fb7471e8543d3f4006a58 /drivers/fc4
parent3d06f7a5f74a813cee817c4b30b5e6f0398da0be (diff)
parentc8e91b0a8fc8493e3bf3efcb3c8f866e9453cf1c (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: (207 commits) [SCSI] gdth: fix CONFIG_ISA build failure [SCSI] esp_scsi: remove __dev{init,exit} [SCSI] gdth: !use_sg cleanup and use of scsi accessors [SCSI] gdth: Move members from SCp to gdth_cmndinfo, stage 2 [SCSI] gdth: Setup proper per-command private data [SCSI] gdth: Remove gdth_ctr_tab[] [SCSI] gdth: switch to modern scsi host registration [SCSI] gdth: gdth_interrupt() gdth_get_status() & gdth_wait() fixes [SCSI] gdth: clean up host private data [SCSI] gdth: Remove virt hosts [SCSI] gdth: Reorder scsi_host_template intitializers [SCSI] gdth: kill gdth_{read,write}[bwl] wrappers [SCSI] gdth: Remove 2.4.x support, in-kernel changelog [SCSI] gdth: split out pci probing [SCSI] gdth: split out eisa probing [SCSI] gdth: split out isa probing gdth: Make one abuse of scsi_cmnd less obvious [SCSI] NCR5380: Use scsi_eh API for REQUEST_SENSE invocation [SCSI] usb storage: use scsi_eh API in REQUEST_SENSE execution [SCSI] scsi_error: Refactoring scsi_error to facilitate in synchronous REQUEST_SENSE ...
Diffstat (limited to 'drivers/fc4')
-rw-r--r--drivers/fc4/fc.c41
1 files changed, 15 insertions, 26 deletions
diff --git a/drivers/fc4/fc.c b/drivers/fc4/fc.c
index 22b62b3cd14e..82de9e1adb1e 100644
--- a/drivers/fc4/fc.c
+++ b/drivers/fc4/fc.c
@@ -427,15 +427,10 @@ static inline void fcp_scsi_receive(fc_channel *fc, int token, int status, fc_hd
427 memcpy(SCpnt->sense_buffer, ((char *)(rsp+1)), sense_len); 427 memcpy(SCpnt->sense_buffer, ((char *)(rsp+1)), sense_len);
428 } 428 }
429 429
430 if (fcmd->data) { 430 if (fcmd->data)
431 if (SCpnt->use_sg) 431 dma_unmap_sg(fc->dev, scsi_sglist(SCpnt),
432 dma_unmap_sg(fc->dev, (struct scatterlist *)SCpnt->request_buffer, 432 scsi_sg_count(SCpnt),
433 SCpnt->use_sg, 433 SCpnt->sc_data_direction);
434 SCpnt->sc_data_direction);
435 else
436 dma_unmap_single(fc->dev, fcmd->data, SCpnt->request_bufflen,
437 SCpnt->sc_data_direction);
438 }
439 break; 434 break;
440 default: 435 default:
441 host_status=DID_ERROR; /* FIXME */ 436 host_status=DID_ERROR; /* FIXME */
@@ -793,10 +788,14 @@ static int fcp_scsi_queue_it(fc_channel *fc, struct scsi_cmnd *SCpnt,
793 fcp_cntl = FCP_CNTL_QTYPE_SIMPLE; 788 fcp_cntl = FCP_CNTL_QTYPE_SIMPLE;
794 } else 789 } else
795 fcp_cntl = FCP_CNTL_QTYPE_UNTAGGED; 790 fcp_cntl = FCP_CNTL_QTYPE_UNTAGGED;
796 if (!SCpnt->request_bufflen && !SCpnt->use_sg) { 791
792 if (!scsi_bufflen(SCpnt)) {
797 cmd->fcp_cntl = fcp_cntl; 793 cmd->fcp_cntl = fcp_cntl;
798 fcmd->data = (dma_addr_t)NULL; 794 fcmd->data = (dma_addr_t)NULL;
799 } else { 795 } else {
796 struct scatterlist *sg;
797 int nents;
798
800 switch (SCpnt->cmnd[0]) { 799 switch (SCpnt->cmnd[0]) {
801 case WRITE_6: 800 case WRITE_6:
802 case WRITE_10: 801 case WRITE_10:
@@ -805,22 +804,12 @@ static int fcp_scsi_queue_it(fc_channel *fc, struct scsi_cmnd *SCpnt,
805 default: 804 default:
806 cmd->fcp_cntl = (FCP_CNTL_READ | fcp_cntl); break; 805 cmd->fcp_cntl = (FCP_CNTL_READ | fcp_cntl); break;
807 } 806 }
808 if (!SCpnt->use_sg) { 807
809 cmd->fcp_data_len = SCpnt->request_bufflen; 808 sg = scsi_sglist(SCpnt);
810 fcmd->data = dma_map_single (fc->dev, (char *)SCpnt->request_buffer, 809 nents = dma_map_sg(fc->dev, sg, scsi_sg_count(SCpnt),
811 SCpnt->request_bufflen, 810 SCpnt->sc_data_direction);
812 SCpnt->sc_data_direction); 811 fcmd->data = sg_dma_address(sg);
813 } else { 812 cmd->fcp_data_len = sg_dma_len(sg);
814 struct scatterlist *sg = (struct scatterlist *)SCpnt->request_buffer;
815 int nents;
816
817 FCD(("XXX: Use_sg %d %d\n", SCpnt->use_sg, sg->length))
818 nents = dma_map_sg (fc->dev, sg, SCpnt->use_sg,
819 SCpnt->sc_data_direction);
820 if (nents > 1) printk ("%s: SG for nents %d (use_sg %d) not handled yet\n", fc->name, nents, SCpnt->use_sg);
821 fcmd->data = sg_dma_address(sg);
822 cmd->fcp_data_len = sg_dma_len(sg);
823 }
824 } 813 }
825 memcpy (cmd->fcp_cdb, SCpnt->cmnd, SCpnt->cmd_len); 814 memcpy (cmd->fcp_cdb, SCpnt->cmnd, SCpnt->cmd_len);
826 memset (cmd->fcp_cdb+SCpnt->cmd_len, 0, sizeof(cmd->fcp_cdb)-SCpnt->cmd_len); 815 memset (cmd->fcp_cdb+SCpnt->cmd_len, 0, sizeof(cmd->fcp_cdb)-SCpnt->cmd_len);