Merge branch 'linus' into cont_syslog
[safe/jmp/linux-2.6] / drivers / ata / pdc_adma.c
index 6a4654e..adbe042 100644 (file)
@@ -34,6 +34,7 @@
 
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/gfp.h>
 #include <linux/pci.h>
 #include <linux/init.h>
 #include <linux/blkdev.h>
@@ -131,7 +132,6 @@ struct adma_port_priv {
 static int adma_ata_init_one(struct pci_dev *pdev,
                                const struct pci_device_id *ent);
 static int adma_port_start(struct ata_port *ap);
-static void adma_host_stop(struct ata_host *host);
 static void adma_port_stop(struct ata_port *ap);
 static void adma_qc_prep(struct ata_queued_cmd *qc);
 static unsigned int adma_qc_issue(struct ata_queued_cmd *qc);
@@ -149,6 +149,8 @@ static struct scsi_host_template adma_ata_sht = {
 static struct ata_port_operations adma_ata_ops = {
        .inherits               = &ata_sff_port_ops,
 
+       .lost_interrupt         = ATA_OP_NULL,
+
        .check_atapi_dma        = adma_check_atapi_dma,
        .qc_prep                = adma_qc_prep,
        .qc_issue               = adma_qc_issue,
@@ -159,7 +161,6 @@ static struct ata_port_operations adma_ata_ops = {
 
        .port_start             = adma_port_start,
        .port_stop              = adma_port_stop,
-       .host_stop              = adma_host_stop,
 };
 
 static struct ata_port_info adma_port_info[] = {
@@ -168,7 +169,7 @@ static struct ata_port_info adma_port_info[] = {
                .flags          = ATA_FLAG_SLAVE_POSS |
                                  ATA_FLAG_NO_LEGACY | ATA_FLAG_MMIO |
                                  ATA_FLAG_PIO_POLLING,
-               .pio_mask       = 0x10, /* pio4 */
+               .pio_mask       = ATA_PIO4_ONLY,
                .udma_mask      = ATA_UDMA4,
                .port_ops       = &adma_ata_ops,
        },
@@ -210,7 +211,7 @@ static void adma_reinit_engine(struct ata_port *ap)
 
        /* mask/clear ATA interrupts */
        writeb(ATA_NIEN, ap->ioaddr.ctl_addr);
-       ata_check_status(ap);
+       ata_sff_check_status(ap);
 
        /* reset the ADMA engine */
        adma_reset_engine(ap);
@@ -245,7 +246,7 @@ static void adma_freeze(struct ata_port *ap)
 
        /* mask/clear ATA interrupts */
        writeb(ATA_NIEN, ap->ioaddr.ctl_addr);
-       ata_check_status(ap);
+       ata_sff_check_status(ap);
 
        /* reset ADMA to idle state */
        writew(aPIOMD4 | aNIEN | aRSTADM, chan + ADMA_CONTROL);
@@ -268,7 +269,7 @@ static int adma_prereset(struct ata_link *link, unsigned long deadline)
                pp->state = adma_state_mmio;
        adma_reinit_engine(ap);
 
-       return ata_std_prereset(link, deadline);
+       return ata_sff_prereset(link, deadline);
 }
 
 static int adma_fill_sg(struct ata_queued_cmd *qc)
@@ -323,10 +324,8 @@ static void adma_qc_prep(struct ata_queued_cmd *qc)
        VPRINTK("ENTER\n");
 
        adma_enter_reg_mode(qc->ap);
-       if (qc->tf.protocol != ATA_PROT_DMA) {
-               ata_qc_prep(qc);
+       if (qc->tf.protocol != ATA_PROT_DMA)
                return;
-       }
 
        buf[i++] = 0;   /* Response flags */
        buf[i++] = 0;   /* reserved */
@@ -423,7 +422,7 @@ static unsigned int adma_qc_issue(struct ata_queued_cmd *qc)
        }
 
        pp->state = adma_state_mmio;
-       return ata_qc_issue_prot(qc);
+       return ata_sff_qc_issue(qc);
 }
 
 static inline unsigned int adma_intr_pkt(struct ata_host *host)
@@ -441,8 +440,6 @@ static inline unsigned int adma_intr_pkt(struct ata_host *host)
                        continue;
                handled = 1;
                adma_enter_reg_mode(ap);
-               if (ap->flags & ATA_FLAG_DISABLED)
-                       continue;
                pp = ap->private_data;
                if (!pp || pp->state != adma_state_pkt)
                        continue;
@@ -483,42 +480,38 @@ static inline unsigned int adma_intr_mmio(struct ata_host *host)
        unsigned int handled = 0, port_no;
 
        for (port_no = 0; port_no < host->n_ports; ++port_no) {
-               struct ata_port *ap;
-               ap = host->ports[port_no];
-               if (ap && (!(ap->flags & ATA_FLAG_DISABLED))) {
-                       struct ata_queued_cmd *qc;
-                       struct adma_port_priv *pp = ap->private_data;
-                       if (!pp || pp->state != adma_state_mmio)
+               struct ata_port *ap = host->ports[port_no];
+               struct adma_port_priv *pp = ap->private_data;
+               struct ata_queued_cmd *qc;
+
+               if (!pp || pp->state != adma_state_mmio)
+                       continue;
+               qc = ata_qc_from_tag(ap, ap->link.active_tag);
+               if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING))) {
+
+                       /* check main status, clearing INTRQ */
+                       u8 status = ata_sff_check_status(ap);
+                       if ((status & ATA_BUSY))
                                continue;
-                       qc = ata_qc_from_tag(ap, ap->link.active_tag);
-                       if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING))) {
-
-                               /* check main status, clearing INTRQ */
-                               u8 status = ata_check_status(ap);
-                               if ((status & ATA_BUSY))
-                                       continue;
-                               DPRINTK("ata%u: protocol %d (dev_stat 0x%X)\n",
-                                       ap->print_id, qc->tf.protocol, status);
-
-                               /* complete taskfile transaction */
-                               pp->state = adma_state_idle;
-                               qc->err_mask |= ac_err_mask(status);
-                               if (!qc->err_mask)
-                                       ata_qc_complete(qc);
-                               else {
-                                       struct ata_eh_info *ehi =
-                                               &ap->link.eh_info;
-                                       ata_ehi_clear_desc(ehi);
-                                       ata_ehi_push_desc(ehi,
-                                               "status 0x%02X", status);
-
-                                       if (qc->err_mask == AC_ERR_DEV)
-                                               ata_port_abort(ap);
-                                       else
-                                               ata_port_freeze(ap);
-                               }
-                               handled = 1;
+                       DPRINTK("ata%u: protocol %d (dev_stat 0x%X)\n",
+                               ap->print_id, qc->tf.protocol, status);
+
+                       /* complete taskfile transaction */
+                       pp->state = adma_state_idle;
+                       qc->err_mask |= ac_err_mask(status);
+                       if (!qc->err_mask)
+                               ata_qc_complete(qc);
+                       else {
+                               struct ata_eh_info *ehi = &ap->link.eh_info;
+                               ata_ehi_clear_desc(ehi);
+                               ata_ehi_push_desc(ehi, "status 0x%02X", status);
+
+                               if (qc->err_mask == AC_ERR_DEV)
+                                       ata_port_abort(ap);
+                               else
+                                       ata_port_freeze(ap);
                        }
+                       handled = 1;
                }
        }
        return handled;
