diff options
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__ */ |