netfilter: nf_conntrack: fix hash resizing with namespaces
[safe/jmp/linux-2.6] / include / linux / ata.h
index 9c75921..38a6948 100644 (file)
@@ -75,6 +75,7 @@ enum {
        ATA_ID_EIDE_DMA_TIME    = 66,
        ATA_ID_EIDE_PIO         = 67,
        ATA_ID_EIDE_PIO_IORDY   = 68,
+       ATA_ID_ADDITIONAL_SUPP  = 69,
        ATA_ID_QUEUE_DEPTH      = 75,
        ATA_ID_MAJOR_VER        = 80,
        ATA_ID_COMMAND_SET_1    = 82,
@@ -87,6 +88,7 @@ enum {
        ATA_ID_HW_CONFIG        = 93,
        ATA_ID_SPG              = 98,
        ATA_ID_LBA_CAPACITY_2   = 100,
+       ATA_ID_SECTOR_SIZE      = 106,
        ATA_ID_LAST_LUN         = 126,
        ATA_ID_DLF              = 128,
        ATA_ID_CSFO             = 129,
@@ -210,15 +212,25 @@ enum {
        ATA_CMD_STANDBY         = 0xE2, /* place in standby power mode */
        ATA_CMD_IDLE            = 0xE3, /* place in idle power mode */
        ATA_CMD_EDD             = 0x90, /* execute device diagnostic */
+       ATA_CMD_DOWNLOAD_MICRO  = 0x92,
+       ATA_CMD_NOP             = 0x00,
        ATA_CMD_FLUSH           = 0xE7,
        ATA_CMD_FLUSH_EXT       = 0xEA,
        ATA_CMD_ID_ATA          = 0xEC,
        ATA_CMD_ID_ATAPI        = 0xA1,
+       ATA_CMD_SERVICE         = 0xA2,
        ATA_CMD_READ            = 0xC8,
        ATA_CMD_READ_EXT        = 0x25,
+       ATA_CMD_READ_QUEUED     = 0x26,
+       ATA_CMD_READ_STREAM_EXT = 0x2B,
+       ATA_CMD_READ_STREAM_DMA_EXT = 0x2A,
        ATA_CMD_WRITE           = 0xCA,
        ATA_CMD_WRITE_EXT       = 0x35,
+       ATA_CMD_WRITE_QUEUED    = 0x36,
+       ATA_CMD_WRITE_STREAM_EXT = 0x3B,
+       ATA_CMD_WRITE_STREAM_DMA_EXT = 0x3A,
        ATA_CMD_WRITE_FUA_EXT   = 0x3D,
+       ATA_CMD_WRITE_QUEUED_FUA_EXT = 0x3E,
        ATA_CMD_FPDMA_READ      = 0x60,
        ATA_CMD_FPDMA_WRITE     = 0x61,
        ATA_CMD_PIO_READ        = 0x20,
@@ -235,6 +247,7 @@ enum {
        ATA_CMD_PACKET          = 0xA0,
        ATA_CMD_VERIFY          = 0x40,
        ATA_CMD_VERIFY_EXT      = 0x42,
+       ATA_CMD_WRITE_UNCORR_EXT = 0x45,
        ATA_CMD_STANDBYNOW1     = 0xE0,
        ATA_CMD_IDLEIMMEDIATE   = 0xE1,
        ATA_CMD_SLEEP           = 0xE6,
@@ -243,15 +256,34 @@ enum {
        ATA_CMD_READ_NATIVE_MAX_EXT = 0x27,
        ATA_CMD_SET_MAX         = 0xF9,
        ATA_CMD_SET_MAX_EXT     = 0x37,
-       ATA_CMD_READ_LOG_EXT    = 0x2f,
+       ATA_CMD_READ_LOG_EXT    = 0x2F,
+       ATA_CMD_WRITE_LOG_EXT   = 0x3F,
+       ATA_CMD_READ_LOG_DMA_EXT = 0x47,
+       ATA_CMD_WRITE_LOG_DMA_EXT = 0x57,
+       ATA_CMD_TRUSTED_RCV     = 0x5C,
+       ATA_CMD_TRUSTED_RCV_DMA = 0x5D,
+       ATA_CMD_TRUSTED_SND     = 0x5E,
+       ATA_CMD_TRUSTED_SND_DMA = 0x5F,
        ATA_CMD_PMP_READ        = 0xE4,
        ATA_CMD_PMP_WRITE       = 0xE8,
        ATA_CMD_CONF_OVERLAY    = 0xB1,
+       ATA_CMD_SEC_SET_PASS    = 0xF1,
+       ATA_CMD_SEC_UNLOCK      = 0xF2,
+       ATA_CMD_SEC_ERASE_PREP  = 0xF3,
+       ATA_CMD_SEC_ERASE_UNIT  = 0xF4,
        ATA_CMD_SEC_FREEZE_LOCK = 0xF5,
+       ATA_CMD_SEC_DISABLE_PASS = 0xF6,
+       ATA_CMD_CONFIG_STREAM   = 0x51,
        ATA_CMD_SMART           = 0xB0,
        ATA_CMD_MEDIA_LOCK      = 0xDE,
        ATA_CMD_MEDIA_UNLOCK    = 0xDF,
        ATA_CMD_DSM             = 0x06,
+       ATA_CMD_CHK_MED_CRD_TYP = 0xD1,
+       ATA_CMD_CFA_REQ_EXT_ERR = 0x03,
+       ATA_CMD_CFA_WRITE_NE    = 0x38,
+       ATA_CMD_CFA_TRANS_SECT  = 0x87,
+       ATA_CMD_CFA_ERASE       = 0xC0,
+       ATA_CMD_CFA_WRITE_MULT_NE = 0xCD,
        /* marked obsolete in the ATA/ATAPI-7 spec */
        ATA_CMD_RESTORE         = 0x10,
 
@@ -304,8 +336,12 @@ enum {
        SETFEATURES_SATA_DISABLE = 0x90, /* Disable use of SATA feature */
 
        /* SETFEATURE Sector counts for SATA features */
-       SATA_AN                 = 0x05,  /* Asynchronous Notification */
-       SATA_DIPM               = 0x03,  /* Device Initiated Power Management */
+       SATA_FPDMA_OFFSET       = 0x01, /* FPDMA non-zero buffer offsets */
+       SATA_FPDMA_AA           = 0x02, /* FPDMA Setup FIS Auto-Activate */
+       SATA_DIPM               = 0x03, /* Device Initiated Power Management */
+       SATA_FPDMA_IN_ORDER     = 0x04, /* FPDMA in-order data delivery */
+       SATA_AN                 = 0x05, /* Asynchronous Notification */
+       SATA_SSP                = 0x06, /* Software Settings Preservation */
 
        /* feature values for SET_MAX */
        ATA_SET_MAX_ADDR        = 0x00,
@@ -525,6 +561,9 @@ static inline int ata_is_data(u8 prot)
 #define ata_id_has_atapi_AN(id)        \
        ( (((id)[76] != 0x0000) && ((id)[76] != 0xffff)) && \
          ((id)[78] & (1 << 5)) )
+#define ata_id_has_fpdma_aa(id)        \
+       ( (((id)[76] != 0x0000) && ((id)[76] != 0xffff)) && \
+         ((id)[78] & (1 << 2)) )
 #define ata_id_iordy_disable(id) ((id)[ATA_ID_CAPABILITY] & (1 << 10))
 #define ata_id_has_iordy(id) ((id)[ATA_ID_CAPABILITY] & (1 << 11))
 #define ata_id_u32(id,n)       \
@@ -601,6 +640,18 @@ static inline int ata_id_flush_ext_enabled(const u16 *id)
        return (id[ATA_ID_CFS_ENABLE_2] & 0x2400) == 0x2400;
 }
 
+static inline int ata_id_has_large_logical_sectors(const u16 *id)
+{
+       if ((id[ATA_ID_SECTOR_SIZE] & 0xc000) != 0x4000)
+               return 0;
+       return id[ATA_ID_SECTOR_SIZE] & (1 << 13);
+}
+
+static inline u8 ata_id_logical_per_physical_sectors(const u16 *id)
+{
+       return id[ATA_ID_SECTOR_SIZE] & 0xf;
+}
+
 static inline int ata_id_has_lba48(const u16 *id)
 {
        if ((id[ATA_ID_COMMAND_SET_2] & 0xC000) != 0x4000)
@@ -766,6 +817,16 @@ static inline int ata_id_has_trim(const u16 *id)
        return 0;
 }
 
+static inline int ata_id_has_zero_after_trim(const u16 *id)
+{
+       /* DSM supported, deterministic read, and read zero after trim set */
+       if (ata_id_has_trim(id) &&
+           (id[ATA_ID_ADDITIONAL_SUPP] & 0x4020) == 0x4020)
+               return 1;
+
+       return 0;
+}
+
 static inline int ata_id_current_chs_valid(const u16 *id)
 {
        /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command
@@ -921,17 +982,17 @@ static inline void ata_id_to_hd_driveid(u16 *id)
 }
 
 /*
- * Write up to 'max' LBA Range Entries to the buffer that will cover the
- * extent from sector to sector + count.  This is used for TRIM and for
- * ADD LBA(S) TO NV CACHE PINNED SET.
+ * Write LBA Range Entries to the buffer that will cover the extent from
+ * sector to sector + count.  This is used for TRIM and for ADD LBA(S)
+ * TO NV CACHE PINNED SET.
  */
-static inline unsigned ata_set_lba_range_entries(void *_buffer, unsigned max,
-                                               u64 sector, unsigned long count)
+static inline unsigned ata_set_lba_range_entries(void *_buffer,
+               unsigned buf_size, u64 sector, unsigned long count)
 {
        __le64 *buffer = _buffer;
-       unsigned i = 0;
+       unsigned i = 0, used_bytes;
 
-       while (i < max) {
+       while (i < buf_size / 8 ) { /* 6-byte LBA + 2-byte range per entry */
                u64 entry = sector |
                        ((u64)(count > 0xffff ? 0xffff : count) << 48);
                buffer[i++] = __cpu_to_le64(entry);
@@ -941,9 +1002,9 @@ static inline unsigned ata_set_lba_range_entries(void *_buffer, unsigned max,
                sector += 0xffff;
        }
 
-       max = ALIGN(i * 8, 512);
-       memset(buffer + i, 0, max - i * 8);
-       return max;
+       used_bytes = ALIGN(i * 8, 512);
+       memset(buffer + i, 0, used_bytes - i * 8);
+       return used_bytes;
 }
 
 static inline int is_multi_taskfile(struct ata_taskfile *tf)