Re: [PATCH] x86: cpu make amd.c more like amd_64.c

Previous thread: none

Next thread: [PATCH 2.6.28] m68k: init_irq_proc depends on CONFIG_PROC_FS by Geert Uytterhoeven on Sunday, September 7, 2008 - 1:44 am. (1 message)
From: Yinghai Lu
Date: Sunday, September 7, 2008 - 12:15 am

1. make 32bit have early_init_amd_mc and amd_detect_cmp
2. seperate init_amd_k5/k6/k7 ...

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>

---
 arch/x86/kernel/cpu/amd.c    |  396 ++++++++++++++++++++++++-------------------
 arch/x86/kernel/cpu/amd_64.c |   17 +
 include/asm-x86/processor.h  |    4 
 3 files changed, 236 insertions(+), 181 deletions(-)

Index: linux-2.6/arch/x86/kernel/cpu/amd.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/cpu/amd.c
+++ linux-2.6/arch/x86/kernel/cpu/amd.c
@@ -24,8 +24,200 @@
 extern void vide(void);
 __asm__(".align 4\nvide: ret");
 
+static void __cpuinit init_amd_k5(struct cpuinfo_x86 *c)
+{
+/*
+ * General Systems BIOSen alias the cpu frequency registers
+ * of the Elan at 0x000df000. Unfortuantly, one of the Linux
+ * drivers subsequently pokes it, and changes the CPU speed.
+ * Workaround : Remove the unneeded alias.
+ */
+#define CBAR		(0xfffc) /* Configuration Base Address  (32-bit) */
+#define CBAR_ENB	(0x80000000)
+#define CBAR_KEY	(0X000000CB)
+	if (c->x86_model == 9 || c->x86_model == 10) {
+		if (inl (CBAR) & CBAR_ENB)
+			outl (0 | CBAR_KEY, CBAR);
+	}
+}
+
+
+static void __cpuinit init_amd_k6(struct cpuinfo_x86 *c)
+{
+	u32 l, h;
+	int mbytes = num_physpages >> (20-PAGE_SHIFT);
+
+	if (c->x86_model < 6) {
+		/* Based on AMD doc 20734R - June 2000 */
+		if (c->x86_model == 0) {
+			clear_cpu_cap(c, X86_FEATURE_APIC);
+			set_cpu_cap(c, X86_FEATURE_PGE);
+		}
+		return;
+	}
+
+	if (c->x86_model == 6 && c->x86_mask == 1) {
+		const int K6_BUG_LOOP = 1000000;
+		int n;
+		void (*f_vide)(void);
+		unsigned long d, d2;
+
+		printk(KERN_INFO "AMD K6 stepping B detected - ");
+
+		/*
+		 * It looks like AMD fixed the 2.6.2 bug and improved indirect
+		 * calls at the same time.
+		 */
+
+		n = K6_BUG_LOOP;
+		f_vide = vide;
+		rdtscl(d);
+		while (n--)
+			f_vide();
+		rdtscl(d2);
+		d = d2-d;
+
+		if (d > ...
From: Ingo Molnar
Date: Sunday, September 7, 2008 - 12:25 am

applied to tip/x86/unify-cpu-detect, thanks Yinghai.

	Ingo
--

From: Ingo Molnar
Date: Sunday, September 7, 2008 - 2:07 am

-tip testing found a build failure with the attached config:

arch/x86/kernel/cpu/common.c: In function 'identify_cpu':
arch/x86/kernel/cpu/common.c:633: error: 'struct cpuinfo_x86' has no member named 'x86_coreid_bits'

	Ingo

Previous thread: none

Next thread: [PATCH 2.6.28] m68k: init_irq_proc depends on CONFIG_PROC_FS by Geert Uytterhoeven on Sunday, September 7, 2008 - 1:44 am. (1 message)