@@ -561,11 +554,7 @@ static int adma_port_start(struct ata_port *ap)
 {
        struct device *dev = ap->host->dev;
        struct adma_port_priv *pp;
-       int rc;
 
-       rc = ata_port_start(ap);
-       if (rc)
-               return rc;
        adma_enter_reg_mode(ap);
        pp = devm_kzalloc(dev, sizeof(*pp), GFP_KERNEL);
        if (!pp)
@@ -591,14 +580,6 @@ static void adma_port_stop(struct ata_port *ap)
        adma_reset_engine(ap);
 }
 
-static void adma_host_stop(struct ata_host *host)
-{
-       unsigned int port_no;
-
-       for (port_no = 0; port_no < ADMA_PORTS; ++port_no)
-               adma_reset_engine(host->ports[port_no]);
-}
-
 static void adma_host_init(struct ata_host *host, unsigned int chip_id)
 {
        unsigned int port_no;
@@ -615,13 +596,13 @@ static int adma_set_dma_masks(struct pci_dev *pdev, void __iomem *mmio_base)
 {
        int rc;
 
-       rc = pci_set_dma_mask(pdev, DMA_32BIT_MASK);
+       rc = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
        if (rc) {
                dev_printk(KERN_ERR, &pdev->dev,
                        "32-bit DMA enable failed\n");
                return rc;
        }
-       rc = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK);
+       rc = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
        if (rc) {
                dev_printk(KERN_ERR, &pdev->dev,
                        "32-bit consistent DMA enable failed\n");