Commit 3258a4d5 authored by FUJITA Tomonori's avatar FUJITA Tomonori Committed by James Bottomley

[SCSI] 53c700: 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.

Jens Axboe <jens.axboe@oracle.com> did the for_each_sg cleanup.
Signed-off-by: default avatarFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 824d7b57
...@@ -585,16 +585,8 @@ NCR_700_unmap(struct NCR_700_Host_Parameters *hostdata, struct scsi_cmnd *SCp, ...@@ -585,16 +585,8 @@ NCR_700_unmap(struct NCR_700_Host_Parameters *hostdata, struct scsi_cmnd *SCp,
struct NCR_700_command_slot *slot) struct NCR_700_command_slot *slot)
{ {
if(SCp->sc_data_direction != DMA_NONE && if(SCp->sc_data_direction != DMA_NONE &&
SCp->sc_data_direction != DMA_BIDIRECTIONAL) { SCp->sc_data_direction != DMA_BIDIRECTIONAL)
if(SCp->use_sg) { scsi_dma_unmap(SCp);
dma_unmap_sg(hostdata->dev, SCp->request_buffer,
SCp->use_sg, SCp->sc_data_direction);
} else {
dma_unmap_single(hostdata->dev, slot->dma_handle,
SCp->request_bufflen,
SCp->sc_data_direction);
}
}
} }
STATIC inline void STATIC inline void
...@@ -1263,12 +1255,11 @@ process_script_interrupt(__u32 dsps, __u32 dsp, struct scsi_cmnd *SCp, ...@@ -1263,12 +1255,11 @@ process_script_interrupt(__u32 dsps, __u32 dsp, struct scsi_cmnd *SCp,
host->host_no, pun, lun, NCR_700_condition[i], host->host_no, pun, lun, NCR_700_condition[i],
NCR_700_phase[j], dsp - hostdata->pScript); NCR_700_phase[j], dsp - hostdata->pScript);
if(SCp != NULL) { if(SCp != NULL) {
scsi_print_command(SCp); struct scatterlist *sg;
if(SCp->use_sg) { scsi_print_command(SCp);
for(i = 0; i < SCp->use_sg + 1; i++) { scsi_for_each_sg(SCp, sg, scsi_sg_count(SCp) + 1, i) {
printk(KERN_INFO " SG[%d].length = %d, move_insn=%08x, addr %08x\n", i, ((struct scatterlist *)SCp->request_buffer)[i].length, ((struct NCR_700_command_slot *)SCp->host_scribble)->SG[i].ins, ((struct NCR_700_command_slot *)SCp->host_scribble)->SG[i].pAddr); printk(KERN_INFO " SG[%d].length = %d, move_insn=%08x, addr %08x\n", i, sg->length, ((struct NCR_700_command_slot *)SCp->host_scribble)->SG[i].ins, ((struct NCR_700_command_slot *)SCp->host_scribble)->SG[i].pAddr);
}
} }
} }
NCR_700_internal_bus_reset(host); NCR_700_internal_bus_reset(host);
...@@ -1844,8 +1835,8 @@ NCR_700_queuecommand(struct scsi_cmnd *SCp, void (*done)(struct scsi_cmnd *)) ...@@ -1844,8 +1835,8 @@ NCR_700_queuecommand(struct scsi_cmnd *SCp, void (*done)(struct scsi_cmnd *))
} }
/* sanity check: some of the commands generated by the mid-layer /* sanity check: some of the commands generated by the mid-layer
* have an eccentric idea of their sc_data_direction */ * have an eccentric idea of their sc_data_direction */
if(!SCp->use_sg && !SCp->request_bufflen if(!scsi_sg_count(SCp) && !scsi_bufflen(SCp) &&
&& SCp->sc_data_direction != DMA_NONE) { SCp->sc_data_direction != DMA_NONE) {
#ifdef NCR_700_DEBUG #ifdef NCR_700_DEBUG
printk("53c700: Command"); printk("53c700: Command");
scsi_print_command(SCp); scsi_print_command(SCp);
...@@ -1887,31 +1878,15 @@ NCR_700_queuecommand(struct scsi_cmnd *SCp, void (*done)(struct scsi_cmnd *)) ...@@ -1887,31 +1878,15 @@ NCR_700_queuecommand(struct scsi_cmnd *SCp, void (*done)(struct scsi_cmnd *))
int i; int i;
int sg_count; int sg_count;
dma_addr_t vPtr = 0; dma_addr_t vPtr = 0;
struct scatterlist *sg;
__u32 count = 0; __u32 count = 0;
if(SCp->use_sg) { sg_count = scsi_dma_map(SCp);
sg_count = dma_map_sg(hostdata->dev, BUG_ON(sg_count < 0);
SCp->request_buffer, SCp->use_sg,
direction);
} else {
vPtr = dma_map_single(hostdata->dev,
SCp->request_buffer,
SCp->request_bufflen,
direction);
count = SCp->request_bufflen;
slot->dma_handle = vPtr;
sg_count = 1;
}
for(i = 0; i < sg_count; i++) { scsi_for_each_sg(SCp, sg, sg_count, i) {
vPtr = sg_dma_address(sg);
if(SCp->use_sg) { count = sg_dma_len(sg);
struct scatterlist *sg = SCp->request_buffer;
vPtr = sg_dma_address(&sg[i]);
count = sg_dma_len(&sg[i]);
}
slot->SG[i].ins = bS_to_host(move_ins | count); slot->SG[i].ins = bS_to_host(move_ins | count);
DEBUG((" scatter block %d: move %d[%08x] from 0x%lx\n", DEBUG((" scatter block %d: move %d[%08x] from 0x%lx\n",
......
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