aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-sff.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata/libata-sff.c')
-rw-r--r--drivers/ata/libata-sff.c69
1 files changed, 21 insertions, 48 deletions
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index 8023167bbbeb..026439e05afe 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -64,46 +64,6 @@ u8 ata_irq_on(struct ata_port *ap)
64 return tmp; 64 return tmp;
65} 65}
66 66
67u8 ata_dummy_irq_on (struct ata_port *ap) { return 0; }
68
69/**
70 * ata_irq_ack - Acknowledge a device interrupt.
71 * @ap: Port on which interrupts are enabled.
72 *
73 * Wait up to 10 ms for legacy IDE device to become idle (BUSY
74 * or BUSY+DRQ clear). Obtain dma status and port status from
75 * device. Clear the interrupt. Return port status.
76 *
77 * LOCKING:
78 */
79
80u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq)
81{
82 unsigned int bits = chk_drq ? ATA_BUSY | ATA_DRQ : ATA_BUSY;
83 u8 host_stat = 0, post_stat = 0, status;
84
85 status = ata_busy_wait(ap, bits, 1000);
86 if (status & bits)
87 if (ata_msg_err(ap))
88 printk(KERN_ERR "abnormal status 0x%X\n", status);
89
90 if (ap->ioaddr.bmdma_addr) {
91 /* get controller status; clear intr, err bits */
92 host_stat = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);
93 iowrite8(host_stat | ATA_DMA_INTR | ATA_DMA_ERR,
94 ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);
95
96 post_stat = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);
97 }
98 if (ata_msg_intr(ap))
99 printk(KERN_INFO "%s: irq ack: host_stat 0x%X, new host_stat 0x%X, drv_stat 0x%X\n",
100 __FUNCTION__,
101 host_stat, post_stat, status);
102 return status;
103}
104
105u8 ata_dummy_irq_ack(struct ata_port *ap, unsigned int chk_drq) { return 0; }
106
107/** 67/**
108 * ata_tf_load - send taskfile registers to host controller 68 * ata_tf_load - send taskfile registers to host controller
109 * @ap: Port to which output is sent 69 * @ap: Port to which output is sent
@@ -445,7 +405,7 @@ void ata_bmdma_drive_eh(struct ata_port *ap, ata_prereset_fn_t prereset,
445 unsigned long flags; 405 unsigned long flags;
446 int thaw = 0; 406 int thaw = 0;
447 407
448 qc = __ata_qc_from_tag(ap, ap->active_tag); 408 qc = __ata_qc_from_tag(ap, ap->link.active_tag);
449 if (qc && !(qc->flags & ATA_QCFLAG_FAILED)) 409 if (qc && !(qc->flags & ATA_QCFLAG_FAILED))
450 qc = NULL; 410 qc = NULL;
451 411
@@ -500,7 +460,7 @@ void ata_bmdma_error_handler(struct ata_port *ap)
500 ata_reset_fn_t hardreset; 460 ata_reset_fn_t hardreset;
501 461
502 hardreset = NULL; 462 hardreset = NULL;
503 if (sata_scr_valid(ap)) 463 if (sata_scr_valid(&ap->link))
504 hardreset = sata_std_hardreset; 464 hardreset = sata_std_hardreset;
505 465
506 ata_bmdma_drive_eh(ap, ata_std_prereset, ata_std_softreset, hardreset, 466 ata_bmdma_drive_eh(ap, ata_std_prereset, ata_std_softreset, hardreset,
@@ -607,6 +567,9 @@ int ata_pci_init_bmdma(struct ata_host *host)
607 if ((!(ap->flags & ATA_FLAG_IGN_SIMPLEX)) && 567 if ((!(ap->flags & ATA_FLAG_IGN_SIMPLEX)) &&
608 (ioread8(bmdma + 2) & 0x80)) 568 (ioread8(bmdma + 2) & 0x80))
609 host->flags |= ATA_HOST_SIMPLEX; 569 host->flags |= ATA_HOST_SIMPLEX;
570
571 ata_port_desc(ap, "bmdma 0x%llx",
572 (unsigned long long)pci_resource_start(pdev, 4) + 8 * i);
610 } 573 }
611 574
612 return 0; 575 return 0;
@@ -674,6 +637,10 @@ int ata_pci_init_sff_host(struct ata_host *host)
674 ((unsigned long)iomap[base + 1] | ATA_PCI_CTL_OFS); 637 ((unsigned long)iomap[base + 1] | ATA_PCI_CTL_OFS);
675 ata_std_ports(&ap->ioaddr); 638 ata_std_ports(&ap->ioaddr);
676 639
640 ata_port_desc(ap, "cmd 0x%llx ctl 0x%llx",
641 (unsigned long long)pci_resource_start(pdev, base),
642 (unsigned long long)pci_resource_start(pdev, base + 1));
643
677 mask |= 1 << i; 644 mask |= 1 << i;
678 } 645 }
679 646
@@ -844,24 +811,30 @@ int ata_pci_init_one(struct pci_dev *pdev,
844 IRQF_SHARED, DRV_NAME, host); 811 IRQF_SHARED, DRV_NAME, host);
845 if (rc) 812 if (rc)
846 goto err_out; 813 goto err_out;
847 host->irq = pdev->irq; 814
815 ata_port_desc(host->ports[0], "irq %d", pdev->irq);
816 ata_port_desc(host->ports[1], "irq %d", pdev->irq);
848 } else { 817 } else {
849 if (!ata_port_is_dummy(host->ports[0])) { 818 if (!ata_port_is_dummy(host->ports[0])) {
850 host->irq = ATA_PRIMARY_IRQ(pdev); 819 rc = devm_request_irq(dev, ATA_PRIMARY_IRQ(pdev),
851 rc = devm_request_irq(dev, host->irq,
852 pi->port_ops->irq_handler, 820 pi->port_ops->irq_handler,
853 IRQF_SHARED, DRV_NAME, host); 821 IRQF_SHARED, DRV_NAME, host);
854 if (rc) 822 if (rc)
855 goto err_out; 823 goto err_out;
824
825 ata_port_desc(host->ports[0], "irq %d",
826 ATA_PRIMARY_IRQ(pdev));
856 } 827 }
857 828
858 if (!ata_port_is_dummy(host->ports[1])) { 829 if (!ata_port_is_dummy(host->ports[1])) {
859 host->irq2 = ATA_SECONDARY_IRQ(pdev); 830 rc = devm_request_irq(dev, ATA_SECONDARY_IRQ(pdev),
860 rc = devm_request_irq(dev, host->irq2,
861 pi->port_ops->irq_handler, 831 pi->port_ops->irq_handler,
862 IRQF_SHARED, DRV_NAME, host); 832 IRQF_SHARED, DRV_NAME, host);
863 if (rc) 833 if (rc)
864 goto err_out; 834 goto err_out;
835
836 ata_port_desc(host->ports[1], "irq %d",
837 ATA_SECONDARY_IRQ(pdev));
865 } 838 }
866 } 839 }
867 840
@@ -909,7 +882,7 @@ unsigned long ata_pci_default_filter(struct ata_device *adev, unsigned long xfer
909 /* Filter out DMA modes if the device has been configured by 882 /* Filter out DMA modes if the device has been configured by
910 the BIOS as PIO only */ 883 the BIOS as PIO only */
911 884
912 if (adev->ap->ioaddr.bmdma_addr == 0) 885 if (adev->link->ap->ioaddr.bmdma_addr == 0)
913 xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA); 886 xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA);
914 return xfer_mask; 887 return xfer_mask;
915} 888}