libata bugfix: preserve LBA bit for HDIO_DRIVE_TASK
[cascardo/linux.git] / drivers / ata / libata-sff.c
index c561b3b..2ffcca0 100644 (file)
@@ -64,6 +64,46 @@ u8 ata_irq_on(struct ata_port *ap)
        return tmp;
 }
 
+u8 ata_dummy_irq_on (struct ata_port *ap)      { return 0; }
+
+/**
+ *     ata_irq_ack - Acknowledge a device interrupt.
+ *     @ap: Port on which interrupts are enabled.
+ *
+ *     Wait up to 10 ms for legacy IDE device to become idle (BUSY
+ *     or BUSY+DRQ clear).  Obtain dma status and port status from
+ *     device.  Clear the interrupt.  Return port status.
+ *
+ *     LOCKING:
+ */
+
+u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq)
+{
+       unsigned int bits = chk_drq ? ATA_BUSY | ATA_DRQ : ATA_BUSY;
+       u8 host_stat, post_stat, status;
+
+       status = ata_busy_wait(ap, bits, 1000);
+       if (status & bits)
+               if (ata_msg_err(ap))
+                       printk(KERN_ERR "abnormal status 0x%X\n", status);
+
+       /* get controller status; clear intr, err bits */
+       host_stat = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);
+       iowrite8(host_stat | ATA_DMA_INTR | ATA_DMA_ERR,
+                ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);
+
+       post_stat = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);
+
+       if (ata_msg_intr(ap))
+               printk(KERN_INFO "%s: irq ack: host_stat 0x%X, new host_stat 0x%X, drv_stat 0x%X\n",
+                       __FUNCTION__,
+                       host_stat, post_stat, status);
+
+       return status;
+}
+
+u8 ata_dummy_irq_ack(struct ata_port *ap, unsigned int chk_drq) { return 0; }
+
 /**
  *     ata_tf_load - send taskfile registers to host controller
  *     @ap: Port to which output is sent
@@ -135,7 +175,7 @@ void ata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf)
  */
 void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf)
 {
-       DPRINTK("ata%u: cmd 0x%X\n", ap->id, tf->command);
+       DPRINTK("ata%u: cmd 0x%X\n", ap->print_id, tf->command);
 
        iowrite8(tf->command, ap->ioaddr.command_addr);
        ata_pause(ap);
@@ -370,8 +410,7 @@ void ata_bmdma_thaw(struct ata_port *ap)
        /* clear & re-enable interrupts */
        ata_chk_status(ap);
        ap->ops->irq_clear(ap);
-       if (ap->ioaddr.ctl_addr)        /* FIXME: hack. create a hook instead */
-               ata_irq_on(ap);
+       ap->ops->irq_on(ap);
 }
 
 /**
@@ -482,7 +521,7 @@ void ata_bmdma_post_internal_cmd(struct ata_queued_cmd *qc)
 static int ata_resources_present(struct pci_dev *pdev, int port)
 {
        int i;
-       
+
        /* Check the PCI resources for this channel are enabled */
        port = port * 2;
        for (i = 0; i < 2; i ++) {
@@ -492,7 +531,7 @@ static int ata_resources_present(struct pci_dev *pdev, int port)
        }
        return 1;
 }
-               
+
 /**
  *     ata_pci_init_native_mode - Initialize native-mode driver
  *     @pdev:  pci device to be initialized
@@ -537,7 +576,7 @@ ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port, int
 
        probe_ent->irq = pdev->irq;
        probe_ent->irq_flags = IRQF_SHARED;
-       
+
        /* Discard disabled ports. Some controllers show their
           unused channels this way */
        if (ata_resources_present(pdev, 0) == 0)