docbook: dmapool: fix fatal changed filename
[safe/jmp/linux-2.6] / drivers / ata / sata_vsc.c
index 8133017..95ae3ed 100644 (file)
@@ -47,7 +47,7 @@
 #include <linux/libata.h>
 
 #define DRV_NAME       "sata_vsc"
-#define DRV_VERSION    "2.2"
+#define DRV_VERSION    "2.3"
 
 enum {
        VSC_MMIO_BAR                    = 0,
@@ -98,20 +98,21 @@ enum {
                              VSC_SATA_INT_PHY_CHANGE),
 };
 
-static u32 vsc_sata_scr_read (struct ata_port *ap, unsigned int sc_reg)
+static int vsc_sata_scr_read(struct ata_port *ap, unsigned int sc_reg, u32 *val)
 {
        if (sc_reg > SCR_CONTROL)
-               return 0xffffffffU;
-       return readl(ap->ioaddr.scr_addr + (sc_reg * 4));
+               return -EINVAL;
+       *val = readl(ap->ioaddr.scr_addr + (sc_reg * 4));
+       return 0;
 }
 
 
-static void vsc_sata_scr_write (struct ata_port *ap, unsigned int sc_reg,
-                              u32 val)
+static int vsc_sata_scr_write(struct ata_port *ap, unsigned int sc_reg, u32 val)
 {
        if (sc_reg > SCR_CONTROL)
-               return;
+               return -EINVAL;
        writel(val, ap->ioaddr.scr_addr + (sc_reg * 4));
+       return 0;
 }
 
 
@@ -161,7 +162,8 @@ static void vsc_sata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf)
        /*
         * The only thing the ctl register is used for is SRST.
         * That is not enabled or disabled via tf_load.
-        * However, if ATA_NIEN is changed, then we need to change the interrupt register.
+        * However, if ATA_NIEN is changed, then we need to change
+        * the interrupt register.
         */
        if ((tf->ctl & ATA_NIEN) != (ap->last_ctl & ATA_NIEN)) {
                ap->last_ctl = tf->ctl;
@@ -218,7 +220,7 @@ static void vsc_sata_tf_read(struct ata_port *ap, struct ata_taskfile *tf)
                tf->hob_lbal = lbal >> 8;
                tf->hob_lbam = lbam >> 8;
                tf->hob_lbah = lbah >> 8;
-        }
+       }
 }
 
 static inline void vsc_error_intr(u8 port_status, struct ata_port *ap)
@@ -239,7 +241,7 @@ static void vsc_port_intr(u8 port_status, struct ata_port *ap)
                return;
        }
 
-       qc = ata_qc_from_tag(ap, ap->active_tag);
+       qc = ata_qc_from_tag(ap, ap->link.active_tag);
        if (qc && likely(!(qc->tf.flags & ATA_TFLAG_POLLING)))
                handled = ata_host_intr(ap, qc);
 
@@ -255,9 +257,10 @@ static void vsc_port_intr(u8 port_status, struct ata_port *ap)
 /*
  * vsc_sata_interrupt
  *
- * Read the interrupt register and process for the devices that have them pending.
+ * Read the interrupt register and process for the devices that have
+ * them pending.
  */
-static irqreturn_t vsc_sata_interrupt (int irq, void *dev_instance)
+static irqreturn_t vsc_sata_interrupt(int irq, void *dev_instance)
 {
        struct ata_host *host = dev_instance;
        unsigned int i;
@@ -286,7 +289,7 @@ static irqreturn_t vsc_sata_interrupt (int irq, void *dev_instance)
                                handled++;
                        } else
                                dev_printk(KERN_ERR, host->dev,
-                                       "interrupt from disabled port %d\n", i);
+                                       "interrupt from disabled port %d\n", i);
                }
        }
 
@@ -316,7 +319,6 @@ static struct scsi_host_template vsc_sata_sht = {
 
 
 static const struct ata_port_operations vsc_sata_ops = {
-       .port_disable           = ata_port_disable,
        .tf_load                = vsc_sata_tf_load,
        .tf_read                = vsc_sata_tf_read,
        .exec_command           = ata_exec_command,
@@ -335,7 +337,6 @@ static const struct ata_port_operations vsc_sata_ops = {
        .post_internal_cmd      = ata_bmdma_post_internal_cmd,
        .irq_clear              = ata_bmdma_irq_clear,
        .irq_on                 = ata_irq_on,
-       .irq_ack                = ata_irq_ack,
        .scr_read               = vsc_sata_scr_read,
        .scr_write              = vsc_sata_scr_write,
        .port_start             = ata_port_start,
@@ -364,14 +365,15 @@ static void __devinit vsc_sata_setup_port(struct ata_ioports *port,
 }
 
 
-static int __devinit vsc_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
+static int __devinit vsc_sata_init_one(struct pci_dev *pdev,
+                                      const struct pci_device_id *ent)
 {
        static const struct ata_port_info pi = {
                .flags          = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
                                  ATA_FLAG_MMIO,
                .pio_mask       = 0x1f,
                .mwdma_mask     = 0x07,
-               .udma_mask      = 0x7f,
+               .udma_mask      = ATA_UDMA6,
                .port_ops       = &vsc_sata_ops,
        };
        const struct ata_port_info *ppi[] = { &pi, NULL };
@@ -407,9 +409,15 @@ static int __devinit vsc_sata_init_one (struct pci_dev *pdev, const struct pci_d
 
        mmio_base = host->iomap[VSC_MMIO_BAR];
 
-       for (i = 0; i < host->n_ports; i++)
-               vsc_sata_setup_port(&host->ports[i]->ioaddr,
-                                   mmio_base + (i + 1) * VSC_SATA_PORT_OFFSET);
+       for (i = 0; i < host->n_ports; i++) {
+               struct ata_port *ap = host->ports[i];
+               unsigned int offset = (i + 1) * VSC_SATA_PORT_OFFSET;
+
+               vsc_sata_setup_port(&ap->ioaddr, mmio_base + offset);
+
+               ata_port_pbar_desc(ap, VSC_MMIO_BAR, -1, "mmio");
+               ata_port_pbar_desc(ap, VSC_MMIO_BAR, offset, "port");
+       }
 
        /*
         * Use 32 bit DMA mask, because 64 bit address support is poor.