aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/ata_piix.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2010-01-18 20:49:19 -0500
committerJeff Garzik <jgarzik@redhat.com>2010-03-01 14:58:44 -0500
commit27943620cbd960f710a385ff4a538e14ed3f1922 (patch)
treefae161f49c10fa488f7a5891085961f284021544 /drivers/ata/ata_piix.c
parentd88ec2e5c13261cf317b46832a7de216f6d06537 (diff)
libata: implement spurious irq handling for SFF and apply it to piix
Traditional IDE interface sucks in that it doesn't have a reliable IRQ pending bit, so if the controller raises IRQ while the driver is expecting it not to, the IRQ won't be cleared and eventually the IRQ line will be killed by interrupt subsystem. Some controllers have non-standard mechanism to indicate IRQ pending so that this condition can be detected and worked around. This patch adds an optional operation ->sff_irq_check() which will be called for each port from the ata_sff_interrupt() if an unexpected interrupt is received. If the operation returns %true, ->sff_check_status() and ->sff_irq_clear() will be cleared for the port. Note that this doesn't mark the interrupt as handled so it won't prevent IRQ subsystem from killing the IRQ if this mechanism fails to clear the spurious IRQ. This patch also implements ->sff_irq_check() for ata_piix. Note that this adds slight overhead to shared IRQ operation as IRQs which are destined for other controllers will trigger extra register accesses to check whether IDE interrupt is pending but this solves rare screaming IRQ cases and for some curious reason also helps weird BIOS related glitch on Samsung n130 as reported in bko#14314. http://bugzilla.kernel.org/show_bug.cgi?id=14314 * piix_base_ops dropped as suggested by Sergei. * Spurious IRQ detection doesn't kick in anymore if polling qc is in progress. This provides less protection but some controllers have possible data corruption issues if the wrong register is accessed while a command is in progress. Signed-off-by: Tejun Heo <tj@kernel.org> Reported-by: Johannes Stezenbach <js@sig21.net> Reported-by: Hans Werner <hwerner4@gmx.de> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata/ata_piix.c')
-rw-r--r--drivers/ata/ata_piix.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
index b5f614b9c245..c33806654e46 100644
--- a/drivers/ata/ata_piix.c
+++ b/drivers/ata/ata_piix.c
@@ -173,6 +173,7 @@ static int piix_sidpr_scr_read(struct ata_link *link,
173 unsigned int reg, u32 *val); 173 unsigned int reg, u32 *val);
174static int piix_sidpr_scr_write(struct ata_link *link, 174static int piix_sidpr_scr_write(struct ata_link *link,
175 unsigned int reg, u32 val); 175 unsigned int reg, u32 val);
176static bool piix_irq_check(struct ata_port *ap);
176#ifdef CONFIG_PM 177#ifdef CONFIG_PM
177static int piix_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg); 178static int piix_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg);
178static int piix_pci_device_resume(struct pci_dev *pdev); 179static int piix_pci_device_resume(struct pci_dev *pdev);
@@ -317,8 +318,13 @@ static struct scsi_host_template piix_sht = {
317 ATA_BMDMA_SHT(DRV_NAME), 318 ATA_BMDMA_SHT(DRV_NAME),
318}; 319};
319 320
320static struct ata_port_operations piix_pata_ops = { 321static struct ata_port_operations piix_sata_ops = {
321 .inherits = &ata_bmdma32_port_ops, 322 .inherits = &ata_bmdma32_port_ops,
323 .sff_irq_check = piix_irq_check,
324};
325
326static struct ata_port_operations piix_pata_ops = {
327 .inherits = &piix_sata_ops,
322 .cable_detect = ata_cable_40wire, 328 .cable_detect = ata_cable_40wire,
323 .set_piomode = piix_set_piomode, 329 .set_piomode = piix_set_piomode,
324 .set_dmamode = piix_set_dmamode, 330 .set_dmamode = piix_set_dmamode,
@@ -336,10 +342,6 @@ static struct ata_port_operations ich_pata_ops = {
336 .set_dmamode = ich_set_dmamode, 342 .set_dmamode = ich_set_dmamode,
337}; 343};
338 344
339static struct ata_port_operations piix_sata_ops = {
340 .inherits = &ata_bmdma32_port_ops,
341};
342
343static struct ata_port_operations piix_sidpr_sata_ops = { 345static struct ata_port_operations piix_sidpr_sata_ops = {
344 .inherits = &piix_sata_ops, 346 .inherits = &piix_sata_ops,
345 .hardreset = sata_std_hardreset, 347 .hardreset = sata_std_hardreset,
@@ -970,6 +972,14 @@ static int piix_sidpr_scr_write(struct ata_link *link,
970 return 0; 972 return 0;
971} 973}
972 974
975static bool piix_irq_check(struct ata_port *ap)
976{
977 if (unlikely(!ap->ioaddr.bmdma_addr))
978 return false;
979
980 return ap->ops->bmdma_status(ap) & ATA_DMA_INTR;
981}
982
973#ifdef CONFIG_PM 983#ifdef CONFIG_PM
974static int piix_broken_suspend(void) 984static int piix_broken_suspend(void)
975{ 985{