diff options
author | Jaroslav Kysela <perex@suse.cz> | 2006-03-22 05:02:08 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-03-22 05:02:08 -0500 |
commit | 5501972e0b5857bc8354770d900ceb9b40c7f6b7 (patch) | |
tree | ff239422827c4cd54d2998f8851304255de31b38 /include/linux/ata.h | |
parent | 9d2f928ddf64ca0361562e30faf584cd33055c60 (diff) | |
parent | e952f31bce6e9f64db01f607abc46529ba57ac9e (diff) |
Merge with rsync://rsync.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Diffstat (limited to 'include/linux/ata.h')
-rw-r--r-- | include/linux/ata.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/include/linux/ata.h b/include/linux/ata.h index 94f77cce27fa..b02a16c435e7 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h | |||
@@ -267,6 +267,16 @@ struct ata_taskfile { | |||
267 | ((u64) (id)[(n) + 1] << 16) | \ | 267 | ((u64) (id)[(n) + 1] << 16) | \ |
268 | ((u64) (id)[(n) + 0]) ) | 268 | ((u64) (id)[(n) + 0]) ) |
269 | 269 | ||
270 | static inline unsigned int ata_id_major_version(const u16 *id) | ||
271 | { | ||
272 | unsigned int mver; | ||
273 | |||
274 | for (mver = 14; mver >= 1; mver--) | ||
275 | if (id[ATA_ID_MAJOR_VER] & (1 << mver)) | ||
276 | break; | ||
277 | return mver; | ||
278 | } | ||
279 | |||
270 | static inline int ata_id_current_chs_valid(const u16 *id) | 280 | static inline int ata_id_current_chs_valid(const u16 *id) |
271 | { | 281 | { |
272 | /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command | 282 | /* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command |
@@ -302,4 +312,16 @@ static inline int ata_ok(u8 status) | |||
302 | == ATA_DRDY); | 312 | == ATA_DRDY); |
303 | } | 313 | } |
304 | 314 | ||
315 | static inline int lba_28_ok(u64 block, u32 n_block) | ||
316 | { | ||
317 | /* check the ending block number */ | ||
318 | return ((block + n_block - 1) < ((u64)1 << 28)) && (n_block <= 256); | ||
319 | } | ||
320 | |||
321 | static inline int lba_48_ok(u64 block, u32 n_block) | ||
322 | { | ||
323 | /* check the ending block number */ | ||
324 | return ((block + n_block - 1) < ((u64)1 << 48)) && (n_block <= 65536); | ||
325 | } | ||
326 | |||
305 | #endif /* __LINUX_ATA_H__ */ | 327 | #endif /* __LINUX_ATA_H__ */ |