diff options
| author | Jeff Garzik <jgarzik@pobox.com> | 2005-12-19 00:09:53 -0500 |
|---|---|---|
| committer | Jeff Garzik <jgarzik@pobox.com> | 2005-12-19 00:09:53 -0500 |
| commit | 418fbfe979d96efc7b91f29b2085d51541c61f0b (patch) | |
| tree | a9acb07328e0c76011727d5b3b6f5407afcd2866 /arch/ia64/kernel/time.c | |
| parent | 8b132f4ee7304fec4fa27dec67879bc0172e916a (diff) | |
| parent | ff60dde9e46b87757d5e83bd58be0688fca8e816 (diff) | |
Merge branch 'master'
Diffstat (limited to 'arch/ia64/kernel/time.c')
| -rw-r--r-- | arch/ia64/kernel/time.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c index 5b7e736f3b49..028a2b95936c 100644 --- a/arch/ia64/kernel/time.c +++ b/arch/ia64/kernel/time.c @@ -249,3 +249,32 @@ time_init (void) */ set_normalized_timespec(&wall_to_monotonic, -xtime.tv_sec, -xtime.tv_nsec); } + +#define SMALLUSECS 100 + +void +udelay (unsigned long usecs) +{ + unsigned long start; + unsigned long cycles; + unsigned long smallusecs; + + /* + * Execute the non-preemptible delay loop (because the ITC might + * not be synchronized between CPUS) in relatively short time + * chunks, allowing preemption between the chunks. + */ + while (usecs > 0) { + smallusecs = (usecs > SMALLUSECS) ? SMALLUSECS : usecs; + preempt_disable(); + cycles = smallusecs*local_cpu_data->cyc_per_usec; + start = ia64_get_itc(); + + while (ia64_get_itc() - start < cycles) + cpu_relax(); + + preempt_enable(); + usecs -= smallusecs; + } +} +EXPORT_SYMBOL(udelay); |
