aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/ips.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/ips.c')
-rw-r--r--drivers/scsi/ips.c89
1 files changed, 26 insertions, 63 deletions
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c
index 7ed568f180ae..7c615c70ec5c 100644
--- a/drivers/scsi/ips.c
+++ b/drivers/scsi/ips.c
@@ -2377,7 +2377,7 @@ ips_get_bios_version(ips_ha_t * ha, int intr)
2377 if (inb(ha->io_addr + IPS_REG_FLDP) != 0x55) 2377 if (inb(ha->io_addr + IPS_REG_FLDP) != 0x55)
2378 return; 2378 return;
2379 2379
2380 outl(cpu_to_le32(1), ha->io_addr + IPS_REG_FLAP); 2380 outl(1, ha->io_addr + IPS_REG_FLAP);
2381 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) 2381 if (ha->pcidev->revision == IPS_REVID_TROMBONE64)
2382 udelay(25); /* 25 us */ 2382 udelay(25); /* 25 us */
2383 2383
@@ -2385,21 +2385,21 @@ ips_get_bios_version(ips_ha_t * ha, int intr)
2385 return; 2385 return;
2386 2386
2387 /* Get Major version */ 2387 /* Get Major version */
2388 outl(cpu_to_le32(0x1FF), ha->io_addr + IPS_REG_FLAP); 2388 outl(0x1FF, ha->io_addr + IPS_REG_FLAP);
2389 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) 2389 if (ha->pcidev->revision == IPS_REVID_TROMBONE64)
2390 udelay(25); /* 25 us */ 2390 udelay(25); /* 25 us */
2391 2391
2392 major = inb(ha->io_addr + IPS_REG_FLDP); 2392 major = inb(ha->io_addr + IPS_REG_FLDP);
2393 2393
2394 /* Get Minor version */ 2394 /* Get Minor version */
2395 outl(cpu_to_le32(0x1FE), ha->io_addr + IPS_REG_FLAP); 2395 outl(0x1FE, ha->io_addr + IPS_REG_FLAP);
2396 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) 2396 if (ha->pcidev->revision == IPS_REVID_TROMBONE64)
2397 udelay(25); /* 25 us */ 2397 udelay(25); /* 25 us */
2398 2398
2399 minor = inb(ha->io_addr + IPS_REG_FLDP); 2399 minor = inb(ha->io_addr + IPS_REG_FLDP);
2400 2400
2401 /* Get SubMinor version */ 2401 /* Get SubMinor version */
2402 outl(cpu_to_le32(0x1FD), ha->io_addr + IPS_REG_FLAP); 2402 outl(0x1FD, ha->io_addr + IPS_REG_FLAP);
2403 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) 2403 if (ha->pcidev->revision == IPS_REVID_TROMBONE64)
2404 udelay(25); /* 25 us */ 2404 udelay(25); /* 25 us */
2405 2405
@@ -3502,27 +3502,11 @@ ips_send_wait(ips_ha_t * ha, ips_scb_t * scb, int timeout, int intr)
3502static void 3502static void
3503ips_scmd_buf_write(struct scsi_cmnd *scmd, void *data, unsigned int count) 3503ips_scmd_buf_write(struct scsi_cmnd *scmd, void *data, unsigned int count)
3504{ 3504{
3505 int i; 3505 unsigned long flags;
3506 unsigned int min_cnt, xfer_cnt;
3507 char *cdata = (char *) data;
3508 unsigned char *buffer;
3509 unsigned long flags;
3510 struct scatterlist *sg = scsi_sglist(scmd);
3511
3512 for (i = 0, xfer_cnt = 0;
3513 (i < scsi_sg_count(scmd)) && (xfer_cnt < count); i++) {
3514 min_cnt = min(count - xfer_cnt, sg[i].length);
3515
3516 /* kmap_atomic() ensures addressability of the data buffer.*/
3517 /* local_irq_save() protects the KM_IRQ0 address slot. */
3518 local_irq_save(flags);
3519 buffer = kmap_atomic(sg_page(&sg[i]), KM_IRQ0) + sg[i].offset;
3520 memcpy(buffer, &cdata[xfer_cnt], min_cnt);
3521 kunmap_atomic(buffer - sg[i].offset, KM_IRQ0);
3522 local_irq_restore(flags);
3523 3506
3524 xfer_cnt += min_cnt; 3507 local_irq_save(flags);
3525 } 3508 scsi_sg_copy_from_buffer(scmd, data, count);
3509 local_irq_restore(flags);
3526} 3510}
3527 3511
3528/****************************************************************************/ 3512/****************************************************************************/
@@ -3535,27 +3519,11 @@ ips_scmd_buf_write(struct scsi_cmnd *scmd, void *data, unsigned int count)
3535static void 3519static void
3536ips_scmd_buf_read(struct scsi_cmnd *scmd, void *data, unsigned int count) 3520ips_scmd_buf_read(struct scsi_cmnd *scmd, void *data, unsigned int count)
3537{ 3521{
3538 int i; 3522 unsigned long flags;
3539 unsigned int min_cnt, xfer_cnt;
3540 char *cdata = (char *) data;
3541 unsigned char *buffer;
3542 unsigned long flags;
3543 struct scatterlist *sg = scsi_sglist(scmd);
3544
3545 for (i = 0, xfer_cnt = 0;
3546 (i < scsi_sg_count(scmd)) && (xfer_cnt < count); i++) {
3547 min_cnt = min(count - xfer_cnt, sg[i].length);
3548
3549 /* kmap_atomic() ensures addressability of the data buffer.*/
3550 /* local_irq_save() protects the KM_IRQ0 address slot. */
3551 local_irq_save(flags);
3552 buffer = kmap_atomic(sg_page(&sg[i]), KM_IRQ0) + sg[i].offset;
3553 memcpy(&cdata[xfer_cnt], buffer, min_cnt);
3554 kunmap_atomic(buffer - sg[i].offset, KM_IRQ0);
3555 local_irq_restore(flags);
3556 3523
3557 xfer_cnt += min_cnt; 3524 local_irq_save(flags);
3558 } 3525 scsi_sg_copy_to_buffer(scmd, data, count);
3526 local_irq_restore(flags);
3559} 3527}
3560 3528
3561/****************************************************************************/ 3529/****************************************************************************/
@@ -3696,9 +3664,7 @@ ips_send_cmd(ips_ha_t * ha, ips_scb_t * scb)
3696 scb->cmd.basic_io.sg_count = scb->sg_len; 3664 scb->cmd.basic_io.sg_count = scb->sg_len;
3697 3665
3698 if (scb->cmd.basic_io.lba) 3666 if (scb->cmd.basic_io.lba)
3699 scb->cmd.basic_io.lba = 3667 le32_add_cpu(&scb->cmd.basic_io.lba,
3700 cpu_to_le32(le32_to_cpu
3701 (scb->cmd.basic_io.lba) +
3702 le16_to_cpu(scb->cmd.basic_io. 3668 le16_to_cpu(scb->cmd.basic_io.
3703 sector_count)); 3669 sector_count));
3704 else 3670 else
@@ -3744,9 +3710,7 @@ ips_send_cmd(ips_ha_t * ha, ips_scb_t * scb)
3744 scb->cmd.basic_io.sg_count = scb->sg_len; 3710 scb->cmd.basic_io.sg_count = scb->sg_len;
3745 3711
3746 if (scb->cmd.basic_io.lba) 3712 if (scb->cmd.basic_io.lba)
3747 scb->cmd.basic_io.lba = 3713 le32_add_cpu(&scb->cmd.basic_io.lba,
3748 cpu_to_le32(le32_to_cpu
3749 (scb->cmd.basic_io.lba) +
3750 le16_to_cpu(scb->cmd.basic_io. 3714 le16_to_cpu(scb->cmd.basic_io.
3751 sector_count)); 3715 sector_count));
3752 else 3716 else
@@ -4888,7 +4852,7 @@ ips_init_copperhead(ips_ha_t * ha)
4888 return (0); 4852 return (0);
4889 4853
4890 /* setup CCCR */ 4854 /* setup CCCR */
4891 outl(cpu_to_le32(0x1010), ha->io_addr + IPS_REG_CCCR); 4855 outl(0x1010, ha->io_addr + IPS_REG_CCCR);
4892 4856
4893 /* Enable busmastering */ 4857 /* Enable busmastering */
4894 outb(IPS_BIT_EBM, ha->io_addr + IPS_REG_SCPR); 4858 outb(IPS_BIT_EBM, ha->io_addr + IPS_REG_SCPR);
@@ -5270,12 +5234,12 @@ ips_statinit(ips_ha_t * ha)
5270 ha->adapt->p_status_tail = ha->adapt->status; 5234 ha->adapt->p_status_tail = ha->adapt->status;
5271 5235
5272 phys_status_start = ha->adapt->hw_status_start; 5236 phys_status_start = ha->adapt->hw_status_start;
5273 outl(cpu_to_le32(phys_status_start), ha->io_addr + IPS_REG_SQSR); 5237 outl(phys_status_start, ha->io_addr + IPS_REG_SQSR);
5274 outl(cpu_to_le32(phys_status_start + IPS_STATUS_Q_SIZE), 5238 outl(phys_status_start + IPS_STATUS_Q_SIZE,
5275 ha->io_addr + IPS_REG_SQER); 5239 ha->io_addr + IPS_REG_SQER);
5276 outl(cpu_to_le32(phys_status_start + IPS_STATUS_SIZE), 5240 outl(phys_status_start + IPS_STATUS_SIZE,
5277 ha->io_addr + IPS_REG_SQHR); 5241 ha->io_addr + IPS_REG_SQHR);
5278 outl(cpu_to_le32(phys_status_start), ha->io_addr + IPS_REG_SQTR); 5242 outl(phys_status_start, ha->io_addr + IPS_REG_SQTR);
5279 5243
5280 ha->adapt->hw_status_tail = phys_status_start; 5244 ha->adapt->hw_status_tail = phys_status_start;
5281} 5245}
@@ -5332,7 +5296,7 @@ ips_statupd_copperhead(ips_ha_t * ha)
5332 ha->adapt->hw_status_tail = ha->adapt->hw_status_start; 5296 ha->adapt->hw_status_tail = ha->adapt->hw_status_start;
5333 } 5297 }
5334 5298
5335 outl(cpu_to_le32(ha->adapt->hw_status_tail), 5299 outl(ha->adapt->hw_status_tail,
5336 ha->io_addr + IPS_REG_SQTR); 5300 ha->io_addr + IPS_REG_SQTR);
5337 5301
5338 return (ha->adapt->p_status_tail->value); 5302 return (ha->adapt->p_status_tail->value);
@@ -5434,8 +5398,8 @@ ips_issue_copperhead(ips_ha_t * ha, ips_scb_t * scb)
5434 } /* end if */ 5398 } /* end if */
5435 } /* end while */ 5399 } /* end while */
5436 5400
5437 outl(cpu_to_le32(scb->scb_busaddr), ha->io_addr + IPS_REG_CCSAR); 5401 outl(scb->scb_busaddr, ha->io_addr + IPS_REG_CCSAR);
5438 outw(cpu_to_le32(IPS_BIT_START_CMD), ha->io_addr + IPS_REG_CCCR); 5402 outw(IPS_BIT_START_CMD, ha->io_addr + IPS_REG_CCCR);
5439 5403
5440 return (IPS_SUCCESS); 5404 return (IPS_SUCCESS);
5441} 5405}
@@ -5520,7 +5484,7 @@ ips_issue_i2o(ips_ha_t * ha, ips_scb_t * scb)
5520 ips_name, ha->host_num, scb->cmd.basic_io.command_id); 5484 ips_name, ha->host_num, scb->cmd.basic_io.command_id);
5521 } 5485 }
5522 5486
5523 outl(cpu_to_le32(scb->scb_busaddr), ha->io_addr + IPS_REG_I2O_INMSGQ); 5487 outl(scb->scb_busaddr, ha->io_addr + IPS_REG_I2O_INMSGQ);
5524 5488
5525 return (IPS_SUCCESS); 5489 return (IPS_SUCCESS);
5526} 5490}
@@ -6412,7 +6376,7 @@ ips_program_bios(ips_ha_t * ha, char *buffer, uint32_t buffersize,
6412 6376
6413 for (i = 0; i < buffersize; i++) { 6377 for (i = 0; i < buffersize; i++) {
6414 /* write a byte */ 6378 /* write a byte */
6415 outl(cpu_to_le32(i + offset), ha->io_addr + IPS_REG_FLAP); 6379 outl(i + offset, ha->io_addr + IPS_REG_FLAP);
6416 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) 6380 if (ha->pcidev->revision == IPS_REVID_TROMBONE64)
6417 udelay(25); /* 25 us */ 6381 udelay(25); /* 25 us */
6418 6382
@@ -6597,7 +6561,7 @@ ips_verify_bios(ips_ha_t * ha, char *buffer, uint32_t buffersize,
6597 if (inb(ha->io_addr + IPS_REG_FLDP) != 0x55) 6561 if (inb(ha->io_addr + IPS_REG_FLDP) != 0x55)
6598 return (1); 6562 return (1);
6599 6563
6600 outl(cpu_to_le32(1), ha->io_addr + IPS_REG_FLAP); 6564 outl(1, ha->io_addr + IPS_REG_FLAP);
6601 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) 6565 if (ha->pcidev->revision == IPS_REVID_TROMBONE64)
6602 udelay(25); /* 25 us */ 6566 udelay(25); /* 25 us */
6603 if (inb(ha->io_addr + IPS_REG_FLDP) != 0xAA) 6567 if (inb(ha->io_addr + IPS_REG_FLDP) != 0xAA)
@@ -6606,7 +6570,7 @@ ips_verify_bios(ips_ha_t * ha, char *buffer, uint32_t buffersize,
6606 checksum = 0xff; 6570 checksum = 0xff;
6607 for (i = 2; i < buffersize; i++) { 6571 for (i = 2; i < buffersize; i++) {
6608 6572
6609 outl(cpu_to_le32(i + offset), ha->io_addr + IPS_REG_FLAP); 6573 outl(i + offset, ha->io_addr + IPS_REG_FLAP);
6610 if (ha->pcidev->revision == IPS_REVID_TROMBONE64) 6574 if (ha->pcidev->revision == IPS_REVID_TROMBONE64)
6611 udelay(25); /* 25 us */ 6575 udelay(25); /* 25 us */
6612 6576
@@ -6842,7 +6806,6 @@ ips_register_scsi(int index)
6842 sh->sg_tablesize = sh->hostt->sg_tablesize; 6806 sh->sg_tablesize = sh->hostt->sg_tablesize;
6843 sh->can_queue = sh->hostt->can_queue; 6807 sh->can_queue = sh->hostt->can_queue;
6844 sh->cmd_per_lun = sh->hostt->cmd_per_lun; 6808 sh->cmd_per_lun = sh->hostt->cmd_per_lun;
6845 sh->unchecked_isa_dma = sh->hostt->unchecked_isa_dma;
6846 sh->use_clustering = sh->hostt->use_clustering; 6809 sh->use_clustering = sh->hostt->use_clustering;
6847 sh->max_sectors = 128; 6810 sh->max_sectors = 128;
6848 6811