X-Git-Url: https://git.ti.com/gitweb?p=android-sdk%2Farm-ds5-gator.git;a=blobdiff_plain;f=gator_events_armv6.c;h=7b1d875084f744fb8ed72f034e4c412969556fd9;hp=c571e44b23183eb34b944168db4e911de28d6dc3;hb=7c366b2d106bd14742cc3446f874e520d473703d;hpb=438a1e1cbf4b99b4f6ff1ecf07f9b7cfcc20d517 diff --git a/gator_events_armv6.c b/gator_events_armv6.c index c571e44..7b1d875 100644 --- a/gator_events_armv6.c +++ b/gator_events_armv6.c @@ -8,16 +8,12 @@ #include "gator.h" -#if defined(__arm__) - #define ARM1136 0xb36 #define ARM1156 0xb56 #define ARM1176 0xb76 static const char *pmnc_name; -extern u32 gator_cpuid(void); - /* * Per-CPU PMCR */ @@ -99,20 +95,6 @@ int gator_events_armv6_create_files(struct super_block *sb, struct dentry *root) return 0; } -static int gator_events_armv6_init(int *key) -{ - unsigned int cnt; - - for (cnt = PMN0; cnt <= CCNT; cnt++) { - pmnc_enabled[cnt] = 0; - pmnc_event[cnt] = 0; - pmnc_key[cnt] = *key; - *key = *key + 1; - } - - return 0; -} - static void gator_events_armv6_online(void) { unsigned int cnt; @@ -130,7 +112,7 @@ static void gator_events_armv6_online(void) for (pmnc = 0, cnt = PMN0; cnt <= CCNT; cnt++) { unsigned long event; - per_cpu(perfPrev, raw_smp_processor_id())[cnt] = 0; + per_cpu(perfPrev, smp_processor_id())[cnt] = 0; if (!pmnc_enabled[cnt]) continue; @@ -177,7 +159,7 @@ static void gator_events_armv6_stop(void) static int gator_events_armv6_read(int **buffer) { int cnt, len = 0; - int cpu = raw_smp_processor_id(); + int cpu = smp_processor_id(); for (cnt = PMN0; cnt <= CCNT; cnt++) { if (pmnc_enabled[cnt]) { @@ -208,10 +190,19 @@ static int gator_events_armv6_read(int **buffer) return len; } -#endif -int gator_events_armv6_install(gator_interface *gi) { -#if defined(__arm__) +static struct gator_interface gator_events_armv6_interface = { + .create_files = gator_events_armv6_create_files, + .stop = gator_events_armv6_stop, + .online = gator_events_armv6_online, + .offline = gator_events_armv6_offline, + .read = gator_events_armv6_read, +}; + +int gator_events_armv6_init(void) +{ + unsigned int cnt; + switch (gator_cpuid()) { case ARM1136: case ARM1156: @@ -222,12 +213,12 @@ int gator_events_armv6_install(gator_interface *gi) { return -1; } - gi->create_files = gator_events_armv6_create_files; - gi->init = gator_events_armv6_init; - gi->stop = gator_events_armv6_stop; - gi->online = gator_events_armv6_online; - gi->offline = gator_events_armv6_offline; - gi->read = gator_events_armv6_read; -#endif - return 0; + for (cnt = PMN0; cnt <= CCNT; cnt++) { + pmnc_enabled[cnt] = 0; + pmnc_event[cnt] = 0; + pmnc_key[cnt] = gator_events_get_key(); + } + + return gator_events_install(&gator_events_armv6_interface); } +gator_events_init(gator_events_armv6_init);