Commit a43e6bd1 authored by FUJITA Tomonori's avatar FUJITA Tomonori Committed by James Bottomley

[SCSI] fc4: 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: default avatarFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 4bd6d7f3
...@@ -427,15 +427,10 @@ static inline void fcp_scsi_receive(fc_channel *fc, int token, int status, fc_hd ...@@ -427,15 +427,10 @@ static inline void fcp_scsi_receive(fc_channel *fc, int token, int status, fc_hd
memcpy(SCpnt->sense_buffer, ((char *)(rsp+1)), sense_len); memcpy(SCpnt->sense_buffer, ((char *)(rsp+1)), sense_len);
} }
if (fcmd->data) { if (fcmd->data)
if (SCpnt->use_sg) dma_unmap_sg(fc->dev, scsi_sglist(SCpnt),
dma_unmap_sg(fc->dev, (struct scatterlist *)SCpnt->request_buffer, scsi_sg_count(SCpnt),
SCpnt->use_sg,
SCpnt->sc_data_direction); SCpnt->sc_data_direction);
else
dma_unmap_single(fc->dev, fcmd->data, SCpnt->request_bufflen,
SCpnt->sc_data_direction);
}
break; break;
default: default:
host_status=DID_ERROR; /* FIXME */ host_status=DID_ERROR; /* FIXME */
...@@ -793,10 +788,14 @@ static int fcp_scsi_queue_it(fc_channel *fc, struct scsi_cmnd *SCpnt, ...@@ -793,10 +788,14 @@ static int fcp_scsi_queue_it(fc_channel *fc, struct scsi_cmnd *SCpnt,
fcp_cntl = FCP_CNTL_QTYPE_SIMPLE; fcp_cntl = FCP_CNTL_QTYPE_SIMPLE;
} else } else
fcp_cntl = FCP_CNTL_QTYPE_UNTAGGED; fcp_cntl = FCP_CNTL_QTYPE_UNTAGGED;
if (!SCpnt->request_bufflen && !SCpnt->use_sg) {
if (!scsi_bufflen(SCpnt)) {
cmd->fcp_cntl = fcp_cntl; cmd->fcp_cntl = fcp_cntl;
fcmd->data = (dma_addr_t)NULL; fcmd->data = (dma_addr_t)NULL;
} else { } else {
struct scatterlist *sg;
int nents;
switch (SCpnt->cmnd[0]) { switch (SCpnt->cmnd[0]) {
case WRITE_6: case WRITE_6:
case WRITE_10: case WRITE_10:
...@@ -805,23 +804,13 @@ static int fcp_scsi_queue_it(fc_channel *fc, struct scsi_cmnd *SCpnt, ...@@ -805,23 +804,13 @@ static int fcp_scsi_queue_it(fc_channel *fc, struct scsi_cmnd *SCpnt,
default: default:
cmd->fcp_cntl = (FCP_CNTL_READ | fcp_cntl); break; cmd->fcp_cntl = (FCP_CNTL_READ | fcp_cntl); break;
} }
if (!SCpnt->use_sg) {
cmd->fcp_data_len = SCpnt->request_bufflen;
fcmd->data = dma_map_single (fc->dev, (char *)SCpnt->request_buffer,
SCpnt->request_bufflen,
SCpnt->sc_data_direction);
} else {
struct scatterlist *sg = (struct scatterlist *)SCpnt->request_buffer;
int nents;
FCD(("XXX: Use_sg %d %d\n", SCpnt->use_sg, sg->length)) sg = scsi_sglist(SCpnt);
nents = dma_map_sg (fc->dev, sg, SCpnt->use_sg, nents = dma_map_sg(fc->dev, sg, scsi_sg_count(SCpnt),
SCpnt->sc_data_direction); SCpnt->sc_data_direction);
if (nents > 1) printk ("%s: SG for nents %d (use_sg %d) not handled yet\n", fc->name, nents, SCpnt->use_sg);
fcmd->data = sg_dma_address(sg); fcmd->data = sg_dma_address(sg);
cmd->fcp_data_len = sg_dma_len(sg); cmd->fcp_data_len = sg_dma_len(sg);
} }
}
memcpy (cmd->fcp_cdb, SCpnt->cmnd, SCpnt->cmd_len); memcpy (cmd->fcp_cdb, SCpnt->cmnd, SCpnt->cmd_len);
memset (cmd->fcp_cdb+SCpnt->cmd_len, 0, sizeof(cmd->fcp_cdb)-SCpnt->cmd_len); memset (cmd->fcp_cdb+SCpnt->cmd_len, 0, sizeof(cmd->fcp_cdb)-SCpnt->cmd_len);
FCD(("XXX: %04x.%04x.%04x.%04x - %08x%08x%08x\n", cmd->fcp_addr[0], cmd->fcp_addr[1], cmd->fcp_addr[2], cmd->fcp_addr[3], *(u32 *)SCpnt->cmnd, *(u32 *)(SCpnt->cmnd+4), *(u32 *)(SCpnt->cmnd+8))) FCD(("XXX: %04x.%04x.%04x.%04x - %08x%08x%08x\n", cmd->fcp_addr[0], cmd->fcp_addr[1], cmd->fcp_addr[2], cmd->fcp_addr[3], *(u32 *)SCpnt->cmnd, *(u32 *)(SCpnt->cmnd+4), *(u32 *)(SCpnt->cmnd+8)))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment