]> err.no Git - linux-2.6/blobdiff - drivers/ata/ahci.c
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
[linux-2.6] / drivers / ata / ahci.c
index 813031c01fbaec9028b91bed5dd1cf8710959ee7..54e1f38ce30187be1800ea581ed54589b38bcacd 100644 (file)
@@ -277,7 +277,7 @@ static const struct ata_port_info ahci_port_info[] = {
        /* board_ahci */
        {
                .sht            = &ahci_sht,
-               .host_flags     = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
+               .flags          = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
                                  ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA |
                                  ATA_FLAG_SKIP_D2H_BSY,
                .pio_mask       = 0x1f, /* pio0-4 */
@@ -287,7 +287,7 @@ static const struct ata_port_info ahci_port_info[] = {
        /* board_ahci_vt8251 */
        {
                .sht            = &ahci_sht,
-               .host_flags     = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
+               .flags          = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
                                  ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA |
                                  ATA_FLAG_SKIP_D2H_BSY |
                                  AHCI_FLAG_RESET_NEEDS_CLO | AHCI_FLAG_NO_NCQ,
@@ -299,76 +299,46 @@ static const struct ata_port_info ahci_port_info[] = {
 
 static const struct pci_device_id ahci_pci_tbl[] = {
        /* Intel */
-       { PCI_VENDOR_ID_INTEL, 0x2652, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
-         board_ahci }, /* ICH6 */
-       { PCI_VENDOR_ID_INTEL, 0x2653, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
-         board_ahci }, /* ICH6M */
-       { PCI_VENDOR_ID_INTEL, 0x27c1, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
-         board_ahci }, /* ICH7 */
-       { PCI_VENDOR_ID_INTEL, 0x27c5, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
-         board_ahci }, /* ICH7M */
-       { PCI_VENDOR_ID_INTEL, 0x27c3, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
-         board_ahci }, /* ICH7R */
-       { PCI_VENDOR_ID_AL, 0x5288, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
-         board_ahci }, /* ULi M5288 */
-       { PCI_VENDOR_ID_INTEL, 0x2681, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
-         board_ahci }, /* ESB2 */
-       { PCI_VENDOR_ID_INTEL, 0x2682, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
-         board_ahci }, /* ESB2 */
-       { PCI_VENDOR_ID_INTEL, 0x2683, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
-         board_ahci }, /* ESB2 */
-       { PCI_VENDOR_ID_INTEL, 0x27c6, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
-         board_ahci }, /* ICH7-M DH */
-       { PCI_VENDOR_ID_INTEL, 0x2821, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
-         board_ahci }, /* ICH8 */
-       { PCI_VENDOR_ID_INTEL, 0x2822, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
-         board_ahci }, /* ICH8 */
-       { PCI_VENDOR_ID_INTEL, 0x2824, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
-         board_ahci }, /* ICH8 */
-       { PCI_VENDOR_ID_INTEL, 0x2829, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
-         board_ahci }, /* ICH8M */
-       { PCI_VENDOR_ID_INTEL, 0x282a, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
-         board_ahci }, /* ICH8M */
+       { PCI_VDEVICE(INTEL, 0x2652), board_ahci }, /* ICH6 */
+       { PCI_VDEVICE(INTEL, 0x2653), board_ahci }, /* ICH6M */
+       { PCI_VDEVICE(INTEL, 0x27c1), board_ahci }, /* ICH7 */
+       { PCI_VDEVICE(INTEL, 0x27c5), board_ahci }, /* ICH7M */
+       { PCI_VDEVICE(INTEL, 0x27c3), board_ahci }, /* ICH7R */
+       { PCI_VDEVICE(AL, 0x5288), board_ahci }, /* ULi M5288 */
+       { PCI_VDEVICE(INTEL, 0x2681), board_ahci }, /* ESB2 */
+       { PCI_VDEVICE(INTEL, 0x2682), board_ahci }, /* ESB2 */
+       { PCI_VDEVICE(INTEL, 0x2683), board_ahci }, /* ESB2 */
+       { PCI_VDEVICE(INTEL, 0x27c6), board_ahci }, /* ICH7-M DH */
+       { PCI_VDEVICE(INTEL, 0x2821), board_ahci }, /* ICH8 */
+       { PCI_VDEVICE(INTEL, 0x2822), board_ahci }, /* ICH8 */
+       { PCI_VDEVICE(INTEL, 0x2824), board_ahci }, /* ICH8 */
+       { PCI_VDEVICE(INTEL, 0x2829), board_ahci }, /* ICH8M */
+       { PCI_VDEVICE(INTEL, 0x282a), board_ahci }, /* ICH8M */
 
        /* JMicron */
-       { 0x197b, 0x2360, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
-         board_ahci }, /* JMicron JMB360 */
-       { 0x197b, 0x2361, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
-         board_ahci }, /* JMicron JMB361 */
-       { 0x197b, 0x2363, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
-         board_ahci }, /* JMicron JMB363 */
-       { 0x197b, 0x2365, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
-         board_ahci }, /* JMicron JMB365 */
-       { 0x197b, 0x2366, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
-         board_ahci }, /* JMicron JMB366 */
+       { PCI_VDEVICE(JMICRON, 0x2360), board_ahci }, /* JMicron JMB360 */
+       { PCI_VDEVICE(JMICRON, 0x2361), board_ahci }, /* JMicron JMB361 */
+       { PCI_VDEVICE(JMICRON, 0x2363), board_ahci }, /* JMicron JMB363 */
+       { PCI_VDEVICE(JMICRON, 0x2365), board_ahci }, /* JMicron JMB365 */
+       { PCI_VDEVICE(JMICRON, 0x2366), board_ahci }, /* JMicron JMB366 */
 
        /* ATI */
-       { PCI_VENDOR_ID_ATI, 0x4380, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
-         board_ahci }, /* ATI SB600 non-raid */
-       { PCI_VENDOR_ID_ATI, 0x4381, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
-         board_ahci }, /* ATI SB600 raid */
+       { PCI_VDEVICE(ATI, 0x4380), board_ahci }, /* ATI SB600 non-raid */
+       { PCI_VDEVICE(ATI, 0x4381), board_ahci }, /* ATI SB600 raid */
 
        /* VIA */
-       { PCI_VENDOR_ID_VIA, 0x3349, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
-         board_ahci_vt8251 }, /* VIA VT8251 */
+       { PCI_VDEVICE(VIA, 0x3349), board_ahci_vt8251 }, /* VIA VT8251 */
 
        /* NVIDIA */
-       { PCI_VENDOR_ID_NVIDIA, 0x044c, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
-         board_ahci },         /* MCP65 */
-       { PCI_VENDOR_ID_NVIDIA, 0x044d, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
-         board_ahci },         /* MCP65 */
-       { PCI_VENDOR_ID_NVIDIA, 0x044e, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
-         board_ahci },         /* MCP65 */
-       { PCI_VENDOR_ID_NVIDIA, 0x044f, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
-         board_ahci },         /* MCP65 */
+       { PCI_VDEVICE(NVIDIA, 0x044c), board_ahci },            /* MCP65 */
+       { PCI_VDEVICE(NVIDIA, 0x044d), board_ahci },            /* MCP65 */
+       { PCI_VDEVICE(NVIDIA, 0x044e), board_ahci },            /* MCP65 */
+       { PCI_VDEVICE(NVIDIA, 0x044f), board_ahci },            /* MCP65 */
 
        /* SiS */
-       { PCI_VENDOR_ID_SI, 0x1184, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
-         board_ahci }, /* SiS 966 */
-       { PCI_VENDOR_ID_SI, 0x1185, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
-         board_ahci }, /* SiS 966 */
-       { PCI_VENDOR_ID_SI, 0x0186, PCI_ANY_ID, PCI_ANY_ID, 0, 0,
-         board_ahci }, /* SiS 968 */
+       { PCI_VDEVICE(SI, 0x1184), board_ahci }, /* SiS 966 */
+       { PCI_VDEVICE(SI, 0x1185), board_ahci }, /* SiS 966 */
+       { PCI_VDEVICE(SI, 0x0186), board_ahci }, /* SiS 968 */
 
        { }     /* terminate list */
 };
@@ -709,7 +679,7 @@ static void ahci_fill_cmd_slot(struct ahci_port_priv *pp, unsigned int tag,
 static int ahci_clo(struct ata_port *ap)
 {
        void __iomem *port_mmio = (void __iomem *) ap->ioaddr.cmd_addr;
-       struct ahci_host_priv *hpriv = ap->host_set->private_data;
+       struct ahci_host_priv *hpriv = ap->host->private_data;
        u32 tmp;
 
        if (!(hpriv->cap & HOST_CAP_CLO))
@@ -741,7 +711,7 @@ static int ahci_prereset(struct ata_port *ap)
 static int ahci_softreset(struct ata_port *ap, unsigned int *class)
 {
        struct ahci_port_priv *pp = ap->private_data;
-       void __iomem *mmio = ap->host_set->mmio_base;
+       void __iomem *mmio = ap->host->mmio_base;
        void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no);
        const u32 cmd_fis_len = 5; /* five dwords */
        const char *reason = NULL;
@@ -850,7 +820,7 @@ static int ahci_hardreset(struct ata_port *ap, unsigned int *class)
        struct ahci_port_priv *pp = ap->private_data;
        u8 *d2h_fis = pp->rx_fis + RX_FIS_D2H_REG;
        struct ata_taskfile tf;
-       void __iomem *mmio = ap->host_set->mmio_base;
+       void __iomem *mmio = ap->host->mmio_base;
        void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no);
        int rc;
 
@@ -1039,7 +1009,7 @@ static void ahci_error_intr(struct ata_port *ap, u32 irq_stat)
 
 static void ahci_host_intr(struct ata_port *ap)
 {
-       void __iomem *mmio = ap->host_set->mmio_base;
+       void __iomem *mmio = ap->host->mmio_base;
        void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no);
        struct ata_eh_info *ehi = &ap->eh_info;
        u32 status, qc_active;
@@ -1075,7 +1045,7 @@ static void ahci_host_intr(struct ata_port *ap)
                return;
 
        /* ignore interim PIO setup fis interrupts */
-       if (ata_tag_valid(ap->active_tag) && (status & PORT_IRQ_PIOS_FIS)) 
+       if (ata_tag_valid(ap->active_tag) && (status & PORT_IRQ_PIOS_FIS))
                return;
 
        if (ata_ratelimit())
@@ -1091,7 +1061,7 @@ static void ahci_irq_clear(struct ata_port *ap)
 
 static irqreturn_t ahci_interrupt(int irq, void *dev_instance, struct pt_regs *regs)
 {
-       struct ata_host_set *host_set = dev_instance;
+       struct ata_host *host = dev_instance;
        struct ahci_host_priv *hpriv;
        unsigned int i, handled = 0;
        void __iomem *mmio;
@@ -1099,8 +1069,8 @@ static irqreturn_t ahci_interrupt(int irq, void *dev_instance, struct pt_regs *r
 
        VPRINTK("ENTER\n");
 
-       hpriv = host_set->private_data;
-       mmio = host_set->mmio_base;
+       hpriv = host->private_data;
+       mmio = host->mmio_base;
 
        /* sigh.  0xffffffff is a valid return from h/w */
        irq_stat = readl(mmio + HOST_IRQ_STAT);
@@ -1108,22 +1078,22 @@ static irqreturn_t ahci_interrupt(int irq, void *dev_instance, struct pt_regs *r
        if (!irq_stat)
                return IRQ_NONE;
 
-        spin_lock(&host_set->lock);
+        spin_lock(&host->lock);
 
-        for (i = 0; i < host_set->n_ports; i++) {
+        for (i = 0; i < host->n_ports; i++) {
                struct ata_port *ap;
 
                if (!(irq_stat & (1 << i)))
                        continue;
 
-               ap = host_set->ports[i];
+               ap = host->ports[i];
                if (ap) {
                        ahci_host_intr(ap);
                        VPRINTK("port %u\n", i);
                } else {
                        VPRINTK("port %u (no irq)\n", i);
                        if (ata_ratelimit())
-                               dev_printk(KERN_WARNING, host_set->dev,
+                               dev_printk(KERN_WARNING, host->dev,
                                        "interrupt on disabled port %u\n", i);
                }
 
@@ -1135,7 +1105,7 @@ static irqreturn_t ahci_interrupt(int irq, void *dev_instance, struct pt_regs *r
                handled = 1;
        }
 
-       spin_unlock(&host_set->lock);
+       spin_unlock(&host->lock);
 
        VPRINTK("EXIT\n");
 
@@ -1157,7 +1127,7 @@ static unsigned int ahci_qc_issue(struct ata_queued_cmd *qc)
 
 static void ahci_freeze(struct ata_port *ap)
 {
-       void __iomem *mmio = ap->host_set->mmio_base;
+       void __iomem *mmio = ap->host->mmio_base;
        void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no);
 
        /* turn IRQ off */
@@ -1166,7 +1136,7 @@ static void ahci_freeze(struct ata_port *ap)
 
 static void ahci_thaw(struct ata_port *ap)
 {
-       void __iomem *mmio = ap->host_set->mmio_base;
+       void __iomem *mmio = ap->host->mmio_base;
        void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no);
        u32 tmp;
 
@@ -1181,7 +1151,7 @@ static void ahci_thaw(struct ata_port *ap)
 
 static void ahci_error_handler(struct ata_port *ap)
 {
-       void __iomem *mmio = ap->host_set->mmio_base;
+       void __iomem *mmio = ap->host->mmio_base;
        void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no);
 
        if (!(ap->pflags & ATA_PFLAG_FROZEN)) {
@@ -1198,7 +1168,7 @@ static void ahci_error_handler(struct ata_port *ap)
 static void ahci_post_internal_cmd(struct ata_queued_cmd *qc)
 {
        struct ata_port *ap = qc->ap;
-       void __iomem *mmio = ap->host_set->mmio_base;
+       void __iomem *mmio = ap->host->mmio_base;
        void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no);
 
        if (qc->flags & ATA_QCFLAG_FAILED)
@@ -1213,9 +1183,9 @@ static void ahci_post_internal_cmd(struct ata_queued_cmd *qc)
 
 static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg)
 {
-       struct ahci_host_priv *hpriv = ap->host_set->private_data;
+       struct ahci_host_priv *hpriv = ap->host->private_data;
        struct ahci_port_priv *pp = ap->private_data;
-       void __iomem *mmio = ap->host_set->mmio_base;
+       void __iomem *mmio = ap->host->mmio_base;
        void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no);
        const char *emsg = NULL;
        int rc;
@@ -1233,8 +1203,8 @@ static int ahci_port_suspend(struct ata_port *ap, pm_message_t mesg)
 static int ahci_port_resume(struct ata_port *ap)
 {
        struct ahci_port_priv *pp = ap->private_data;
-       struct ahci_host_priv *hpriv = ap->host_set->private_data;
-       void __iomem *mmio = ap->host_set->mmio_base;
+       struct ahci_host_priv *hpriv = ap->host->private_data;
+       void __iomem *mmio = ap->host->mmio_base;
        void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no);
 
        ahci_init_port(port_mmio, hpriv->cap, pp->cmd_slot_dma, pp->rx_fis_dma);
@@ -1244,8 +1214,8 @@ static int ahci_port_resume(struct ata_port *ap)
 
 static int ahci_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg)
 {
-       struct ata_host_set *host_set = dev_get_drvdata(&pdev->dev);
-       void __iomem *mmio = host_set->mmio_base;
+       struct ata_host *host = dev_get_drvdata(&pdev->dev);
+       void __iomem *mmio = host->mmio_base;
        u32 ctl;
 
        if (mesg.event == PM_EVENT_SUSPEND) {
@@ -1264,9 +1234,9 @@ static int ahci_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg)
 
 static int ahci_pci_device_resume(struct pci_dev *pdev)
 {
-       struct ata_host_set *host_set = dev_get_drvdata(&pdev->dev);
-       struct ahci_host_priv *hpriv = host_set->private_data;
-       void __iomem *mmio = host_set->mmio_base;
+       struct ata_host *host = dev_get_drvdata(&pdev->dev);
+       struct ahci_host_priv *hpriv = host->private_data;
+       void __iomem *mmio = host->mmio_base;
        int rc;
 
        ata_pci_device_do_resume(pdev);
@@ -1276,20 +1246,20 @@ static int ahci_pci_device_resume(struct pci_dev *pdev)
                if (rc)
                        return rc;
 
-               ahci_init_controller(mmio, pdev, host_set->n_ports, hpriv->cap);
+               ahci_init_controller(mmio, pdev, host->n_ports, hpriv->cap);
        }
 
-       ata_host_set_resume(host_set);
+       ata_host_resume(host);
 
        return 0;
 }
 
 static int ahci_port_start(struct ata_port *ap)
 {
-       struct device *dev = ap->host_set->dev;
-       struct ahci_host_priv *hpriv = ap->host_set->private_data;
+       struct device *dev = ap->host->dev;
+       struct ahci_host_priv *hpriv = ap->host->private_data;
        struct ahci_port_priv *pp;
-       void __iomem *mmio = ap->host_set->mmio_base;
+       void __iomem *mmio = ap->host->mmio_base;
        void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no);
        void *mem;
        dma_addr_t mem_dma;
@@ -1350,10 +1320,10 @@ static int ahci_port_start(struct ata_port *ap)
 
 static void ahci_port_stop(struct ata_port *ap)
 {
-       struct device *dev = ap->host_set->dev;
-       struct ahci_host_priv *hpriv = ap->host_set->private_data;
+       struct device *dev = ap->host->dev;
+       struct ahci_host_priv *hpriv = ap->host->private_data;
        struct ahci_port_priv *pp = ap->private_data;
-       void __iomem *mmio = ap->host_set->mmio_base;
+       void __iomem *mmio = ap->host->mmio_base;
        void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no);
        const char *emsg = NULL;
        int rc;
@@ -1581,7 +1551,7 @@ static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
        memset(hpriv, 0, sizeof(*hpriv));
 
        probe_ent->sht          = ahci_port_info[board_idx].sht;
-       probe_ent->host_flags   = ahci_port_info[board_idx].host_flags;
+       probe_ent->port_flags   = ahci_port_info[board_idx].flags;
        probe_ent->pio_mask     = ahci_port_info[board_idx].pio_mask;
        probe_ent->udma_mask    = ahci_port_info[board_idx].udma_mask;
        probe_ent->port_ops     = ahci_port_info[board_idx].port_ops;
@@ -1599,9 +1569,9 @@ static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
        if (rc)
                goto err_out_hpriv;
 
-       if (!(probe_ent->host_flags & AHCI_FLAG_NO_NCQ) &&
+       if (!(probe_ent->port_flags & AHCI_FLAG_NO_NCQ) &&
            (hpriv->cap & HOST_CAP_NCQ))
-               probe_ent->host_flags |= ATA_FLAG_NCQ;
+               probe_ent->port_flags |= ATA_FLAG_NCQ;
 
        ahci_print_info(probe_ent);
 
@@ -1632,27 +1602,27 @@ err_out:
 static void ahci_remove_one (struct pci_dev *pdev)
 {
        struct device *dev = pci_dev_to_dev(pdev);
-       struct ata_host_set *host_set = dev_get_drvdata(dev);
-       struct ahci_host_priv *hpriv = host_set->private_data;
+       struct ata_host *host = dev_get_drvdata(dev);
+       struct ahci_host_priv *hpriv = host->private_data;
        unsigned int i;
        int have_msi;
 
-       for (i = 0; i < host_set->n_ports; i++)
-               ata_port_detach(host_set->ports[i]);
+       for (i = 0; i < host->n_ports; i++)
+               ata_port_detach(host->ports[i]);
 
        have_msi = hpriv->flags & AHCI_FLAG_MSI;
-       free_irq(host_set->irq, host_set);
+       free_irq(host->irq, host);
 
-       for (i = 0; i < host_set->n_ports; i++) {
-               struct ata_port *ap = host_set->ports[i];
+       for (i = 0; i < host->n_ports; i++) {
+               struct ata_port *ap = host->ports[i];
 
-               ata_scsi_release(ap->host);
-               scsi_host_put(ap->host);
+               ata_scsi_release(ap->scsi_host);
+               scsi_host_put(ap->scsi_host);
        }
 
        kfree(hpriv);
-       pci_iounmap(pdev, host_set->mmio_base);
-       kfree(host_set);
+       pci_iounmap(pdev, host->mmio_base);
+       kfree(host);
 
        if (have_msi)
                pci_disable_msi(pdev);