From: Hongbo Zhang <hongbo.zh...@linaro.org>

This patch moves the MIPS system info codes into the newly added MIPS
specific platform file.

Signed-off-by: Hongbo Zhang <hongbo.zh...@linaro.org>
---
 platform/linux-generic/Makefile.am                 |  1 +
 .../linux-generic/arch/mips64/odp_sysinfo_parse.c  | 53 ++++++++++++++++++++++
 platform/linux-generic/odp_system_info.c           | 47 -------------------
 3 files changed, 54 insertions(+), 47 deletions(-)
 create mode 100644 platform/linux-generic/arch/mips64/odp_sysinfo_parse.c

diff --git a/platform/linux-generic/Makefile.am 
b/platform/linux-generic/Makefile.am
index de43eff..d3802f8 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -165,6 +165,7 @@ __LIB__libodp_la_SOURCES = \
 EXTRA_DIST = \
             arch/linux/odp_cpu_arch.c \
             arch/mips64/odp_cpu_arch.c \
+            arch/mips64/odp_sysinfo_parse.c \
             arch/x86/odp_cpu_arch.c \
             arch/x86/odp_sysinfo_parse.c
 
diff --git a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c 
b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
new file mode 100644
index 0000000..cc75b96
--- /dev/null
+++ b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c
@@ -0,0 +1,53 @@
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#include <odp_internal.h>
+#include <string.h>
+
+int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
+{
+       char str[1024];
+       char *pos;
+       double mhz = 0.0;
+       int model = 0;
+       int count = 2;
+
+       while (fgets(str, sizeof(str), file) != NULL && count > 0) {
+               if (!mhz) {
+                       pos = strstr(str, "BogoMIPS");
+
+                       if (pos) {
+                               sscanf(pos, "BogoMIPS : %lf", &mhz);
+                               count--;
+                       }
+               }
+
+               if (!model) {
+                       pos = strstr(str, "cpu model");
+
+                       if (pos) {
+                               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;
+                               model = 1;
+                               count--;
+                       }
+               }
+       }
+
+       /* bogomips seems to be 2x freq */
+       sysinfo->cpu_hz[0] = (uint64_t)(mhz * 1000000.0 / 2.0);
+
+       return 0;
+}
+
+uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
+{
+       return -1;
+}
diff --git a/platform/linux-generic/odp_system_info.c 
b/platform/linux-generic/odp_system_info.c
index 4824d55..854bad0 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -121,53 +121,6 @@ static uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
        return -1;
 }
 
-#elif defined __OCTEON__
-
-static int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
-{
-       char str[1024];
-       char *pos;
-       double mhz = 0.0;
-       int model = 0;
-       int count = 2;
-
-       while (fgets(str, sizeof(str), file) != NULL && count > 0) {
-               if (!mhz) {
-                       pos = strstr(str, "BogoMIPS");
-
-                       if (pos) {
-                               sscanf(pos, "BogoMIPS : %lf", &mhz);
-                               count--;
-                       }
-               }
-
-               if (!model) {
-                       pos = strstr(str, "cpu model");
-
-                       if (pos) {
-                               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;
-                               model = 1;
-                               count--;
-                       }
-               }
-       }
-
-       /* bogomips seems to be 2x freq */
-       sysinfo->cpu_hz[0] = (uint64_t)(mhz * 1000000.0 / 2.0);
-
-       return 0;
-}
-
-static uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
-{
-       return -1;
-}
-
 #elif defined __powerpc__
 static int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo)
 {
-- 
2.1.4

_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to