Merge with /pub/scm/linux/kernel/git/torvalds/linux-2.6.git
[sfrench/cifs-2.6.git] / include / linux / libata.h
index 83a83babff8465a6494e28c3def5d3795608aa74..c91be5e64ededd7f59831bddf7bfba2b080d2db5 100644 (file)
@@ -122,6 +122,12 @@ enum {
        ATA_FLAG_NOINTR         = (1 << 9), /* FIXME: Remove this once
                                             * proper HSM is in place. */
        ATA_FLAG_DEBUGMSG       = (1 << 10),
+       ATA_FLAG_NO_ATAPI       = (1 << 11), /* No ATAPI support */
+
+       ATA_FLAG_SUSPENDED      = (1 << 12), /* port is suspended */
+
+       ATA_FLAG_PIO_LBA48      = (1 << 13), /* Host DMA engine is LBA28 only */
+       ATA_FLAG_IRQ_MASK       = (1 << 14), /* Mask IRQ in PIO xfers */
 
        ATA_QCFLAG_ACTIVE       = (1 << 1), /* cmd not yet ack'd to scsi lyer */
        ATA_QCFLAG_SG           = (1 << 3), /* have s/g table? */
@@ -129,12 +135,14 @@ enum {
        ATA_QCFLAG_DMAMAP       = ATA_QCFLAG_SG | ATA_QCFLAG_SINGLE,
 
        /* various lengths of time */
-       ATA_TMOUT_EDD           = 5 * HZ,       /* hueristic */
+       ATA_TMOUT_EDD           = 5 * HZ,       /* heuristic */
        ATA_TMOUT_PIO           = 30 * HZ,
-       ATA_TMOUT_BOOT          = 30 * HZ,      /* hueristic */
-       ATA_TMOUT_BOOT_QUICK    = 7 * HZ,       /* hueristic */
+       ATA_TMOUT_BOOT          = 30 * HZ,      /* heuristic */
+       ATA_TMOUT_BOOT_QUICK    = 7 * HZ,       /* heuristic */
        ATA_TMOUT_CDB           = 30 * HZ,
        ATA_TMOUT_CDB_QUICK     = 5 * HZ,
+       ATA_TMOUT_INTERNAL      = 30 * HZ,
+       ATA_TMOUT_INTERNAL_QUICK = 5 * HZ,
 
        /* ATA bus states */
        BUS_UNKNOWN             = 0,
@@ -194,7 +202,7 @@ struct ata_port;
 struct ata_queued_cmd;
 
 /* typedefs */
-typedef int (*ata_qc_cb_t) (struct ata_queued_cmd *qc, unsigned int err_mask);
+typedef int (*ata_qc_cb_t) (struct ata_queued_cmd *qc);
 
 struct ata_ioports {
        unsigned long           cmd_addr;
@@ -279,9 +287,9 @@ struct ata_queued_cmd {
        /* DO NOT iterate over __sg manually, use ata_for_each_sg() */
        struct scatterlist      *__sg;
 
-       ata_qc_cb_t             complete_fn;
+       unsigned int            err_mask;
 
-       struct completion       *waiting;
+       ata_qc_cb_t             complete_fn;
 
        void                    *private_data;
 };
@@ -433,6 +441,8 @@ extern void ata_std_ports(struct ata_ioports *ioaddr);
 extern int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info,
                             unsigned int n_ports);
 extern void ata_pci_remove_one (struct pci_dev *pdev);
+extern int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t state);
+extern int ata_pci_device_resume(struct pci_dev *pdev);
 #endif /* CONFIG_PCI */
 extern int ata_device_add(const struct ata_probe_ent *ent);
 extern void ata_host_set_remove(struct ata_host_set *host_set);
@@ -442,6 +452,10 @@ extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmn
 extern int ata_scsi_error(struct Scsi_Host *host);
 extern int ata_scsi_release(struct Scsi_Host *host);
 extern unsigned int ata_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc);
+extern int ata_scsi_device_resume(struct scsi_device *);
+extern int ata_scsi_device_suspend(struct scsi_device *);
+extern int ata_device_resume(struct ata_port *, struct ata_device *);
+extern int ata_device_suspend(struct ata_port *, struct ata_device *);
 extern int ata_ratelimit(void);
 
 /*
@@ -475,9 +489,10 @@ extern void ata_bmdma_start (struct ata_queued_cmd *qc);
 extern void ata_bmdma_stop(struct ata_queued_cmd *qc);
 extern u8   ata_bmdma_status(struct ata_port *ap);
 extern void ata_bmdma_irq_clear(struct ata_port *ap);
-extern void ata_qc_complete(struct ata_queued_cmd *qc, unsigned int err_mask);
+extern void ata_qc_complete(struct ata_queued_cmd *qc);
 extern void ata_eng_timeout(struct ata_port *ap);
-extern void ata_scsi_simulate(u16 *id, struct scsi_cmnd *cmd,
+extern void ata_scsi_simulate(struct ata_port *ap, struct ata_device *dev,
+                             struct scsi_cmnd *cmd,
                              void (*done)(struct scsi_cmnd *));
 extern int ata_std_bios_param(struct scsi_device *sdev,
                              struct block_device *bdev,
@@ -487,6 +502,8 @@ extern int ata_scsi_slave_config(struct scsi_device *sdev);
 /*
  * Timing helpers
  */
+
+extern unsigned int ata_pio_need_iordy(const struct ata_device *);
 extern int ata_timing_compute(struct ata_device *, unsigned short,
                              struct ata_timing *, int, int);
 extern void ata_timing_merge(const struct ata_timing *,
@@ -539,6 +556,16 @@ ata_sg_is_last(struct scatterlist *sg, struct ata_queued_cmd *qc)
        return 0;
 }
 
+static inline struct scatterlist *
+ata_qc_first_sg(struct ata_queued_cmd *qc)
+{
+       if (qc->n_elem)
+               return qc->__sg;
+       if (qc->pad_len)
+               return &qc->pad_sgent;
+       return NULL;
+}
+
 static inline struct scatterlist *
 ata_qc_next_sg(struct scatterlist *sg, struct ata_queued_cmd *qc)
 {
@@ -546,11 +573,13 @@ ata_qc_next_sg(struct scatterlist *sg, struct ata_queued_cmd *qc)
                return NULL;
        if (++sg - qc->__sg < qc->n_elem)
                return sg;
-       return qc->pad_len ? &qc->pad_sgent : NULL;
+       if (qc->pad_len)
+               return &qc->pad_sgent;
+       return NULL;
 }
 
 #define ata_for_each_sg(sg, qc) \
-       for (sg = qc->__sg; sg; sg = ata_qc_next_sg(sg, qc))
+       for (sg = ata_qc_first_sg(qc); sg; sg = ata_qc_next_sg(sg, qc))
 
 static inline unsigned int ata_tag_valid(unsigned int tag)
 {
@@ -667,6 +696,7 @@ static inline void ata_qc_reinit(struct ata_queued_cmd *qc)
        qc->cursect = qc->cursg = qc->cursg_ofs = 0;
        qc->nsect = 0;
        qc->nbytes = qc->curbytes = 0;
+       qc->err_mask = 0;
 
        ata_tf_init(qc->ap, &qc->tf, qc->dev->devno);
 }