# HG changeset patch
# User Jimi Xenidis <[EMAIL PROTECTED]>
# Node ID af1380a08804aed15a04f3dd60c5e56011e68d06
# Parent  acfb1ac23f80286c8b532052f5e4b77f33612636
[XEN][POWERPC] Backoff the SCOM stuff by default

Sadly the SCOM stuff is proving to be unstable for various versions of
the chip.  I'm turning it off by default.  Also adding some PVR
decoding logic.

Signed-off-by: Jimi Xenidis <[EMAIL PROTECTED]>
---
 xen/arch/powerpc/powerpc64/ppc970_scom.c |   25 +++++++--
 xen/include/asm-powerpc/processor.h      |   79 +++++++++++++++++++++++++++++++
 2 files changed, 98 insertions(+), 6 deletions(-)

diff -r acfb1ac23f80 -r af1380a08804 xen/arch/powerpc/powerpc64/ppc970_scom.c
--- a/xen/arch/powerpc/powerpc64/ppc970_scom.c  Mon Sep 25 11:19:55 2006 -0400
+++ b/xen/arch/powerpc/powerpc64/ppc970_scom.c  Tue Sep 26 12:42:33 2006 -0400
@@ -24,7 +24,10 @@
 #include <xen/console.h>
 #include <xen/errno.h>
 #include <asm/delay.h>
+#include <asm/processor.h>
 #include "scom.h"
+
+#undef CONFIG_SCOM
 
 #define SPRN_SCOMC 276
 #define SPRN_SCOMD 277
@@ -153,19 +156,29 @@ int cpu_scom_write(uint addr, ulong d)
 
 void cpu_scom_init(void)
 {
+#ifdef CONFIG_SCOM
     ulong val;
-    console_start_sync();
-    if (!cpu_scom_read(SCOM_PTSR, &val))
-        printk("SCOM PTSR: 0x%016lx\n", val);
+    if (PVR_REV(mfpvr()) == 0x0300) {
+        /* these address are only good for 970FX */
+        console_start_sync();
+        if (!cpu_scom_read(SCOM_PTSR, &val))
+            printk("SCOM PTSR: 0x%016lx\n", val);
 
-    console_end_sync();
+        console_end_sync();
+    }
+#endif
 }
 
 void cpu_scom_AMCR(void)
 {
+#ifdef CONFIG_SCOM
     ulong val;
 
-    cpu_scom_read(SCOM_AMC_REG, &val);
-    printk("SCOM AMCR: 0x%016lx\n", val);
+    if (PVR_REV(mfpvr()) == 0x0300) {
+        /* these address are only good for 970FX */
+        cpu_scom_read(SCOM_AMC_REG, &val);
+        printk("SCOM AMCR: 0x%016lx\n", val);
+    }
+#endif
 }
 
diff -r acfb1ac23f80 -r af1380a08804 xen/include/asm-powerpc/processor.h
--- a/xen/include/asm-powerpc/processor.h       Mon Sep 25 11:19:55 2006 -0400
+++ b/xen/include/asm-powerpc/processor.h       Tue Sep 26 12:42:33 2006 -0400
@@ -30,6 +30,85 @@
 
 /* most assembler do not know this instruction */
 #define HRFID .long 0x4c000224
+
+/* Processor Version Register (PVR) field extraction */
+
+#define PVR_VER(pvr)   (((pvr) >>  16) & 0xFFFF)       /* Version field */
+#define PVR_REV(pvr)   (((pvr) >>   0) & 0xFFFF)       /* Revison field */
+
+#define __is_processor(pv)     (PVR_VER(mfspr(SPRN_PVR)) == (pv))
+
+/*
+ * IBM has further subdivided the standard PowerPC 16-bit version and
+ * revision subfields of the PVR for the PowerPC 403s into the following:
+ */
+
+#define PVR_FAM(pvr)   (((pvr) >> 20) & 0xFFF) /* Family field */
+#define PVR_MEM(pvr)   (((pvr) >> 16) & 0xF)   /* Member field */
+#define PVR_CORE(pvr)  (((pvr) >> 12) & 0xF)   /* Core field */
+#define PVR_CFG(pvr)   (((pvr) >>  8) & 0xF)   /* Configuration field */
+#define PVR_MAJ(pvr)   (((pvr) >>  4) & 0xF)   /* Major revision field */
+#define PVR_MIN(pvr)   (((pvr) >>  0) & 0xF)   /* Minor revision field */
+
+/* Processor Version Numbers */
+
+#define PVR_403GA      0x00200000
+#define PVR_403GB      0x00200100
+#define PVR_403GC      0x00200200
+#define PVR_403GCX     0x00201400
+#define PVR_405GP      0x40110000
+#define PVR_STB03XXX   0x40310000
+#define PVR_NP405H     0x41410000
+#define PVR_NP405L     0x41610000
+#define PVR_601                0x00010000
+#define PVR_602                0x00050000
+#define PVR_603                0x00030000
+#define PVR_603e       0x00060000
+#define PVR_603ev      0x00070000
+#define PVR_603r       0x00071000
+#define PVR_604                0x00040000
+#define PVR_604e       0x00090000
+#define PVR_604r       0x000A0000
+#define PVR_620                0x00140000
+#define PVR_740                0x00080000
+#define PVR_750                PVR_740
+#define PVR_740P       0x10080000
+#define PVR_750P       PVR_740P
+#define PVR_7400       0x000C0000
+#define PVR_7410       0x800C0000
+#define PVR_7450       0x80000000
+#define PVR_8540       0x80200000
+#define PVR_8560       0x80200000
+/*
+ * For the 8xx processors, all of them report the same PVR family for
+ * the PowerPC core. The various versions of these processors must be
+ * differentiated by the version number in the Communication Processor
+ * Module (CPM).
+ */
+#define PVR_821                0x00500000
+#define PVR_823                PVR_821
+#define PVR_850                PVR_821
+#define PVR_860                PVR_821
+#define PVR_8240       0x00810100
+#define PVR_8245       0x80811014
+#define PVR_8260       PVR_8240
+
+/* 64-bit processors */
+/* XXX the prefix should be PVR_, we'll do a global sweep to fix it one day */
+#define PV_NORTHSTAR   0x0033
+#define PV_PULSAR      0x0034
+#define PV_POWER4      0x0035
+#define PV_ICESTAR     0x0036
+#define PV_SSTAR       0x0037
+#define PV_POWER4p     0x0038
+#define PV_970         0x0039
+#define PV_POWER5      0x003A
+#define PV_POWER5p     0x003B
+#define PV_970FX       0x003C
+#define PV_630         0x0040
+#define PV_630p        0x0041
+#define PV_970MP       0x0044
+#define PV_BE          0x0070
 
 #ifndef __ASSEMBLY__ 
 #include <xen/types.h>

_______________________________________________
Xen-ppc-devel mailing list
Xen-ppc-devel@lists.xensource.com
http://lists.xensource.com/xen-ppc-devel

Reply via email to