sh: Populate initial secondary CPU info from boot_cpu_data.
[safe/jmp/linux-2.6] / arch / powerpc / kernel / power6-pmu.c
index 8898622..ca399ba 100644 (file)
@@ -9,8 +9,10 @@
  * 2 of the License, or (at your option) any later version.
  */
 #include <linux/kernel.h>
-#include <linux/perf_counter.h>
+#include <linux/perf_event.h>
+#include <linux/string.h>
 #include <asm/reg.h>
+#include <asm/cputable.h>
 
 /*
  * Bits in event code for POWER6
@@ -516,7 +518,8 @@ static int power6_cache_events[C(MAX)][C(OP_MAX)][C(RESULT_MAX)] = {
        },
 };
 
-struct power_pmu power6_pmu = {
+static struct power_pmu power6_pmu = {
+       .name                   = "POWER6",
        .n_counter              = 6,
        .max_alternatives       = MAX_ALT,
        .add_fields             = 0x1555,
@@ -531,3 +534,14 @@ struct power_pmu power6_pmu = {
        .generic_events         = power6_generic_events,
        .cache_events           = &power6_cache_events,
 };
+
+static int init_power6_pmu(void)
+{
+       if (!cur_cpu_spec->oprofile_cpu_type ||
+           strcmp(cur_cpu_spec->oprofile_cpu_type, "ppc64/power6"))
+               return -ENODEV;
+
+       return register_power_pmu(&power6_pmu);
+}
+
+arch_initcall(init_power6_pmu);