[SCSI] Remove SUGGEST flags
[safe/jmp/linux-2.6] / drivers / scsi / ips.c
index b1b2295..457d76a 100644 (file)
 #include <asm/byteorder.h>
 #include <asm/page.h>
 #include <linux/stddef.h>
-#include <linux/version.h>
 #include <linux/string.h>
 #include <linux/errno.h>
 #include <linux/kernel.h>
@@ -1005,8 +1004,7 @@ static int __ips_eh_reset(struct scsi_cmnd *SC)
        DEBUG_VAR(1, "(%s%d) Failing active commands", ips_name, ha->host_num);
 
        while ((scb = ips_removeq_scb_head(&ha->scb_activelist))) {
-               scb->scsi_cmd->result =
-                   (DID_RESET << 16) | (SUGGEST_RETRY << 24);
+               scb->scsi_cmd->result = DID_RESET << 16;
                scb->scsi_cmd->scsi_done(scb->scsi_cmd);
                ips_freescb(ha, scb);
        }
@@ -1309,7 +1307,7 @@ ips_intr_copperhead(ips_ha_t * ha)
                        cstatus.value = (*ha->func.statupd) (ha);
 
                if (cstatus.fields.command_id > (IPS_MAX_CMDS - 1)) {
-                       /* Spurious Interupt ? */
+                       /* Spurious Interrupt ? */
                        continue;
                }
 
@@ -1576,7 +1574,7 @@ ips_make_passthru(ips_ha_t *ha, struct scsi_cmnd *SC, ips_scb_t *scb, int intr)
        METHOD_TRACE("ips_make_passthru", 1);
 
         scsi_for_each_sg(SC, sg, scsi_sg_count(SC), i)
-                length += sg[i].length;
+               length += sg->length;
 
        if (length < sizeof (ips_passthru_t)) {
                /* wrong size */
@@ -2377,7 +2375,7 @@ ips_get_bios_version(ips_ha_t * ha, int intr)
                        if (inb(ha->io_addr + IPS_REG_FLDP) != 0x55)
                                return;
 
-                       outl(cpu_to_le32(1), ha->io_addr + IPS_REG_FLAP);
+                       outl(1, ha->io_addr + IPS_REG_FLAP);
                        if (ha->pcidev->revision == IPS_REVID_TROMBONE64)
                                udelay(25);     /* 25 us */
 
@@ -2385,21 +2383,21 @@ ips_get_bios_version(ips_ha_t * ha, int intr)
                                return;
 
                        /* Get Major version */
-                       outl(cpu_to_le32(0x1FF), ha->io_addr + IPS_REG_FLAP);
+                       outl(0x1FF, ha->io_addr + IPS_REG_FLAP);
                        if (ha->pcidev->revision == IPS_REVID_TROMBONE64)
                                udelay(25);     /* 25 us */
 
                        major = inb(ha->io_addr + IPS_REG_FLDP);
 
                        /* Get Minor version */
-                       outl(cpu_to_le32(0x1FE), ha->io_addr + IPS_REG_FLAP);
+                       outl(0x1FE, ha->io_addr + IPS_REG_FLAP);
                        if (ha->pcidev->revision == IPS_REVID_TROMBONE64)
                                udelay(25);     /* 25 us */
 
                        minor = inb(ha->io_addr + IPS_REG_FLDP);
 
                        /* Get SubMinor version */
-                       outl(cpu_to_le32(0x1FD), ha->io_addr + IPS_REG_FLAP);
+                       outl(0x1FD, ha->io_addr + IPS_REG_FLAP);
                        if (ha->pcidev->revision == IPS_REVID_TROMBONE64)
                                udelay(25);     /* 25 us */
 
@@ -3433,13 +3431,11 @@ ips_map_status(ips_ha_t * ha, ips_scb_t * scb, ips_stat_t * sp)
                                            (IPS_DCDB_TABLE_TAPE *) & scb->dcdb;
                                        memcpy(scb->scsi_cmd->sense_buffer,
                                               tapeDCDB->sense_info,
-                                              sizeof (scb->scsi_cmd->
-                                                      sense_buffer));
+                                              SCSI_SENSE_BUFFERSIZE);
                                } else {
                                        memcpy(scb->scsi_cmd->sense_buffer,
                                               scb->dcdb.sense_info,
-                                              sizeof (scb->scsi_cmd->
-                                                      sense_buffer));
+                                              SCSI_SENSE_BUFFERSIZE);
                                }
                                device_error = 2;       /* check condition */
                        }
