diff options
Diffstat (limited to 'include/linux/ata.h')
-rw-r--r-- | include/linux/ata.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/include/linux/ata.h b/include/linux/ata.h index 8263a7b74d34..5c4e54a2a8d6 100644 --- a/include/linux/ata.h +++ b/include/linux/ata.h | |||
@@ -43,6 +43,7 @@ enum { | |||
43 | ATA_MAX_SECTORS_128 = 128, | 43 | ATA_MAX_SECTORS_128 = 128, |
44 | ATA_MAX_SECTORS = 256, | 44 | ATA_MAX_SECTORS = 256, |
45 | ATA_MAX_SECTORS_LBA48 = 65535,/* TODO: 65536? */ | 45 | ATA_MAX_SECTORS_LBA48 = 65535,/* TODO: 65536? */ |
46 | ATA_MAX_SECTORS_TAPE = 65535, | ||
46 | 47 | ||
47 | ATA_ID_WORDS = 256, | 48 | ATA_ID_WORDS = 256, |
48 | ATA_ID_SERNO = 10, | 49 | ATA_ID_SERNO = 10, |
@@ -180,6 +181,7 @@ enum { | |||
180 | ATA_CMD_VERIFY_EXT = 0x42, | 181 | ATA_CMD_VERIFY_EXT = 0x42, |
181 | ATA_CMD_STANDBYNOW1 = 0xE0, | 182 | ATA_CMD_STANDBYNOW1 = 0xE0, |
182 | ATA_CMD_IDLEIMMEDIATE = 0xE1, | 183 | ATA_CMD_IDLEIMMEDIATE = 0xE1, |
184 | ATA_CMD_SLEEP = 0xE6, | ||
183 | ATA_CMD_INIT_DEV_PARAMS = 0x91, | 185 | ATA_CMD_INIT_DEV_PARAMS = 0x91, |
184 | ATA_CMD_READ_NATIVE_MAX = 0xF8, | 186 | ATA_CMD_READ_NATIVE_MAX = 0xF8, |
185 | ATA_CMD_READ_NATIVE_MAX_EXT = 0x27, | 187 | ATA_CMD_READ_NATIVE_MAX_EXT = 0x27, |
@@ -235,6 +237,7 @@ enum { | |||
235 | 237 | ||
236 | /* SETFEATURE Sector counts for SATA features */ | 238 | /* SETFEATURE Sector counts for SATA features */ |
237 | SATA_AN = 0x05, /* Asynchronous Notification */ | 239 | SATA_AN = 0x05, /* Asynchronous Notification */ |
240 | SATA_DIPM = 0x03, /* Device Initiated Power Management */ | ||
238 | 241 | ||
239 | /* ATAPI stuff */ | 242 | /* ATAPI stuff */ |
240 | ATAPI_PKT_DMA = (1 << 0), | 243 | ATAPI_PKT_DMA = (1 << 0), |
@@ -377,6 +380,26 @@ struct ata_taskfile { | |||
377 | 380 | ||
378 | #define ata_id_cdb_intr(id) (((id)[0] & 0x60) == 0x20) | 381 | #define ata_id_cdb_intr(id) (((id)[0] & 0x60) == 0x20) |
379 | 382 | ||
383 | static inline bool ata_id_has_hipm(const u16 *id) | ||
384 | { | ||
385 | u16 val = id[76]; | ||
386 | |||
387 | if (val == 0 || val == 0xffff) | ||
388 | return false; | ||
389 | |||
390 | return val & (1 << 9); | ||
391 | } | ||
392 | |||
393 | static inline bool ata_id_has_dipm(const u16 *id) | ||
394 | { | ||
395 | u16 val = id[78]; | ||
396 | |||
397 | if (val == 0 || val == 0xffff) | ||
398 | return false; | ||
399 | |||
400 | return val & (1 << 3); | ||
401 | } | ||
402 | |||
380 | static inline int ata_id_has_fua(const u16 *id) | 403 | static inline int ata_id_has_fua(const u16 *id) |
381 | { | 404 | { |
382 | if ((id[84] & 0xC000) != 0x4000) | 405 | if ((id[84] & 0xC000) != 0x4000) |
@@ -402,6 +425,8 @@ static inline int ata_id_has_lba48(const u16 *id) | |||
402 | { | 425 | { |
403 | if ((id[83] & 0xC000) != 0x4000) | 426 | if ((id[83] & 0xC000) != 0x4000) |
404 | return 0; | 427 | return 0; |
428 | if (!ata_id_u64(id, 100)) | ||
429 | return 0; | ||
405 | return id[83] & (1 << 10); | 430 | return id[83] & (1 << 10); |
406 | } | 431 | } |
407 | 432 | ||
@@ -512,6 +537,15 @@ static inline int ata_drive_40wire(const u16 *dev_id) | |||
512 | return 1; | 537 | return 1; |
513 | } | 538 | } |
514 | 539 | ||
540 | static inline int ata_drive_40wire_relaxed(const u16 *dev_id) | ||
541 | { | ||
542 | if (ata_id_is_sata(dev_id)) | ||
543 | return 0; /* SATA */ | ||
544 | if ((dev_id[93] & 0x2000) == 0x2000) | ||
545 | return 0; /* 80 wire */ | ||
546 | return 1; | ||
547 | } | ||
548 | |||
515 | static inline int atapi_cdb_len(const u16 *dev_id) | 549 | static inline int atapi_cdb_len(const u16 *dev_id) |
516 | { | 550 | { |
517 | u16 tmp = dev_id[0] & 0x3; | 551 | u16 tmp = dev_id[0] & 0x3; |
@@ -522,6 +556,11 @@ static inline int atapi_cdb_len(const u16 *dev_id) | |||
522 | } | 556 | } |
523 | } | 557 | } |
524 | 558 | ||
559 | static inline int atapi_command_packet_set(const u16 *dev_id) | ||
560 | { | ||
561 | return (dev_id[0] >> 8) & 0x1f; | ||
562 | } | ||
563 | |||
525 | static inline int is_atapi_taskfile(const struct ata_taskfile *tf) | 564 | static inline int is_atapi_taskfile(const struct ata_taskfile *tf) |
526 | { | 565 | { |
527 | return (tf->protocol == ATA_PROT_ATAPI) || | 566 | return (tf->protocol == ATA_PROT_ATAPI) || |