aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/sata_promise.c
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2005-10-30 04:44:42 -0500
committerJeff Garzik <jgarzik@pobox.com>2005-10-30 04:44:42 -0500
commita7dac447bb9cef27d4d29cdf63e2d7809c50b1f4 (patch)
treea8935490cdd374aba3a804ba9f79d1aed67db36d /drivers/scsi/sata_promise.c
parent81cfb8864c73230eb1c37753aba517db15cf4d8f (diff)
[libata] change ata_qc_complete() to take error mask as second arg
The second argument to ata_qc_complete() was being used for two purposes: communicate the ATA Status register to the completion function, and indicate an error. On legacy PCI IDE hardware, the latter is often implicit in the former. On more modern hardware, the driver often completely emulated a Status register value, passing ATA_ERR as an indication that something went wrong. Now that previous code changes have eliminated the need to use drv_stat arg to communicate the ATA Status register value, we can convert it to a mask of possible error classes. This will lead to more flexible error handling in the future.
Diffstat (limited to 'drivers/scsi/sata_promise.c')
-rw-r--r--drivers/scsi/sata_promise.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c
index 63911f16b6ec..8f41702275db 100644
--- a/drivers/scsi/sata_promise.c
+++ b/drivers/scsi/sata_promise.c
@@ -399,7 +399,8 @@ static void pdc_eng_timeout(struct ata_port *ap)
399 case ATA_PROT_DMA: 399 case ATA_PROT_DMA:
400 case ATA_PROT_NODATA: 400 case ATA_PROT_NODATA:
401 printk(KERN_ERR "ata%u: command timeout\n", ap->id); 401 printk(KERN_ERR "ata%u: command timeout\n", ap->id);
402 ata_qc_complete(qc, ata_wait_idle(ap) | ATA_ERR); 402 drv_stat = ata_wait_idle(ap);
403 ata_qc_complete(qc, __ac_err_mask(drv_stat));
403 break; 404 break;
404 405
405 default: 406 default:
@@ -408,7 +409,7 @@ static void pdc_eng_timeout(struct ata_port *ap)
408 printk(KERN_ERR "ata%u: unknown timeout, cmd 0x%x stat 0x%x\n", 409 printk(KERN_ERR "ata%u: unknown timeout, cmd 0x%x stat 0x%x\n",
409 ap->id, qc->tf.command, drv_stat); 410 ap->id, qc->tf.command, drv_stat);
410 411
411 ata_qc_complete(qc, drv_stat); 412 ata_qc_complete(qc, ac_err_mask(drv_stat));
412 break; 413 break;
413 } 414 }
414 415
@@ -420,24 +421,21 @@ out:
420static inline unsigned int pdc_host_intr( struct ata_port *ap, 421static inline unsigned int pdc_host_intr( struct ata_port *ap,
421 struct ata_queued_cmd *qc) 422 struct ata_queued_cmd *qc)
422{ 423{
423 u8 status; 424 unsigned int handled = 0, err_mask = 0;
424 unsigned int handled = 0, have_err = 0;
425 u32 tmp; 425 u32 tmp;
426 void __iomem *mmio = (void __iomem *) ap->ioaddr.cmd_addr + PDC_GLOBAL_CTL; 426 void __iomem *mmio = (void __iomem *) ap->ioaddr.cmd_addr + PDC_GLOBAL_CTL;
427 427
428 tmp = readl(mmio); 428 tmp = readl(mmio);
429 if (tmp & PDC_ERR_MASK) { 429 if (tmp & PDC_ERR_MASK) {
430 have_err = 1; 430 err_mask = AC_ERR_DEV;
431 pdc_reset_port(ap); 431 pdc_reset_port(ap);
432 } 432 }
433 433
434 switch (qc->tf.protocol) { 434 switch (qc->tf.protocol) {
435 case ATA_PROT_DMA: 435 case ATA_PROT_DMA:
436 case ATA_PROT_NODATA: 436 case ATA_PROT_NODATA:
437 status = ata_wait_idle(ap); 437 err_mask |= ac_err_mask(ata_wait_idle(ap));
438 if (have_err) 438 ata_qc_complete(qc, err_mask);
439 status |= ATA_ERR;
440 ata_qc_complete(qc, status);
441 handled = 1; 439 handled = 1;
442 break; 440 break;
443 441