[v5,8/8] linux-generic: sysinfo clean up for ARM

Message ID 1456946992-19251-9-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 arch/arm/odp_sysinfo_parse.c is currently a symlink to
arch/linux/odp_sysinfo_parse.c, but in fact there should be defferences
between them.

A separated real arch/arm/odp_sysinfo_parse.c is created for ARM, and
the model_str is set to a general "ARM", which is much better then the
general defaul "UNKNOWN" although not so accurate in detailed ARM CPU
model string.

ODP_DBG("TODO: true values should be implemented when possible\n") is
added for ARM too, this means when possible true values can be implemented
for ARM, and only ARM odp_cpuinfo_parser() is updated, while the general
defaul odp_cpuinfo_parser() should be leave there unchanged. In other
words the current implementation for ARM is a temporary work around, but
for the generic default dummy data has to be accepted.

ODP_DBG("Refer to https://bugs.linaro.org/show_bug.cgi?id=1870\n") is
deleted, because this bug describes another thing, eg in previous code,
only cpu_hz_max[0] and model_str[0] were set, the others such as
cpu_hz_max[1...n-1] and model_str[1...n-1] were missing, it isn't related
with the value itself is dummy or not, and this bug was already fixed.

Signed-off-by: Hongbo Zhang <hongbo.zhang@linaro.org>
Reviewed-and-tested-by: Bill Fischofer <bill.fischofer@linaro.org>
---
 .../linux-generic/arch/arm/odp_sysinfo_parse.c     | 29 +++++++++++++++++++++-
 .../linux-generic/arch/linux/odp_sysinfo_parse.c   |  1 -
 2 files changed, 28 insertions(+), 2 deletions(-)
 mode change 120000 => 100644 platform/linux-generic/arch/arm/odp_sysinfo_parse.c

Patch

diff --git a/platform/linux-generic/arch/arm/odp_sysinfo_parse.c b/platform/linux-generic/arch/arm/odp_sysinfo_parse.c
deleted file mode 120000
index 2f368af..0000000
--- a/platform/linux-generic/arch/arm/odp_sysinfo_parse.c
+++ /dev/null
@@ -1 +0,0 @@ 
-../linux/odp_sysinfo_parse.c
\ No newline at end of file
diff --git a/platform/linux-generic/arch/arm/odp_sysinfo_parse.c b/platform/linux-generic/arch/arm/odp_sysinfo_parse.c
new file mode 100644
index 0000000..b141168
--- /dev/null
+++ b/platform/linux-generic/arch/arm/odp_sysinfo_parse.c
@@ -0,0 +1,28 @@ 
+/* Copyright (c) 2016, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#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)
+{
+	int i;
+
+	ODP_DBG("Warning: use dummy values for freq and model string\n");
+	ODP_DBG("TODO: true values should be implemented when possible\n");
+	for (i = 0; i < MAX_CPU_NUMBER; i++) {
+		sysinfo->cpu_hz_max[i] = 1400000000;
+		strcpy(sysinfo->model_str[i], "ARM");
+	}
+
+	return 0;
+}
+
+uint64_t odp_cpu_hz_current(int id ODP_UNUSED)
+{
+	return 0;
+}
diff --git a/platform/linux-generic/arch/linux/odp_sysinfo_parse.c b/platform/linux-generic/arch/linux/odp_sysinfo_parse.c
index 4a22a61..4dcd6d1 100644
--- a/platform/linux-generic/arch/linux/odp_sysinfo_parse.c
+++ b/platform/linux-generic/arch/linux/odp_sysinfo_parse.c
@@ -13,7 +13,6 @@  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");