diff options
| -rw-r--r-- | drivers/ata/ahci.h | 2 | ||||
| -rw-r--r-- | drivers/ata/libahci.c | 67 |
2 files changed, 9 insertions, 60 deletions
diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h index 6a22055151f0..40f0e34f17af 100644 --- a/drivers/ata/ahci.h +++ b/drivers/ata/ahci.h | |||
| @@ -304,7 +304,7 @@ struct ahci_port_priv { | |||
| 304 | unsigned int ncq_saw_d2h:1; | 304 | unsigned int ncq_saw_d2h:1; |
| 305 | unsigned int ncq_saw_dmas:1; | 305 | unsigned int ncq_saw_dmas:1; |
| 306 | unsigned int ncq_saw_sdb:1; | 306 | unsigned int ncq_saw_sdb:1; |
| 307 | u32 intr_status; /* interrupts to handle */ | 307 | atomic_t intr_status; /* interrupts to handle */ |
| 308 | spinlock_t lock; /* protects parent ata_port */ | 308 | spinlock_t lock; /* protects parent ata_port */ |
| 309 | u32 intr_mask; /* interrupts to enable */ | 309 | u32 intr_mask; /* interrupts to enable */ |
| 310 | bool fbs_supported; /* set iff FBS is supported */ | 310 | bool fbs_supported; /* set iff FBS is supported */ |
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c index 48175e5bd001..97683e45ab04 100644 --- a/drivers/ata/libahci.c +++ b/drivers/ata/libahci.c | |||
| @@ -1794,14 +1794,11 @@ static irqreturn_t ahci_port_thread_fn(int irq, void *dev_instance) | |||
| 1794 | struct ata_port *ap = dev_instance; | 1794 | struct ata_port *ap = dev_instance; |
| 1795 | struct ahci_port_priv *pp = ap->private_data; | 1795 | struct ahci_port_priv *pp = ap->private_data; |
| 1796 | void __iomem *port_mmio = ahci_port_base(ap); | 1796 | void __iomem *port_mmio = ahci_port_base(ap); |
| 1797 | unsigned long flags; | ||
| 1798 | u32 status; | 1797 | u32 status; |
| 1799 | 1798 | ||
| 1800 | spin_lock_irqsave(&ap->host->lock, flags); | 1799 | status = atomic_xchg(&pp->intr_status, 0); |
| 1801 | status = pp->intr_status; | 1800 | if (!status) |
| 1802 | if (status) | 1801 | return IRQ_NONE; |
| 1803 | pp->intr_status = 0; | ||
| 1804 | spin_unlock_irqrestore(&ap->host->lock, flags); | ||
| 1805 | 1802 | ||
| 1806 | spin_lock_bh(ap->lock); | 1803 | spin_lock_bh(ap->lock); |
| 1807 | ahci_handle_port_interrupt(ap, port_mmio, status); | 1804 | ahci_handle_port_interrupt(ap, port_mmio, status); |
| @@ -1810,67 +1807,19 @@ static irqreturn_t ahci_port_thread_fn(int irq, void *dev_instance) | |||
| 1810 | return IRQ_HANDLED; | 1807 | return IRQ_HANDLED; |
| 1811 | } | 1808 | } |
| 1812 | 1809 | ||
| 1813 | static void ahci_update_intr_status(struct ata_port *ap) | 1810 | static irqreturn_t ahci_multi_irqs_intr(int irq, void *dev_instance) |
| 1814 | { | 1811 | { |
| 1812 | struct ata_port *ap = dev_instance; | ||
| 1815 | void __iomem *port_mmio = ahci_port_base(ap); | 1813 | void __iomem *port_mmio = ahci_port_base(ap); |
| 1816 | struct ahci_port_priv *pp = ap->private_data; | 1814 | struct ahci_port_priv *pp = ap->private_data; |
| 1817 | u32 status; | 1815 | u32 status; |
| 1818 | 1816 | ||
| 1819 | status = readl(port_mmio + PORT_IRQ_STAT); | ||
| 1820 | writel(status, port_mmio + PORT_IRQ_STAT); | ||
| 1821 | |||
| 1822 | pp->intr_status |= status; | ||
| 1823 | } | ||
| 1824 | |||
| 1825 | static irqreturn_t ahci_multi_irqs_intr(int irq, void *dev_instance) | ||
| 1826 | { | ||
| 1827 | struct ata_port *ap_this = dev_instance; | ||
| 1828 | struct ahci_port_priv *pp = ap_this->private_data; | ||
| 1829 | struct ata_host *host = ap_this->host; | ||
| 1830 | struct ahci_host_priv *hpriv = host->private_data; | ||
| 1831 | void __iomem *mmio = hpriv->mmio; | ||
| 1832 | unsigned int i; | ||
| 1833 | u32 irq_stat, irq_masked; | ||
| 1834 | |||
| 1835 | VPRINTK("ENTER\n"); | 1817 | VPRINTK("ENTER\n"); |
| 1836 | 1818 | ||
| 1837 | spin_lock(&host->lock); | 1819 | status = readl(port_mmio + PORT_IRQ_STAT); |
| 1838 | 1820 | writel(status, port_mmio + PORT_IRQ_STAT); | |
| 1839 | irq_stat = readl(mmio + HOST_IRQ_STAT); | ||
| 1840 | |||
| 1841 | if (!irq_stat) { | ||
| 1842 | u32 status = pp->intr_status; | ||
| 1843 | |||
| 1844 | spin_unlock(&host->lock); | ||
| 1845 | |||
| 1846 | VPRINTK("EXIT\n"); | ||
| 1847 | |||
| 1848 | return status ? IRQ_WAKE_THREAD : IRQ_NONE; | ||
| 1849 | } | ||
| 1850 | |||
| 1851 | irq_masked = irq_stat & hpriv->port_map; | ||
| 1852 | |||
| 1853 | for (i = 0; i < host->n_ports; i++) { | ||
| 1854 | struct ata_port *ap; | ||
| 1855 | |||
| 1856 | if (!(irq_masked & (1 << i))) | ||
| 1857 | continue; | ||
| 1858 | |||
| 1859 | ap = host->ports[i]; | ||
| 1860 | if (ap) { | ||
| 1861 | ahci_update_intr_status(ap); | ||
| 1862 | VPRINTK("port %u\n", i); | ||
| 1863 | } else { | ||
| 1864 | VPRINTK("port %u (no irq)\n", i); | ||
| 1865 | if (ata_ratelimit()) | ||
| 1866 | dev_warn(host->dev, | ||
| 1867 | "interrupt on disabled port %u\n", i); | ||
| 1868 | } | ||
| 1869 | } | ||
| 1870 | |||
| 1871 | writel(irq_stat, mmio + HOST_IRQ_STAT); | ||
| 1872 | 1821 | ||
| 1873 | spin_unlock(&host->lock); | 1822 | atomic_or(status, &pp->intr_status); |
| 1874 | 1823 | ||
| 1875 | VPRINTK("EXIT\n"); | 1824 | VPRINTK("EXIT\n"); |
| 1876 | 1825 | ||