@@ -3504,27 +3500,11 @@ ips_send_wait(ips_ha_t * ha, ips_scb_t * scb, int timeout, int intr)
 static void
 ips_scmd_buf_write(struct scsi_cmnd *scmd, void *data, unsigned int count)
 {
-        int i;
-        unsigned int min_cnt, xfer_cnt;
-        char *cdata = (char *) data;
-        unsigned char *buffer;
-        unsigned long flags;
-        struct scatterlist *sg = scsi_sglist(scmd);
-
-        for (i = 0, xfer_cnt = 0;
-             (i < scsi_sg_count(scmd)) && (xfer_cnt < count); i++) {
-                min_cnt = min(count - xfer_cnt, sg[i].length);
-
-                /* kmap_atomic() ensures addressability of the data buffer.*/
-                /* local_irq_save() protects the KM_IRQ0 address slot.     */
-                local_irq_save(flags);
-                buffer = kmap_atomic(sg_page(&sg[i]), KM_IRQ0) + sg[i].offset;
-                memcpy(buffer, &cdata[xfer_cnt], min_cnt);
-                kunmap_atomic(buffer - sg[i].offset, KM_IRQ0);
-                local_irq_restore(flags);
+       unsigned long flags;
 
-                xfer_cnt += min_cnt;
-        }
+       local_irq_save(flags);
+       scsi_sg_copy_from_buffer(scmd, data, count);
+       local_irq_restore(flags);
 }
 
 /****************************************************************************/
@@ -3537,27 +3517,11 @@ ips_scmd_buf_write(struct scsi_cmnd *scmd, void *data, unsigned int count)
 static void
 ips_scmd_buf_read(struct scsi_cmnd *scmd, void *data, unsigned int count)
 {
-        int i;
-        unsigned int min_cnt, xfer_cnt;
-        char *cdata = (char *) data;
-        unsigned char *buffer;
-        unsigned long flags;
-        struct scatterlist *sg = scsi_sglist(scmd);
-
-        for (i = 0, xfer_cnt = 0;
-             (i < scsi_sg_count(scmd)) && (xfer_cnt < count); i++) {
-                min_cnt = min(count - xfer_cnt, sg[i].length);
-
-                /* kmap_atomic() ensures addressability of the data buffer.*/
-                /* local_irq_save() protects the KM_IRQ0 address slot.     */
-                local_irq_save(flags);
-                buffer = kmap_atomic(sg_page(&sg[i]), KM_IRQ0) + sg[i].offset;
-                memcpy(&cdata[xfer_cnt], buffer, min_cnt);
-                kunmap_atomic(buffer - sg[i].offset, KM_IRQ0);
-                local_irq_restore(flags);
+       unsigned long flags;
 
-                xfer_cnt += min_cnt;
-        }
+       local_irq_save(flags);
+       scsi_sg_copy_to_buffer(scmd, data, count);
+       local_irq_restore(flags);
 }
 
 /****************************************************************************/
@@ -3698,9 +3662,7 @@ ips_send_cmd(ips_ha_t * ha, ips_scb_t * scb)
                        scb->cmd.basic_io.sg_count = scb->sg_len;
 
                        if (scb->cmd.basic_io.lba)
