diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2007-05-21 02:10:00 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2007-05-26 17:30:17 -0400 |
commit | 5f60ef6ac7b6338ec9e82a0900185d554f476243 (patch) | |
tree | 343df430cd9b941255d13ff820427c589ad66151 | |
parent | 4c688fc7df61874997be4588c889e2248c4ca195 (diff) |
[SCSI] ibmmca: 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>
-rw-r--r-- | drivers/scsi/ibmmca.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/drivers/scsi/ibmmca.c b/drivers/scsi/ibmmca.c index bec242df3613..4275d1b04ced 100644 --- a/drivers/scsi/ibmmca.c +++ b/drivers/scsi/ibmmca.c | |||
@@ -555,7 +555,7 @@ static irqreturn_t interrupt_handler(int irq, void *dev_id) | |||
555 | printk(KERN_ERR "IBM MCA SCSI: Fatal Subsystem ERROR!\n"); | 555 | printk(KERN_ERR "IBM MCA SCSI: Fatal Subsystem ERROR!\n"); |
556 | printk(KERN_ERR " Last cmd=0x%x, ena=%x, len=", lastSCSI, ld(shpnt)[ldn].scb.enable); | 556 | printk(KERN_ERR " Last cmd=0x%x, ena=%x, len=", lastSCSI, ld(shpnt)[ldn].scb.enable); |
557 | if (ld(shpnt)[ldn].cmd) | 557 | if (ld(shpnt)[ldn].cmd) |
558 | printk("%ld/%ld,", (long) (ld(shpnt)[ldn].cmd->request_bufflen), (long) (ld(shpnt)[ldn].scb.sys_buf_length)); | 558 | printk("%ld/%ld,", (long) (scsi_bufflen(ld(shpnt)[ldn].cmd)), (long) (ld(shpnt)[ldn].scb.sys_buf_length)); |
559 | else | 559 | else |
560 | printk("none,"); | 560 | printk("none,"); |
561 | if (ld(shpnt)[ldn].cmd) | 561 | if (ld(shpnt)[ldn].cmd) |
@@ -1708,7 +1708,7 @@ static int ibmmca_queuecommand(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *)) | |||
1708 | int target; | 1708 | int target; |
1709 | int max_pun; | 1709 | int max_pun; |
1710 | int i; | 1710 | int i; |
1711 | struct scatterlist *sl; | 1711 | struct scatterlist *sg; |
1712 | 1712 | ||
1713 | shpnt = cmd->device->host; | 1713 | shpnt = cmd->device->host; |
1714 | 1714 | ||
@@ -1829,20 +1829,18 @@ static int ibmmca_queuecommand(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *)) | |||
1829 | scb->tsb_adr = isa_virt_to_bus(&(ld(shpnt)[ldn].tsb)); | 1829 | scb->tsb_adr = isa_virt_to_bus(&(ld(shpnt)[ldn].tsb)); |
1830 | scsi_cmd = cmd->cmnd[0]; | 1830 | scsi_cmd = cmd->cmnd[0]; |
1831 | 1831 | ||
1832 | if (cmd->use_sg) { | 1832 | if (scsi_sg_count(cmd)) { |
1833 | i = cmd->use_sg; | 1833 | BUG_ON(scsi_sg_count(cmd) > 16); |
1834 | sl = (struct scatterlist *) (cmd->request_buffer); | 1834 | |
1835 | if (i > 16) | 1835 | scsi_for_each_sg(cmd, sg, scsi_sg_count(cmd), i) { |
1836 | panic("IBM MCA SCSI: scatter-gather list too long.\n"); | 1836 | ld(shpnt)[ldn].sge[i].address = (void *) (isa_page_to_bus(sg->page) + sg->offset); |
1837 | while (--i >= 0) { | 1837 | ld(shpnt)[ldn].sge[i].byte_length = sg->length; |
1838 | ld(shpnt)[ldn].sge[i].address = (void *) (isa_page_to_bus(sl[i].page) + sl[i].offset); | ||
1839 | ld(shpnt)[ldn].sge[i].byte_length = sl[i].length; | ||
1840 | } | 1838 | } |
1841 | scb->enable |= IM_POINTER_TO_LIST; | 1839 | scb->enable |= IM_POINTER_TO_LIST; |
1842 | scb->sys_buf_adr = isa_virt_to_bus(&(ld(shpnt)[ldn].sge[0])); | 1840 | scb->sys_buf_adr = isa_virt_to_bus(&(ld(shpnt)[ldn].sge[0])); |
1843 | scb->sys_buf_length = cmd->use_sg * sizeof(struct im_sge); | 1841 | scb->sys_buf_length = scsi_sg_count(cmd) * sizeof(struct im_sge); |
1844 | } else { | 1842 | } else { |
1845 | scb->sys_buf_adr = isa_virt_to_bus(cmd->request_buffer); | 1843 | scb->sys_buf_adr = isa_virt_to_bus(scsi_sglist(cmd)); |
1846 | /* recent Linux midlevel SCSI places 1024 byte for inquiry | 1844 | /* recent Linux midlevel SCSI places 1024 byte for inquiry |
1847 | * command. Far too much for old PS/2 hardware. */ | 1845 | * command. Far too much for old PS/2 hardware. */ |
1848 | switch (scsi_cmd) { | 1846 | switch (scsi_cmd) { |
@@ -1853,16 +1851,16 @@ static int ibmmca_queuecommand(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *)) | |||
1853 | case REQUEST_SENSE: | 1851 | case REQUEST_SENSE: |
1854 | case MODE_SENSE: | 1852 | case MODE_SENSE: |
1855 | case MODE_SELECT: | 1853 | case MODE_SELECT: |
1856 | if (cmd->request_bufflen > 255) | 1854 | if (scsi_bufflen(cmd) > 255) |
1857 | scb->sys_buf_length = 255; | 1855 | scb->sys_buf_length = 255; |
1858 | else | 1856 | else |
1859 | scb->sys_buf_length = cmd->request_bufflen; | 1857 | scb->sys_buf_length = scsi_bufflen(cmd); |
1860 | break; | 1858 | break; |
1861 | case TEST_UNIT_READY: | 1859 | case TEST_UNIT_READY: |
1862 | scb->sys_buf_length = 0; | 1860 | scb->sys_buf_length = 0; |
1863 | break; | 1861 | break; |
1864 | default: | 1862 | default: |
1865 | scb->sys_buf_length = cmd->request_bufflen; | 1863 | scb->sys_buf_length = scsi_bufflen(cmd); |
1866 | break; | 1864 | break; |
1867 | } | 1865 | } |
1868 | } | 1866 | } |