Title: [5363] trunk: print out error/warning if you are running on the incorrect CPU type

Diff

Modified: trunk/arch/blackfin/kernel/setup.c (5362 => 5363)


--- trunk/arch/blackfin/kernel/setup.c	2008-09-30 05:42:59 UTC (rev 5362)
+++ trunk/arch/blackfin/kernel/setup.c	2008-09-30 19:40:26 UTC (rev 5363)
@@ -813,14 +813,21 @@
 		printk(KERN_INFO "Compiled for ADSP-%s Rev none\n", CPU);
 	else
 		printk(KERN_INFO "Compiled for ADSP-%s Rev 0.%d\n", CPU, bfin_compiled_revid());
-	if (bfin_revid() != bfin_compiled_revid()) {
-		if (bfin_compiled_revid() == -1)
-			printk(KERN_ERR "Warning: Compiled for Rev none, but running on Rev %d\n",
-			       bfin_revid());
-		else if (bfin_compiled_revid() != 0xffff)
-			printk(KERN_ERR "Warning: Compiled for Rev %d, but running on Rev %d\n",
-			       bfin_compiled_revid(), bfin_revid());
+
+	if (unlikely(CPUID != bfin_cpuid()))
+		printk(KERN_ERR "ERROR: Not running on ADSP-%s: unknown CPUID 0x%04x Rev 0.%d",
+			CPU, bfin_cpuid(), bfin_revid());
+	else {
+		if (bfin_revid() != bfin_compiled_revid()) {
+			if (bfin_compiled_revid() == -1)
+				printk(KERN_ERR "Warning: Compiled for Rev none, but running on Rev %d\n",
+				       bfin_revid());
+			else if (bfin_compiled_revid() != 0xffff)
+				printk(KERN_ERR "Warning: Compiled for Rev %d, but running on Rev %d\n",
+				       bfin_compiled_revid(), bfin_revid());
+		}
 	}
+
 	if (bfin_revid() <= CONFIG_BF_REV_MIN || bfin_revid() > CONFIG_BF_REV_MAX)
 		printk(KERN_ERR "Warning: Unsupported Chip Revision ADSP-%s Rev 0.%d detected\n",
 		       CPU, bfin_revid());
@@ -997,13 +1004,18 @@
 	}
 
 	seq_printf(m, "processor\t: %d\n"
-		"vendor_id\t: %s\n"
-		"cpu family\t: 0x%x\n"
-		"model name\t: ADSP-%s %lu(MHz CCLK) %lu(MHz SCLK) (%s)\n"
+		"vendor_id\t: %s\n",
+		*(unsigned int *)v,
+		vendor);
+
+	if (CPUID == bfin_cpuid())
+		seq_printf(m, "cpu family\t: 0x%04x\n", CPUID);
+	else
+		seq_printf(m, "cpu family\t: Compiled for:0x%04x, running on:0x%04x\n",
+			CPUID, bfin_cpuid());
+
+	seq_printf(m, "model name\t: ADSP-%s %lu(MHz CCLK) %lu(MHz SCLK) (%s)\n"
 		"stepping\t: %d\n",
-		*(unsigned int *)v,
-		vendor,
-		(bfin_read_CHIPID() & CHIPID_FAMILY),
 		cpu, cclk/1000000, sclk/1000000,
 #ifdef CONFIG_MPU
 		"mpu on",

Modified: trunk/include/asm-blackfin/mach-bf527/bf527.h (5362 => 5363)


--- trunk/include/asm-blackfin/mach-bf527/bf527.h	2008-09-30 05:42:59 UTC (rev 5362)
+++ trunk/include/asm-blackfin/mach-bf527/bf527.h	2008-09-30 19:40:26 UTC (rev 5363)
@@ -110,12 +110,15 @@
 
 #ifdef CONFIG_BF527
 #define CPU "BF527"
+#define CPUID 0x27e4
 #endif
 #ifdef CONFIG_BF525
 #define CPU "BF525"
+#define CPUID 0x27e4
 #endif
 #ifdef CONFIG_BF522
 #define CPU "BF522"
+#define CPUID 0x27e4
 #endif
 #ifndef CPU
 #define	CPU "UNKNOWN"

Modified: trunk/include/asm-blackfin/mach-bf533/bf533.h (5362 => 5363)


--- trunk/include/asm-blackfin/mach-bf533/bf533.h	2008-09-30 05:42:59 UTC (rev 5362)
+++ trunk/include/asm-blackfin/mach-bf533/bf533.h	2008-09-30 19:40:26 UTC (rev 5363)
@@ -141,15 +141,15 @@
 
 #ifdef CONFIG_BF533
 #define CPU "BF533"
-#define CPUID 0x027a5000
+#define CPUID 0x27a5
 #endif
 #ifdef CONFIG_BF532
 #define CPU "BF532"
-#define CPUID 0x0275A000
+#define CPUID 0x275A
 #endif
 #ifdef CONFIG_BF531
 #define CPU "BF531"
-#define CPUID 0x027a5000
+#define CPUID 0x27a5
 #endif
 #ifndef CPU
 #define	CPU "UNKNOWN"

Modified: trunk/include/asm-blackfin/mach-bf537/bf537.h (5362 => 5363)


--- trunk/include/asm-blackfin/mach-bf537/bf537.h	2008-09-30 05:42:59 UTC (rev 5362)
+++ trunk/include/asm-blackfin/mach-bf537/bf537.h	2008-09-30 19:40:26 UTC (rev 5363)
@@ -121,15 +121,15 @@
 
 #ifdef CONFIG_BF537
 #define CPU "BF537"
-#define CPUID 0x027c8000
+#define CPUID 0x27c8
 #endif
 #ifdef CONFIG_BF536
 #define CPU "BF536"
-#define CPUID 0x027c8000
+#define CPUID 0x27c8
 #endif
 #ifdef CONFIG_BF534
 #define CPU "BF534"
-#define CPUID 0x027c6000
+#define CPUID 0x27c6
 #endif
 #ifndef CPU
 #define	CPU "UNKNOWN"

Modified: trunk/include/asm-blackfin/mach-bf548/bf548.h (5362 => 5363)


--- trunk/include/asm-blackfin/mach-bf548/bf548.h	2008-09-30 05:42:59 UTC (rev 5362)
+++ trunk/include/asm-blackfin/mach-bf548/bf548.h	2008-09-30 19:40:26 UTC (rev 5363)
@@ -106,17 +106,18 @@
 
 #if defined(CONFIG_BF542)
 # define CPU   "BF542"
-# define CPUID 0x027c8000
+# define CPUID 0x27c8
 #elif defined(CONFIG_BF544)
 # define CPU "BF544"
-# define CPUID 0x027c8000
+# define CPUID 0x27c8
 #elif defined(CONFIG_BF547)
 # define CPU "BF547"
 #elif defined(CONFIG_BF548)
 # define CPU "BF548"
-# define CPUID 0x027c6000
+# define CPUID 0x27c6
 #elif defined(CONFIG_BF549)
 # define CPU "BF549"
+# define CPUID 0x27c8
 #else
 # define CPU "UNKNOWN"
 # define CPUID 0x0

Modified: trunk/include/asm-blackfin/mach-bf561/bf561.h (5362 => 5363)


--- trunk/include/asm-blackfin/mach-bf561/bf561.h	2008-09-30 05:42:59 UTC (rev 5362)
+++ trunk/include/asm-blackfin/mach-bf561/bf561.h	2008-09-30 19:40:26 UTC (rev 5363)
@@ -211,7 +211,7 @@
 
 #ifdef CONFIG_BF561
 #define CPU "BF561"
-#define CPUID 0x027bb000
+#define CPUID 0x27bb
 #endif
 #ifndef CPU
 #define CPU "UNKNOWN"

Modified: trunk/include/asm-blackfin/processor.h (5362 => 5363)


--- trunk/include/asm-blackfin/processor.h	2008-09-30 05:42:59 UTC (rev 5362)
+++ trunk/include/asm-blackfin/processor.h	2008-09-30 19:40:26 UTC (rev 5363)
@@ -134,6 +134,12 @@
 	return revid;
 }
 
+static inline uint16_t __pure bfin_cpuid(void)
+{
+	return (bfin_read_CHIPID() & CHIPID_FAMILY) >> 12;
+
+}
+
 static inline uint32_t __pure bfin_compiled_revid(void)
 {
 #if defined(CONFIG_BF_REV_0_0)
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
http://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to