]> err.no Git - linux-2.6/blobdiff - drivers/ata/sata_mv.c
[PATCH] libata: Fix HPA handling regression
[linux-2.6] / drivers / ata / sata_mv.c
index 246e7c5fdce82564998cb9af0c359a3665ba0f6b..4df8311968e9e3f04325a7823cc53d78c21f1754 100644 (file)
@@ -483,8 +483,6 @@ static struct scsi_host_template mv6_sht = {
 };
 
 static const struct ata_port_operations mv5_ops = {
-       .port_disable           = ata_port_disable,
-
        .tf_load                = ata_tf_load,
        .tf_read                = ata_tf_read,
        .check_status           = ata_check_status,
@@ -499,7 +497,6 @@ static const struct ata_port_operations mv5_ops = {
 
        .irq_clear              = mv_irq_clear,
        .irq_on                 = ata_irq_on,
-       .irq_ack                = ata_irq_ack,
 
        .error_handler          = mv_error_handler,
        .post_internal_cmd      = mv_post_int_cmd,
@@ -514,8 +511,6 @@ static const struct ata_port_operations mv5_ops = {
 };
 
 static const struct ata_port_operations mv6_ops = {
-       .port_disable           = ata_port_disable,
-
        .tf_load                = ata_tf_load,
        .tf_read                = ata_tf_read,
        .check_status           = ata_check_status,
@@ -530,7 +525,6 @@ static const struct ata_port_operations mv6_ops = {
 
        .irq_clear              = mv_irq_clear,
        .irq_on                 = ata_irq_on,
-       .irq_ack                = ata_irq_ack,
 
        .error_handler          = mv_error_handler,
        .post_internal_cmd      = mv_post_int_cmd,
@@ -545,8 +539,6 @@ static const struct ata_port_operations mv6_ops = {
 };
 
 static const struct ata_port_operations mv_iie_ops = {
-       .port_disable           = ata_port_disable,
-
        .tf_load                = ata_tf_load,
        .tf_read                = ata_tf_read,
        .check_status           = ata_check_status,
@@ -561,7 +553,6 @@ static const struct ata_port_operations mv_iie_ops = {
 
        .irq_clear              = mv_irq_clear,
        .irq_on                 = ata_irq_on,
-       .irq_ack                = ata_irq_ack,
 
        .error_handler          = mv_error_handler,
        .post_internal_cmd      = mv_post_int_cmd,
@@ -1423,8 +1414,8 @@ static void mv_err_intr(struct ata_port *ap, struct ata_queued_cmd *qc)
                /* just a guess: do we need to do this? should we
                 * expand this, and do it in all cases?
                 */
-               sata_scr_read(ap, SCR_ERROR, &serr);
-               sata_scr_write_flush(ap, SCR_ERROR, serr);
+               sata_scr_read(&ap->link, SCR_ERROR, &serr);
+               sata_scr_write_flush(&ap->link, SCR_ERROR, serr);
        }
 
        edma_err_cause = readl(port_mmio + EDMA_ERR_IRQ_CAUSE_OFS);
@@ -1468,8 +1459,8 @@ static void mv_err_intr(struct ata_port *ap, struct ata_queued_cmd *qc)
                }
 
                if (edma_err_cause & EDMA_ERR_SERR) {
-                       sata_scr_read(ap, SCR_ERROR, &serr);
-                       sata_scr_write_flush(ap, SCR_ERROR, serr);
+                       sata_scr_read(&ap->link, SCR_ERROR, &serr);
+                       sata_scr_write_flush(&ap->link, SCR_ERROR, serr);
                        err_mask = AC_ERR_ATA_BUS;
                        action |= ATA_EH_HARDRESET;
                }
@@ -1687,7 +1678,7 @@ static void mv_pci_error(struct ata_host *host, void __iomem *mmio)
 
        for (i = 0; i < host->n_ports; i++) {
                ap = host->ports[i];
-               if (!ata_port_offline(ap)) {
+               if (!ata_link_offline(&ap->link)) {
                        ehi = &ap->link.eh_info;
                        ata_ehi_clear_desc(ehi);
                        if (!printed++)
@@ -2198,14 +2189,14 @@ static void mv_phy_reset(struct ata_port *ap, unsigned int *class,
 
        /* Issue COMRESET via SControl */
 comreset_retry:
-       sata_scr_write_flush(ap, SCR_CONTROL, 0x301);
+       sata_scr_write_flush(&ap->link, SCR_CONTROL, 0x301);
        msleep(1);
 
-       sata_scr_write_flush(ap, SCR_CONTROL, 0x300);
+       sata_scr_write_flush(&ap->link, SCR_CONTROL, 0x300);
        msleep(20);
 
        do {
-               sata_scr_read(ap, SCR_STATUS, &sstatus);
+               sata_scr_read(&ap->link, SCR_STATUS, &sstatus);
                if (((sstatus & 0x3) == 3) || ((sstatus & 0x3) == 0))
                        break;
 
@@ -2230,7 +2221,7 @@ comreset_retry:
        }
 #endif
 
-       if (ata_port_offline(ap)) {
+       if (ata_link_offline(&ap->link)) {
                *class = ATA_DEV_NONE;
                return;
        }
@@ -2257,7 +2248,7 @@ comreset_retry:
         */
 
        /* finally, read device signature from TF registers */
-       *class = ata_dev_try_classify(ap, 0, NULL);
+       *class = ata_dev_try_classify(ap->link.device, 1, NULL);
 
        writelfl(0, port_mmio + EDMA_ERR_IRQ_CAUSE_OFS);
 
@@ -2266,10 +2257,11 @@ comreset_retry:
        VPRINTK("EXIT\n");
 }
 
-static int mv_prereset(struct ata_port *ap, unsigned long deadline)
+static int mv_prereset(struct ata_link *link, unsigned long deadline)
 {
+       struct ata_port *ap = link->ap;
        struct mv_port_priv *pp = ap->private_data;
-       struct ata_eh_context *ehc = &ap->link.eh_context;
+       struct ata_eh_context *ehc = &link->eh_context;
        int rc;
 
        rc = mv_stop_dma(ap);
@@ -2285,7 +2277,7 @@ static int mv_prereset(struct ata_port *ap, unsigned long deadline)
        if (ehc->i.action & ATA_EH_HARDRESET)
                return 0;
 
-       if (ata_port_online(ap))
+       if (ata_link_online(link))
                rc = ata_wait_ready(ap, deadline);
        else
                rc = -ENODEV;
@@ -2293,9 +2285,10 @@ static int mv_prereset(struct ata_port *ap, unsigned long deadline)
        return rc;
 }
 
-static int mv_hardreset(struct ata_port *ap, unsigned int *class,
+static int mv_hardreset(struct ata_link *link, unsigned int *class,
                        unsigned long deadline)
 {
+       struct ata_port *ap = link->ap;
        struct mv_host_priv *hpriv = ap->host->private_data;
        void __iomem *mmio = ap->host->iomap[MV_PRIMARY_BAR];
 
@@ -2308,16 +2301,17 @@ static int mv_hardreset(struct ata_port *ap, unsigned int *class,
        return 0;
 }
 
-static void mv_postreset(struct ata_port *ap, unsigned int *classes)
+static void mv_postreset(struct ata_link *link, unsigned int *classes)
 {
+       struct ata_port *ap = link->ap;
        u32 serr;
 
        /* print link status */
-       sata_print_link_status(ap);
+       sata_print_link_status(link);
 
        /* clear SError */
-       sata_scr_read(ap, SCR_ERROR, &serr);
-       sata_scr_write_flush(ap, SCR_ERROR, serr);
+       sata_scr_read(link, SCR_ERROR, &serr);
+       sata_scr_write_flush(link, SCR_ERROR, serr);
 
        /* bail out if no device is present */
        if (classes[0] == ATA_DEV_NONE && classes[1] == ATA_DEV_NONE) {
@@ -2590,8 +2584,14 @@ static int mv_init_host(struct ata_host *host, unsigned int board_idx)
        }
 
        for (port = 0; port < host->n_ports; port++) {
+               struct ata_port *ap = host->ports[port];
                void __iomem *port_mmio = mv_port_base(mmio, port);
-               mv_port_init(&host->ports[port]->ioaddr, port_mmio);
+               unsigned int offset = port_mmio - mmio;
+
+               mv_port_init(&ap->ioaddr, port_mmio);
+
+               ata_port_pbar_desc(ap, MV_PRIMARY_BAR, -1, "mmio");
+               ata_port_pbar_desc(ap, MV_PRIMARY_BAR, offset, "port");
        }
 
        for (hc = 0; hc < n_hc; hc++) {