Commit bc1ebfba authored by FUJITA Tomonori's avatar FUJITA Tomonori Committed by James Bottomley

[SCSI] qlogicfas408: 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 fea97f9a
...@@ -265,8 +265,6 @@ static unsigned int ql_pcmd(struct scsi_cmnd *cmd) ...@@ -265,8 +265,6 @@ static unsigned int ql_pcmd(struct scsi_cmnd *cmd)
unsigned int message; /* scsi returned message */ unsigned int message; /* scsi returned message */
unsigned int phase; /* recorded scsi phase */ unsigned int phase; /* recorded scsi phase */
unsigned int reqlen; /* total length of transfer */ unsigned int reqlen; /* total length of transfer */
struct scatterlist *sglist; /* scatter-gather list pointer */
unsigned int sgcount; /* sg counter */
char *buf; char *buf;
struct qlogicfas408_priv *priv = get_priv_by_cmd(cmd); struct qlogicfas408_priv *priv = get_priv_by_cmd(cmd);
int qbase = priv->qbase; int qbase = priv->qbase;
...@@ -301,9 +299,10 @@ static unsigned int ql_pcmd(struct scsi_cmnd *cmd) ...@@ -301,9 +299,10 @@ static unsigned int ql_pcmd(struct scsi_cmnd *cmd)
if (inb(qbase + 7) & 0x1f) /* if some bytes in fifo */ if (inb(qbase + 7) & 0x1f) /* if some bytes in fifo */
outb(1, qbase + 3); /* clear fifo */ outb(1, qbase + 3); /* clear fifo */
/* note that request_bufflen is the total xfer size when sg is used */ /* note that request_bufflen is the total xfer size when sg is used */
reqlen = cmd->request_bufflen; reqlen = scsi_bufflen(cmd);
/* note that it won't work if transfers > 16M are requested */ /* note that it won't work if transfers > 16M are requested */
if (reqlen && !((phase = inb(qbase + 4)) & 6)) { /* data phase */ if (reqlen && !((phase = inb(qbase + 4)) & 6)) { /* data phase */
struct scatterlist *sg;
rtrc(2) rtrc(2)
outb(reqlen, qbase); /* low-mid xfer cnt */ outb(reqlen, qbase); /* low-mid xfer cnt */
outb(reqlen >> 8, qbase + 1); /* low-mid xfer cnt */ outb(reqlen >> 8, qbase + 1); /* low-mid xfer cnt */
...@@ -311,23 +310,16 @@ static unsigned int ql_pcmd(struct scsi_cmnd *cmd) ...@@ -311,23 +310,16 @@ static unsigned int ql_pcmd(struct scsi_cmnd *cmd)
outb(0x90, qbase + 3); /* command do xfer */ outb(0x90, qbase + 3); /* command do xfer */
/* PIO pseudo DMA to buffer or sglist */ /* PIO pseudo DMA to buffer or sglist */
REG1; REG1;
if (!cmd->use_sg)
ql_pdma(priv, phase, cmd->request_buffer, scsi_for_each_sg(cmd, sg, scsi_sg_count(cmd), i) {
cmd->request_bufflen);
else {
sgcount = cmd->use_sg;
sglist = cmd->request_buffer;
while (sgcount--) {
if (priv->qabort) { if (priv->qabort) {
REG0; REG0;
return ((priv->qabort == 1 ? return ((priv->qabort == 1 ?
DID_ABORT : DID_RESET) << 16); DID_ABORT : DID_RESET) << 16);
} }
buf = page_address(sglist->page) + sglist->offset; buf = page_address(sg->page) + sg->offset;
if (ql_pdma(priv, phase, buf, sglist->length)) if (ql_pdma(priv, phase, buf, sg->length))
break; break;
sglist++;
}
} }
REG0; REG0;
rtrc(2) rtrc(2)
......
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