vserver 1.9.5.x5
[linux-2.6.git] / include / linux / ata.h
index 4b6d0e4..f178894 100644 (file)
@@ -24,6 +24,8 @@
 #ifndef __LINUX_ATA_H__
 #define __LINUX_ATA_H__
 
+#include <linux/types.h>
+
 /* defines only for the constants which don't work well as enums */
 #define ATA_DMA_BOUNDARY       0xffffUL
 #define ATA_DMA_MASK           0xffffffffULL
@@ -33,8 +35,6 @@ enum {
        ATA_MAX_DEVICES         = 2,    /* per bus/port */
        ATA_MAX_PRD             = 256,  /* we could make these 256/256 */
        ATA_SECT_SIZE           = 512,
-       ATA_SECT_SIZE_MASK      = (ATA_SECT_SIZE - 1),
-       ATA_SECT_DWORDS         = ATA_SECT_SIZE / sizeof(u32),
 
        ATA_ID_WORDS            = 256,
        ATA_ID_PROD_OFS         = 27,
@@ -42,6 +42,7 @@ enum {
        ATA_ID_SERNO_OFS        = 10,
        ATA_ID_MAJOR_VER        = 80,
        ATA_ID_PIO_MODES        = 64,
+       ATA_ID_MWDMA_MODES      = 63,
        ATA_ID_UDMA_MODES       = 88,
        ATA_ID_PIO4             = (1 << 1),
 
@@ -122,6 +123,8 @@ enum {
        ATA_CMD_PIO_WRITE_EXT   = 0x34,
        ATA_CMD_SET_FEATURES    = 0xEF,
        ATA_CMD_PACKET          = 0xA0,
+       ATA_CMD_VERIFY          = 0x40,
+       ATA_CMD_VERIFY_EXT      = 0x42,
 
        /* SETFEATURES stuff */
        SETFEATURES_XFER        = 0x03,
@@ -133,13 +136,24 @@ enum {
        XFER_UDMA_2             = 0x42,
        XFER_UDMA_1             = 0x41,
        XFER_UDMA_0             = 0x40,
+       XFER_MW_DMA_2           = 0x22,
+       XFER_MW_DMA_1           = 0x21,
+       XFER_MW_DMA_0           = 0x20,
        XFER_PIO_4              = 0x0C,
        XFER_PIO_3              = 0x0B,
+       XFER_PIO_2              = 0x0A,
+       XFER_PIO_1              = 0x09,
+       XFER_PIO_0              = 0x08,
+       XFER_SW_DMA_2           = 0x12,
+       XFER_SW_DMA_1           = 0x11,
+       XFER_SW_DMA_0           = 0x10,
+       XFER_PIO_SLOW           = 0x00,
 
        /* ATAPI stuff */
        ATAPI_PKT_DMA           = (1 << 0),
        ATAPI_DMADIR            = (1 << 2),     /* ATAPI data dir:
                                                   0=to device, 1=to host */
+       ATAPI_CDB_LEN           = 16,
 
        /* cable types */
        ATA_CBL_NONE            = 0,
@@ -169,16 +183,22 @@ enum ata_tf_protocols {
        ATA_PROT_PIO,           /* PIO single sector */
        ATA_PROT_PIO_MULT,      /* PIO multiple sector */
        ATA_PROT_DMA,           /* DMA */
-       ATA_PROT_ATAPI,         /* packet command */
+       ATA_PROT_ATAPI,         /* packet command, PIO data xfer*/
+       ATA_PROT_ATAPI_NODATA,  /* packet command, no data */
        ATA_PROT_ATAPI_DMA,     /* packet command with special DMA sauce */
 };
 
+enum ata_ioctls {
+       ATA_IOC_GET_IO32        = 0x309,
+       ATA_IOC_SET_IO32        = 0x324,
+};
+
 /* core structures */
 
 struct ata_prd {
        u32                     addr;
        u32                     flags_len;
-} __attribute__((packed));
+};
 
 struct ata_taskfile {
        unsigned long           flags;          /* ATA_TFLAG_xxx */
@@ -203,26 +223,39 @@ struct ata_taskfile {
        u8                      command;        /* IO operation */
 };
 
-#define ata_id_is_ata(dev)     (((dev)->id[0] & (1 << 15)) == 0)
-#define ata_id_rahead_enabled(dev) ((dev)->id[85] & (1 << 6))
-#define ata_id_wcache_enabled(dev) ((dev)->id[85] & (1 << 5))
-#define ata_id_has_lba48(dev)  ((dev)->id[83] & (1 << 10))
-#define ata_id_has_wcache(dev) ((dev)->id[82] & (1 << 5))
-#define ata_id_has_pm(dev)     ((dev)->id[82] & (1 << 3))
-#define ata_id_has_lba(dev)    ((dev)->id[49] & (1 << 9))
-#define ata_id_has_dma(dev)    ((dev)->id[49] & (1 << 8))
-#define ata_id_removeable(dev) ((dev)->id[0] & (1 << 7))
-#define ata_id_u32(dev,n)      \
-       (((u32) (dev)->id[(n) + 1] << 16) | ((u32) (dev)->id[(n)]))
-#define ata_id_u64(dev,n)      \
-       ( ((u64) dev->id[(n) + 3] << 48) |      \
-         ((u64) dev->id[(n) + 2] << 32) |      \
-         ((u64) dev->id[(n) + 1] << 16) |      \
-         ((u64) dev->id[(n) + 0]) )
+#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_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_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_removeable(id)  ((id)[0] & (1 << 7))
+#define ata_id_u32(id,n)       \
+       (((u32) (id)[(n) + 1] << 16) | ((u32) (id)[(n)]))
+#define ata_id_u64(id,n)       \
+       ( ((u64) (id)[(n) + 3] << 48) | \
+         ((u64) (id)[(n) + 2] << 32) | \
+         ((u64) (id)[(n) + 1] << 16) | \
+         ((u64) (id)[(n) + 0]) )
+
+static inline int atapi_cdb_len(u16 *dev_id)
+{
+       u16 tmp = dev_id[0] & 0x3;
+       switch (tmp) {
+       case 0:         return 12;
+       case 1:         return 16;
+       default:        return -1;
+       }
+}
 
 static inline int is_atapi_taskfile(struct ata_taskfile *tf)
 {
        return (tf->protocol == ATA_PROT_ATAPI) ||
+              (tf->protocol == ATA_PROT_ATAPI_NODATA) ||
               (tf->protocol == ATA_PROT_ATAPI_DMA);
 }