/* Copyright (c) 2016-2018, Linaro Limited * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ #include #include #include int _odp_cpuinfo_parser(FILE *file, system_info_t *sysinfo) { char str[1024]; char *pos; double mhz = 0.0; uint64_t hz; int model = 0; int count = 2; int id = 0; sysinfo->cpu_arch = ODP_CPU_ARCH_MIPS; sysinfo->cpu_isa_sw.mips = ODP_CPU_ARCH_MIPS_UNKNOWN; sysinfo->cpu_isa_hw.mips = ODP_CPU_ARCH_MIPS_UNKNOWN; strcpy(sysinfo->cpu_arch_str, "mips64"); while (fgets(str, sizeof(str), file) != NULL && id < CONFIG_NUM_CPU_IDS) { if (!mhz) { pos = strstr(str, "BogoMIPS"); if (pos) if (sscanf(pos, "BogoMIPS : %lf", &mhz) == 1) { /* bogomips seems to be 2x freq */ hz = (uint64_t)(mhz * 1000000.0 / 2.0); sysinfo->cpu_hz_max[id] = hz; count--; } } if (!model) { pos = strstr(str, "cpu model"); if (pos) { int len; pos = strchr(str, ':'); strncpy(sysinfo->model_str[id], pos + 2, MODEL_STR_SIZE - 1); len = strlen(sysinfo->model_str[id]); sysinfo->model_str[id][len - 1] = 0; model = 1; count--; } } if (count == 0) { mhz = 0.0; model = 0; count = 2; id++; } } return 0; } void _odp_sys_info_print_arch(void) { } uint64_t odp_cpu_arch_hz_current(int id ODP_UNUSED) { return odp_global_ro.system_info.default_cpu_hz; }