<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">
From: Ingo Molnar &lt;mingo@elte.hu&gt;

Clean up the TSC-synchronization code: get rid of div64 and calm down the
printks.

Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
Signed-off-by: Andrew Morton &lt;akpm@osdl.org&gt;
---

 25-akpm/arch/i386/kernel/smpboot.c |   39 +++++--------------------------------
 1 files changed, 6 insertions(+), 33 deletions(-)

diff -puN arch/i386/kernel/smpboot.c~tsc-synchronisation-cleanup arch/i386/kernel/smpboot.c
--- 25/arch/i386/kernel/smpboot.c~tsc-synchronisation-cleanup	2004-09-05 14:58:48.049055712 -0700
+++ 25-akpm/arch/i386/kernel/smpboot.c	2004-09-05 14:58:48.053055104 -0700
@@ -197,34 +197,6 @@ static unsigned long long tsc_values[NR_
 
 #define NR_LOOPS 5
 
-/*
- * accurate 64-bit/32-bit division, expanded to 32-bit divisions and 64-bit
- * multiplication. Not terribly optimized but we need it at boot time only
- * anyway.
- *
- * result == a / b
- *	== (a1 + a2*(2^32)) / b
- *	== a1/b + a2*(2^32/b)
- *	== a1/b + a2*((2^32-1)/b) + a2/b + (a2*((2^32-1) % b))/b
- *		    ^---- (this multiplication can overflow)
- */
-
-static unsigned long long __init div64 (unsigned long long a, unsigned long b0)
-{
-	unsigned int a1, a2;
-	unsigned long long res;
-
-	a1 = ((unsigned int*)&amp;a)[0];
-	a2 = ((unsigned int*)&amp;a)[1];
-
-	res = a1/b0 +
-		(unsigned long long)a2 * (unsigned long long)(0xffffffff/b0) +
-		a2 / b0 +
-		(a2 * (0xffffffff % b0)) / b0;
-
-	return res;
-}
-
 static void __init synchronize_tsc_bp (void)
 {
 	int i;
@@ -234,7 +206,7 @@ static void __init synchronize_tsc_bp (v
 	unsigned long one_usec;
 	int buggy = 0;
 
-	printk("checking TSC synchronization across %u CPUs: ", num_booting_cpus());
+	printk(KERN_INFO "checking TSC synchronization across %u CPUs: ", num_booting_cpus());
 
 	/* convert from kcyc/sec to cyc/usec */
 	one_usec = cpu_khz / 1000;
@@ -289,7 +261,8 @@ static void __init synchronize_tsc_bp (v
 			sum += t0;
 		}
 	}
-	avg = div64(sum, num_booting_cpus());
+	avg = sum;
+	do_div(avg, num_booting_cpus());
 
 	sum = 0;
 	for (i = 0; i &lt; NR_CPUS; i++) {
@@ -307,18 +280,18 @@ static void __init synchronize_tsc_bp (v
 				buggy = 1;
 				printk("\n");
 			}
-			realdelta = div64(delta, one_usec);
+			realdelta = delta;
+			do_div(realdelta, one_usec);
 			if (tsc_values[i] &lt; avg)
 				realdelta = -realdelta;
 
-			printk("BIOS BUG: CPU#%d improperly initialized, has %ld usecs TSC skew! FIXED.\n", i, realdelta);
+			printk(KERN_INFO "CPU#%d had %ld usecs TSC skew, fixed it up.\n", i, realdelta);
 		}
 
 		sum += delta;
 	}
 	if (!buggy)
 		printk("passed.\n");
-		;
 }
 
 static void __init synchronize_tsc_ap (void)
_
</pre></body></html>