X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=inline;f=drivers%2Fscsi%2Fips.c;h=7c615c70ec5c236f7416f9466f2cd5a920c5e865;hb=04489eeb02a40bc15029886cef7285ada3ab0de6;hp=62640366845aaa98ef70c4915f28e7a6f79e8f0b;hpb=9924a781f3e746ba5aa54cf96ca462b8d0915221;p=linux-2.6 diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c index 6264036684..7c615c70ec 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) 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 +2385,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 */ @@ -3502,28 +3502,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++, sg = sg_next(sg)) { - min_cnt = min(count - xfer_cnt, sg->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), KM_IRQ0) + sg->offset; - memcpy(buffer, &cdata[xfer_cnt], min_cnt); - kunmap_atomic(buffer - sg->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); } /****************************************************************************/ @@ -3536,28 +3519,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++, sg = sg_next(sg)) { - min_cnt = min(count - xfer_cnt, sg->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), KM_IRQ0) + sg->offset; - memcpy(&cdata[xfer_cnt], buffer, min_cnt); - kunmap_atomic(buffer - sg->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 +3664,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 +3710,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 @@ -4890,7 +4852,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 +5234,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 +5296,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 +5398,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 +5484,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 +6376,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 +6561,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 +6570,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 */