
From: Mikael Pettersson <mikpe@csd.uu.se>

This patch is an update to perfctr's PPC32 low-level driver:
- Add support for the MPC7447A processor.
- Add partial support for the new MPC7448 processor.
  PLL_CFG decoding not yet implemented due to lack of docs.
- Enable overflow interrupt support on all G4 processors except
  those with the DEC/TAU/PMI erratum.
- Wrap thread_struct's perfctr pointer in an #ifdef to avoid
  bloat when perfctr is disabled. This was requested by some
  users in the PPC32 embedded world.

Signed-off-by: Mikael Pettersson <mikpe@csd.uu.se>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/drivers/perfctr/ppc.c       |   20 +++++++++++---------
 25-akpm/include/asm-ppc/processor.h |    2 ++
 2 files changed, 13 insertions(+), 9 deletions(-)

diff -puN drivers/perfctr/ppc.c~perfctr-ppc32-update drivers/perfctr/ppc.c
--- 25/drivers/perfctr/ppc.c~perfctr-ppc32-update	2005-02-22 18:17:38.000000000 -0800
+++ 25-akpm/drivers/perfctr/ppc.c	2005-02-22 18:17:38.000000000 -0800
@@ -1,4 +1,4 @@
-/* $Id: ppc.c,v 1.12 2004/05/31 18:13:42 mikpe Exp $
+/* $Id: ppc.c,v 1.27 2004/10/24 00:07:44 mikpe Exp $
  * PPC32 performance-monitoring counters driver.
  *
  * Copyright (C) 2004  Mikael Pettersson
@@ -149,14 +149,6 @@ static inline int perfctr_cstatus_has_mm
  *   doing this (a) reserves one PMC, and (b) needs indirect accesses
  *   since the SPR number in general isn't known at compile-time.
  *
- * Driver notes
- * ------------
- * - The driver currently does not support performance monitor interrupts,
- *   mostly because of the 750/7400/7410 erratum. Working around it would
- *   require disabling the decrementer interrupt, reserving a performance
- *   counter and setting it up for TBL bit-flip events, and having the PMI
- *   handler invoke the decrementer handler.
- *
  * 604
  * ---
  * 604 has MMCR0, PMC1, PMC2, SIA, and SDA.
@@ -830,10 +822,13 @@ static int __init known_init(void)
 		pll_type = PLL_7400;
 		break;
 	case 0x800C: /* 7410 */
+		if ((pvr & 0xFFFF) >= 0x1103)
+			features |= PERFCTR_FEATURE_PCINT;
 		pm_type = PM_7400;
 		pll_type = PLL_7400;
 		break;
 	case 0x8000: /* 7451/7441 */
+		features |= PERFCTR_FEATURE_PCINT;
 		pm_type = PM_7450;
 		pll_type = PLL_7450;
 		break;
@@ -842,9 +837,16 @@ static int __init known_init(void)
 		pll_type = ((pvr & 0xFFFF) < 0x0303) ? PLL_7450 : PLL_7457;
 		break;
 	case 0x8002: /* 7457/7447 */
+	case 0x8003: /* 7447A */
+		features |= PERFCTR_FEATURE_PCINT;
 		pm_type = PM_7450;
 		pll_type = PLL_7457;
 		break;
+	case 0x8004: /* 7448 */
+		features |= PERFCTR_FEATURE_PCINT;
+		pm_type = PM_7450;
+		pll_type = PLL_NONE; /* known to differ from 7447A, no details yet */
+		break;
 	default:
 		return -ENODEV;
 	}
diff -puN include/asm-ppc/processor.h~perfctr-ppc32-update include/asm-ppc/processor.h
--- 25/include/asm-ppc/processor.h~perfctr-ppc32-update	2005-02-22 18:17:38.000000000 -0800
+++ 25-akpm/include/asm-ppc/processor.h	2005-02-22 18:17:38.000000000 -0800
@@ -122,7 +122,9 @@ struct thread_struct {
 	unsigned long	spefscr;	/* SPE & eFP status */
 	int		used_spe;	/* set if process has used spe */
 #endif /* CONFIG_SPE */
+#ifdef CONFIG_PERFCTR_VIRTUAL
 	struct vperfctr *perfctr;	/* performance counters */
+#endif
 };
 
 #define ARCH_MIN_TASKALIGN 16
_
