libata: put some intelligence into EH speed down sequence
[powerpc.git] / include / linux / libata.h
index 308bb8c..5db50fa 100644 (file)
@@ -35,6 +35,7 @@
 #include <linux/ata.h>
 #include <linux/workqueue.h>
 #include <scsi/scsi_host.h>
+#include <linux/acpi.h>
 
 /*
  * Define if arch has non-standard setup.  This is a _PCI_ standard
@@ -54,8 +55,6 @@
 #undef ATA_VERBOSE_DEBUG       /* yet more debugging output */
 #undef ATA_IRQ_TRAP            /* define to ack screaming irqs */
 #undef ATA_NDEBUG              /* define to disable quick runtime checks */
-#define ATA_ENABLE_PATA                /* define to enable PATA support in some
-                                * low-level drivers */
 
 
 /* note: prints function name for you */
@@ -174,6 +173,7 @@ enum {
        ATA_FLAG_DEBUGMSG       = (1 << 13),
        ATA_FLAG_SETXFER_POLLING= (1 << 14), /* use polling for SETXFER */
        ATA_FLAG_IGN_SIMPLEX    = (1 << 15), /* ignore SIMPLEX */
+       ATA_FLAG_NO_IORDY       = (1 << 16), /* controller lacks iordy */
 
        /* The following flag belongs to ap->pflags but is kept in
         * ap->flags because it's referenced in many LLDs and will be
@@ -495,7 +495,12 @@ struct ata_device {
 
        /* error history */
        struct ata_ering        ering;
+       int                     spdn_cnt;
        unsigned int            horkage;        /* List of broken features */
+#ifdef CONFIG_SATA_ACPI
+       /* ACPI objects info */
+       acpi_handle obj_handle;
+#endif
 };
 
 /* Offset into struct ata_device.  Fields above it are maintained
@@ -632,6 +637,8 @@ struct ata_port_operations {
 
        irq_handler_t irq_handler;
        void (*irq_clear) (struct ata_port *);
+       u8 (*irq_on) (struct ata_port *);
+       u8 (*irq_ack) (struct ata_port *ap, unsigned int chk_drq);
 
        u32 (*scr_read) (struct ata_port *ap, unsigned int sc_reg);
        void (*scr_write) (struct ata_port *ap, unsigned int sc_reg,
@@ -753,6 +760,7 @@ extern void ata_port_queue_task(struct ata_port *ap, work_func_t fn,
 extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val,
                             unsigned long interval_msec,
                             unsigned long timeout_msec);
+extern unsigned int ata_dev_try_classify(struct ata_port *, unsigned int, u8 *);
 
 /*
  * Default driver ops implementations
@@ -813,6 +821,10 @@ extern void ata_scsi_slave_destroy(struct scsi_device *sdev);
 extern int ata_scsi_change_queue_depth(struct scsi_device *sdev,
                                       int queue_depth);
 extern struct ata_device *ata_dev_pair(struct ata_device *adev);
+extern u8 ata_irq_on(struct ata_port *ap);
+extern u8 ata_dummy_irq_on(struct ata_port *ap);
+extern u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq);
+extern u8 ata_dummy_irq_ack(struct ata_port *ap, unsigned int chk_drq);
 
 /*
  * Timing helpers
@@ -1147,42 +1159,6 @@ static inline void ata_qc_reinit(struct ata_queued_cmd *qc)
        qc->result_tf.feature = 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:
- */
-
-static inline 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;
-}
-
 static inline int ata_try_flush_cache(const struct ata_device *dev)
 {
        return ata_id_wcache_enabled(dev->id) ||