-                               scb->cmd.basic_io.lba =
-                                   cpu_to_le32(le32_to_cpu
-                                               (scb->cmd.basic_io.lba) +
+                               le32_add_cpu(&scb->cmd.basic_io.lba,
                                                le16_to_cpu(scb->cmd.basic_io.
                                                            sector_count));
                        else
@@ -3746,9 +3708,7 @@ ips_send_cmd(ips_ha_t * ha, ips_scb_t * scb)
                        scb->cmd.basic_io.sg_count = scb->sg_len;
 
                        if (scb->cmd.basic_io.lba)
-                               scb->cmd.basic_io.lba =
-                                   cpu_to_le32(le32_to_cpu
-                                               (scb->cmd.basic_io.lba) +
+                               le32_add_cpu(&scb->cmd.basic_io.lba,
                                                le16_to_cpu(scb->cmd.basic_io.
                                                            sector_count));
                        else
@@ -3857,7 +3817,7 @@ ips_send_cmd(ips_ha_t * ha, ips_scb_t * scb)
                scb->cmd.dcdb.segment_4G = 0;
                scb->cmd.dcdb.enhanced_sg = 0;
 
-               TimeOut = scb->scsi_cmd->timeout_per_command;
+               TimeOut = scb->scsi_cmd->request->timeout;
 
                if (ha->subsys->param[4] & 0x00100000) {        /* If NEW Tape DCDB is Supported */
                        if (!scb->sg_len) {
@@ -4890,7 +4850,7 @@ ips_init_copperhead(ips_ha_t * ha)
                return (0);
 
        /* setup CCCR */
-       outl(cpu_to_le32(0x1010), ha->io_addr + IPS_REG_CCCR);
+       outl(0x1010, ha->io_addr + IPS_REG_CCCR);
 
        /* Enable busmastering */
        outb(IPS_BIT_EBM, ha->io_addr + IPS_REG_SCPR);
@@ -5272,12 +5232,12 @@ ips_statinit(ips_ha_t * ha)
        ha->adapt->p_status_tail = ha->adapt->status;
 
        phys_status_start = ha->adapt->hw_status_start;
-       outl(cpu_to_le32(phys_status_start), ha->io_addr + IPS_REG_SQSR);
-       outl(cpu_to_le32(phys_status_start + IPS_STATUS_Q_SIZE),
+       outl(phys_status_start, ha->io_addr + IPS_REG_SQSR);
+       outl(phys_status_start + IPS_STATUS_Q_SIZE,
             ha->io_addr + IPS_REG_SQER);
-       outl(cpu_to_le32(phys_status_start + IPS_STATUS_SIZE),
+       outl(phys_status_start + IPS_STATUS_SIZE,
             ha->io_addr + IPS_REG_SQHR);
-       outl(cpu_to_le32(phys_status_start), ha->io_addr + IPS_REG_SQTR);
+       outl(phys_status_start, ha->io_addr + IPS_REG_SQTR);
 
        ha->adapt->hw_status_tail = phys_status_start;
 }
@@ -5334,7 +5294,7 @@ ips_statupd_copperhead(ips_ha_t * ha)
                ha->adapt->hw_status_tail = ha->adapt->hw_status_start;
        }
 
-       outl(cpu_to_le32(ha->adapt->hw_status_tail),
+       outl(ha->adapt->hw_status_tail,
             ha->io_addr + IPS_REG_SQTR);
 
        return (ha->adapt->p_status_tail->value);
@@ -5436,8 +5396,8 @@ ips_issue_copperhead(ips_ha_t * ha, ips_scb_t * scb)
                }               /* end if */
        }                       /* end while */
 
-       outl(cpu_to_le32(scb->scb_busaddr), ha->io_addr + IPS_REG_CCSAR);
-       outw(cpu_to_le32(IPS_BIT_START_CMD), ha->io_addr + IPS_REG_CCCR);
+       outl(scb->scb_busaddr, ha->io_addr + IPS_REG_CCSAR);
+       outw(IPS_BIT_START_CMD, ha->io_addr + IPS_REG_CCCR);
 
        return (IPS_SUCCESS);
 }
@@ -5522,7 +5482,7 @@ ips_issue_i2o(ips_ha_t * ha, ips_scb_t * scb)
                          ips_name, ha->host_num, scb->cmd.basic_io.command_id);
        }
 
-       outl(cpu_to_le32(scb->scb_busaddr), ha->io_addr + IPS_REG_I2O_INMSGQ);
+       outl(scb->scb_busaddr, ha->io_addr + IPS_REG_I2O_INMSGQ);
 
        return (IPS_SUCCESS);
 }
@@ -6414,7 +6374,7 @@ ips_program_bios(ips_ha_t * ha, char *buffer, uint32_t buffersize,
 
        for (i = 0; i < buffersize; i++) {
                /* write a byte */
-               outl(cpu_to_le32(i + offset), ha->io_addr + IPS_REG_FLAP);
+               outl(i + offset, ha->io_addr + IPS_REG_FLAP);
                if (ha->pcidev->revision == IPS_REVID_TROMBONE64)
                        udelay(25);     /* 25 us */
 
@@ -6599,7 +6559,7 @@ ips_verify_bios(ips_ha_t * ha, char *buffer, uint32_t buffersize,
        if (inb(ha->io_addr + IPS_REG_FLDP) != 0x55)
                return (1);
 
-       outl(cpu_to_le32(1), ha->io_addr + IPS_REG_FLAP);
+       outl(1, ha->io_addr + IPS_REG_FLAP);
        if (ha->pcidev->revision == IPS_REVID_TROMBONE64)
                udelay(25);     /* 25 us */
        if (inb(ha->io_addr + IPS_REG_FLDP) != 0xAA)
@@ -6608,7 +6568,7 @@ ips_verify_bios(ips_ha_t * ha, char *buffer, uint32_t buffersize,
        checksum = 0xff;
        for (i = 2; i < buffersize; i++) {
 
-               outl(cpu_to_le32(i + offset), ha->io_addr + IPS_REG_FLAP);
+               outl(i + offset, ha->io_addr + IPS_REG_FLAP);
                if (ha->pcidev->revision == IPS_REVID_TROMBONE64)
                        udelay(25);     /* 25 us */
 
@@ -6844,7 +6804,6 @@ ips_register_scsi(int index)
        sh->sg_tablesize = sh->hostt->sg_tablesize;
        sh->can_queue = sh->hostt->can_queue;
        sh->cmd_per_lun = sh->hostt->cmd_per_lun;
-       sh->unchecked_isa_dma = sh->hostt->unchecked_isa_dma;
        sh->use_clustering = sh->hostt->use_clustering;
        sh->max_sectors = 128;