aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ppc
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2005-10-19 00:53:32 -0400
committerPaul Mackerras <paulus@samba.org>2005-10-20 02:22:24 -0400
commitf7f6f4fea68d9981d65f99a589ad85f510924d99 (patch)
tree99eea889bb2ec2967a2be883a63ef58507a25cf9 /arch/ppc
parent3d904eef54fd145e2ae5fadb52d2c39bc49339ae (diff)
[PATCH] powerpc: Merge ppc64 pmc.[ch] with ppc32 perfmon.[ch]
This patches the ppc32 and ppc64 versions of the headers and .c files with helper functions for manipulating the performance counting hardware. As a side effect, it removes use of the term "perfmon" from ppc32, thus avoiding confusion with the unrelated performance counter interface from HP Labs also called "perfmon". Built, but not booted, for g5, pSeries, iSeries, and 32-bit Powermac with both ARCH=powerpc and ARCH=ppc{,64} as appropriate. Signed-off-by: David Gibson <dwg@au1.ibm.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/ppc')
-rw-r--r--arch/ppc/kernel/Makefile4
-rw-r--r--arch/ppc/kernel/perfmon.c96
-rw-r--r--arch/ppc/kernel/perfmon_fsl_booke.c2
-rw-r--r--arch/ppc/kernel/traps.c2
4 files changed, 4 insertions, 100 deletions
diff --git a/arch/ppc/kernel/Makefile b/arch/ppc/kernel/Makefile
index ccbc442c9ed3..b35346df1e37 100644
--- a/arch/ppc/kernel/Makefile
+++ b/arch/ppc/kernel/Makefile
@@ -15,7 +15,7 @@ extra-y += vmlinux.lds
15obj-y := entry.o traps.o irq.o idle.o time.o misc.o \ 15obj-y := entry.o traps.o irq.o idle.o time.o misc.o \
16 process.o align.o \ 16 process.o align.o \
17 setup.o \ 17 setup.o \
18 ppc_htab.o perfmon.o 18 ppc_htab.o
19obj-$(CONFIG_6xx) += l2cr.o cpu_setup_6xx.o 19obj-$(CONFIG_6xx) += l2cr.o cpu_setup_6xx.o
20obj-$(CONFIG_SOFTWARE_SUSPEND) += swsusp.o 20obj-$(CONFIG_SOFTWARE_SUSPEND) += swsusp.o
21obj-$(CONFIG_POWER4) += cpu_setup_power4.o 21obj-$(CONFIG_POWER4) += cpu_setup_power4.o
@@ -38,7 +38,7 @@ endif
38 38
39else 39else
40obj-y := irq.o idle.o \ 40obj-y := irq.o idle.o \
41 align.o perfmon.o 41 align.o
42obj-$(CONFIG_6xx) += l2cr.o cpu_setup_6xx.o 42obj-$(CONFIG_6xx) += l2cr.o cpu_setup_6xx.o
43obj-$(CONFIG_SOFTWARE_SUSPEND) += swsusp.o 43obj-$(CONFIG_SOFTWARE_SUSPEND) += swsusp.o
44obj-$(CONFIG_MODULES) += module.o 44obj-$(CONFIG_MODULES) += module.o
diff --git a/arch/ppc/kernel/perfmon.c b/arch/ppc/kernel/perfmon.c
deleted file mode 100644
index c9a38dd0cdc4..000000000000
--- a/arch/ppc/kernel/perfmon.c
+++ /dev/null
@@ -1,96 +0,0 @@
1/* kernel/perfmon.c
2 * PPC 32 Performance Monitor Infrastructure
3 *
4 * Author: Andy Fleming
5 * Copyright (c) 2004 Freescale Semiconductor, Inc
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 */
12
13#include <linux/errno.h>
14#include <linux/sched.h>
15#include <linux/kernel.h>
16#include <linux/mm.h>
17#include <linux/stddef.h>
18#include <linux/unistd.h>
19#include <linux/ptrace.h>
20#include <linux/slab.h>
21#include <linux/user.h>
22#include <linux/a.out.h>
23#include <linux/interrupt.h>
24#include <linux/config.h>
25#include <linux/init.h>
26#include <linux/module.h>
27#include <linux/prctl.h>
28
29#include <asm/pgtable.h>
30#include <asm/uaccess.h>
31#include <asm/system.h>
32#include <asm/io.h>
33#include <asm/reg.h>
34#include <asm/xmon.h>
35
36/* A lock to regulate grabbing the interrupt */
37DEFINE_SPINLOCK(perfmon_lock);
38
39#if defined (CONFIG_FSL_BOOKE) && !defined (CONFIG_E200)
40static void dummy_perf(struct pt_regs *regs)
41{
42 unsigned int pmgc0 = mfpmr(PMRN_PMGC0);
43
44 pmgc0 &= ~PMGC0_PMIE;
45 mtpmr(PMRN_PMGC0, pmgc0);
46}
47
48#elif defined(CONFIG_6xx)
49/* Ensure exceptions are disabled */
50static void dummy_perf(struct pt_regs *regs)
51{
52 unsigned int mmcr0 = mfspr(SPRN_MMCR0);
53
54 mmcr0 &= ~MMCR0_PMXE;
55 mtspr(SPRN_MMCR0, mmcr0);
56}
57#else
58static void dummy_perf(struct pt_regs *regs)
59{
60}
61#endif
62
63void (*perf_irq)(struct pt_regs *) = dummy_perf;
64
65/* Grab the interrupt, if it's free.
66 * Returns 0 on success, -1 if the interrupt is taken already */
67int reserve_pmc_hardware(void (*handler)(struct pt_regs *))
68{
69 int err = 0;
70
71 spin_lock(&perfmon_lock);
72
73 if (perf_irq == dummy_perf)
74 perf_irq = handler;
75 else {
76 pr_info("perfmon irq already handled by %p\n", perf_irq);
77 err = -EBUSY;
78 }
79
80 spin_unlock(&perfmon_lock);
81
82 return err;
83}
84
85void release_pmc_hardware(void)
86{
87 spin_lock(&perfmon_lock);
88
89 perf_irq = dummy_perf;
90
91 spin_unlock(&perfmon_lock);
92}
93
94EXPORT_SYMBOL(perf_irq);
95EXPORT_SYMBOL(reserve_pmc_hardware);
96EXPORT_SYMBOL(release_pmc_hardware);
diff --git a/arch/ppc/kernel/perfmon_fsl_booke.c b/arch/ppc/kernel/perfmon_fsl_booke.c
index 03526bfb0840..32455dfcc36b 100644
--- a/arch/ppc/kernel/perfmon_fsl_booke.c
+++ b/arch/ppc/kernel/perfmon_fsl_booke.c
@@ -32,7 +32,7 @@
32#include <asm/io.h> 32#include <asm/io.h>
33#include <asm/reg.h> 33#include <asm/reg.h>
34#include <asm/xmon.h> 34#include <asm/xmon.h>
35#include <asm/perfmon.h> 35#include <asm/pmc.h>
36 36
37static inline u32 get_pmlca(int ctr); 37static inline u32 get_pmlca(int ctr);
38static inline void set_pmlca(int ctr, u32 pmlca); 38static inline void set_pmlca(int ctr, u32 pmlca);
diff --git a/arch/ppc/kernel/traps.c b/arch/ppc/kernel/traps.c
index 3145e9773db9..5e4bf88a1ef5 100644
--- a/arch/ppc/kernel/traps.c
+++ b/arch/ppc/kernel/traps.c
@@ -41,7 +41,7 @@
41#ifdef CONFIG_PMAC_BACKLIGHT 41#ifdef CONFIG_PMAC_BACKLIGHT
42#include <asm/backlight.h> 42#include <asm/backlight.h>
43#endif 43#endif
44#include <asm/perfmon.h> 44#include <asm/pmc.h>
45 45
46#ifdef CONFIG_XMON 46#ifdef CONFIG_XMON
47extern int xmon_bpt(struct pt_regs *regs); 47extern int xmon_bpt(struct pt_regs *regs);