]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/linux/ata.h
sched: cleanup, remove the TASK_NONINTERACTIVE flag
[linux-2.6-omap-h63xx.git] / include / linux / ata.h
index 23a22df039d8c64664b9f85582e16594a600b16a..a4f373f8b79863e88c57b711b00bf5766bede086 100644 (file)
@@ -73,6 +73,19 @@ enum {
        ATA_PIO5                = ATA_PIO4 | (1 << 5),
        ATA_PIO6                = ATA_PIO5 | (1 << 6),
 
+       ATA_SWDMA0              = (1 << 0),
+       ATA_SWDMA1              = ATA_SWDMA0 | (1 << 1),
+       ATA_SWDMA2              = ATA_SWDMA1 | (1 << 2),
+
+       ATA_SWDMA2_ONLY         = (1 << 2),
+
+       ATA_MWDMA0              = (1 << 0),
+       ATA_MWDMA1              = ATA_MWDMA0 | (1 << 1),
+       ATA_MWDMA2              = ATA_MWDMA1 | (1 << 2),
+
+       ATA_MWDMA12_ONLY        = (1 << 1) | (1 << 2),
+       ATA_MWDMA2_ONLY         = (1 << 2),
+
        ATA_UDMA0               = (1 << 0),
        ATA_UDMA1               = ATA_UDMA0 | (1 << 1),
        ATA_UDMA2               = ATA_UDMA1 | (1 << 2),
@@ -217,6 +230,12 @@ enum {
 
        SETFEATURES_SPINUP      = 0x07, /* Spin-up drive */
 
+       SETFEATURES_SATA_ENABLE = 0x10, /* Enable use of SATA feature */
+       SETFEATURES_SATA_DISABLE = 0x90, /* Disable use of SATA feature */
+
+       /* SETFEATURE Sector counts for SATA features */
+       SATA_AN                 = 0x05,  /* Asynchronous Notification */
+
        /* ATAPI stuff */
        ATAPI_PKT_DMA           = (1 << 0),
        ATAPI_DMADIR            = (1 << 2),     /* ATAPI data dir:
@@ -268,6 +287,15 @@ enum {
        SERR_PROTOCOL           = (1 << 10), /* protocol violation */
        SERR_INTERNAL           = (1 << 11), /* host internal error */
        SERR_PHYRDY_CHG         = (1 << 16), /* PHY RDY changed */
+       SERR_PHY_INT_ERR        = (1 << 17), /* PHY internal error */
+       SERR_COMM_WAKE          = (1 << 18), /* Comm wake */
+       SERR_10B_8B_ERR         = (1 << 19), /* 10b to 8b decode error */
+       SERR_DISPARITY          = (1 << 20), /* Disparity */
+       SERR_CRC                = (1 << 21), /* CRC error */
+       SERR_HANDSHAKE          = (1 << 22), /* Handshake error */
+       SERR_LINK_SEQ_ERR       = (1 << 23), /* Link sequence error */
+       SERR_TRANS_ST_ERROR     = (1 << 24), /* Transport state trans. error */
+       SERR_UNRECOG_FIS        = (1 << 25), /* Unrecognized FIS */
        SERR_DEV_XCHG           = (1 << 26), /* device exchanged */
 
        /* struct ata_taskfile flags */
@@ -328,24 +356,17 @@ struct ata_taskfile {
 };
 
 #define ata_id_is_ata(id)      (((id)[0] & (1 << 15)) == 0)
-#define ata_id_rahead_enabled(id) ((id)[85] & (1 << 6))
-#define ata_id_wcache_enabled(id) ((id)[85] & (1 << 5))
-#define ata_id_hpa_enabled(id) ((id)[85] & (1 << 10))
-#define ata_id_has_fua(id)     ((id)[84] & (1 << 6))
-#define ata_id_has_flush(id)   ((id)[83] & (1 << 12))
-#define ata_id_has_flush_ext(id) ((id)[83] & (1 << 13))
-#define ata_id_has_lba48(id)   ((id)[83] & (1 << 10))
-#define ata_id_has_hpa(id)     ((id)[82] & (1 << 10))
-#define ata_id_has_wcache(id)  ((id)[82] & (1 << 5))
-#define ata_id_has_pm(id)      ((id)[82] & (1 << 3))
 #define ata_id_has_lba(id)     ((id)[49] & (1 << 9))
 #define ata_id_has_dma(id)     ((id)[49] & (1 << 8))
 #define ata_id_has_ncq(id)     ((id)[76] & (1 << 8))
 #define ata_id_queue_depth(id) (((id)[75] & 0x1f) + 1)
 #define ata_id_removeable(id)  ((id)[0] & (1 << 7))
-#define ata_id_has_dword_io(id)        ((id)[50] & (1 << 0))
+#define ata_id_has_dword_io(id)        ((id)[48] & (1 << 0))
+#define ata_id_has_atapi_AN(id)        \
+       ( (((id)[76] != 0x0000) && ((id)[76] != 0xffff)) && \
+         ((id)[78] & (1 << 5)) )
 #define ata_id_iordy_disable(id) ((id)[49] & (1 << 10))
-#define ata_id_has_iordy(id) ((id)[49] & (1 << 9))
+#define ata_id_has_iordy(id) ((id)[49] & (1 << 11))
 #define ata_id_u32(id,n)       \
        (((u32) (id)[(n) + 1] << 16) | ((u32) (id)[(n)]))
 #define ata_id_u64(id,n)       \
@@ -356,6 +377,90 @@ struct ata_taskfile {
 
 #define ata_id_cdb_intr(id)    (((id)[0] & 0x60) == 0x20)
 
+static inline int ata_id_has_fua(const u16 *id)
+{
+       if ((id[84] & 0xC000) != 0x4000)
+               return 0;
+       return id[84] & (1 << 6);
+}
+
+static inline int ata_id_has_flush(const u16 *id)
+{
+       if ((id[83] & 0xC000) != 0x4000)
+               return 0;
+       return id[83] & (1 << 12);
+}
+
+static inline int ata_id_has_flush_ext(const u16 *id)
+{
+       if ((id[83] & 0xC000) != 0x4000)
+               return 0;
+       return id[83] & (1 << 13);
+}
+
+static inline int ata_id_has_lba48(const u16 *id)
+{
+       if ((id[83] & 0xC000) != 0x4000)
+               return 0;
+       return id[83] & (1 << 10);
+}
+
+static inline int ata_id_hpa_enabled(const u16 *id)
+{
+       /* Yes children, word 83 valid bits cover word 82 data */
+       if ((id[83] & 0xC000) != 0x4000)
+               return 0;
+       /* And 87 covers 85-87 */
+       if ((id[87] & 0xC000) != 0x4000)
+               return 0;
+       /* Check command sets enabled as well as supported */
+       if ((id[85] & ( 1 << 10)) == 0)
+               return 0;
+       return id[82] & (1 << 10);
+}
+
+static inline int ata_id_has_wcache(const u16 *id)
+{
+       /* Yes children, word 83 valid bits cover word 82 data */
+       if ((id[83] & 0xC000) != 0x4000)
+               return 0;
+       return id[82] & (1 << 5);
+}
+
+static inline int ata_id_has_pm(const u16 *id)
+{
+       if ((id[83] & 0xC000) != 0x4000)
+               return 0;
+       return id[82] & (1 << 3);
+}
+
+static inline int ata_id_rahead_enabled(const u16 *id)
+{
+       if ((id[87] & 0xC000) != 0x4000)
+               return 0;
+       return id[85] & (1 << 6);
+}
+
+static inline int ata_id_wcache_enabled(const u16 *id)
+{
+       if ((id[87] & 0xC000) != 0x4000)
+               return 0;
+       return id[85] & (1 << 5);
+}
+
+/**
+ *     ata_id_major_version    -       get ATA level of drive
+ *     @id: Identify data
+ *
+ *     Caveats:
+ *             ATA-1 considers identify optional
+ *             ATA-2 introduces mandatory identify
+ *             ATA-3 introduces word 80 and accurate reporting
+ *
+ *     The practical impact of this is that ata_id_major_version cannot
+ *     reliably report on drives below ATA3. 
+ */
+
 static inline unsigned int ata_id_major_version(const u16 *id)
 {
        unsigned int mver;