libata: implement spurious irq handling for SFF and apply it to piix
[safe/jmp/linux-2.6] / drivers / ata / ata_piix.c
index b5f614b..c338066 100644 (file)
@@ -173,6 +173,7 @@ static int piix_sidpr_scr_read(struct ata_link *link,
                               unsigned int reg, u32 *val);
 static int piix_sidpr_scr_write(struct ata_link *link,
                                unsigned int reg, u32 val);
+static bool piix_irq_check(struct ata_port *ap);
 #ifdef CONFIG_PM
 static int piix_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg);
 static int piix_pci_device_resume(struct pci_dev *pdev);
@@ -317,8 +318,13 @@ static struct scsi_host_template piix_sht = {
        ATA_BMDMA_SHT(DRV_NAME),
 };
 
-static struct ata_port_operations piix_pata_ops = {
+static struct ata_port_operations piix_sata_ops = {
        .inherits               = &ata_bmdma32_port_ops,
+       .sff_irq_check          = piix_irq_check,
+};
+
+static struct ata_port_operations piix_pata_ops = {
+       .inherits               = &piix_sata_ops,
        .cable_detect           = ata_cable_40wire,
        .set_piomode            = piix_set_piomode,
        .set_dmamode            = piix_set_dmamode,
@@ -336,10 +342,6 @@ static struct ata_port_operations ich_pata_ops = {
        .set_dmamode            = ich_set_dmamode,
 };
 
-static struct ata_port_operations piix_sata_ops = {
-       .inherits               = &ata_bmdma32_port_ops,
-};
-
 static struct ata_port_operations piix_sidpr_sata_ops = {
        .inherits               = &piix_sata_ops,
        .hardreset              = sata_std_hardreset,
@@ -970,6 +972,14 @@ static int piix_sidpr_scr_write(struct ata_link *link,
        return 0;
 }
 
+static bool piix_irq_check(struct ata_port *ap)
+{
+       if (unlikely(!ap->ioaddr.bmdma_addr))
+               return false;
+
+       return ap->ops->bmdma_status(ap) & ATA_DMA_INTR;
+}
+
 #ifdef CONFIG_PM
 static int piix_broken_suspend(void)
 {