aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAnton Blanchard <anton@samba.org>2006-01-08 23:41:31 -0500
committerPaul Mackerras <paulus@samba.org>2006-01-09 00:02:52 -0500
commit32a33994d513606d29e87e152deb67ba5f3c8e82 (patch)
tree2966bbe85eb2880aacc1dba045af7a02cee0aa26 /arch
parent9a699aefa87cb0379a67741926820c9271d748a9 (diff)
[PATCH] ppc64: Fix oprofile when compiled as a module
My recent changes to oprofile broke it when built as a module. Fix it by using an enum instead of a function pointer. This way we still retain the oprofile configuration in the cputable. Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/kernel/cputable.c104
-rw-r--r--arch/powerpc/oprofile/common.c26
2 files changed, 50 insertions, 80 deletions
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index 2f82a2091440..2a16f4a192ee 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -78,10 +78,8 @@ struct cpu_spec cpu_specs[] = {
78 .dcache_bsize = 128, 78 .dcache_bsize = 128,
79 .num_pmcs = 8, 79 .num_pmcs = 8,
80 .cpu_setup = __setup_cpu_power3, 80 .cpu_setup = __setup_cpu_power3,
81#ifdef CONFIG_OPROFILE
82 .oprofile_cpu_type = "ppc64/power3", 81 .oprofile_cpu_type = "ppc64/power3",
83 .oprofile_model = &op_model_rs64, 82 .oprofile_type = RS64,
84#endif
85 }, 83 },
86 { /* Power3+ */ 84 { /* Power3+ */
87 .pvr_mask = 0xffff0000, 85 .pvr_mask = 0xffff0000,
@@ -93,10 +91,8 @@ struct cpu_spec cpu_specs[] = {
93 .dcache_bsize = 128, 91 .dcache_bsize = 128,
94 .num_pmcs = 8, 92 .num_pmcs = 8,
95 .cpu_setup = __setup_cpu_power3, 93 .cpu_setup = __setup_cpu_power3,
96#ifdef CONFIG_OPROFILE
97 .oprofile_cpu_type = "ppc64/power3", 94 .oprofile_cpu_type = "ppc64/power3",
98 .oprofile_model = &op_model_rs64, 95 .oprofile_type = RS64,
99#endif
100 }, 96 },
101 { /* Northstar */ 97 { /* Northstar */
102 .pvr_mask = 0xffff0000, 98 .pvr_mask = 0xffff0000,
@@ -108,10 +104,8 @@ struct cpu_spec cpu_specs[] = {
108 .dcache_bsize = 128, 104 .dcache_bsize = 128,
109 .num_pmcs = 8, 105 .num_pmcs = 8,
110 .cpu_setup = __setup_cpu_power3, 106 .cpu_setup = __setup_cpu_power3,
111#ifdef CONFIG_OPROFILE
112 .oprofile_cpu_type = "ppc64/rs64", 107 .oprofile_cpu_type = "ppc64/rs64",
113 .oprofile_model = &op_model_rs64, 108 .oprofile_type = RS64,
114#endif
115 }, 109 },
116 { /* Pulsar */ 110 { /* Pulsar */
117 .pvr_mask = 0xffff0000, 111 .pvr_mask = 0xffff0000,
@@ -123,10 +117,8 @@ struct cpu_spec cpu_specs[] = {
123 .dcache_bsize = 128, 117 .dcache_bsize = 128,
124 .num_pmcs = 8, 118 .num_pmcs = 8,
125 .cpu_setup = __setup_cpu_power3, 119 .cpu_setup = __setup_cpu_power3,
126#ifdef CONFIG_OPROFILE
127 .oprofile_cpu_type = "ppc64/rs64", 120 .oprofile_cpu_type = "ppc64/rs64",
128 .oprofile_model = &op_model_rs64, 121 .oprofile_type = RS64,
129#endif
130 }, 122 },
131 { /* I-star */ 123 { /* I-star */
132 .pvr_mask = 0xffff0000, 124 .pvr_mask = 0xffff0000,
@@ -138,10 +130,8 @@ struct cpu_spec cpu_specs[] = {
138 .dcache_bsize = 128, 130 .dcache_bsize = 128,
139 .num_pmcs = 8, 131 .num_pmcs = 8,
140 .cpu_setup = __setup_cpu_power3, 132 .cpu_setup = __setup_cpu_power3,
141#ifdef CONFIG_OPROFILE
142 .oprofile_cpu_type = "ppc64/rs64", 133 .oprofile_cpu_type = "ppc64/rs64",
143 .oprofile_model = &op_model_rs64, 134 .oprofile_type = RS64,
144#endif
145 }, 135 },
146 { /* S-star */ 136 { /* S-star */
147 .pvr_mask = 0xffff0000, 137 .pvr_mask = 0xffff0000,
@@ -153,10 +143,8 @@ struct cpu_spec cpu_specs[] = {
153 .dcache_bsize = 128, 143 .dcache_bsize = 128,
154 .num_pmcs = 8, 144 .num_pmcs = 8,
155 .cpu_setup = __setup_cpu_power3, 145 .cpu_setup = __setup_cpu_power3,
156#ifdef CONFIG_OPROFILE
157 .oprofile_cpu_type = "ppc64/rs64", 146 .oprofile_cpu_type = "ppc64/rs64",
158 .oprofile_model = &op_model_rs64, 147 .oprofile_type = RS64,
159#endif
160 }, 148 },
161 { /* Power4 */ 149 { /* Power4 */
162 .pvr_mask = 0xffff0000, 150 .pvr_mask = 0xffff0000,
@@ -168,10 +156,8 @@ struct cpu_spec cpu_specs[] = {
168 .dcache_bsize = 128, 156 .dcache_bsize = 128,
169 .num_pmcs = 8, 157 .num_pmcs = 8,
170 .cpu_setup = __setup_cpu_power4, 158 .cpu_setup = __setup_cpu_power4,
171#ifdef CONFIG_OPROFILE
172 .oprofile_cpu_type = "ppc64/power4", 159 .oprofile_cpu_type = "ppc64/power4",
173 .oprofile_model = &op_model_rs64, 160 .oprofile_type = POWER4,
174#endif
175 }, 161 },
176 { /* Power4+ */ 162 { /* Power4+ */
177 .pvr_mask = 0xffff0000, 163 .pvr_mask = 0xffff0000,
@@ -183,10 +169,8 @@ struct cpu_spec cpu_specs[] = {
183 .dcache_bsize = 128, 169 .dcache_bsize = 128,
184 .num_pmcs = 8, 170 .num_pmcs = 8,
185 .cpu_setup = __setup_cpu_power4, 171 .cpu_setup = __setup_cpu_power4,
186#ifdef CONFIG_OPROFILE
187 .oprofile_cpu_type = "ppc64/power4", 172 .oprofile_cpu_type = "ppc64/power4",
188 .oprofile_model = &op_model_power4, 173 .oprofile_type = POWER4,
189#endif
190 }, 174 },
191 { /* PPC970 */ 175 { /* PPC970 */
192 .pvr_mask = 0xffff0000, 176 .pvr_mask = 0xffff0000,
@@ -199,10 +183,8 @@ struct cpu_spec cpu_specs[] = {
199 .dcache_bsize = 128, 183 .dcache_bsize = 128,
200 .num_pmcs = 8, 184 .num_pmcs = 8,
201 .cpu_setup = __setup_cpu_ppc970, 185 .cpu_setup = __setup_cpu_ppc970,
202#ifdef CONFIG_OPROFILE
203 .oprofile_cpu_type = "ppc64/970", 186 .oprofile_cpu_type = "ppc64/970",
204 .oprofile_model = &op_model_power4, 187 .oprofile_type = POWER4,
205#endif
206 }, 188 },
207#endif /* CONFIG_PPC64 */ 189#endif /* CONFIG_PPC64 */
208#if defined(CONFIG_PPC64) || defined(CONFIG_POWER4) 190#if defined(CONFIG_PPC64) || defined(CONFIG_POWER4)
@@ -221,10 +203,8 @@ struct cpu_spec cpu_specs[] = {
221 .dcache_bsize = 128, 203 .dcache_bsize = 128,
222 .num_pmcs = 8, 204 .num_pmcs = 8,
223 .cpu_setup = __setup_cpu_ppc970, 205 .cpu_setup = __setup_cpu_ppc970,
224#ifdef CONFIG_OPROFILE
225 .oprofile_cpu_type = "ppc64/970", 206 .oprofile_cpu_type = "ppc64/970",
226 .oprofile_model = &op_model_power4, 207 .oprofile_type = POWER4,
227#endif
228 }, 208 },
229#endif /* defined(CONFIG_PPC64) || defined(CONFIG_POWER4) */ 209#endif /* defined(CONFIG_PPC64) || defined(CONFIG_POWER4) */
230#ifdef CONFIG_PPC64 210#ifdef CONFIG_PPC64
@@ -238,10 +218,8 @@ struct cpu_spec cpu_specs[] = {
238 .icache_bsize = 128, 218 .icache_bsize = 128,
239 .dcache_bsize = 128, 219 .dcache_bsize = 128,
240 .cpu_setup = __setup_cpu_ppc970, 220 .cpu_setup = __setup_cpu_ppc970,
241#ifdef CONFIG_OPROFILE
242 .oprofile_cpu_type = "ppc64/970", 221 .oprofile_cpu_type = "ppc64/970",
243 .oprofile_model = &op_model_power4, 222 .oprofile_type = POWER4,
244#endif
245 }, 223 },
246 { /* Power5 GR */ 224 { /* Power5 GR */
247 .pvr_mask = 0xffff0000, 225 .pvr_mask = 0xffff0000,
@@ -253,10 +231,8 @@ struct cpu_spec cpu_specs[] = {
253 .dcache_bsize = 128, 231 .dcache_bsize = 128,
254 .num_pmcs = 6, 232 .num_pmcs = 6,
255 .cpu_setup = __setup_cpu_power4, 233 .cpu_setup = __setup_cpu_power4,
256#ifdef CONFIG_OPROFILE
257 .oprofile_cpu_type = "ppc64/power5", 234 .oprofile_cpu_type = "ppc64/power5",
258 .oprofile_model = &op_model_power4, 235 .oprofile_type = POWER4,
259#endif
260 }, 236 },
261 { /* Power5 GS */ 237 { /* Power5 GS */
262 .pvr_mask = 0xffff0000, 238 .pvr_mask = 0xffff0000,
@@ -268,10 +244,8 @@ struct cpu_spec cpu_specs[] = {
268 .dcache_bsize = 128, 244 .dcache_bsize = 128,
269 .num_pmcs = 6, 245 .num_pmcs = 6,
270 .cpu_setup = __setup_cpu_power4, 246 .cpu_setup = __setup_cpu_power4,
271#ifdef CONFIG_OPROFILE
272 .oprofile_cpu_type = "ppc64/power5", 247 .oprofile_cpu_type = "ppc64/power5",
273 .oprofile_model = &op_model_power4, 248 .oprofile_type = POWER4,
274#endif
275 }, 249 },
276 { /* Cell Broadband Engine */ 250 { /* Cell Broadband Engine */
277 .pvr_mask = 0xffff0000, 251 .pvr_mask = 0xffff0000,
@@ -546,10 +520,8 @@ struct cpu_spec cpu_specs[] = {
546 .dcache_bsize = 32, 520 .dcache_bsize = 32,
547 .num_pmcs = 6, 521 .num_pmcs = 6,
548 .cpu_setup = __setup_cpu_745x, 522 .cpu_setup = __setup_cpu_745x,
549#ifdef CONFIG_OPROFILE
550 .oprofile_cpu_type = "ppc/7450", 523 .oprofile_cpu_type = "ppc/7450",
551 .oprofile_model = &op_model_7450, 524 .oprofile_type = G4,
552#endif
553 }, 525 },
554 { /* 7450 2.1 */ 526 { /* 7450 2.1 */
555 .pvr_mask = 0xffffffff, 527 .pvr_mask = 0xffffffff,
@@ -561,10 +533,8 @@ struct cpu_spec cpu_specs[] = {
561 .dcache_bsize = 32, 533 .dcache_bsize = 32,
562 .num_pmcs = 6, 534 .num_pmcs = 6,
563 .cpu_setup = __setup_cpu_745x, 535 .cpu_setup = __setup_cpu_745x,
564#ifdef CONFIG_OPROFILE
565 .oprofile_cpu_type = "ppc/7450", 536 .oprofile_cpu_type = "ppc/7450",
566 .oprofile_model = &op_model_7450, 537 .oprofile_type = G4,
567#endif
568 }, 538 },
569 { /* 7450 2.3 and newer */ 539 { /* 7450 2.3 and newer */
570 .pvr_mask = 0xffff0000, 540 .pvr_mask = 0xffff0000,
@@ -576,10 +546,8 @@ struct cpu_spec cpu_specs[] = {
576 .dcache_bsize = 32, 546 .dcache_bsize = 32,
577 .num_pmcs = 6, 547 .num_pmcs = 6,
578 .cpu_setup = __setup_cpu_745x, 548 .cpu_setup = __setup_cpu_745x,
579#ifdef CONFIG_OPROFILE
580 .oprofile_cpu_type = "ppc/7450", 549 .oprofile_cpu_type = "ppc/7450",
581 .oprofile_model = &op_model_7450, 550 .oprofile_type = G4,
582#endif
583 }, 551 },
584 { /* 7455 rev 1.x */ 552 { /* 7455 rev 1.x */
585 .pvr_mask = 0xffffff00, 553 .pvr_mask = 0xffffff00,
@@ -591,10 +559,8 @@ struct cpu_spec cpu_specs[] = {
591 .dcache_bsize = 32, 559 .dcache_bsize = 32,
592 .num_pmcs = 6, 560 .num_pmcs = 6,
593 .cpu_setup = __setup_cpu_745x, 561 .cpu_setup = __setup_cpu_745x,
594#ifdef CONFIG_OPROFILE
595 .oprofile_cpu_type = "ppc/7450", 562 .oprofile_cpu_type = "ppc/7450",
596 .oprofile_model = &op_model_7450, 563 .oprofile_type = G4,
597#endif
598 }, 564 },
599 { /* 7455 rev 2.0 */ 565 { /* 7455 rev 2.0 */
600 .pvr_mask = 0xffffffff, 566 .pvr_mask = 0xffffffff,
@@ -606,10 +572,8 @@ struct cpu_spec cpu_specs[] = {
606 .dcache_bsize = 32, 572 .dcache_bsize = 32,
607 .num_pmcs = 6, 573 .num_pmcs = 6,
608 .cpu_setup = __setup_cpu_745x, 574 .cpu_setup = __setup_cpu_745x,
609#ifdef CONFIG_OPROFILE
610 .oprofile_cpu_type = "ppc/7450", 575 .oprofile_cpu_type = "ppc/7450",
611 .oprofile_model = &op_model_7450, 576 .oprofile_type = G4,
612#endif
613 }, 577 },
614 { /* 7455 others */ 578 { /* 7455 others */
615 .pvr_mask = 0xffff0000, 579 .pvr_mask = 0xffff0000,
@@ -621,10 +585,8 @@ struct cpu_spec cpu_specs[] = {
621 .dcache_bsize = 32, 585 .dcache_bsize = 32,
622 .num_pmcs = 6, 586 .num_pmcs = 6,
623 .cpu_setup = __setup_cpu_745x, 587 .cpu_setup = __setup_cpu_745x,
624#ifdef CONFIG_OPROFILE
625 .oprofile_cpu_type = "ppc/7450", 588 .oprofile_cpu_type = "ppc/7450",
626 .oprofile_model = &op_model_7450, 589 .oprofile_type = G4,
627#endif
628 }, 590 },
629 { /* 7447/7457 Rev 1.0 */ 591 { /* 7447/7457 Rev 1.0 */
630 .pvr_mask = 0xffffffff, 592 .pvr_mask = 0xffffffff,
@@ -636,10 +598,8 @@ struct cpu_spec cpu_specs[] = {
636 .dcache_bsize = 32, 598 .dcache_bsize = 32,
637 .num_pmcs = 6, 599 .num_pmcs = 6,
638 .cpu_setup = __setup_cpu_745x, 600 .cpu_setup = __setup_cpu_745x,
639#ifdef CONFIG_OPROFILE
640 .oprofile_cpu_type = "ppc/7450", 601 .oprofile_cpu_type = "ppc/7450",
641 .oprofile_model = &op_model_7450, 602 .oprofile_type = G4,
642#endif
643 }, 603 },
644 { /* 7447/7457 Rev 1.1 */ 604 { /* 7447/7457 Rev 1.1 */
645 .pvr_mask = 0xffffffff, 605 .pvr_mask = 0xffffffff,
@@ -651,10 +611,8 @@ struct cpu_spec cpu_specs[] = {
651 .dcache_bsize = 32, 611 .dcache_bsize = 32,
652 .num_pmcs = 6, 612 .num_pmcs = 6,
653 .cpu_setup = __setup_cpu_745x, 613 .cpu_setup = __setup_cpu_745x,
654#ifdef CONFIG_OPROFILE
655 .oprofile_cpu_type = "ppc/7450", 614 .oprofile_cpu_type = "ppc/7450",
656 .oprofile_model = &op_model_7450, 615 .oprofile_type = G4,
657#endif
658 }, 616 },
659 { /* 7447/7457 Rev 1.2 and later */ 617 { /* 7447/7457 Rev 1.2 and later */
660 .pvr_mask = 0xffff0000, 618 .pvr_mask = 0xffff0000,
@@ -666,10 +624,8 @@ struct cpu_spec cpu_specs[] = {
666 .dcache_bsize = 32, 624 .dcache_bsize = 32,
667 .num_pmcs = 6, 625 .num_pmcs = 6,
668 .cpu_setup = __setup_cpu_745x, 626 .cpu_setup = __setup_cpu_745x,
669#ifdef CONFIG_OPROFILE
670 .oprofile_cpu_type = "ppc/7450", 627 .oprofile_cpu_type = "ppc/7450",
671 .oprofile_model = &op_model_7450, 628 .oprofile_type = G4,
672#endif
673 }, 629 },
674 { /* 7447A */ 630 { /* 7447A */
675 .pvr_mask = 0xffff0000, 631 .pvr_mask = 0xffff0000,
@@ -681,10 +637,8 @@ struct cpu_spec cpu_specs[] = {
681 .dcache_bsize = 32, 637 .dcache_bsize = 32,
682 .num_pmcs = 6, 638 .num_pmcs = 6,
683 .cpu_setup = __setup_cpu_745x, 639 .cpu_setup = __setup_cpu_745x,
684#ifdef CONFIG_OPROFILE
685 .oprofile_cpu_type = "ppc/7450", 640 .oprofile_cpu_type = "ppc/7450",
686 .oprofile_model = &op_model_7450, 641 .oprofile_type = G4,
687#endif
688 }, 642 },
689 { /* 7448 */ 643 { /* 7448 */
690 .pvr_mask = 0xffff0000, 644 .pvr_mask = 0xffff0000,
@@ -696,10 +650,8 @@ struct cpu_spec cpu_specs[] = {
696 .dcache_bsize = 32, 650 .dcache_bsize = 32,
697 .num_pmcs = 6, 651 .num_pmcs = 6,
698 .cpu_setup = __setup_cpu_745x, 652 .cpu_setup = __setup_cpu_745x,
699#ifdef CONFIG_OPROFILE
700 .oprofile_cpu_type = "ppc/7450", 653 .oprofile_cpu_type = "ppc/7450",
701 .oprofile_model = &op_model_7450, 654 .oprofile_type = G4,
702#endif
703 }, 655 },
704 { /* 82xx (8240, 8245, 8260 are all 603e cores) */ 656 { /* 82xx (8240, 8245, 8260 are all 603e cores) */
705 .pvr_mask = 0x7fff0000, 657 .pvr_mask = 0x7fff0000,
@@ -1023,10 +975,8 @@ struct cpu_spec cpu_specs[] = {
1023 .icache_bsize = 32, 975 .icache_bsize = 32,
1024 .dcache_bsize = 32, 976 .dcache_bsize = 32,
1025 .num_pmcs = 4, 977 .num_pmcs = 4,
1026#ifdef CONFIG_OPROFILE
1027 .oprofile_cpu_type = "ppc/e500", 978 .oprofile_cpu_type = "ppc/e500",
1028 .oprofile_model = &op_model_fsl_booke, 979 .oprofile_type = BOOKE,
1029#endif
1030 }, 980 },
1031 { /* e500v2 */ 981 { /* e500v2 */
1032 .pvr_mask = 0xffff0000, 982 .pvr_mask = 0xffff0000,
@@ -1040,10 +990,8 @@ struct cpu_spec cpu_specs[] = {
1040 .icache_bsize = 32, 990 .icache_bsize = 32,
1041 .dcache_bsize = 32, 991 .dcache_bsize = 32,
1042 .num_pmcs = 4, 992 .num_pmcs = 4,
1043#ifdef CONFIG_OPROFILE
1044 .oprofile_cpu_type = "ppc/e500", 993 .oprofile_cpu_type = "ppc/e500",
1045 .oprofile_model = &op_model_fsl_booke, 994 .oprofile_type = BOOKE,
1046#endif
1047 }, 995 },
1048#endif 996#endif
1049#if !CLASSIC_PPC 997#if !CLASSIC_PPC
diff --git a/arch/powerpc/oprofile/common.c b/arch/powerpc/oprofile/common.c
index a370778b68dd..71615eb70b2b 100644
--- a/arch/powerpc/oprofile/common.c
+++ b/arch/powerpc/oprofile/common.c
@@ -135,9 +135,31 @@ static int op_powerpc_create_files(struct super_block *sb, struct dentry *root)
135 135
136int __init oprofile_arch_init(struct oprofile_operations *ops) 136int __init oprofile_arch_init(struct oprofile_operations *ops)
137{ 137{
138 if (!cur_cpu_spec->oprofile_model || !cur_cpu_spec->oprofile_cpu_type) 138 if (!cur_cpu_spec->oprofile_cpu_type)
139 return -ENODEV; 139 return -ENODEV;
140 model = cur_cpu_spec->oprofile_model; 140
141 switch (cur_cpu_spec->oprofile_type) {
142#ifdef CONFIG_PPC64
143 case RS64:
144 model = &op_model_rs64;
145 break;
146 case POWER4:
147 model = &op_model_power4;
148 break;
149#else
150 case G4:
151 model = &op_model_7450;
152 break;
153#endif
154#ifdef CONFIG_FSL_BOOKE
155 case BOOKE:
156 model = &op_model_fsl_booke;
157 break;
158#endif
159 default:
160 return -ENODEV;
161 }
162
141 model->num_counters = cur_cpu_spec->num_pmcs; 163 model->num_counters = cur_cpu_spec->num_pmcs;
142 164
143 ops->cpu_type = cur_cpu_spec->oprofile_cpu_type; 165 ops->cpu_type = cur_cpu_spec->oprofile_cpu_type;