aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/include/asm/cputable.h1
-rw-r--r--arch/powerpc/kernel/Makefile4
-rw-r--r--arch/powerpc/kernel/cputable.c24
-rw-r--r--arch/powerpc/kernel/setup_32.c11
-rw-r--r--arch/powerpc/kernel/sysfs.c106
-rw-r--r--arch/powerpc/oprofile/op_model_power4.c4
6 files changed, 117 insertions, 33 deletions
diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h
index ef8a248dfd55..f99813f1ede6 100644
--- a/arch/powerpc/include/asm/cputable.h
+++ b/arch/powerpc/include/asm/cputable.h
@@ -62,6 +62,7 @@ enum powerpc_pmc_type {
62 PPC_PMC_DEFAULT = 0, 62 PPC_PMC_DEFAULT = 0,
63 PPC_PMC_IBM = 1, 63 PPC_PMC_IBM = 1,
64 PPC_PMC_PA6T = 2, 64 PPC_PMC_PA6T = 2,
65 PPC_PMC_G4 = 3,
65}; 66};
66 67
67struct pt_regs; 68struct pt_regs;
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 64f5948ebc9d..f17b5792ebc2 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -27,13 +27,13 @@ endif
27obj-y := cputable.o ptrace.o syscalls.o \ 27obj-y := cputable.o ptrace.o syscalls.o \
28 irq.o align.o signal_32.o pmc.o vdso.o \ 28 irq.o align.o signal_32.o pmc.o vdso.o \
29 init_task.o process.o systbl.o idle.o \ 29 init_task.o process.o systbl.o idle.o \
30 signal.o 30 signal.o sysfs.o
31obj-y += vdso32/ 31obj-y += vdso32/
32obj-$(CONFIG_PPC64) += setup_64.o sys_ppc32.o \ 32obj-$(CONFIG_PPC64) += setup_64.o sys_ppc32.o \
33 signal_64.o ptrace32.o \ 33 signal_64.o ptrace32.o \
34 paca.o cpu_setup_ppc970.o \ 34 paca.o cpu_setup_ppc970.o \
35 cpu_setup_pa6t.o \ 35 cpu_setup_pa6t.o \
36 firmware.o sysfs.o nvram_64.o 36 firmware.o nvram_64.o
37obj-$(CONFIG_PPC64) += vdso64/ 37obj-$(CONFIG_PPC64) += vdso64/
38obj-$(CONFIG_ALTIVEC) += vecemu.o vector.o 38obj-$(CONFIG_ALTIVEC) += vecemu.o vector.o
39obj-$(CONFIG_PPC_970_NAP) += idle_power4.o 39obj-$(CONFIG_PPC_970_NAP) += idle_power4.o
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index 25c273c761d1..e70d0483fb4e 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -610,6 +610,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
610 .icache_bsize = 32, 610 .icache_bsize = 32,
611 .dcache_bsize = 32, 611 .dcache_bsize = 32,
612 .num_pmcs = 4, 612 .num_pmcs = 4,
613 .pmc_type = PPC_PMC_IBM,
613 .cpu_setup = __setup_cpu_750cx, 614 .cpu_setup = __setup_cpu_750cx,
614 .machine_check = machine_check_generic, 615 .machine_check = machine_check_generic,
615 .platform = "ppc750", 616 .platform = "ppc750",
@@ -623,6 +624,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
623 .icache_bsize = 32, 624 .icache_bsize = 32,
624 .dcache_bsize = 32, 625 .dcache_bsize = 32,
625 .num_pmcs = 4, 626 .num_pmcs = 4,
627 .pmc_type = PPC_PMC_IBM,
626 .cpu_setup = __setup_cpu_750cx, 628 .cpu_setup = __setup_cpu_750cx,
627 .machine_check = machine_check_generic, 629 .machine_check = machine_check_generic,
628 .platform = "ppc750", 630 .platform = "ppc750",
@@ -636,6 +638,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
636 .icache_bsize = 32, 638 .icache_bsize = 32,
637 .dcache_bsize = 32, 639 .dcache_bsize = 32,
638 .num_pmcs = 4, 640 .num_pmcs = 4,
641 .pmc_type = PPC_PMC_IBM,
639 .cpu_setup = __setup_cpu_750cx, 642 .cpu_setup = __setup_cpu_750cx,
640 .machine_check = machine_check_generic, 643 .machine_check = machine_check_generic,
641 .platform = "ppc750", 644 .platform = "ppc750",
@@ -649,6 +652,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
649 .icache_bsize = 32, 652 .icache_bsize = 32,
650 .dcache_bsize = 32, 653 .dcache_bsize = 32,
651 .num_pmcs = 4, 654 .num_pmcs = 4,
655 .pmc_type = PPC_PMC_IBM,
652 .cpu_setup = __setup_cpu_750, 656 .cpu_setup = __setup_cpu_750,
653 .machine_check = machine_check_generic, 657 .machine_check = machine_check_generic,
654 .platform = "ppc750", 658 .platform = "ppc750",
@@ -662,6 +666,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
662 .icache_bsize = 32, 666 .icache_bsize = 32,
663 .dcache_bsize = 32, 667 .dcache_bsize = 32,
664 .num_pmcs = 4, 668 .num_pmcs = 4,
669 .pmc_type = PPC_PMC_IBM,
665 .cpu_setup = __setup_cpu_750, 670 .cpu_setup = __setup_cpu_750,
666 .machine_check = machine_check_generic, 671 .machine_check = machine_check_generic,
667 .platform = "ppc750", 672 .platform = "ppc750",
@@ -675,6 +680,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
675 .icache_bsize = 32, 680 .icache_bsize = 32,
676 .dcache_bsize = 32, 681 .dcache_bsize = 32,
677 .num_pmcs = 4, 682 .num_pmcs = 4,
683 .pmc_type = PPC_PMC_IBM,
678 .cpu_setup = __setup_cpu_750, 684 .cpu_setup = __setup_cpu_750,
679 .machine_check = machine_check_generic, 685 .machine_check = machine_check_generic,
680 .platform = "ppc750", 686 .platform = "ppc750",
@@ -688,6 +694,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
688 .icache_bsize = 32, 694 .icache_bsize = 32,
689 .dcache_bsize = 32, 695 .dcache_bsize = 32,
690 .num_pmcs = 4, 696 .num_pmcs = 4,
697 .pmc_type = PPC_PMC_IBM,
691 .cpu_setup = __setup_cpu_750, 698 .cpu_setup = __setup_cpu_750,
692 .machine_check = machine_check_generic, 699 .machine_check = machine_check_generic,
693 .platform = "ppc750", 700 .platform = "ppc750",
@@ -701,6 +708,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
701 .icache_bsize = 32, 708 .icache_bsize = 32,
702 .dcache_bsize = 32, 709 .dcache_bsize = 32,
703 .num_pmcs = 4, 710 .num_pmcs = 4,
711 .pmc_type = PPC_PMC_IBM,
704 .cpu_setup = __setup_cpu_750fx, 712 .cpu_setup = __setup_cpu_750fx,
705 .machine_check = machine_check_generic, 713 .machine_check = machine_check_generic,
706 .platform = "ppc750", 714 .platform = "ppc750",
@@ -714,6 +722,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
714 .icache_bsize = 32, 722 .icache_bsize = 32,
715 .dcache_bsize = 32, 723 .dcache_bsize = 32,
716 .num_pmcs = 4, 724 .num_pmcs = 4,
725 .pmc_type = PPC_PMC_IBM,
717 .cpu_setup = __setup_cpu_750fx, 726 .cpu_setup = __setup_cpu_750fx,
718 .machine_check = machine_check_generic, 727 .machine_check = machine_check_generic,
719 .platform = "ppc750", 728 .platform = "ppc750",
@@ -727,6 +736,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
727 .icache_bsize = 32, 736 .icache_bsize = 32,
728 .dcache_bsize = 32, 737 .dcache_bsize = 32,
729 .num_pmcs = 4, 738 .num_pmcs = 4,
739 .pmc_type = PPC_PMC_IBM,
730 .cpu_setup = __setup_cpu_750, 740 .cpu_setup = __setup_cpu_750,
731 .machine_check = machine_check_generic, 741 .machine_check = machine_check_generic,
732 .platform = "ppc750", 742 .platform = "ppc750",
@@ -741,6 +751,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
741 .icache_bsize = 32, 751 .icache_bsize = 32,
742 .dcache_bsize = 32, 752 .dcache_bsize = 32,
743 .num_pmcs = 4, 753 .num_pmcs = 4,
754 .pmc_type = PPC_PMC_G4,
744 .cpu_setup = __setup_cpu_7400, 755 .cpu_setup = __setup_cpu_7400,
745 .machine_check = machine_check_generic, 756 .machine_check = machine_check_generic,
746 .platform = "ppc7400", 757 .platform = "ppc7400",
@@ -755,6 +766,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
755 .icache_bsize = 32, 766 .icache_bsize = 32,
756 .dcache_bsize = 32, 767 .dcache_bsize = 32,
757 .num_pmcs = 4, 768 .num_pmcs = 4,
769 .pmc_type = PPC_PMC_G4,
758 .cpu_setup = __setup_cpu_7400, 770 .cpu_setup = __setup_cpu_7400,
759 .machine_check = machine_check_generic, 771 .machine_check = machine_check_generic,
760 .platform = "ppc7400", 772 .platform = "ppc7400",
@@ -769,6 +781,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
769 .icache_bsize = 32, 781 .icache_bsize = 32,
770 .dcache_bsize = 32, 782 .dcache_bsize = 32,
771 .num_pmcs = 4, 783 .num_pmcs = 4,
784 .pmc_type = PPC_PMC_G4,
772 .cpu_setup = __setup_cpu_7410, 785 .cpu_setup = __setup_cpu_7410,
773 .machine_check = machine_check_generic, 786 .machine_check = machine_check_generic,
774 .platform = "ppc7400", 787 .platform = "ppc7400",
@@ -783,6 +796,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
783 .icache_bsize = 32, 796 .icache_bsize = 32,
784 .dcache_bsize = 32, 797 .dcache_bsize = 32,
785 .num_pmcs = 6, 798 .num_pmcs = 6,
799 .pmc_type = PPC_PMC_G4,
786 .cpu_setup = __setup_cpu_745x, 800 .cpu_setup = __setup_cpu_745x,
787 .oprofile_cpu_type = "ppc/7450", 801 .oprofile_cpu_type = "ppc/7450",
788 .oprofile_type = PPC_OPROFILE_G4, 802 .oprofile_type = PPC_OPROFILE_G4,
@@ -799,6 +813,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
799 .icache_bsize = 32, 813 .icache_bsize = 32,
800 .dcache_bsize = 32, 814 .dcache_bsize = 32,
801 .num_pmcs = 6, 815 .num_pmcs = 6,
816 .pmc_type = PPC_PMC_G4,
802 .cpu_setup = __setup_cpu_745x, 817 .cpu_setup = __setup_cpu_745x,
803 .oprofile_cpu_type = "ppc/7450", 818 .oprofile_cpu_type = "ppc/7450",
804 .oprofile_type = PPC_OPROFILE_G4, 819 .oprofile_type = PPC_OPROFILE_G4,
@@ -815,6 +830,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
815 .icache_bsize = 32, 830 .icache_bsize = 32,
816 .dcache_bsize = 32, 831 .dcache_bsize = 32,
817 .num_pmcs = 6, 832 .num_pmcs = 6,
833 .pmc_type = PPC_PMC_G4,
818 .cpu_setup = __setup_cpu_745x, 834 .cpu_setup = __setup_cpu_745x,
819 .oprofile_cpu_type = "ppc/7450", 835 .oprofile_cpu_type = "ppc/7450",
820 .oprofile_type = PPC_OPROFILE_G4, 836 .oprofile_type = PPC_OPROFILE_G4,
@@ -831,6 +847,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
831 .icache_bsize = 32, 847 .icache_bsize = 32,
832 .dcache_bsize = 32, 848 .dcache_bsize = 32,
833 .num_pmcs = 6, 849 .num_pmcs = 6,
850 .pmc_type = PPC_PMC_G4,
834 .cpu_setup = __setup_cpu_745x, 851 .cpu_setup = __setup_cpu_745x,
835 .oprofile_cpu_type = "ppc/7450", 852 .oprofile_cpu_type = "ppc/7450",
836 .oprofile_type = PPC_OPROFILE_G4, 853 .oprofile_type = PPC_OPROFILE_G4,
@@ -847,6 +864,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
847 .icache_bsize = 32, 864 .icache_bsize = 32,
848 .dcache_bsize = 32, 865 .dcache_bsize = 32,
849 .num_pmcs = 6, 866 .num_pmcs = 6,
867 .pmc_type = PPC_PMC_G4,
850 .cpu_setup = __setup_cpu_745x, 868 .cpu_setup = __setup_cpu_745x,
851 .oprofile_cpu_type = "ppc/7450", 869 .oprofile_cpu_type = "ppc/7450",
852 .oprofile_type = PPC_OPROFILE_G4, 870 .oprofile_type = PPC_OPROFILE_G4,
@@ -863,6 +881,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
863 .icache_bsize = 32, 881 .icache_bsize = 32,
864 .dcache_bsize = 32, 882 .dcache_bsize = 32,
865 .num_pmcs = 6, 883 .num_pmcs = 6,
884 .pmc_type = PPC_PMC_G4,
866 .cpu_setup = __setup_cpu_745x, 885 .cpu_setup = __setup_cpu_745x,
867 .oprofile_cpu_type = "ppc/7450", 886 .oprofile_cpu_type = "ppc/7450",
868 .oprofile_type = PPC_OPROFILE_G4, 887 .oprofile_type = PPC_OPROFILE_G4,
@@ -879,6 +898,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
879 .icache_bsize = 32, 898 .icache_bsize = 32,
880 .dcache_bsize = 32, 899 .dcache_bsize = 32,
881 .num_pmcs = 6, 900 .num_pmcs = 6,
901 .pmc_type = PPC_PMC_G4,
882 .cpu_setup = __setup_cpu_745x, 902 .cpu_setup = __setup_cpu_745x,
883 .oprofile_cpu_type = "ppc/7450", 903 .oprofile_cpu_type = "ppc/7450",
884 .oprofile_type = PPC_OPROFILE_G4, 904 .oprofile_type = PPC_OPROFILE_G4,
@@ -895,6 +915,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
895 .icache_bsize = 32, 915 .icache_bsize = 32,
896 .dcache_bsize = 32, 916 .dcache_bsize = 32,
897 .num_pmcs = 6, 917 .num_pmcs = 6,
918 .pmc_type = PPC_PMC_G4,
898 .cpu_setup = __setup_cpu_745x, 919 .cpu_setup = __setup_cpu_745x,
899 .oprofile_cpu_type = "ppc/7450", 920 .oprofile_cpu_type = "ppc/7450",
900 .oprofile_type = PPC_OPROFILE_G4, 921 .oprofile_type = PPC_OPROFILE_G4,
@@ -910,6 +931,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
910 .icache_bsize = 32, 931 .icache_bsize = 32,
911 .dcache_bsize = 32, 932 .dcache_bsize = 32,
912 .num_pmcs = 6, 933 .num_pmcs = 6,
934 .pmc_type = PPC_PMC_G4,
913 .cpu_setup = __setup_cpu_745x, 935 .cpu_setup = __setup_cpu_745x,
914 .oprofile_cpu_type = "ppc/7450", 936 .oprofile_cpu_type = "ppc/7450",
915 .oprofile_type = PPC_OPROFILE_G4, 937 .oprofile_type = PPC_OPROFILE_G4,
@@ -926,6 +948,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
926 .icache_bsize = 32, 948 .icache_bsize = 32,
927 .dcache_bsize = 32, 949 .dcache_bsize = 32,
928 .num_pmcs = 6, 950 .num_pmcs = 6,
951 .pmc_type = PPC_PMC_G4,
929 .cpu_setup = __setup_cpu_745x, 952 .cpu_setup = __setup_cpu_745x,
930 .oprofile_cpu_type = "ppc/7450", 953 .oprofile_cpu_type = "ppc/7450",
931 .oprofile_type = PPC_OPROFILE_G4, 954 .oprofile_type = PPC_OPROFILE_G4,
@@ -942,6 +965,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
942 .icache_bsize = 32, 965 .icache_bsize = 32,
943 .dcache_bsize = 32, 966 .dcache_bsize = 32,
944 .num_pmcs = 6, 967 .num_pmcs = 6,
968 .pmc_type = PPC_PMC_G4,
945 .cpu_setup = __setup_cpu_745x, 969 .cpu_setup = __setup_cpu_745x,
946 .oprofile_cpu_type = "ppc/7450", 970 .oprofile_cpu_type = "ppc/7450",
947 .oprofile_type = PPC_OPROFILE_G4, 971 .oprofile_type = PPC_OPROFILE_G4,
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index 066e65c59b58..1e0df1658d3f 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -209,23 +209,12 @@ EXPORT_SYMBOL(nvram_sync);
209 209
210#endif /* CONFIG_NVRAM */ 210#endif /* CONFIG_NVRAM */
211 211
212static DEFINE_PER_CPU(struct cpu, cpu_devices);
213
214int __init ppc_init(void) 212int __init ppc_init(void)
215{ 213{
216 int cpu;
217
218 /* clear the progress line */ 214 /* clear the progress line */
219 if (ppc_md.progress) 215 if (ppc_md.progress)
220 ppc_md.progress(" ", 0xffff); 216 ppc_md.progress(" ", 0xffff);
221 217
222 /* register CPU devices */
223 for_each_possible_cpu(cpu) {
224 struct cpu *c = &per_cpu(cpu_devices, cpu);
225 c->hotpluggable = 1;
226 register_cpu(c, cpu);
227 }
228
229 /* call platform init */ 218 /* call platform init */
230 if (ppc_md.init != NULL) { 219 if (ppc_md.init != NULL) {
231 ppc_md.init(); 220 ppc_md.init();
diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
index 12058db70095..ef2ad92a417f 100644
--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -15,18 +15,24 @@
15#include <asm/firmware.h> 15#include <asm/firmware.h>
16#include <asm/hvcall.h> 16#include <asm/hvcall.h>
17#include <asm/prom.h> 17#include <asm/prom.h>
18#include <asm/paca.h>
19#include <asm/lppaca.h>
20#include <asm/machdep.h> 18#include <asm/machdep.h>
21#include <asm/smp.h> 19#include <asm/smp.h>
22 20
21#ifdef CONFIG_PPC64
22#include <asm/paca.h>
23#include <asm/lppaca.h>
24#endif
25
23static DEFINE_PER_CPU(struct cpu, cpu_devices); 26static DEFINE_PER_CPU(struct cpu, cpu_devices);
24 27
25static DEFINE_PER_CPU(struct kobject *, cache_toplevel); 28static DEFINE_PER_CPU(struct kobject *, cache_toplevel);
26 29
27/* SMT stuff */ 30/*
31 * SMT snooze delay stuff, 64-bit only for now
32 */
33
34#ifdef CONFIG_PPC64
28 35
29#ifdef CONFIG_PPC_MULTIPLATFORM
30/* Time in microseconds we delay before sleeping in the idle loop */ 36/* Time in microseconds we delay before sleeping in the idle loop */
31DEFINE_PER_CPU(unsigned long, smt_snooze_delay) = { 100 }; 37DEFINE_PER_CPU(unsigned long, smt_snooze_delay) = { 100 };
32 38
@@ -106,7 +112,7 @@ static int __init setup_smt_snooze_delay(char *str)
106} 112}
107__setup("smt-snooze-delay=", setup_smt_snooze_delay); 113__setup("smt-snooze-delay=", setup_smt_snooze_delay);
108 114
109#endif /* CONFIG_PPC_MULTIPLATFORM */ 115#endif /* CONFIG_PPC64 */
110 116
111/* 117/*
112 * Enabling PMCs will slow partition context switch times so we only do 118 * Enabling PMCs will slow partition context switch times so we only do
@@ -115,7 +121,7 @@ __setup("smt-snooze-delay=", setup_smt_snooze_delay);
115 121
116static DEFINE_PER_CPU(char, pmcs_enabled); 122static DEFINE_PER_CPU(char, pmcs_enabled);
117 123
118void ppc64_enable_pmcs(void) 124void ppc_enable_pmcs(void)
119{ 125{
120 /* Only need to enable them once */ 126 /* Only need to enable them once */
121 if (__get_cpu_var(pmcs_enabled)) 127 if (__get_cpu_var(pmcs_enabled))
@@ -126,7 +132,7 @@ void ppc64_enable_pmcs(void)
126 if (ppc_md.enable_pmcs) 132 if (ppc_md.enable_pmcs)
127 ppc_md.enable_pmcs(); 133 ppc_md.enable_pmcs();
128} 134}
129EXPORT_SYMBOL(ppc64_enable_pmcs); 135EXPORT_SYMBOL(ppc_enable_pmcs);
130 136
131/* XXX convert to rusty's on_one_cpu */ 137/* XXX convert to rusty's on_one_cpu */
132static unsigned long run_on_cpu(unsigned long cpu, 138static unsigned long run_on_cpu(unsigned long cpu,
@@ -154,7 +160,7 @@ static unsigned long read_##NAME(unsigned long junk) \
154} \ 160} \
155static unsigned long write_##NAME(unsigned long val) \ 161static unsigned long write_##NAME(unsigned long val) \
156{ \ 162{ \
157 ppc64_enable_pmcs(); \ 163 ppc_enable_pmcs(); \
158 mtspr(ADDRESS, val); \ 164 mtspr(ADDRESS, val); \
159 return 0; \ 165 return 0; \
160} \ 166} \
@@ -184,28 +190,53 @@ static ssize_t __used \
184 * that are implemented on the current processor 190 * that are implemented on the current processor
185 */ 191 */
186 192
193#ifdef CONFIG_PPC64
194#define HAS_PPC_PMC_CLASSIC 1
195#define HAS_PPC_PMC_IBM 1
196#define HAS_PPC_PMC_PA6T 1
197#elif CONFIG_6xx
198#define HAS_PPC_PMC_CLASSIC 1
199#define HAS_PPC_PMC_IBM 1
200#define HAS_PPC_PMC_G4 1
201#endif
202
203
204#ifdef HAS_PPC_PMC_CLASSIC
187SYSFS_PMCSETUP(mmcr0, SPRN_MMCR0); 205SYSFS_PMCSETUP(mmcr0, SPRN_MMCR0);
188SYSFS_PMCSETUP(mmcr1, SPRN_MMCR1); 206SYSFS_PMCSETUP(mmcr1, SPRN_MMCR1);
189SYSFS_PMCSETUP(mmcra, SPRN_MMCRA);
190SYSFS_PMCSETUP(pmc1, SPRN_PMC1); 207SYSFS_PMCSETUP(pmc1, SPRN_PMC1);
191SYSFS_PMCSETUP(pmc2, SPRN_PMC2); 208SYSFS_PMCSETUP(pmc2, SPRN_PMC2);
192SYSFS_PMCSETUP(pmc3, SPRN_PMC3); 209SYSFS_PMCSETUP(pmc3, SPRN_PMC3);
193SYSFS_PMCSETUP(pmc4, SPRN_PMC4); 210SYSFS_PMCSETUP(pmc4, SPRN_PMC4);
194SYSFS_PMCSETUP(pmc5, SPRN_PMC5); 211SYSFS_PMCSETUP(pmc5, SPRN_PMC5);
195SYSFS_PMCSETUP(pmc6, SPRN_PMC6); 212SYSFS_PMCSETUP(pmc6, SPRN_PMC6);
213
214#ifdef HAS_PPC_PMC_G4
215SYSFS_PMCSETUP(mmcr2, SPRN_MMCR2);
216#endif
217
218#ifdef CONFIG_PPC64
196SYSFS_PMCSETUP(pmc7, SPRN_PMC7); 219SYSFS_PMCSETUP(pmc7, SPRN_PMC7);
197SYSFS_PMCSETUP(pmc8, SPRN_PMC8); 220SYSFS_PMCSETUP(pmc8, SPRN_PMC8);
221
222SYSFS_PMCSETUP(mmcra, SPRN_MMCRA);
198SYSFS_PMCSETUP(purr, SPRN_PURR); 223SYSFS_PMCSETUP(purr, SPRN_PURR);
199SYSFS_PMCSETUP(spurr, SPRN_SPURR); 224SYSFS_PMCSETUP(spurr, SPRN_SPURR);
200SYSFS_PMCSETUP(dscr, SPRN_DSCR); 225SYSFS_PMCSETUP(dscr, SPRN_DSCR);
201 226
227static SYSDEV_ATTR(mmcra, 0600, show_mmcra, store_mmcra);
228static SYSDEV_ATTR(spurr, 0600, show_spurr, NULL);
229static SYSDEV_ATTR(dscr, 0600, show_dscr, store_dscr);
230static SYSDEV_ATTR(purr, 0600, show_purr, store_purr);
231#endif /* CONFIG_PPC64 */
232
233#ifdef HAS_PPC_PMC_PA6T
202SYSFS_PMCSETUP(pa6t_pmc0, SPRN_PA6T_PMC0); 234SYSFS_PMCSETUP(pa6t_pmc0, SPRN_PA6T_PMC0);
203SYSFS_PMCSETUP(pa6t_pmc1, SPRN_PA6T_PMC1); 235SYSFS_PMCSETUP(pa6t_pmc1, SPRN_PA6T_PMC1);
204SYSFS_PMCSETUP(pa6t_pmc2, SPRN_PA6T_PMC2); 236SYSFS_PMCSETUP(pa6t_pmc2, SPRN_PA6T_PMC2);
205SYSFS_PMCSETUP(pa6t_pmc3, SPRN_PA6T_PMC3); 237SYSFS_PMCSETUP(pa6t_pmc3, SPRN_PA6T_PMC3);
206SYSFS_PMCSETUP(pa6t_pmc4, SPRN_PA6T_PMC4); 238SYSFS_PMCSETUP(pa6t_pmc4, SPRN_PA6T_PMC4);
207SYSFS_PMCSETUP(pa6t_pmc5, SPRN_PA6T_PMC5); 239SYSFS_PMCSETUP(pa6t_pmc5, SPRN_PA6T_PMC5);
208
209#ifdef CONFIG_DEBUG_KERNEL 240#ifdef CONFIG_DEBUG_KERNEL
210SYSFS_PMCSETUP(hid0, SPRN_HID0); 241SYSFS_PMCSETUP(hid0, SPRN_HID0);
211SYSFS_PMCSETUP(hid1, SPRN_HID1); 242SYSFS_PMCSETUP(hid1, SPRN_HID1);
@@ -236,28 +267,37 @@ SYSFS_PMCSETUP(tsr1, SPRN_PA6T_TSR1);
236SYSFS_PMCSETUP(tsr2, SPRN_PA6T_TSR2); 267SYSFS_PMCSETUP(tsr2, SPRN_PA6T_TSR2);
237SYSFS_PMCSETUP(tsr3, SPRN_PA6T_TSR3); 268SYSFS_PMCSETUP(tsr3, SPRN_PA6T_TSR3);
238#endif /* CONFIG_DEBUG_KERNEL */ 269#endif /* CONFIG_DEBUG_KERNEL */
270#endif /* HAS_PPC_PMC_PA6T */
239 271
240static SYSDEV_ATTR(mmcra, 0600, show_mmcra, store_mmcra); 272#ifdef HAS_PPC_PMC_IBM
241static SYSDEV_ATTR(spurr, 0600, show_spurr, NULL);
242static SYSDEV_ATTR(dscr, 0600, show_dscr, store_dscr);
243static SYSDEV_ATTR(purr, 0600, show_purr, store_purr);
244
245static struct sysdev_attribute ibm_common_attrs[] = { 273static struct sysdev_attribute ibm_common_attrs[] = {
246 _SYSDEV_ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0), 274 _SYSDEV_ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0),
247 _SYSDEV_ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1), 275 _SYSDEV_ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1),
248}; 276};
277#endif /* HAS_PPC_PMC_G4 */
278
279#ifdef HAS_PPC_PMC_G4
280static struct sysdev_attribute g4_common_attrs[] = {
281 _SYSDEV_ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0),
282 _SYSDEV_ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1),
283 _SYSDEV_ATTR(mmcr2, 0600, show_mmcr2, store_mmcr2),
284};
285#endif /* HAS_PPC_PMC_G4 */
249 286
250static struct sysdev_attribute ibm_pmc_attrs[] = { 287static struct sysdev_attribute classic_pmc_attrs[] = {
251 _SYSDEV_ATTR(pmc1, 0600, show_pmc1, store_pmc1), 288 _SYSDEV_ATTR(pmc1, 0600, show_pmc1, store_pmc1),
252 _SYSDEV_ATTR(pmc2, 0600, show_pmc2, store_pmc2), 289 _SYSDEV_ATTR(pmc2, 0600, show_pmc2, store_pmc2),
253 _SYSDEV_ATTR(pmc3, 0600, show_pmc3, store_pmc3), 290 _SYSDEV_ATTR(pmc3, 0600, show_pmc3, store_pmc3),
254 _SYSDEV_ATTR(pmc4, 0600, show_pmc4, store_pmc4), 291 _SYSDEV_ATTR(pmc4, 0600, show_pmc4, store_pmc4),
255 _SYSDEV_ATTR(pmc5, 0600, show_pmc5, store_pmc5), 292 _SYSDEV_ATTR(pmc5, 0600, show_pmc5, store_pmc5),
256 _SYSDEV_ATTR(pmc6, 0600, show_pmc6, store_pmc6), 293 _SYSDEV_ATTR(pmc6, 0600, show_pmc6, store_pmc6),
294#ifdef CONFIG_PPC64
257 _SYSDEV_ATTR(pmc7, 0600, show_pmc7, store_pmc7), 295 _SYSDEV_ATTR(pmc7, 0600, show_pmc7, store_pmc7),
258 _SYSDEV_ATTR(pmc8, 0600, show_pmc8, store_pmc8), 296 _SYSDEV_ATTR(pmc8, 0600, show_pmc8, store_pmc8),
297#endif
259}; 298};
260 299
300#ifdef HAS_PPC_PMC_PA6T
261static struct sysdev_attribute pa6t_attrs[] = { 301static struct sysdev_attribute pa6t_attrs[] = {
262 _SYSDEV_ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0), 302 _SYSDEV_ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0),
263 _SYSDEV_ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1), 303 _SYSDEV_ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1),
@@ -298,6 +338,8 @@ static struct sysdev_attribute pa6t_attrs[] = {
298 _SYSDEV_ATTR(tsr3, 0600, show_tsr3, store_tsr3), 338 _SYSDEV_ATTR(tsr3, 0600, show_tsr3, store_tsr3),
299#endif /* CONFIG_DEBUG_KERNEL */ 339#endif /* CONFIG_DEBUG_KERNEL */
300}; 340};
341#endif /* HAS_PPC_PMC_PA6T */
342#endif /* HAS_PPC_PMC_CLASSIC */
301 343
302struct cache_desc { 344struct cache_desc {
303 struct kobject kobj; 345 struct kobject kobj;
@@ -588,23 +630,36 @@ static void __cpuinit register_cpu_online(unsigned int cpu)
588 struct sysdev_attribute *attrs, *pmc_attrs; 630 struct sysdev_attribute *attrs, *pmc_attrs;
589 int i, nattrs; 631 int i, nattrs;
590 632
633#ifdef CONFIG_PPC64
591 if (!firmware_has_feature(FW_FEATURE_ISERIES) && 634 if (!firmware_has_feature(FW_FEATURE_ISERIES) &&
592 cpu_has_feature(CPU_FTR_SMT)) 635 cpu_has_feature(CPU_FTR_SMT))
593 sysdev_create_file(s, &attr_smt_snooze_delay); 636 sysdev_create_file(s, &attr_smt_snooze_delay);
637#endif
594 638
595 /* PMC stuff */ 639 /* PMC stuff */
596 switch (cur_cpu_spec->pmc_type) { 640 switch (cur_cpu_spec->pmc_type) {
641#ifdef HAS_PPC_PMC_IBM
597 case PPC_PMC_IBM: 642 case PPC_PMC_IBM:
598 attrs = ibm_common_attrs; 643 attrs = ibm_common_attrs;
599 nattrs = sizeof(ibm_common_attrs) / sizeof(struct sysdev_attribute); 644 nattrs = sizeof(ibm_common_attrs) / sizeof(struct sysdev_attribute);
600 pmc_attrs = ibm_pmc_attrs; 645 pmc_attrs = classic_pmc_attrs;
601 break; 646 break;
647#endif /* HAS_PPC_PMC_IBM */
648#ifdef HAS_PPC_PMC_G4
649 case PPC_PMC_G4:
650 attrs = g4_common_attrs;
651 nattrs = sizeof(g4_common_attrs) / sizeof(struct sysdev_attribute);
652 pmc_attrs = classic_pmc_attrs;
653 break;
654#endif /* HAS_PPC_PMC_G4 */
655#ifdef HAS_PPC_PMC_PA6T
602 case PPC_PMC_PA6T: 656 case PPC_PMC_PA6T:
603 /* PA Semi starts counting at PMC0 */ 657 /* PA Semi starts counting at PMC0 */
604 attrs = pa6t_attrs; 658 attrs = pa6t_attrs;
605 nattrs = sizeof(pa6t_attrs) / sizeof(struct sysdev_attribute); 659 nattrs = sizeof(pa6t_attrs) / sizeof(struct sysdev_attribute);
606 pmc_attrs = NULL; 660 pmc_attrs = NULL;
607 break; 661 break;
662#endif /* HAS_PPC_PMC_PA6T */
608 default: 663 default:
609 attrs = NULL; 664 attrs = NULL;
610 nattrs = 0; 665 nattrs = 0;
@@ -618,6 +673,7 @@ static void __cpuinit register_cpu_online(unsigned int cpu)
618 for (i = 0; i < cur_cpu_spec->num_pmcs; i++) 673 for (i = 0; i < cur_cpu_spec->num_pmcs; i++)
619 sysdev_create_file(s, &pmc_attrs[i]); 674 sysdev_create_file(s, &pmc_attrs[i]);
620 675
676#ifdef CONFIG_PPC64
621 if (cpu_has_feature(CPU_FTR_MMCRA)) 677 if (cpu_has_feature(CPU_FTR_MMCRA))
622 sysdev_create_file(s, &attr_mmcra); 678 sysdev_create_file(s, &attr_mmcra);
623 679
@@ -629,6 +685,7 @@ static void __cpuinit register_cpu_online(unsigned int cpu)
629 685
630 if (cpu_has_feature(CPU_FTR_DSCR)) 686 if (cpu_has_feature(CPU_FTR_DSCR))
631 sysdev_create_file(s, &attr_dscr); 687 sysdev_create_file(s, &attr_dscr);
688#endif /* CONFIG_PPC64 */
632 689
633 create_cache_info(s); 690 create_cache_info(s);
634} 691}
@@ -664,17 +721,28 @@ static void unregister_cpu_online(unsigned int cpu)
664 721
665 /* PMC stuff */ 722 /* PMC stuff */
666 switch (cur_cpu_spec->pmc_type) { 723 switch (cur_cpu_spec->pmc_type) {
724#ifdef HAS_PPC_PMC_IBM
667 case PPC_PMC_IBM: 725 case PPC_PMC_IBM:
668 attrs = ibm_common_attrs; 726 attrs = ibm_common_attrs;
669 nattrs = sizeof(ibm_common_attrs) / sizeof(struct sysdev_attribute); 727 nattrs = sizeof(ibm_common_attrs) / sizeof(struct sysdev_attribute);
670 pmc_attrs = ibm_pmc_attrs; 728 pmc_attrs = classic_pmc_attrs;
729 break;
730#endif /* HAS_PPC_PMC_IBM */
731#ifdef HAS_PPC_PMC_G4
732 case PPC_PMC_G4:
733 attrs = g4_common_attrs;
734 nattrs = sizeof(g4_common_attrs) / sizeof(struct sysdev_attribute);
735 pmc_attrs = classic_pmc_attrs;
671 break; 736 break;
737#endif /* HAS_PPC_PMC_G4 */
738#ifdef HAS_PPC_PMC_PA6T
672 case PPC_PMC_PA6T: 739 case PPC_PMC_PA6T:
673 /* PA Semi starts counting at PMC0 */ 740 /* PA Semi starts counting at PMC0 */
674 attrs = pa6t_attrs; 741 attrs = pa6t_attrs;
675 nattrs = sizeof(pa6t_attrs) / sizeof(struct sysdev_attribute); 742 nattrs = sizeof(pa6t_attrs) / sizeof(struct sysdev_attribute);
676 pmc_attrs = NULL; 743 pmc_attrs = NULL;
677 break; 744 break;
745#endif /* HAS_PPC_PMC_PA6T */
678 default: 746 default:
679 attrs = NULL; 747 attrs = NULL;
680 nattrs = 0; 748 nattrs = 0;
@@ -688,6 +756,7 @@ static void unregister_cpu_online(unsigned int cpu)
688 for (i = 0; i < cur_cpu_spec->num_pmcs; i++) 756 for (i = 0; i < cur_cpu_spec->num_pmcs; i++)
689 sysdev_remove_file(s, &pmc_attrs[i]); 757 sysdev_remove_file(s, &pmc_attrs[i]);
690 758
759#ifdef CONFIG_PPC64
691 if (cpu_has_feature(CPU_FTR_MMCRA)) 760 if (cpu_has_feature(CPU_FTR_MMCRA))
692 sysdev_remove_file(s, &attr_mmcra); 761 sysdev_remove_file(s, &attr_mmcra);
693 762
@@ -699,6 +768,7 @@ static void unregister_cpu_online(unsigned int cpu)
699 768
700 if (cpu_has_feature(CPU_FTR_DSCR)) 769 if (cpu_has_feature(CPU_FTR_DSCR))
701 sysdev_remove_file(s, &attr_dscr); 770 sysdev_remove_file(s, &attr_dscr);
771#endif /* CONFIG_PPC64 */
702 772
703 remove_cache_info(s); 773 remove_cache_info(s);
704} 774}
diff --git a/arch/powerpc/oprofile/op_model_power4.c b/arch/powerpc/oprofile/op_model_power4.c
index 446a8bbb847b..3e3d91f536e0 100644
--- a/arch/powerpc/oprofile/op_model_power4.c
+++ b/arch/powerpc/oprofile/op_model_power4.c
@@ -64,7 +64,7 @@ static int power4_reg_setup(struct op_counter_config *ctr,
64 return 0; 64 return 0;
65} 65}
66 66
67extern void ppc64_enable_pmcs(void); 67extern void ppc_enable_pmcs(void);
68 68
69/* 69/*
70 * Older CPUs require the MMCRA sample bit to be always set, but newer 70 * Older CPUs require the MMCRA sample bit to be always set, but newer
@@ -91,7 +91,7 @@ static int power4_cpu_setup(struct op_counter_config *ctr)
91 unsigned int mmcr0 = mmcr0_val; 91 unsigned int mmcr0 = mmcr0_val;
92 unsigned long mmcra = mmcra_val; 92 unsigned long mmcra = mmcra_val;
93 93
94 ppc64_enable_pmcs(); 94 ppc_enable_pmcs();
95 95
96 /* set the freeze bit */ 96 /* set the freeze bit */
97 mmcr0 |= MMCR0_FC; 97 mmcr0 |= MMCR0_FC;