]> err.no Git - linux-2.6/blobdiff - drivers/ata/sata_mv.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland...
[linux-2.6] / drivers / ata / sata_mv.c
index 8e63c60adafff56586ca0c6b416faab36fea66dc..7f1b13e89cf74c5cb75cd8f67b2a19abf816d88c 100644 (file)
@@ -421,7 +421,6 @@ static void mv_error_handler(struct ata_port *ap);
 static void mv_post_int_cmd(struct ata_queued_cmd *qc);
 static void mv_eh_freeze(struct ata_port *ap);
 static void mv_eh_thaw(struct ata_port *ap);
-static int mv_slave_config(struct scsi_device *sdev);
 static int mv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
 
 static void mv5_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio,
@@ -459,7 +458,7 @@ static struct scsi_host_template mv5_sht = {
        .use_clustering         = 1,
        .proc_name              = DRV_NAME,
        .dma_boundary           = MV_DMA_BOUNDARY,
-       .slave_configure        = mv_slave_config,
+       .slave_configure        = ata_scsi_slave_config,
        .slave_destroy          = ata_scsi_slave_destroy,
        .bios_param             = ata_std_bios_param,
 };
@@ -477,14 +476,12 @@ static struct scsi_host_template mv6_sht = {
        .use_clustering         = 1,
        .proc_name              = DRV_NAME,
        .dma_boundary           = MV_DMA_BOUNDARY,
-       .slave_configure        = mv_slave_config,
+       .slave_configure        = ata_scsi_slave_config,
        .slave_destroy          = ata_scsi_slave_destroy,
        .bios_param             = ata_std_bios_param,
 };
 
 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 +496,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 +510,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 +524,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 +538,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 +552,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,
@@ -765,17 +755,6 @@ static void mv_irq_clear(struct ata_port *ap)
 {
 }
 
-static int mv_slave_config(struct scsi_device *sdev)
-{
-       int rc = ata_scsi_slave_config(sdev);
-       if (rc)
-               return rc;
-
-       blk_queue_max_phys_segments(sdev->request_queue, MV_MAX_SG_CT / 2);
-
-       return 0;       /* scsi layer doesn't check return value, sigh */
-}
-
 static void mv_set_edma_ptrs(void __iomem *port_mmio,
                             struct mv_host_priv *hpriv,
                             struct mv_port_priv *pp)
@@ -1147,7 +1126,7 @@ static void mv_fill_sg(struct ata_queued_cmd *qc)
 {
        struct mv_port_priv *pp = qc->ap->private_data;
        struct scatterlist *sg;
-       struct mv_sg *mv_sg;
+       struct mv_sg *mv_sg, *last_sg = NULL;
 
        mv_sg = pp->sg_tbl;
        ata_for_each_sg(sg, qc) {
@@ -1168,13 +1147,13 @@ static void mv_fill_sg(struct ata_queued_cmd *qc)
                        sg_len -= len;
                        addr += len;
 
-                       if (!sg_len && ata_sg_is_last(sg, qc))
-                               mv_sg->flags_size |= cpu_to_le32(EPRD_FLAG_END_OF_TBL);
-
+                       last_sg = mv_sg;
                        mv_sg++;
                }
-
        }
+
+       if (likely(last_sg))
+               last_sg->flags_size |= cpu_to_le32(EPRD_FLAG_END_OF_TBL);
 }
 
 static inline void mv_crqb_pack_cmd(__le16 *cmdw, u8 data, u8 addr, unsigned last)
@@ -2257,7 +2236,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 +2245,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 +2265,7 @@ static int mv_prereset(struct ata_port *ap, unsigned long deadline)
        if (ehc->i.action & ATA_EH_HARDRESET)
                return 0;
 
-       if (ata_link_online(&ap->link))
+       if (ata_link_online(link))
                rc = ata_wait_ready(ap, deadline);
        else
                rc = -ENODEV;
@@ -2293,9 +2273,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 +2289,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->link);
+       sata_print_link_status(link);
 
        /* clear SError */
-       sata_scr_read(&ap->link, SCR_ERROR, &serr);
-       sata_scr_write_flush(&ap->link, 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 +2572,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++) {