diff options
Diffstat (limited to 'include/linux/ata.h')
-rw-r--r-- | include/linux/ata.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/include/linux/ata.h b/include/linux/ata.h index 312a2c0c64e6..3671af869696 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h | |||
@@ -97,6 +97,9 @@ enum { | |||
97 | ATA_DRQ = (1 << 3), /* data request i/o */ | 97 | ATA_DRQ = (1 << 3), /* data request i/o */ |
98 | ATA_ERR = (1 << 0), /* have an error */ | 98 | ATA_ERR = (1 << 0), /* have an error */ |
99 | ATA_SRST = (1 << 2), /* software reset */ | 99 | ATA_SRST = (1 << 2), /* software reset */ |
100 | ATA_ICRC = (1 << 7), /* interface CRC error */ | ||
101 | ATA_UNC = (1 << 6), /* uncorrectable media error */ | ||
102 | ATA_IDNF = (1 << 4), /* ID not found */ | ||
100 | ATA_ABORTED = (1 << 2), /* command aborted */ | 103 | ATA_ABORTED = (1 << 2), /* command aborted */ |
101 | 104 | ||
102 | /* ATA command block registers */ | 105 | /* ATA command block registers */ |
@@ -130,6 +133,8 @@ enum { | |||
130 | ATA_CMD_WRITE = 0xCA, | 133 | ATA_CMD_WRITE = 0xCA, |
131 | ATA_CMD_WRITE_EXT = 0x35, | 134 | ATA_CMD_WRITE_EXT = 0x35, |
132 | ATA_CMD_WRITE_FUA_EXT = 0x3D, | 135 | ATA_CMD_WRITE_FUA_EXT = 0x3D, |
136 | ATA_CMD_FPDMA_READ = 0x60, | ||
137 | ATA_CMD_FPDMA_WRITE = 0x61, | ||
133 | ATA_CMD_PIO_READ = 0x20, | 138 | ATA_CMD_PIO_READ = 0x20, |
134 | ATA_CMD_PIO_READ_EXT = 0x24, | 139 | ATA_CMD_PIO_READ_EXT = 0x24, |
135 | ATA_CMD_PIO_WRITE = 0x30, | 140 | ATA_CMD_PIO_WRITE = 0x30, |
@@ -148,6 +153,10 @@ enum { | |||
148 | ATA_CMD_INIT_DEV_PARAMS = 0x91, | 153 | ATA_CMD_INIT_DEV_PARAMS = 0x91, |
149 | ATA_CMD_READ_NATIVE_MAX = 0xF8, | 154 | ATA_CMD_READ_NATIVE_MAX = 0xF8, |
150 | ATA_CMD_READ_NATIVE_MAX_EXT = 0x27, | 155 | ATA_CMD_READ_NATIVE_MAX_EXT = 0x27, |
156 | ATA_CMD_READ_LOG_EXT = 0x2f, | ||
157 | |||
158 | /* READ_LOG_EXT pages */ | ||
159 | ATA_LOG_SATA_NCQ = 0x10, | ||
151 | 160 | ||
152 | /* SETFEATURES stuff */ | 161 | /* SETFEATURES stuff */ |
153 | SETFEATURES_XFER = 0x03, | 162 | SETFEATURES_XFER = 0x03, |
@@ -172,6 +181,9 @@ enum { | |||
172 | XFER_PIO_0 = 0x08, | 181 | XFER_PIO_0 = 0x08, |
173 | XFER_PIO_SLOW = 0x00, | 182 | XFER_PIO_SLOW = 0x00, |
174 | 183 | ||
184 | SETFEATURES_WC_ON = 0x02, /* Enable write cache */ | ||
185 | SETFEATURES_WC_OFF = 0x82, /* Disable write cache */ | ||
186 | |||
175 | /* ATAPI stuff */ | 187 | /* ATAPI stuff */ |
176 | ATAPI_PKT_DMA = (1 << 0), | 188 | ATAPI_PKT_DMA = (1 << 0), |
177 | ATAPI_DMADIR = (1 << 2), /* ATAPI data dir: | 189 | ATAPI_DMADIR = (1 << 2), /* ATAPI data dir: |
@@ -192,6 +204,16 @@ enum { | |||
192 | SCR_ACTIVE = 3, | 204 | SCR_ACTIVE = 3, |
193 | SCR_NOTIFICATION = 4, | 205 | SCR_NOTIFICATION = 4, |
194 | 206 | ||
207 | /* SError bits */ | ||
208 | SERR_DATA_RECOVERED = (1 << 0), /* recovered data error */ | ||
209 | SERR_COMM_RECOVERED = (1 << 1), /* recovered comm failure */ | ||
210 | SERR_DATA = (1 << 8), /* unrecovered data error */ | ||
211 | SERR_PERSISTENT = (1 << 9), /* persistent data/comm error */ | ||
212 | SERR_PROTOCOL = (1 << 10), /* protocol violation */ | ||
213 | SERR_INTERNAL = (1 << 11), /* host internal error */ | ||
214 | SERR_PHYRDY_CHG = (1 << 16), /* PHY RDY changed */ | ||
215 | SERR_DEV_XCHG = (1 << 26), /* device exchanged */ | ||
216 | |||
195 | /* struct ata_taskfile flags */ | 217 | /* struct ata_taskfile flags */ |
196 | ATA_TFLAG_LBA48 = (1 << 0), /* enable 48-bit LBA and "HOB" */ | 218 | ATA_TFLAG_LBA48 = (1 << 0), /* enable 48-bit LBA and "HOB" */ |
197 | ATA_TFLAG_ISADDR = (1 << 1), /* enable r/w to nsect/lba regs */ | 219 | ATA_TFLAG_ISADDR = (1 << 1), /* enable r/w to nsect/lba regs */ |
@@ -199,6 +221,7 @@ enum { | |||
199 | ATA_TFLAG_WRITE = (1 << 3), /* data dir: host->dev==1 (write) */ | 221 | ATA_TFLAG_WRITE = (1 << 3), /* data dir: host->dev==1 (write) */ |
200 | ATA_TFLAG_LBA = (1 << 4), /* enable LBA */ | 222 | ATA_TFLAG_LBA = (1 << 4), /* enable LBA */ |
201 | ATA_TFLAG_FUA = (1 << 5), /* enable FUA */ | 223 | ATA_TFLAG_FUA = (1 << 5), /* enable FUA */ |
224 | ATA_TFLAG_POLLING = (1 << 6), /* set nIEN to 1 and use polling */ | ||
202 | }; | 225 | }; |
203 | 226 | ||
204 | enum ata_tf_protocols { | 227 | enum ata_tf_protocols { |
@@ -207,6 +230,7 @@ enum ata_tf_protocols { | |||
207 | ATA_PROT_NODATA, /* no data */ | 230 | ATA_PROT_NODATA, /* no data */ |
208 | ATA_PROT_PIO, /* PIO single sector */ | 231 | ATA_PROT_PIO, /* PIO single sector */ |
209 | ATA_PROT_DMA, /* DMA */ | 232 | ATA_PROT_DMA, /* DMA */ |
233 | ATA_PROT_NCQ, /* NCQ */ | ||
210 | ATA_PROT_ATAPI, /* packet command, PIO data xfer*/ | 234 | ATA_PROT_ATAPI, /* packet command, PIO data xfer*/ |
211 | ATA_PROT_ATAPI_NODATA, /* packet command, no data */ | 235 | ATA_PROT_ATAPI_NODATA, /* packet command, no data */ |
212 | ATA_PROT_ATAPI_DMA, /* packet command with special DMA sauce */ | 236 | ATA_PROT_ATAPI_DMA, /* packet command with special DMA sauce */ |
@@ -262,6 +286,8 @@ struct ata_taskfile { | |||
262 | #define ata_id_has_pm(id) ((id)[82] & (1 << 3)) | 286 | #define ata_id_has_pm(id) ((id)[82] & (1 << 3)) |
263 | #define ata_id_has_lba(id) ((id)[49] & (1 << 9)) | 287 | #define ata_id_has_lba(id) ((id)[49] & (1 << 9)) |
264 | #define ata_id_has_dma(id) ((id)[49] & (1 << 8)) | 288 | #define ata_id_has_dma(id) ((id)[49] & (1 << 8)) |
289 | #define ata_id_has_ncq(id) ((id)[76] & (1 << 8)) | ||
290 | #define ata_id_queue_depth(id) (((id)[75] & 0x1f) + 1) | ||
265 | #define ata_id_removeable(id) ((id)[0] & (1 << 7)) | 291 | #define ata_id_removeable(id) ((id)[0] & (1 << 7)) |
266 | #define ata_id_has_dword_io(id) ((id)[50] & (1 << 0)) | 292 | #define ata_id_has_dword_io(id) ((id)[50] & (1 << 0)) |
267 | #define ata_id_u32(id,n) \ | 293 | #define ata_id_u32(id,n) \ |
@@ -272,6 +298,8 @@ struct ata_taskfile { | |||
272 | ((u64) (id)[(n) + 1] << 16) | \ | 298 | ((u64) (id)[(n) + 1] << 16) | \ |
273 | ((u64) (id)[(n) + 0]) ) | 299 | ((u64) (id)[(n) + 0]) ) |
274 | 300 | ||
301 | #define ata_id_cdb_intr(id) (((id)[0] & 0x60) == 0x20) | ||
302 | |||
275 | static inline unsigned int ata_id_major_version(const u16 *id) | 303 | static inline unsigned int ata_id_major_version(const u16 *id) |
276 | { | 304 | { |
277 | unsigned int mver; | 305 | unsigned int mver; |
@@ -311,6 +339,15 @@ static inline int is_atapi_taskfile(const struct ata_taskfile *tf) | |||
311 | (tf->protocol == ATA_PROT_ATAPI_DMA); | 339 | (tf->protocol == ATA_PROT_ATAPI_DMA); |
312 | } | 340 | } |
313 | 341 | ||
342 | static inline int is_multi_taskfile(struct ata_taskfile *tf) | ||
343 | { | ||
344 | return (tf->command == ATA_CMD_READ_MULTI) || | ||
345 | (tf->command == ATA_CMD_WRITE_MULTI) || | ||
346 | (tf->command == ATA_CMD_READ_MULTI_EXT) || | ||
347 | (tf->command == ATA_CMD_WRITE_MULTI_EXT) || | ||
348 | (tf->command == ATA_CMD_WRITE_MULTI_FUA_EXT); | ||
349 | } | ||
350 | |||
314 | static inline int ata_ok(u8 status) | 351 | static inline int ata_ok(u8 status) |
315 | { | 352 | { |
316 | return ((status & (ATA_BUSY | ATA_DRDY | ATA_DF | ATA_DRQ | ATA_ERR)) | 353 | return ((status & (ATA_BUSY | ATA_DRDY | ATA_DF | ATA_DRQ | ATA_ERR)) |