aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/libata.h
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2008-05-19 13:17:51 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-07-14 15:59:32 -0400
commit341c2c958ec7bdd9f54733a8b0b432fe76842a82 (patch)
tree1af1983fe82ad032de6142229fe6c70f04466918 /include/linux/libata.h
parentbce7f793daec3e65ec5c5705d2457b81fe7b5725 (diff)
libata: consistently use msecs for time durations
libata has been using mix of jiffies and msecs for time druations. This is getting confusing. As writing sub HZ values in jiffies is PITA and msecs_to_jiffies() can't be used as initializer, unify unit for all time durations to msecs. So, durations are in msecs and deadlines are in jiffies. ata_deadline() is added to compute deadline from a start time and duration in msecs. While at it, drop now superflous _msec suffix from arguments and rename @timeout to @deadline if it represents a fixed point in time rather than duration. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'include/linux/libata.h')
-rw-r--r--include/linux/libata.h26
1 files changed, 16 insertions, 10 deletions
diff --git a/include/linux/libata.h b/include/linux/libata.h
index e57e5d08312d..94110b652b30 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
@@ -234,17 +235,17 @@ enum {
234 /* bits 24:31 of host->flags are reserved for LLD specific flags */ 235 /* bits 24:31 of host->flags are reserved for LLD specific flags */
235 236
236 /* various lengths of time */ 237 /* various lengths of time */
237 ATA_TMOUT_BOOT = 30 * HZ, /* heuristic */ 238 ATA_TMOUT_BOOT = 30000, /* heuristic */
238 ATA_TMOUT_BOOT_QUICK = 7 * HZ, /* heuristic */ 239 ATA_TMOUT_BOOT_QUICK = 7000, /* heuristic */
239 ATA_TMOUT_INTERNAL = 30 * HZ, 240 ATA_TMOUT_INTERNAL = 30000,
240 ATA_TMOUT_INTERNAL_QUICK = 5 * HZ, 241 ATA_TMOUT_INTERNAL_QUICK = 5000,
241 242
242 /* FIXME: GoVault needs 2s but we can't afford that without 243 /* FIXME: GoVault needs 2s but we can't afford that without
243 * parallel probing. 800ms is enough for iVDR disk 244 * parallel probing. 800ms is enough for iVDR disk
244 * HHD424020F7SV00. Increase to 2secs when parallel probing 245 * HHD424020F7SV00. Increase to 2secs when parallel probing
245 * is in place. 246 * is in place.
246 */ 247 */
247 ATA_TMOUT_FF_WAIT = 4 * HZ / 5, 248 ATA_TMOUT_FF_WAIT = 800,
248 249
249 /* Spec mandates to wait for ">= 2ms" before checking status 250 /* Spec mandates to wait for ">= 2ms" before checking status
250 * after reset. We wait 150ms, because that was the magic 251 * after reset. We wait 150ms, because that was the magic
@@ -256,14 +257,14 @@ enum {
256 * 257 *
257 * Old drivers/ide uses the 2mS rule and then waits for ready. 258 * Old drivers/ide uses the 2mS rule and then waits for ready.
258 */ 259 */
259 ATA_WAIT_AFTER_RESET_MSECS = 150, 260 ATA_WAIT_AFTER_RESET = 150,
260 261
261 /* If PMP is supported, we have to do follow-up SRST. As some 262 /* 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 263 * PMPs don't send D2H Reg FIS after hardreset, LLDs are
263 * advised to wait only for the following duration before 264 * advised to wait only for the following duration before
264 * doing SRST. 265 * doing SRST.
265 */ 266 */
266 ATA_TMOUT_PMP_SRST_WAIT = 1 * HZ, 267 ATA_TMOUT_PMP_SRST_WAIT = 1000,
267 268
268 /* ATA bus states */ 269 /* ATA bus states */
269 BUS_UNKNOWN = 0, 270 BUS_UNKNOWN = 0,
@@ -895,8 +896,7 @@ extern void ata_host_resume(struct ata_host *host);
895#endif 896#endif
896extern int ata_ratelimit(void); 897extern int ata_ratelimit(void);
897extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val, 898extern u32 ata_wait_register(void __iomem *reg, u32 mask, u32 val,
898 unsigned long interval_msec, 899 unsigned long interval, unsigned long timeout);
899 unsigned long timeout_msec);
900extern int atapi_cmd_type(u8 opcode); 900extern int atapi_cmd_type(u8 opcode);
901extern void ata_tf_to_fis(const struct ata_taskfile *tf, 901extern void ata_tf_to_fis(const struct ata_taskfile *tf,
902 u8 pmp, int is_cmd, u8 *fis); 902 u8 pmp, int is_cmd, u8 *fis);
@@ -1389,6 +1389,12 @@ static inline int ata_check_ready(u8 status)
1389 return 0; 1389 return 0;
1390} 1390}
1391 1391
1392static inline unsigned long ata_deadline(unsigned long from_jiffies,
1393 unsigned long timeout_msecs)
1394{
1395 return from_jiffies + msecs_to_jiffies(timeout_msecs);
1396}
1397
1392 1398
1393/************************************************************************** 1399/**************************************************************************
1394 * PMP - drivers/ata/libata-pmp.c 1400 * PMP - drivers/ata/libata-pmp.c