aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/ibmmca.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/ibmmca.c')
-rw-r--r--drivers/scsi/ibmmca.c28
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 }