[PATCH] x86_64: Fix the node cpumask of a cpu going down
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / x86_64 / lib / delay.c
blob03c460cbdd1c0b516fcf3f262518994785bcafe6
1 /*
2 * Precise Delay Loops for x86-64
4 * Copyright (C) 1993 Linus Torvalds
5 * Copyright (C) 1997 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
7 * The __delay function must _NOT_ be inlined as its execution time
8 * depends wildly on alignment on many x86 processors.
9 */
11 #include <linux/config.h>
12 #include <linux/sched.h>
13 #include <linux/delay.h>
14 #include <asm/delay.h>
15 #include <asm/msr.h>
17 #ifdef CONFIG_SMP
18 #include <asm/smp.h>
19 #endif
21 int read_current_timer(unsigned long *timer_value)
23 rdtscll(*timer_value);
24 return 0;
27 void __delay(unsigned long loops)
29 unsigned bclock, now;
31 rdtscl(bclock);
34 rep_nop();
35 rdtscl(now);
37 while((now-bclock) < loops);
40 inline void __const_udelay(unsigned long xloops)
42 __delay((xloops * HZ * cpu_data[raw_smp_processor_id()].loops_per_jiffy) >> 32);
45 void __udelay(unsigned long usecs)
47 __const_udelay(usecs * 0x000010c6); /* 2**32 / 1000000 */
50 void __ndelay(unsigned long nsecs)
52 __const_udelay(nsecs * 0x00005); /* 2**32 / 1000000000 (rounded up) */