[v5,5/8] linux-generic: move CPU info dummy data to generic default file

Message ID 1456946992-19251-6-git-send-email-mike.holmes@linaro.org
State New
Headers show

Commit Message

Mike Holmes March 2, 2016, 7:29 p.m.
From: Hongbo Zhang <hongbo.zhang@linaro.org>

The dummy data of cpu_hz_max and model_str are used when platform is
unknown or data cannot be acquired, but these variables should be set
in function odp_cpuinfo_parser() instead of the systemcpu() which should
cover only the cpu_count, huge_page_size and cache_line_size.

Signed-off-by: Hongbo Zhang <hongbo.zhang@linaro.org>
Reviewed-and-tested-by: Bill Fischofer <bill.fischofer@linaro.org>
---
 platform/linux-generic/arch/linux/odp_sysinfo_parse.c | 13 +++++++++++--
 platform/linux-generic/odp_system_info.c              |  9 +--------
 2 files changed, 12 insertions(+), 10 deletions(-)

Patch

diff --git a/platform/linux-generic/arch/linux/odp_sysinfo_parse.c b/platform/linux-generic/arch/linux/odp_sysinfo_parse.c
index 8ff6f48..4a22a61 100644
--- a/platform/linux-generic/arch/linux/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/linux/odp_sysinfo_parse.c
@@ -5,11 +5,20 @@ 
  */
 
 #include <odp_internal.h>
+#include <odp_debug_internal.h>
 #include <string.h>
 
-int odp_cpuinfo_parser(FILE *file ODP_UNUSED,
-		       odp_system_info_t *sysinfo ODP_UNUSED)
+int odp_cpuinfo_parser(FILE *file ODP_UNUSED, odp_system_info_t *sysinfo)
 {
+	int i;
+
+	ODP_DBG("Warning: use dummy values for freq and model string\n");
+	ODP_DBG("Refer to https://bugs.linaro.org/show_bug.cgi?id=1870\n");
+	for (i = 0; i < MAX_CPU_NUMBER; i++) {
+		sysinfo->cpu_hz_max[i] = 1400000000;
+		strcpy(sysinfo->model_str[i], "UNKNOWN");
+	}
+
 	return 0;
 }
 
diff --git a/platform/linux-generic/odp_system_info.c b/platform/linux-generic/odp_system_info.c
index 42aef8a..bedbbc8 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -151,7 +151,7 @@  static int systemcpu(odp_system_info_t *sysinfo)
 
 static int systemcpu(odp_system_info_t *sysinfo)
 {
-	int ret, i;
+	int ret;
 
 	ret = sysconf_cpu_count();
 	if (ret == 0) {
@@ -166,13 +166,6 @@  static int systemcpu(odp_system_info_t *sysinfo)
 	/* Dummy values */
 	sysinfo->cache_line_size = 64;
 
-	ODP_DBG("Warning: use dummy values for freq and model string\n");
-	ODP_DBG("Refer to https://bugs.linaro.org/show_bug.cgi?id=1870\n");
-	for (i = 0; i < MAX_CPU_NUMBER; i++) {
-		sysinfo->cpu_hz_max[i] = 1400000000;
-		strcpy(sysinfo->model_str[i], "UNKNOWN");
-	}
-
 	return 0;
 }