]> err.no Git - linux-2.6/blobdiff - drivers/ata/pdc_adma.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland...
[linux-2.6] / drivers / ata / pdc_adma.c
index c95c1bf7df37787b709088bdb45ee87d571bef65..199f7e150eb37822f556753f7b7902580926aa3b 100644 (file)
@@ -162,7 +162,6 @@ static struct scsi_host_template adma_ata_sht = {
 };
 
 static const struct ata_port_operations adma_ata_ops = {
-       .port_disable           = ata_port_disable,
        .tf_load                = ata_tf_load,
        .tf_read                = ata_tf_read,
        .exec_command           = ata_exec_command,
@@ -177,7 +176,6 @@ static const struct ata_port_operations adma_ata_ops = {
        .error_handler          = adma_error_handler,
        .irq_clear              = adma_irq_clear,
        .irq_on                 = ata_irq_on,
-       .irq_ack                = ata_irq_ack,
        .port_start             = adma_port_start,
        .port_stop              = adma_port_stop,
        .host_stop              = adma_host_stop,
@@ -297,15 +295,16 @@ static void adma_thaw(struct ata_port *ap)
        adma_reinit_engine(ap);
 }
 
-static int adma_prereset(struct ata_port *ap, unsigned long deadline)
+static int adma_prereset(struct ata_link *link, unsigned long deadline)
 {
+       struct ata_port *ap = link->ap;
        struct adma_port_priv *pp = ap->private_data;
 
        if (pp->state != adma_state_idle) /* healthy paranoia */
                pp->state = adma_state_mmio;
        adma_reinit_engine(ap);
 
-       return ata_std_prereset(ap, deadline);
+       return ata_std_prereset(link, deadline);
 }
 
 static void adma_error_handler(struct ata_port *ap)
@@ -319,7 +318,7 @@ static int adma_fill_sg(struct ata_queued_cmd *qc)
        struct scatterlist *sg;
        struct ata_port *ap = qc->ap;
        struct adma_port_priv *pp = ap->private_data;
-       u8  *buf = pp->pkt;
+       u8  *buf = pp->pkt, *last_buf = NULL;
        int i = (2 + buf[3]) * 8;
        u8 pFLAGS = pORD | ((qc->tf.flags & ATA_TFLAG_WRITE) ? pDIRO : 0);
 
@@ -335,8 +334,7 @@ static int adma_fill_sg(struct ata_queued_cmd *qc)
                *(__le32 *)(buf + i) = cpu_to_le32(len);
                i += 4;
 
-               if (ata_sg_is_last(sg, qc))
-                       pFLAGS |= pEND;
+               last_buf = &buf[i];
                buf[i++] = pFLAGS;
                buf[i++] = qc->dev->dma_mode & 0xf;
                buf[i++] = 0;   /* pPKLW */
@@ -349,6 +347,10 @@ static int adma_fill_sg(struct ata_queued_cmd *qc)
                VPRINTK("PRD[%u] = (0x%lX, 0x%X)\n", i/4,
                                        (unsigned long)addr, len);
        }
+
+       if (likely(last_buf))
+               *last_buf |= pEND;
+
        return i;
 }
 
@@ -485,7 +487,7 @@ static inline unsigned int adma_intr_pkt(struct ata_host *host)
                pp = ap->private_data;
                if (!pp || pp->state != adma_state_pkt)
                        continue;
-               qc = ata_qc_from_tag(ap, ap->active_tag);
+               qc = ata_qc_from_tag(ap, ap->link.active_tag);
                if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING))) {
                        if (status & aPERR)
                                qc->err_mask |= AC_ERR_HOST_BUS;
@@ -500,7 +502,7 @@ static inline unsigned int adma_intr_pkt(struct ata_host *host)
                        if (!qc->err_mask)
                                ata_qc_complete(qc);
                        else {
-                               struct ata_eh_info *ehi = &ap->eh_info;
+                               struct ata_eh_info *ehi = &ap->link.eh_info;
                                ata_ehi_clear_desc(ehi);
                                ata_ehi_push_desc(ehi,
                                        "ADMA-status 0x%02X", status);
@@ -529,7 +531,7 @@ static inline unsigned int adma_intr_mmio(struct ata_host *host)
                        struct adma_port_priv *pp = ap->private_data;
                        if (!pp || pp->state != adma_state_mmio)
                                continue;
-                       qc = ata_qc_from_tag(ap, ap->active_tag);
+                       qc = ata_qc_from_tag(ap, ap->link.active_tag);
                        if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING))) {
 
                                /* check main status, clearing INTRQ */
@@ -545,7 +547,8 @@ static inline unsigned int adma_intr_mmio(struct ata_host *host)
                                if (!qc->err_mask)
                                        ata_qc_complete(qc);
                                else {
-                                       struct ata_eh_info *ehi = &ap->eh_info;
+                                       struct ata_eh_info *ehi =
+                                               &ap->link.eh_info;
                                        ata_ehi_clear_desc(ehi);
                                        ata_ehi_push_desc(ehi,
                                                "status 0x%02X", status);
@@ -704,9 +707,16 @@ static int adma_ata_init_one(struct pci_dev *pdev,
        if (rc)
                return rc;
 
-       for (port_no = 0; port_no < ADMA_PORTS; ++port_no)
-               adma_ata_setup_port(&host->ports[port_no]->ioaddr,
-                                   ADMA_ATA_REGS(mmio_base, port_no));
+       for (port_no = 0; port_no < ADMA_PORTS; ++port_no) {
+               struct ata_port *ap = host->ports[port_no];
+               void __iomem *port_base = ADMA_ATA_REGS(mmio_base, port_no);
+               unsigned int offset = port_base - mmio_base;
+
+               adma_ata_setup_port(&ap->ioaddr, port_base);
+
+               ata_port_pbar_desc(ap, ADMA_MMIO_BAR, -1, "mmio");
+               ata_port_pbar_desc(ap, ADMA_MMIO_BAR, offset, "port");
+       }
 
        /* initialize adapter */
        adma_host_init(host, board_idx);