aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2005-10-28 15:43:16 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-10-28 15:43:16 -0400
commita21a84a375ea3783cf9a53730d643c4db24371bc (patch)
tree3880711cfe4a57629a34a9a329fcf6091266692b /drivers
parent96b88fb850cc419171f926ad04650ec509e9f543 (diff)
[libata pdc_adma] minor fixes and cleanups
Changes mostly from Mark Lord. - fix bugs in probe-time error handling - only complete qc if not NULL - check port-level polling flags
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/pdc_adma.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/drivers/scsi/pdc_adma.c b/drivers/scsi/pdc_adma.c
index 9820f272f889..7999817915c3 100644
--- a/drivers/scsi/pdc_adma.c
+++ b/drivers/scsi/pdc_adma.c
@@ -46,7 +46,7 @@
46#include <linux/libata.h> 46#include <linux/libata.h>
47 47
48#define DRV_NAME "pdc_adma" 48#define DRV_NAME "pdc_adma"
49#define DRV_VERSION "0.01" 49#define DRV_VERSION "0.03"
50 50
51/* macro to calculate base address for ATA regs */ 51/* macro to calculate base address for ATA regs */
52#define ADMA_ATA_REGS(base,port_no) ((base) + ((port_no) * 0x40)) 52#define ADMA_ATA_REGS(base,port_no) ((base) + ((port_no) * 0x40))
@@ -79,7 +79,6 @@ enum {
79 aNIEN = (1 << 8), /* irq mask: 1==masked */ 79 aNIEN = (1 << 8), /* irq mask: 1==masked */
80 aGO = (1 << 7), /* packet trigger ("Go!") */ 80 aGO = (1 << 7), /* packet trigger ("Go!") */
81 aRSTADM = (1 << 5), /* ADMA logic reset */ 81 aRSTADM = (1 << 5), /* ADMA logic reset */
82 aRSTA = (1 << 2), /* ATA hard reset */
83 aPIOMD4 = 0x0003, /* PIO mode 4 */ 82 aPIOMD4 = 0x0003, /* PIO mode 4 */
84 83
85 /* ADMA_STATUS register bits */ 84 /* ADMA_STATUS register bits */
@@ -452,24 +451,25 @@ static inline unsigned int adma_intr_pkt(struct ata_host_set *host_set)
452 struct adma_port_priv *pp; 451 struct adma_port_priv *pp;
453 struct ata_queued_cmd *qc; 452 struct ata_queued_cmd *qc;
454 void __iomem *chan = ADMA_REGS(mmio_base, port_no); 453 void __iomem *chan = ADMA_REGS(mmio_base, port_no);
455 u8 drv_stat, status = readb(chan + ADMA_STATUS); 454 u8 drv_stat = 0, status = readb(chan + ADMA_STATUS);
456 455
457 if (status == 0) 456 if (status == 0)
458 continue; 457 continue;
459 handled = 1; 458 handled = 1;
460 adma_enter_reg_mode(ap); 459 adma_enter_reg_mode(ap);
461 if ((ap->flags & ATA_FLAG_PORT_DISABLED)) 460 if (ap->flags & (ATA_FLAG_PORT_DISABLED | ATA_FLAG_NOINTR))
462 continue; 461 continue;
463 pp = ap->private_data; 462 pp = ap->private_data;
464 if (!pp || pp->state != adma_state_pkt) 463 if (!pp || pp->state != adma_state_pkt)
465 continue; 464 continue;
466 qc = ata_qc_from_tag(ap, ap->active_tag); 465 qc = ata_qc_from_tag(ap, ap->active_tag);
467 drv_stat = 0; 466 if (qc && (!(qc->tf.ctl & ATA_NIEN))) {
468 if ((status & (aPERR | aPSD | aUIRQ))) 467 if ((status & (aPERR | aPSD | aUIRQ)))
469 drv_stat = ATA_ERR; 468 drv_stat = ATA_ERR;
470 else if (pp->pkt[0] != cDONE) 469 else if (pp->pkt[0] != cDONE)
471 drv_stat = ATA_ERR; 470 drv_stat = ATA_ERR;
472 ata_qc_complete(qc, drv_stat); 471 ata_qc_complete(qc, drv_stat);
472 }
473 } 473 }
474 return handled; 474 return handled;
475} 475}
@@ -561,15 +561,15 @@ static int adma_port_start(struct ata_port *ap)
561 if ((pp->pkt_dma & 7) != 0) { 561 if ((pp->pkt_dma & 7) != 0) {
562 printk("bad alignment for pp->pkt_dma: %08x\n", 562 printk("bad alignment for pp->pkt_dma: %08x\n",
563 (u32)pp->pkt_dma); 563 (u32)pp->pkt_dma);
564 goto err_out_kfree2; 564 dma_free_coherent(dev, ADMA_PKT_BYTES,
565 pp->pkt, pp->pkt_dma);
566 goto err_out_kfree;
565 } 567 }
566 memset(pp->pkt, 0, ADMA_PKT_BYTES); 568 memset(pp->pkt, 0, ADMA_PKT_BYTES);
567 ap->private_data = pp; 569 ap->private_data = pp;
568 adma_reinit_engine(ap); 570 adma_reinit_engine(ap);
569 return 0; 571 return 0;
570 572
571err_out_kfree2:
572 kfree(pp);
573err_out_kfree: 573err_out_kfree:
574 kfree(pp); 574 kfree(pp);
575err_out: 575err_out: