diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-03-23 23:44:19 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-03-23 23:44:19 -0500 |
commit | 1ebbe2b20091d306453a5cf480a87e6cd28ae76f (patch) | |
tree | f5cd7a0fa69b8b1938cb5a0faed2e7b0628072a5 /include/linux/ata.h | |
parent | ac58c9059da8886b5e8cde012a80266b18ca146e (diff) | |
parent | 674a396c6d2ba0341ebdd7c1c9950f32f018e2dd (diff) |
Merge branch 'linus'
Diffstat (limited to 'include/linux/ata.h')
-rw-r--r-- | include/linux/ata.h | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/include/linux/ata.h b/include/linux/ata.h index 94f77cce27fa..312a2c0c64e6 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h | |||
@@ -146,6 +146,8 @@ enum { | |||
146 | ATA_CMD_STANDBYNOW1 = 0xE0, | 146 | ATA_CMD_STANDBYNOW1 = 0xE0, |
147 | ATA_CMD_IDLEIMMEDIATE = 0xE1, | 147 | ATA_CMD_IDLEIMMEDIATE = 0xE1, |
148 | ATA_CMD_INIT_DEV_PARAMS = 0x91, | 148 | ATA_CMD_INIT_DEV_PARAMS = 0x91, |
149 | ATA_CMD_READ_NATIVE_MAX = 0xF8, | ||
150 | ATA_CMD_READ_NATIVE_MAX_EXT = 0x27, | ||
149 | 151 | ||
150 | /* SETFEATURES stuff */ | 152 | /* SETFEATURES stuff */ |
151 | SETFEATURES_XFER = 0x03, | 153 | SETFEATURES_XFER = 0x03, |
@@ -204,7 +206,6 @@ enum ata_tf_protocols { | |||
204 | ATA_PROT_UNKNOWN, /* unknown/invalid */ | 206 | ATA_PROT_UNKNOWN, /* unknown/invalid */ |
205 | ATA_PROT_NODATA, /* no data */ | 207 | ATA_PROT_NODATA, /* no data */ |
206 | ATA_PROT_PIO, /* PIO single sector */ | 208 | ATA_PROT_PIO, /* PIO single sector */ |
207 | ATA_PROT_PIO_MULT, /* PIO multiple sector */ | ||
208 | ATA_PROT_DMA, /* DMA */ | 209 | ATA_PROT_DMA, /* DMA */ |
209 | ATA_PROT_ATAPI, /* packet command, PIO data xfer*/ | 210 | ATA_PROT_ATAPI, /* packet command, PIO data xfer*/ |
210 | ATA_PROT_ATAPI_NODATA, /* packet command, no data */ | 211 | ATA_PROT_ATAPI_NODATA, /* packet command, no data */ |
@@ -247,18 +248,22 @@ struct ata_taskfile { | |||
247 | }; | 248 | }; |
248 | 249 | ||
249 | #define ata_id_is_ata(id) (((id)[0] & (1 << 15)) == 0) | 250 | #define ata_id_is_ata(id) (((id)[0] & (1 << 15)) == 0) |
251 | #define ata_id_is_cfa(id) ((id)[0] == 0x848A) | ||
250 | #define ata_id_is_sata(id) ((id)[93] == 0) | 252 | #define ata_id_is_sata(id) ((id)[93] == 0) |
251 | #define ata_id_rahead_enabled(id) ((id)[85] & (1 << 6)) | 253 | #define ata_id_rahead_enabled(id) ((id)[85] & (1 << 6)) |
252 | #define ata_id_wcache_enabled(id) ((id)[85] & (1 << 5)) | 254 | #define ata_id_wcache_enabled(id) ((id)[85] & (1 << 5)) |
255 | #define ata_id_hpa_enabled(id) ((id)[85] & (1 << 10)) | ||
253 | #define ata_id_has_fua(id) ((id)[84] & (1 << 6)) | 256 | #define ata_id_has_fua(id) ((id)[84] & (1 << 6)) |
254 | #define ata_id_has_flush(id) ((id)[83] & (1 << 12)) | 257 | #define ata_id_has_flush(id) ((id)[83] & (1 << 12)) |
255 | #define ata_id_has_flush_ext(id) ((id)[83] & (1 << 13)) | 258 | #define ata_id_has_flush_ext(id) ((id)[83] & (1 << 13)) |
256 | #define ata_id_has_lba48(id) ((id)[83] & (1 << 10)) | 259 | #define ata_id_has_lba48(id) ((id)[83] & (1 << 10)) |
260 | #define ata_id_has_hpa(id) ((id)[82] & (1 << 10)) | ||
257 | #define ata_id_has_wcache(id) ((id)[82] & (1 << 5)) | 261 | #define ata_id_has_wcache(id) ((id)[82] & (1 << 5)) |
258 | #define ata_id_has_pm(id) ((id)[82] & (1 << 3)) | 262 | #define ata_id_has_pm(id) ((id)[82] & (1 << 3)) |
259 | #define ata_id_has_lba(id) ((id)[49] & (1 << 9)) | 263 | #define ata_id_has_lba(id) ((id)[49] & (1 << 9)) |
260 | #define ata_id_has_dma(id) ((id)[49] & (1 << 8)) | 264 | #define ata_id_has_dma(id) ((id)[49] & (1 << 8)) |
261 | #define ata_id_removeable(id) ((id)[0] & (1 << 7)) | 265 | #define ata_id_removeable(id) ((id)[0] & (1 << 7)) |
266 | #define ata_id_has_dword_io(id) ((id)[50] & (1 << 0)) | ||
262 | #define ata_id_u32(id,n) \ | 267 | #define ata_id_u32(id,n) \ |
263 | (((u32) (id)[(n) + 1] << 16) | ((u32) (id)[(n)])) | 268 | (((u32) (id)[(n) + 1] << 16) | ((u32) (id)[(n)])) |
264 | #define ata_id_u64(id,n) \ | 269 | #define ata_id_u64(id,n) \ |
@@ -267,6 +272,16 @@ struct ata_taskfile { | |||
267 | ((u64) (id)[(n) + 1] << 16) | \ | 272 | ((u64) (id)[(n) + 1] << 16) | \ |
268 | ((u64) (id)[(n) + 0]) ) | 273 | ((u64) (id)[(n) + 0]) ) |
269 | 274 | ||
275 | static inline unsigned int ata_id_major_version(const u16 *id) | ||
276 | { | ||
277 | unsigned int mver; | ||
278 | |||
279 | for (mver = 14; mver >= 1; mver--) | ||
280 | if (id[ATA_ID_MAJOR_VER] & (1 << mver)) | ||
281 | break; | ||
282 | return mver; | ||
283 | } | ||
284 | |||
270 | static inline int ata_id_current_chs_valid(const u16 *id) | 285 | static inline int ata_id_current_chs_valid(const u16 *id) |
271 | { | 286 | { |
272 | /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command | 287 | /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command |
@@ -302,4 +317,16 @@ static inline int ata_ok(u8 status) | |||
302 | == ATA_DRDY); | 317 | == ATA_DRDY); |
303 | } | 318 | } |
304 | 319 | ||
320 | static inline int lba_28_ok(u64 block, u32 n_block) | ||
321 | { | ||
322 | /* check the ending block number */ | ||
323 | return ((block + n_block - 1) < ((u64)1 << 28)) && (n_block <= 256); | ||
324 | } | ||
325 | |||
326 | static inline int lba_48_ok(u64 block, u32 n_block) | ||
327 | { | ||
328 | /* check the ending block number */ | ||
329 | return ((block + n_block - 1) < ((u64)1 << 48)) && (n_block <= 65536); | ||
330 | } | ||
331 | |||
305 | #endif /* __LINUX_ATA_H__ */ | 332 | #endif /* __LINUX_ATA_H__ */ |