@@ -31,6 +31,13 @@ extern "C" {
uint64_t odp_sys_cpu_hz(void);
/**
+ * CPU frequency in Hz for AMP system
+ *
+ * @return CPU frequency in Hz
+ */
+uint64_t odp_sys_cpu_hz_amp(int cpu);
+
+/**
* Huge page size in bytes
*
* @return Huge page size in bytes
@@ -25,7 +25,7 @@ extern __thread int __odp_errno;
#define MAX_CPU_NUMBER 128
typedef struct {
- uint64_t cpu_hz;
+ uint64_t cpu_hz[MAX_CPU_NUMBER];
uint64_t huge_page_size;
uint64_t page_size;
int cache_line_size;
@@ -148,7 +148,7 @@ static int cpuinfo_x86(FILE *file, odp_system_info_t *sysinfo)
}
}
- sysinfo->cpu_hz = (uint64_t) (mhz * 1000000.0);
+ sysinfo->cpu_hz[0] = (uint64_t)(mhz * 1000000.0);
return 0;
}
@@ -198,7 +198,7 @@ static int cpuinfo_octeon(FILE *file, odp_system_info_t *sysinfo)
}
/* bogomips seems to be 2x freq */
- sysinfo->cpu_hz = (uint64_t) (mhz * 1000000.0 / 2.0);
+ sysinfo->cpu_hz[0] = (uint64_t)(mhz * 1000000.0 / 2.0);
return 0;
}
@@ -236,7 +236,7 @@ static int cpuinfo_powerpc(FILE *file, odp_system_info_t *sysinfo)
}
}
- sysinfo->cpu_hz = (uint64_t) (mhz * 1000000.0);
+ sysinfo->cpu_hz[0] = (uint64_t)(mhz * 1000000.0);
}
@@ -329,7 +329,7 @@ static int systemcpu(odp_system_info_t *sysinfo)
sysinfo->huge_page_size = huge_page_size();
/* Dummy values */
- sysinfo->cpu_hz = 1400000000;
+ sysinfo->cpu_hz[0] = 1400000000;
sysinfo->cache_line_size = 64;
strncpy(sysinfo->model_str[0], "UNKNOWN", sizeof(sysinfo->model_str));
@@ -375,7 +375,15 @@ int odp_system_info_init(void)
*/
uint64_t odp_sys_cpu_hz(void)
{
- return odp_global_data.system_info.cpu_hz;
+ return odp_sys_cpu_hz_amp(0);
+}
+
+uint64_t odp_sys_cpu_hz_amp(int cpu)
+{
+ if (cpu >= 0 && cpu < MAX_CPU_NUMBER)
+ return odp_global_data.system_info.cpu_hz[cpu];
+ else
+ return -1;
}
uint64_t odp_sys_huge_page_size(void)