ChangeSet 1.2042, 2005/02/22 21:19:43-05:00, [EMAIL PROTECTED]

        Merge pobox.com:/garz/repo/linux-2.6
        into pobox.com:/garz/repo/libata-2.6



 libata-core.c |   86 ++++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 75 insertions(+), 11 deletions(-)


diff -Nru a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
--- a/drivers/scsi/libata-core.c        2005-02-23 15:07:42 -08:00
+++ b/drivers/scsi/libata-core.c        2005-02-23 15:07:42 -08:00
@@ -2601,10 +2601,10 @@
 
        case ATA_PROT_DMA:
        case ATA_PROT_ATAPI_DMA:
-               host_stat = ata_bmdma_status(ap);
+               host_stat = ap->ops->bmdma_status(ap);
 
                /* before we do anything else, clear DMA-Start bit */
-               ata_bmdma_stop(ap);
+               ap->ops->bmdma_stop(ap);
 
                /* fall through */
 
@@ -2613,7 +2613,7 @@
                drv_stat = ata_chk_status(ap);
 
                /* ack bmdma irq events */
-               ata_bmdma_ack_irq(ap);
+               ap->ops->irq_clear(ap);
 
                printk(KERN_ERR "ata%u: command 0x%x timeout, stat 0x%x 
host_stat 0x%x\n",
                       ap->id, qc->tf.command, drv_stat, host_stat);
@@ -2752,6 +2752,24 @@
 }
 
 /**
+ *     ata_qc_free - free unused ata_queued_cmd
+ *     @qc: Command to complete
+ *
+ *     Designed to free unused ata_queued_cmd object
+ *     in case something prevents using it.
+ *
+ *     LOCKING:
+ *
+ */
+void ata_qc_free(struct ata_queued_cmd *qc)
+{
+       assert(qc != NULL);     /* ata_qc_from_tag _might_ return NULL */
+       assert(qc->waiting == NULL);    /* nothing should be waiting */
+
+       __ata_qc_complete(qc);
+}
+
+/**
  *     ata_qc_complete - Complete an active ATA command
  *     @qc: Command to complete
  *     @drv_stat: ATA status register contents
@@ -3042,7 +3060,43 @@
 
 void ata_bmdma_irq_clear(struct ata_port *ap)
 {
-       ata_bmdma_ack_irq(ap);
+    if (ap->flags & ATA_FLAG_MMIO) {
+        void __iomem *mmio = ((void __iomem *) ap->ioaddr.bmdma_addr) + 
ATA_DMA_STATUS;
+        writeb(readb(mmio), mmio);
+    } else {
+        unsigned long addr = ap->ioaddr.bmdma_addr + ATA_DMA_STATUS;
+        outb(inb(addr), addr);
+    }
+
+}
+
+u8 ata_bmdma_status(struct ata_port *ap)
+{
+       u8 host_stat;
+       if (ap->flags & ATA_FLAG_MMIO) {
+               void __iomem *mmio = (void __iomem *) ap->ioaddr.bmdma_addr;
+               host_stat = readb(mmio + ATA_DMA_STATUS);
+       } else
+       host_stat = inb(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);
+       return host_stat;
+}
+
+void ata_bmdma_stop(struct ata_port *ap)
+{
+       if (ap->flags & ATA_FLAG_MMIO) {
+               void __iomem *mmio = (void __iomem *) ap->ioaddr.bmdma_addr;
+
+               /* clear start/stop bit */
+               writeb(readb(mmio + ATA_DMA_CMD) & ~ATA_DMA_START,
+                       mmio + ATA_DMA_CMD);
+       } else {
+               /* clear start/stop bit */
+               outb(inb(ap->ioaddr.bmdma_addr + ATA_DMA_CMD) & ~ATA_DMA_START,
+                       ap->ioaddr.bmdma_addr + ATA_DMA_CMD);
+       }
+
+       /* one-PIO-cycle guaranteed wait, per spec, for HDMA1:0 transition */
+       ata_altstatus(ap);        /* dummy read */
 }
 
 /**
@@ -3072,7 +3126,7 @@
        case ATA_PROT_ATAPI_DMA:
        case ATA_PROT_ATAPI:
                /* check status of DMA engine */
-               host_stat = ata_bmdma_status(ap);
+               host_stat = ap->ops->bmdma_status(ap);
                VPRINTK("ata%u: host_stat 0x%X\n", ap->id, host_stat);
 
                /* if it's not our irq... */
@@ -3080,7 +3134,7 @@
                        goto idle_irq;
 
                /* before we do anything else, clear DMA-Start bit */
-               ata_bmdma_stop(ap);
+               ap->ops->bmdma_stop(ap);
 
                /* fall through */
 
@@ -3099,7 +3153,7 @@
                        ap->id, qc->tf.protocol, status);
 
                /* ack bmdma irq events */
-               ata_bmdma_ack_irq(ap);
+               ap->ops->irq_clear(ap);
 
                /* complete taskfile transaction */
                ata_qc_complete(qc, status);
@@ -3656,6 +3710,7 @@
        struct ata_port_info *port[2];
        u8 tmp8, mask;
        unsigned int legacy_mode = 0;
+       int disable_dev_on_err = 1;
        int rc;
 
        DPRINTK("ENTER\n");
@@ -3686,8 +3741,10 @@
                return rc;
 
        rc = pci_request_regions(pdev, DRV_NAME);
-       if (rc)
+       if (rc) {
+               disable_dev_on_err = 0;
                goto err_out;
+       }
 
        if (legacy_mode) {
                if (!request_region(0x1f0, 8, "libata")) {
@@ -3697,8 +3754,10 @@
                        conflict = ____request_resource(&ioport_resource, &res);
                        if (!strcmp(conflict->name, "libata"))
                                legacy_mode |= (1 << 0);
-                       else
+                       else {
+                               disable_dev_on_err = 0;
                                printk(KERN_WARNING "ata: 0x1f0 IDE port 
busy\n");
+                       }
                } else
                        legacy_mode |= (1 << 0);
 
@@ -3709,8 +3768,10 @@
                        conflict = ____request_resource(&ioport_resource, &res);
                        if (!strcmp(conflict->name, "libata"))
                                legacy_mode |= (1 << 1);
-                       else
+                       else {
+                               disable_dev_on_err = 0;
                                printk(KERN_WARNING "ata: 0x170 IDE port 
busy\n");
+                       }
                } else
                        legacy_mode |= (1 << 1);
        }
@@ -3760,7 +3821,8 @@
                release_region(0x170, 8);
        pci_release_regions(pdev);
 err_out:
-       pci_disable_device(pdev);
+       if (disable_dev_on_err)
+               pci_disable_device(pdev);
        return rc;
 }
 
@@ -3918,6 +3980,8 @@
 EXPORT_SYMBOL_GPL(ata_bmdma_setup);
 EXPORT_SYMBOL_GPL(ata_bmdma_start);
 EXPORT_SYMBOL_GPL(ata_bmdma_irq_clear);
+EXPORT_SYMBOL_GPL(ata_bmdma_status);
+EXPORT_SYMBOL_GPL(ata_bmdma_stop);
 EXPORT_SYMBOL_GPL(ata_port_probe);
 EXPORT_SYMBOL_GPL(sata_phy_reset);
 EXPORT_SYMBOL_GPL(__sata_phy_reset);
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to