From: Hongbo Zhang <[email protected]>

Previous patch makes varible model_str to array model_str[] to contain data
for each CPU on AMP platforms, and then this patch adds new API to get the
corresponding model string for each CPU indexed by CPU ID.

Signed-off-by: Hongbo Zhang <[email protected]>
---
 include/odp/api/cpu.h                    | 11 +++++++++++
 platform/linux-generic/odp_system_info.c | 10 +++++++++-
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/include/odp/api/cpu.h b/include/odp/api/cpu.h
index b63a2e9..55f5d23 100644
--- a/include/odp/api/cpu.h
+++ b/include/odp/api/cpu.h
@@ -53,6 +53,17 @@ int odp_cpu_count(void);
 const char *odp_cpu_model_str(void);
 
 /**
+ * CPU model name of a CPU
+ *
+ * Return CPU model name of the specified CPU.
+ *
+ * @param id    CPU ID
+ *
+ * @return Pointer to CPU model name string
+ */
+const char *odp_cpu_model_str_id(int id);
+
+/**
  * Current CPU frequency in Hz
  *
  * Returns current frequency of this CPU
diff --git a/platform/linux-generic/odp_system_info.c 
b/platform/linux-generic/odp_system_info.c
index 8e903b0..ea1f337 100644
--- a/platform/linux-generic/odp_system_info.c
+++ b/platform/linux-generic/odp_system_info.c
@@ -391,7 +391,15 @@ uint64_t odp_sys_page_size(void)
 
 const char *odp_cpu_model_str(void)
 {
-       return odp_global_data.system_info.model_str[0];
+       return odp_cpu_model_str_id(0);
+}
+
+const char *odp_cpu_model_str_id(int id)
+{
+       if (id >= 0 && id < MAX_CPU_NUMBER)
+               return odp_global_data.system_info.model_str[id];
+       else
+               return NULL;
 }
 
 int odp_sys_cache_line_size(void)
-- 
1.9.1

_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to