]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - include/linux/libata.h
libata: kill ATA_EHI_RESUME_LINK
[mv-sheeva.git] / include / linux / libata.h
index 2e098f940cec74083142d07a017522261b526c5e..4093e3b6a8b7b13ddc257ca965eba751cca3e1b1 100644 (file)
@@ -138,6 +138,7 @@ enum {
        ATA_DFLAG_AN            = (1 << 7), /* AN configured */
        ATA_DFLAG_HIPM          = (1 << 8), /* device supports HIPM */
        ATA_DFLAG_DIPM          = (1 << 9), /* device supports DIPM */
+       ATA_DFLAG_DMADIR        = (1 << 10), /* device requires DMADIR */
        ATA_DFLAG_CFG_MASK      = (1 << 12) - 1,
 
        ATA_DFLAG_PIO           = (1 << 12), /* device limited to PIO mode */
@@ -162,7 +163,6 @@ enum {
        ATA_DEV_NONE            = 9,    /* no device */
 
        /* struct ata_link flags */
-       ATA_LFLAG_HRST_TO_RESUME = (1 << 0), /* hardreset to resume link */
        ATA_LFLAG_SKIP_D2H_BSY  = (1 << 1), /* can't wait for the first D2H
                                             * Register FIS clearing BSY */
        ATA_LFLAG_NO_SRST       = (1 << 2), /* avoid softreset */
@@ -291,19 +291,18 @@ enum {
 
        /* reset / recovery action types */
        ATA_EH_REVALIDATE       = (1 << 0),
-       ATA_EH_SOFTRESET        = (1 << 1),
-       ATA_EH_HARDRESET        = (1 << 2),
+       ATA_EH_SOFTRESET        = (1 << 1), /* meaningful only in ->prereset */
+       ATA_EH_HARDRESET        = (1 << 2), /* meaningful only in ->prereset */
+       ATA_EH_RESET            = ATA_EH_SOFTRESET | ATA_EH_HARDRESET,
        ATA_EH_ENABLE_LINK      = (1 << 3),
+       ATA_EH_LPM              = (1 << 4),  /* link power management action */
 
-       ATA_EH_RESET_MASK       = ATA_EH_SOFTRESET | ATA_EH_HARDRESET,
        ATA_EH_PERDEV_MASK      = ATA_EH_REVALIDATE,
 
        /* ata_eh_info->flags */
        ATA_EHI_HOTPLUGGED      = (1 << 0),  /* could have been hotplugged */
-       ATA_EHI_RESUME_LINK     = (1 << 1),  /* resume link (reset modifier) */
        ATA_EHI_NO_AUTOPSY      = (1 << 2),  /* no autopsy */
        ATA_EHI_QUIET           = (1 << 3),  /* be quiet */
-       ATA_EHI_LPM             = (1 << 4),  /* link power management action */
 
        ATA_EHI_DID_SOFTRESET   = (1 << 16), /* already soft-reset this port */
        ATA_EHI_DID_HARDRESET   = (1 << 17), /* already soft-reset this port */
@@ -312,7 +311,6 @@ enum {
        ATA_EHI_POST_SETMODE    = (1 << 20), /* revaildating after setmode */
 
        ATA_EHI_DID_RESET       = ATA_EHI_DID_SOFTRESET | ATA_EHI_DID_HARDRESET,
-       ATA_EHI_RESET_MODIFIER_MASK = ATA_EHI_RESUME_LINK,
 
        /* max tries if error condition is still set after ->error_handler */
        ATA_EH_MAX_TRIES        = 5,
@@ -349,7 +347,8 @@ enum {
        ATAPI_READ              = 0,            /* READs */
        ATAPI_WRITE             = 1,            /* WRITEs */
        ATAPI_READ_CD           = 2,            /* READ CD [MSF] */
-       ATAPI_MISC              = 3,            /* the rest */
+       ATAPI_PASS_THRU         = 3,            /* SAT pass-thru */
+       ATAPI_MISC              = 4,            /* the rest */
 };
 
 enum ata_xfer_mask {
@@ -462,6 +461,7 @@ struct ata_queued_cmd {
        unsigned int            sect_size;
 
        unsigned int            nbytes;
+       unsigned int            extrabytes;
        unsigned int            curbytes;
 
        struct scatterlist      *cursg;
@@ -847,6 +847,7 @@ extern unsigned int ata_dev_try_classify(struct ata_device *dev, int present,
  */
 extern void ata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf);
 extern void ata_tf_read(struct ata_port *ap, struct ata_taskfile *tf);
+extern int atapi_cmd_type(u8 opcode);
 extern void ata_tf_to_fis(const struct ata_taskfile *tf,
                          u8 pmp, int is_cmd, u8 *fis);
 extern void ata_tf_from_fis(const u8 *fis, struct ata_taskfile *tf);
@@ -1092,8 +1093,7 @@ extern void ata_ehi_clear_desc(struct ata_eh_info *ehi);
 
 static inline void ata_ehi_schedule_probe(struct ata_eh_info *ehi)
 {
-       ehi->flags |= ATA_EHI_RESUME_LINK;
-       ehi->action |= ATA_EH_SOFTRESET;
+       ehi->action |= ATA_EH_RESET;
        ehi->probe_mask |= (1 << ATA_MAX_DEVICES) - 1;
 }
 
@@ -1197,7 +1197,7 @@ static inline struct ata_link *ata_port_next_link(struct ata_link *link)
                return ap->pmp_link;
        }
 
-       if (++link - ap->pmp_link < ap->nr_pmp_links)
+       if (++link < ap->nr_pmp_links + ap->pmp_link)
                return link;
        return NULL;
 }
@@ -1335,6 +1335,11 @@ static inline struct ata_queued_cmd *ata_qc_from_tag(struct ata_port *ap,
        return NULL;
 }
 
+static inline unsigned int ata_qc_raw_nbytes(struct ata_queued_cmd *qc)
+{
+       return qc->nbytes - min(qc->extrabytes, qc->nbytes);
+}
+
 static inline void ata_tf_init(struct ata_device *dev, struct ata_taskfile *tf)
 {
        memset(tf, 0, sizeof(*tf));
@@ -1353,7 +1358,7 @@ static inline void ata_qc_reinit(struct ata_queued_cmd *qc)
        qc->flags = 0;
        qc->cursg = NULL;
        qc->cursg_ofs = 0;
-       qc->nbytes = qc->curbytes = 0;
+       qc->nbytes = qc->extrabytes = qc->curbytes = 0;
        qc->n_elem = 0;
        qc->err_mask = 0;
        qc->sect_size = ATA_SECT_SIZE;
@@ -1372,27 +1377,6 @@ static inline int ata_try_flush_cache(const struct ata_device *dev)
               ata_id_has_flush_ext(dev->id);
 }
 
-static inline int atapi_cmd_type(u8 opcode)
-{
-       switch (opcode) {
-       case GPCMD_READ_10:
-       case GPCMD_READ_12:
-               return ATAPI_READ;
-
-       case GPCMD_WRITE_10:
-       case GPCMD_WRITE_12:
-       case GPCMD_WRITE_AND_VERIFY_10:
-               return ATAPI_WRITE;
-
-       case GPCMD_READ_CD:
-       case GPCMD_READ_CD_MSF:
-               return ATAPI_READ_CD;
-
-       default:
-               return ATAPI_MISC;
-       }
-}
-
 static inline unsigned int ac_err_mask(u8 status)
 {
        if (status & (ATA_BUSY | ATA_DRQ))