aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/53c700.c
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2007-05-14 06:12:55 -0400
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2007-05-26 17:30:04 -0400
commit3258a4d5690880a62121553b604893ecaca7d042 (patch)
tree42c10b636283144b6e5f50c906b024534d2c3e30 /drivers/scsi/53c700.c
parent824d7b570b4dec49e868c251d670941b02a1e489 (diff)
[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: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/53c700.c')
-rw-r--r--drivers/scsi/53c700.c55
1 files changed, 15 insertions, 40 deletions
diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c
index cb02656eb54c..405d9d6f9653 100644
--- a/drivers/scsi/53c700.c
+++ b/drivers/scsi/53c700.c
@@ -585,16 +585,8 @@ NCR_700_unmap(struct NCR_700_Host_Parameters *hostdata, struct scsi_cmnd *SCp,
585 struct NCR_700_command_slot *slot) 585 struct NCR_700_command_slot *slot)
586{ 586{
587 if(SCp->sc_data_direction != DMA_NONE && 587 if(SCp->sc_data_direction != DMA_NONE &&
588 SCp->sc_data_direction != DMA_BIDIRECTIONAL) { 588 SCp->sc_data_direction != DMA_BIDIRECTIONAL)
589 if(SCp->use_sg) { 589 scsi_dma_unmap(SCp);
590 dma_unmap_sg(hostdata->dev, SCp->request_buffer,
591 SCp->use_sg, SCp->sc_data_direction);
592 } else {
593 dma_unmap_single(hostdata->dev, slot->dma_handle,
594 SCp->request_bufflen,
595 SCp->sc_data_direction);
596 }
597 }
598} 590}
599 591
600STATIC inline void 592STATIC inline void
@@ -1263,14 +1255,13 @@ process_script_interrupt(__u32 dsps, __u32 dsp, struct scsi_cmnd *SCp,
1263 host->host_no, pun, lun, NCR_700_condition[i], 1255 host->host_no, pun, lun, NCR_700_condition[i],
1264 NCR_700_phase[j], dsp - hostdata->pScript); 1256 NCR_700_phase[j], dsp - hostdata->pScript);
1265 if(SCp != NULL) { 1257 if(SCp != NULL) {
1266 scsi_print_command(SCp); 1258 struct scatterlist *sg;
1267 1259
1268 if(SCp->use_sg) { 1260 scsi_print_command(SCp);
1269 for(i = 0; i < SCp->use_sg + 1; i++) { 1261 scsi_for_each_sg(SCp, sg, scsi_sg_count(SCp) + 1, i) {
1270 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); 1262 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);
1271 }
1272 } 1263 }
1273 } 1264 }
1274 NCR_700_internal_bus_reset(host); 1265 NCR_700_internal_bus_reset(host);
1275 } else if((dsps & 0xfffff000) == A_DEBUG_INTERRUPT) { 1266 } else if((dsps & 0xfffff000) == A_DEBUG_INTERRUPT) {
1276 printk(KERN_NOTICE "scsi%d (%d:%d) DEBUG INTERRUPT %d AT %08x[%04x], continuing\n", 1267 printk(KERN_NOTICE "scsi%d (%d:%d) DEBUG INTERRUPT %d AT %08x[%04x], continuing\n",
@@ -1844,8 +1835,8 @@ NCR_700_queuecommand(struct scsi_cmnd *SCp, void (*done)(struct scsi_cmnd *))
1844 } 1835 }
1845 /* sanity check: some of the commands generated by the mid-layer 1836 /* sanity check: some of the commands generated by the mid-layer
1846 * have an eccentric idea of their sc_data_direction */ 1837 * have an eccentric idea of their sc_data_direction */
1847 if(!SCp->use_sg && !SCp->request_bufflen 1838 if(!scsi_sg_count(SCp) && !scsi_bufflen(SCp) &&
1848 && SCp->sc_data_direction != DMA_NONE) { 1839 SCp->sc_data_direction != DMA_NONE) {
1849#ifdef NCR_700_DEBUG 1840#ifdef NCR_700_DEBUG
1850 printk("53c700: Command"); 1841 printk("53c700: Command");
1851 scsi_print_command(SCp); 1842 scsi_print_command(SCp);
@@ -1887,31 +1878,15 @@ NCR_700_queuecommand(struct scsi_cmnd *SCp, void (*done)(struct scsi_cmnd *))
1887 int i; 1878 int i;
1888 int sg_count; 1879 int sg_count;
1889 dma_addr_t vPtr = 0; 1880 dma_addr_t vPtr = 0;
1881 struct scatterlist *sg;
1890 __u32 count = 0; 1882 __u32 count = 0;
1891 1883
1892 if(SCp->use_sg) { 1884 sg_count = scsi_dma_map(SCp);
1893 sg_count = dma_map_sg(hostdata->dev, 1885 BUG_ON(sg_count < 0);
1894 SCp->request_buffer, SCp->use_sg,
1895 direction);
1896 } else {
1897 vPtr = dma_map_single(hostdata->dev,
1898 SCp->request_buffer,
1899 SCp->request_bufflen,
1900 direction);
1901 count = SCp->request_bufflen;
1902 slot->dma_handle = vPtr;
1903 sg_count = 1;
1904 }
1905
1906 1886
1907 for(i = 0; i < sg_count; i++) { 1887 scsi_for_each_sg(SCp, sg, sg_count, i) {
1908 1888 vPtr = sg_dma_address(sg);
1909 if(SCp->use_sg) { 1889 count = sg_dma_len(sg);
1910 struct scatterlist *sg = SCp->request_buffer;
1911
1912 vPtr = sg_dma_address(&sg[i]);
1913 count = sg_dma_len(&sg[i]);
1914 }
1915 1890
1916 slot->SG[i].ins = bS_to_host(move_ins | count); 1891 slot->SG[i].ins = bS_to_host(move_ins | count);
1917 DEBUG((" scatter block %d: move %d[%08x] from 0x%lx\n", 1892 DEBUG((" scatter block %d: move %d[%08x] from 0x%lx\n",