Commit 9482ef85 authored by FUJITA Tomonori's avatar FUJITA Tomonori Committed by James Bottomley

[SCSI] sym53c500_cs: 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: default avatarFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 772a5c3f
...@@ -370,8 +370,6 @@ SYM53C500_intr(int irq, void *dev_id) ...@@ -370,8 +370,6 @@ SYM53C500_intr(int irq, void *dev_id)
DEB(unsigned char seq_reg;) DEB(unsigned char seq_reg;)
unsigned char status, int_reg; unsigned char status, int_reg;
unsigned char pio_status; unsigned char pio_status;
struct scatterlist *sglist;
unsigned int sgcount;
int port_base = dev->io_port; int port_base = dev->io_port;
struct sym53c500_data *data = struct sym53c500_data *data =
(struct sym53c500_data *)dev->hostdata; (struct sym53c500_data *)dev->hostdata;
...@@ -434,20 +432,19 @@ SYM53C500_intr(int irq, void *dev_id) ...@@ -434,20 +432,19 @@ SYM53C500_intr(int irq, void *dev_id)
switch (status & 0x07) { /* scsi phase */ switch (status & 0x07) { /* scsi phase */
case 0x00: /* DATA-OUT */ case 0x00: /* DATA-OUT */
if (int_reg & 0x10) { /* Target requesting info transfer */ if (int_reg & 0x10) { /* Target requesting info transfer */
struct scatterlist *sg;
int i;
curSC->SCp.phase = data_out; curSC->SCp.phase = data_out;
VDEB(printk("SYM53C500: Data-Out phase\n")); VDEB(printk("SYM53C500: Data-Out phase\n"));
outb(FLUSH_FIFO, port_base + CMD_REG); outb(FLUSH_FIFO, port_base + CMD_REG);
LOAD_DMA_COUNT(port_base, curSC->request_bufflen); /* Max transfer size */ LOAD_DMA_COUNT(port_base, scsi_bufflen(curSC)); /* Max transfer size */
outb(TRANSFER_INFO | DMA_OP, port_base + CMD_REG); outb(TRANSFER_INFO | DMA_OP, port_base + CMD_REG);
if (!curSC->use_sg) /* Don't use scatter-gather */
SYM53C500_pio_write(fast_pio, port_base, curSC->request_buffer, curSC->request_bufflen); scsi_for_each_sg(curSC, sg, scsi_sg_count(curSC), i) {
else { /* use scatter-gather */ SYM53C500_pio_write(fast_pio, port_base,
sgcount = curSC->use_sg; page_address(sg->page) + sg->offset,
sglist = curSC->request_buffer; sg->length);
while (sgcount--) {
SYM53C500_pio_write(fast_pio, port_base, page_address(sglist->page) + sglist->offset, sglist->length);
sglist++;
}
} }
REG0(port_base); REG0(port_base);
} }
...@@ -455,20 +452,19 @@ SYM53C500_intr(int irq, void *dev_id) ...@@ -455,20 +452,19 @@ SYM53C500_intr(int irq, void *dev_id)
case 0x01: /* DATA-IN */ case 0x01: /* DATA-IN */
if (int_reg & 0x10) { /* Target requesting info transfer */ if (int_reg & 0x10) { /* Target requesting info transfer */
struct scatterlist *sg;
int i;
curSC->SCp.phase = data_in; curSC->SCp.phase = data_in;
VDEB(printk("SYM53C500: Data-In phase\n")); VDEB(printk("SYM53C500: Data-In phase\n"));
outb(FLUSH_FIFO, port_base + CMD_REG); outb(FLUSH_FIFO, port_base + CMD_REG);
LOAD_DMA_COUNT(port_base, curSC->request_bufflen); /* Max transfer size */ LOAD_DMA_COUNT(port_base, scsi_bufflen(curSC)); /* Max transfer size */
outb(TRANSFER_INFO | DMA_OP, port_base + CMD_REG); outb(TRANSFER_INFO | DMA_OP, port_base + CMD_REG);
if (!curSC->use_sg) /* Don't use scatter-gather */
SYM53C500_pio_read(fast_pio, port_base, curSC->request_buffer, curSC->request_bufflen); scsi_for_each_sg(curSC, sg, scsi_sg_count(curSC), i) {
else { /* Use scatter-gather */ SYM53C500_pio_read(fast_pio, port_base,
sgcount = curSC->use_sg; page_address(sg->page) + sg->offset,
sglist = curSC->request_buffer; sg->length);
while (sgcount--) {
SYM53C500_pio_read(fast_pio, port_base, page_address(sglist->page) + sglist->offset, sglist->length);
sglist++;
}
} }
REG0(port_base); REG0(port_base);
} }
...@@ -578,7 +574,7 @@ SYM53C500_queue(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *)) ...@@ -578,7 +574,7 @@ SYM53C500_queue(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
DEB(printk("cmd=%02x, cmd_len=%02x, target=%02x, lun=%02x, bufflen=%d\n", DEB(printk("cmd=%02x, cmd_len=%02x, target=%02x, lun=%02x, bufflen=%d\n",
SCpnt->cmnd[0], SCpnt->cmd_len, SCpnt->device->id, SCpnt->cmnd[0], SCpnt->cmd_len, SCpnt->device->id,
SCpnt->device->lun, SCpnt->request_bufflen)); SCpnt->device->lun, scsi_bufflen(SCpnt)));
VDEB(for (i = 0; i < SCpnt->cmd_len; i++) VDEB(for (i = 0; i < SCpnt->cmd_len; i++)
printk("cmd[%d]=%02x ", i, SCpnt->cmnd[i])); printk("cmd[%d]=%02x ", i, SCpnt->cmnd[i]));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment