aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/qlogicfas408.c30
1 files changed, 11 insertions, 19 deletions
diff --git a/drivers/scsi/qlogicfas408.c b/drivers/scsi/qlogicfas408.c
index 2e7db18f5aef..2bfbf26c00ed 100644
--- a/drivers/scsi/qlogicfas408.c
+++ b/drivers/scsi/qlogicfas408.c
@@ -265,8 +265,6 @@ static unsigned int ql_pcmd(struct scsi_cmnd *cmd)
265 unsigned int message; /* scsi returned message */ 265 unsigned int message; /* scsi returned message */
266 unsigned int phase; /* recorded scsi phase */ 266 unsigned int phase; /* recorded scsi phase */
267 unsigned int reqlen; /* total length of transfer */ 267 unsigned int reqlen; /* total length of transfer */
268 struct scatterlist *sglist; /* scatter-gather list pointer */
269 unsigned int sgcount; /* sg counter */
270 char *buf; 268 char *buf;
271 struct qlogicfas408_priv *priv = get_priv_by_cmd(cmd); 269 struct qlogicfas408_priv *priv = get_priv_by_cmd(cmd);
272 int qbase = priv->qbase; 270 int qbase = priv->qbase;
@@ -301,9 +299,10 @@ static unsigned int ql_pcmd(struct scsi_cmnd *cmd)
301 if (inb(qbase + 7) & 0x1f) /* if some bytes in fifo */ 299 if (inb(qbase + 7) & 0x1f) /* if some bytes in fifo */
302 outb(1, qbase + 3); /* clear fifo */ 300 outb(1, qbase + 3); /* clear fifo */
303 /* note that request_bufflen is the total xfer size when sg is used */ 301 /* note that request_bufflen is the total xfer size when sg is used */
304 reqlen = cmd->request_bufflen; 302 reqlen = scsi_bufflen(cmd);
305 /* note that it won't work if transfers > 16M are requested */ 303 /* note that it won't work if transfers > 16M are requested */
306 if (reqlen && !((phase = inb(qbase + 4)) & 6)) { /* data phase */ 304 if (reqlen && !((phase = inb(qbase + 4)) & 6)) { /* data phase */
305 struct scatterlist *sg;
307 rtrc(2) 306 rtrc(2)
308 outb(reqlen, qbase); /* low-mid xfer cnt */ 307 outb(reqlen, qbase); /* low-mid xfer cnt */
309 outb(reqlen >> 8, qbase + 1); /* low-mid xfer cnt */ 308 outb(reqlen >> 8, qbase + 1); /* low-mid xfer cnt */
@@ -311,23 +310,16 @@ static unsigned int ql_pcmd(struct scsi_cmnd *cmd)
311 outb(0x90, qbase + 3); /* command do xfer */ 310 outb(0x90, qbase + 3); /* command do xfer */
312 /* PIO pseudo DMA to buffer or sglist */ 311 /* PIO pseudo DMA to buffer or sglist */
313 REG1; 312 REG1;
314 if (!cmd->use_sg) 313
315 ql_pdma(priv, phase, cmd->request_buffer, 314 scsi_for_each_sg(cmd, sg, scsi_sg_count(cmd), i) {
316 cmd->request_bufflen); 315 if (priv->qabort) {
317 else { 316 REG0;
318 sgcount = cmd->use_sg; 317 return ((priv->qabort == 1 ?
319 sglist = cmd->request_buffer; 318 DID_ABORT : DID_RESET) << 16);
320 while (sgcount--) {
321 if (priv->qabort) {
322 REG0;
323 return ((priv->qabort == 1 ?
324 DID_ABORT : DID_RESET) << 16);
325 }
326 buf = page_address(sglist->page) + sglist->offset;
327 if (ql_pdma(priv, phase, buf, sglist->length))
328 break;
329 sglist++;
330 } 319 }
320 buf = page_address(sg->page) + sg->offset;
321 if (ql_pdma(priv, phase, buf, sg->length))
322 break;
331 } 323 }
332 REG0; 324 REG0;
333 rtrc(2) 325 rtrc(2)