Commit 0f0a3ad3 authored by Tejun Heo's avatar Tejun Heo

[PATCH] libata: make sure IRQ is cleared after ata_bmdma_freeze()

Now that BMDMA status is recorded in irq handler.  ata_bmdma_freeze()
is free to manipulate host status.  Under certain circumstances, some
controllers (ICH7 in enhanced mode w/ IRQ shared) raise IRQ when CTL
register is written to and ATA_NIEN doesn't mask it.

This patch makes ata_bmdma_freeze() clear all pending IRQs after
freezing a port.  This change makes explicit clearing in
ata_device_add() unnecessary and thus kills it.  The removed code was
SFF-specific and was in the wrong place.

Note that ->freeze() handler is always called under ap->lock held and
irq disabled.  Even if CTL manipulation causes stuck IRQ, it's cleared
immediately.  This should be safe (enough) even in SMP environment.
More correct solution is to mask the IRQ from IRQ controller but that
would be an overkill.
Signed-off-by: default avatarTejun Heo <htejun@gmail.com>
parent ea54763f
...@@ -5681,9 +5681,8 @@ int ata_device_add(const struct ata_probe_ent *ent) ...@@ -5681,9 +5681,8 @@ int ata_device_add(const struct ata_probe_ent *ent)
ap->ioaddr.bmdma_addr, ap->ioaddr.bmdma_addr,
irq_line); irq_line);
ata_chk_status(ap); /* freeze port before requesting IRQ */
host->ops->irq_clear(ap); ata_eh_freeze_port(ap);
ata_eh_freeze_port(ap); /* freeze port before requesting IRQ */
} }
/* obtain irq, that may be shared between channels */ /* obtain irq, that may be shared between channels */
......
...@@ -700,6 +700,14 @@ void ata_bmdma_freeze(struct ata_port *ap) ...@@ -700,6 +700,14 @@ void ata_bmdma_freeze(struct ata_port *ap)
writeb(ap->ctl, (void __iomem *)ioaddr->ctl_addr); writeb(ap->ctl, (void __iomem *)ioaddr->ctl_addr);
else else
outb(ap->ctl, ioaddr->ctl_addr); outb(ap->ctl, ioaddr->ctl_addr);
/* Under certain circumstances, some controllers raise IRQ on
* ATA_NIEN manipulation. Also, many controllers fail to mask
* previously pending IRQ on ATA_NIEN assertion. Clear it.
*/
ata_chk_status(ap);
ap->ops->irq_clear(ap);
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment