diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/libata.h | 55 |
1 files changed, 45 insertions, 10 deletions
diff --git a/include/linux/libata.h b/include/linux/libata.h index e57e5d08312d..5b247b8a6b3b 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
| @@ -27,6 +27,7 @@ | |||
| 27 | #define __LINUX_LIBATA_H__ | 27 | #define __LINUX_LIBATA_H__ |
| 28 | 28 | ||
| 29 | #include <linux/delay.h> | 29 | #include <linux/delay.h> |
| 30 | #include <linux/jiffies.h> | ||
| 30 | #include <linux/interrupt.h> | 31 | #include <linux/interrupt.h> |
| 31 | #include <linux/dma-mapping.h> | 32 | #include <linux/dma-mapping.h> |
| 32 | #include <linux/scatterlist.h> | 33 | #include <linux/scatterlist.h> |
| @@ -115,7 +116,7 @@ enum { | |||
| 115 | /* tag ATA_MAX_QUEUE - 1 is reserved for internal commands */ | 116 | /* tag ATA_MAX_QUEUE - 1 is reserved for internal commands */ |
| 116 | ATA_MAX_QUEUE = 32, | 117 | ATA_MAX_QUEUE = 32, |
| 117 | ATA_TAG_INTERNAL = ATA_MAX_QUEUE - 1, | 118 | ATA_TAG_INTERNAL = ATA_MAX_QUEUE - 1, |
| 118 | ATA_SHORT_PAUSE = (HZ >> 6) + 1, | 119 | ATA_SHORT_PAUSE = 16, |
| 119 | 120 | ||
| 120 | ATAPI_MAX_DRAIN = 16 << 10, | 121 | ATAPI_MAX_DRAIN = 16 << 10, |
| 121 | 122 | ||
| @@ -168,6 +169,7 @@ enum { | |||
| 168 | ATA_LFLAG_ASSUME_CLASS = ATA_LFLAG_ASSUME_ATA | ATA_LFLAG_ASSUME_SEMB, | 169 | ATA_LFLAG_ASSUME_CLASS = ATA_LFLAG_ASSUME_ATA | ATA_LFLAG_ASSUME_SEMB, |
| 169 | ATA_LFLAG_NO_RETRY = (1 << 5), /* don't retry this link */ | 170 | ATA_LFLAG_NO_RETRY = (1 << 5), /* don't retry this link */ |
| 170 | ATA_LFLAG_DISABLED = (1 << 6), /* link is disabled */ | 171 | ATA_LFLAG_DISABLED = (1 << 6), /* link is disabled */ |
| 172 | ATA_LFLAG_SW_ACTIVITY = (1 << 7), /* keep activity stats */ | ||
| 171 | 173 | ||
| 172 | /* struct ata_port flags */ | 174 | /* struct ata_port flags */ |
| 173 | ATA_FLAG_SLAVE_POSS = (1 << 0), /* host supports slave dev */ | 175 | ATA_FLAG_SLAVE_POSS = (1 << 0), /* host supports slave dev */ |
| @@ -190,6 +192,10 @@ enum { | |||
| 190 | ATA_FLAG_AN = (1 << 18), /* controller supports AN */ | 192 | ATA_FLAG_AN = (1 << 18), /* controller supports AN */ |
| 191 | ATA_FLAG_PMP = (1 << 19), /* controller supports PMP */ | 193 | ATA_FLAG_PMP = (1 << 19), /* controller supports PMP */ |
| 192 | ATA_FLAG_IPM = (1 << 20), /* driver can handle IPM */ | 194 | ATA_FLAG_IPM = (1 << 20), /* driver can handle IPM */ |
| 195 | ATA_FLAG_EM = (1 << 21), /* driver supports enclosure | ||
| 196 | * management */ | ||
| 197 | ATA_FLAG_SW_ACTIVITY = (1 << 22), /* driver supports sw activity | ||
| 198 | * led */ | ||
| 193 | 199 | ||
| 194 | /* The following flag belongs to ap->pflags but is kept in | 200 | /* The following flag belongs to ap->pflags but is kept in |
| 195 | * ap->flags because it's referenced in many LLDs and will be | 201 | * ap->flags because it's referenced in many LLDs and will be |
| @@ -234,17 +240,16 @@ enum { | |||
| 234 | /* bits 24:31 of host->flags are reserved for LLD specific flags */ | 240 | /* bits 24:31 of host->flags are reserved for LLD specific flags */ |
| 235 | 241 | ||
| 236 | /* various lengths of time */ | 242 | /* various lengths of time */ |
| 237 | ATA_TMOUT_BOOT = 30 * HZ, /* heuristic */ | 243 | ATA_TMOUT_BOOT = 30000, /* heuristic */ |
| 238 | ATA_TMOUT_BOOT_QUICK = 7 * HZ, /* heuristic */ | 244 | ATA_TMOUT_BOOT_QUICK = 7000, /* heuristic */ |
| 239 | ATA_TMOUT_INTERNAL = 30 * HZ, | 245 | ATA_TMOUT_INTERNAL_QUICK = 5000, |
| 240 | ATA_TMOUT_INTERNAL_QUICK = 5 * HZ, | ||
| 241 | 246 | ||
| 242 | /* FIXME: GoVault needs 2s but we can't afford that without | 247 | /* FIXME: GoVault needs 2s but we can't afford that without |
| 243 | * parallel probing. 800ms is enough for iVDR disk | 248 | * parallel probing. 800ms is enough for iVDR disk |
| 244 | * HHD424020F7SV00. Increase to 2secs when parallel probing | 249 | * HHD424020F7SV00. Increase to 2secs when parallel probing |
| 245 | * is in place. | 250 | * is in place. |
| 246 | */ | 251 | */ |
| 247 | ATA_TMOUT_FF_WAIT = 4 * HZ / 5, | 252 | ATA_TMOUT_FF_WAIT = 800, |
| 248 | 253 | ||
| 249 | /* Spec mandates to wait for ">= 2ms" before checking status | 254 | /* Spec mandates to wait for ">= 2ms" before checking status |
| 250 | * after reset. We wait 150ms, because that was the magic | 255 | * after reset. We wait 150ms, because that was the magic |
| @@ -256,14 +261,14 @@ enum { | |||
| 256 | * | 261 | * |
| 257 | * Old drivers/ide uses the 2mS rule and then waits for ready. | 262 | * Old drivers/ide uses the 2mS rule and then waits for ready. |
| 258 | */ | 263 | */ |
| 259 | ATA_WAIT_AFTER_RESET_MSECS = 150, | 264 | ATA_WAIT_AFTER_RESET = 150, |
| 260 | 265 | ||
| 261 | /* If PMP is supported, we have to do follow-up SRST. As some | 266 | /* If PMP is supported, we have to do follow-up SRST. As some |
| 262 | * PMPs don't send D2H Reg FIS after hardreset, LLDs are | 267 | * PMPs don't send D2H Reg FIS after hardreset, LLDs are |
| 263 | * advised to wait only for the following duration before | 268 | * advised to wait only for the following duration before |
| 264 | * doing SRST. | 269 | * doing SRST. |
| 265 | */ | 270 | */ |
| 266 | ATA_TMOUT_PMP_SRST_WAIT = 1 * HZ, | 271 | ATA_TMOUT_PMP_SRST_WAIT = 1000, |
| 267 | 272 | ||
| 268 | /* ATA bus states */ | 273 | /* ATA bus states */ |
| 269 | BUS_UNKNOWN = 0, | 274 | BUS_UNKNOWN = 0, |
| @@ -340,6 +345,11 @@ enum { | |||
| 340 | 345 | ||
| 341 | SATA_PMP_RW_TIMEOUT = 3000, /* PMP read/write timeout */ | 346 | SATA_PMP_RW_TIMEOUT = 3000, /* PMP read/write timeout */ |
| 342 | 347 | ||
| 348 | /* This should match the actual table size of | ||
| 349 | * ata_eh_cmd_timeout_table in libata-eh.c. | ||
| 350 | */ | ||
| 351 | ATA_EH_CMD_TIMEOUT_TABLE_SIZE = 5, | ||
| 352 | |||
| 343 | /* Horkage types. May be set by libata or controller on drives | 353 | /* Horkage types. May be set by libata or controller on drives |
| 344 | (some horkage may be drive/controller pair dependant */ | 354 | (some horkage may be drive/controller pair dependant */ |
| 345 | 355 | ||
| @@ -441,6 +451,15 @@ enum link_pm { | |||
| 441 | MEDIUM_POWER, | 451 | MEDIUM_POWER, |
| 442 | }; | 452 | }; |
| 443 | extern struct device_attribute dev_attr_link_power_management_policy; | 453 | extern struct device_attribute dev_attr_link_power_management_policy; |
| 454 | extern struct device_attribute dev_attr_em_message_type; | ||
| 455 | extern struct device_attribute dev_attr_em_message; | ||
| 456 | extern struct device_attribute dev_attr_sw_activity; | ||
| 457 | |||
| 458 | enum sw_activity { | ||
| 459 | OFF, | ||
| 460 | BLINK_ON, | ||
| 461 | BLINK_OFF, | ||
| 462 | }; | ||
| 444 | 463 | ||
| 445 | #ifdef CONFIG_ATA_SFF | 464 | #ifdef CONFIG_ATA_SFF |
| 446 | struct ata_ioports { | 465 | struct ata_ioports { |
| @@ -597,10 +616,14 @@ struct ata_eh_info { | |||
| 597 | struct ata_eh_context { | 616 | struct ata_eh_context { |
| 598 | struct ata_eh_info i; | 617 | struct ata_eh_info i; |
| 599 | int tries[ATA_MAX_DEVICES]; | 618 | int tries[ATA_MAX_DEVICES]; |
| 619 | int cmd_timeout_idx[ATA_MAX_DEVICES] | ||
| 620 | [ATA_EH_CMD_TIMEOUT_TABLE_SIZE]; | ||
| 600 | unsigned int classes[ATA_MAX_DEVICES]; | 621 | unsigned int classes[ATA_MAX_DEVICES]; |
| 601 | unsigned int did_probe_mask; | 622 | unsigned int did_probe_mask; |
| 602 | unsigned int saved_ncq_enabled; | 623 | unsigned int saved_ncq_enabled; |
| 603 | u8 saved_xfer_mode[ATA_MAX_DEVICES]; | 624 | u8 saved_xfer_mode[ATA_MAX_DEVICES]; |
| 625 | /* timestamp for the last reset attempt or success */ | ||
| 626 | unsigned long last_reset; | ||
| 604 | }; | 627 | }; |
| 605 | 628 | ||
| 606 | struct ata_acpi_drive | 629 | struct ata_acpi_drive |
| @@ -692,6 +715,7 @@ struct ata_port { | |||
| 692 | struct timer_list fastdrain_timer; | 715 | struct timer_list fastdrain_timer; |
| 693 | unsigned long fastdrain_cnt; | 716 | unsigned long fastdrain_cnt; |
| 694 | 717 | ||
| 718 | int em_message_type; | ||
| 695 | void *private_data; | 719 | void *private_data; |
| 696 | 720 | ||
| 697 | #ifdef CONFIG_ATA_ACPI | 721 | #ifdef CONFIG_ATA_ACPI |
| @@ -783,6 +807,12 @@ struct ata_port_operations { | |||
| 783 | u8 (*bmdma_status)(struct ata_port *ap); | 807 | u8 (*bmdma_status)(struct ata_port *ap); |
| 784 | #endif /* CONFIG_ATA_SFF */ | 808 | #endif /* CONFIG_ATA_SFF */ |
| 785 | 809 | ||
| 810 | ssize_t (*em_show)(struct ata_port *ap, char *buf); | ||
| 811 | ssize_t (*em_store)(struct ata_port *ap, const char *message, | ||
| 812 | size_t size); | ||
| 813 | ssize_t (*sw_activity_show)(struct ata_device *dev, char *buf); | ||
| 814 | ssize_t (*sw_activity_store)(struct ata_device *dev, | ||
| 815 | enum sw_activity val); | ||
| 786 | /* | 816 | /* |
| 787 | * Obsolete | 817 | * Obsolete |
| 788 | */ | 818 | */ |
| @@ -895,8 +925,7 @@ extern void ata_host_resume(struct ata_host *host); | |||
| 895 | #endif | 925 | #endif |
| 896 | extern int ata_ratelimit(void); | 926 | extern int ata_ratelimit(void); |
| 897 | extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val, | 927 | extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val, |
| 898 | unsigned long interval_msec, | 928 | unsigned long interval, unsigned long timeout); |
| 899 | unsigned long timeout_msec); | ||
| 900 | extern int atapi_cmd_type(u8 opcode); | 929 | extern int atapi_cmd_type(u8 opcode); |
| 901 | extern void ata_tf_to_fis(const struct ata_taskfile *tf, | 930 | extern void ata_tf_to_fis(const struct ata_taskfile *tf, |
| 902 | u8 pmp, int is_cmd, u8 *fis); | 931 | u8 pmp, int is_cmd, u8 *fis); |
| @@ -1389,6 +1418,12 @@ static inline int ata_check_ready(u8 status) | |||
| 1389 | return 0; | 1418 | return 0; |
| 1390 | } | 1419 | } |
| 1391 | 1420 | ||
| 1421 | static inline unsigned long ata_deadline(unsigned long from_jiffies, | ||
| 1422 | unsigned long timeout_msecs) | ||
| 1423 | { | ||
| 1424 | return from_jiffies + msecs_to_jiffies(timeout_msecs); | ||
| 1425 | } | ||
| 1426 | |||
| 1392 | 1427 | ||
| 1393 | /************************************************************************** | 1428 | /************************************************************************** |
| 1394 | * PMP - drivers/ata/libata-pmp.c | 1429 | * PMP - drivers/ata/libata-pmp.c |
