aboutsummaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorHongbo Zhang <hongbo.zhang@linaro.org>2016-01-27 16:56:12 +0800
committerMaxim Uvarov <maxim.uvarov@linaro.org>2016-02-08 20:45:23 +0300
commit9ecb329808e80963c04b943646df8e74a1438623 (patch)
treee8e5f2118c1e0e6185c1cc9171a9d56de0d02926 /platform
parent24a6e6464b6837f8ad58fdd8c3d6353a25eb53fd (diff)
linux-generic: sysinfo: apply per-CPU implementation to MIPS
When per-CPU framework was introduced, it was only implemented on x86, for other platforms, only the model_str[0] and cpu_hz[0] are set to pass compile, this patch set all values for model_str[] and cpu_hz[] on the MIPS platform. Signed-off-by: Hongbo Zhang <hongbo.zhang@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Diffstat (limited to 'platform')
-rw-r--r--platform/linux-generic/arch/mips64/odp_sysinfo_parse.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
index dcecbb98c..64d65d28d 100644
--- a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
@@ -12,17 +12,23 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
char str[1024];
char *pos;
double mhz = 0.0;
+ uint64_t hz;
int model = 0;
int count = 2;
+ int id = 0;
strcpy(sysinfo->cpu_arch_str, "mips64");
- while (fgets(str, sizeof(str), file) != NULL && count > 0) {
+ while (fgets(str, sizeof(str), file) != NULL && id < MAX_CPU_NUMBER) {
if (!mhz) {
pos = strstr(str, "BogoMIPS");
if (pos)
- if (sscanf(pos, "BogoMIPS : %lf", &mhz) == 1)
+ if (sscanf(pos, "BogoMIPS : %lf", &mhz) == 1) {
+ /* bogomips seems to be 2x freq */
+ hz = (uint64_t)(mhz * 1000000.0 / 2.0);
+ sysinfo->cpu_hz[id] = hz;
count--;
+ }
}
if (!model) {
@@ -32,18 +38,22 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
int len;
pos = strchr(str, ':');
- strncpy(sysinfo->model_str[0], pos + 2,
- sizeof(sysinfo->model_str[0]));
- len = strlen(sysinfo->model_str[0]);
- sysinfo->model_str[0][len - 1] = 0;
+ strncpy(sysinfo->model_str[id], pos + 2,
+ sizeof(sysinfo->model_str[id]));
+ len = strlen(sysinfo->model_str[id]);
+ sysinfo->model_str[id][len - 1] = 0;
model = 1;
count--;
}
}
- }
- /* bogomips seems to be 2x freq */
- sysinfo->cpu_hz[0] = (uint64_t)(mhz * 1000000.0 / 2.0);
+ if (count == 0) {
+ mhz = 0.0;
+ model = 0;
+ count = 2;
+ id++;
+ }
+ }
return 0;
}