ia64/xen-unstable

view xen/arch/x86/delay.c @ 18806:ed8524f4a044

x86: Re-initialise HPET on resume from S3

Signed-off-by: Guanqun Lu <guanqun.lu@intel.com>
Signed-off-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Nov 18 15:55:14 2008 +0000 (2008-11-18)
parents 043a4aa24781
children
line source
1 /*
2 * Precise Delay Loops for i386
3 *
4 * Copyright (C) 1993 Linus Torvalds
5 * Copyright (C) 1997 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
6 *
7 * The __delay function must _NOT_ be inlined as its execution time
8 * depends wildly on alignment on many x86 processors. The additional
9 * jump magic is needed to get the timing stable on all the CPU's
10 * we have to worry about.
11 */
13 #include <xen/config.h>
14 #include <xen/delay.h>
15 #include <xen/time.h>
16 #include <asm/msr.h>
17 #include <asm/processor.h>
19 void __udelay(unsigned long usecs)
20 {
21 unsigned long ticks = usecs * (cpu_khz / 1000);
22 unsigned long s, e;
24 rdtscl(s);
25 do
26 {
27 rep_nop();
28 rdtscl(e);
29 } while ((e-s) < ticks);
30 }