cpuinfo: Decouple the fetch cpuinfo from up_perf_getfreq

Summary:
Add the default CPU frequency configuration.

Signed-off-by: wangming9 <wangming9@xiaomi.com>
Signed-off-by: lipengfei28 <lipengfei28@xiaomi.com>
This commit is contained in:
wangming9 2023-11-07 22:25:18 +08:00 committed by GUIDINGLI
parent 10d0526f3f
commit f465443f37
8 changed files with 28 additions and 35 deletions

View file

@ -528,6 +528,13 @@ config ARCH_HAVE_CPUINFO
bool
default n
config ARCH_CPUINFO_FREQ_KHZ
int "Default CPU frequency"
default 0
depends on ARCH_HAVE_CPUINFO
---help---
Defines the CPU's default maximum frequency. Frequency unit KHZ.
config ARCH_HAVE_TCBINFO
bool
default n

View file

@ -51,11 +51,9 @@ ssize_t up_show_cpuinfo(char *buf, size_t buf_size, off_t file_off)
procfs_sprintf(buf, buf_size, &file_off, "BogoMIPS\t: %u.%02u\n",
(CONFIG_BOARD_LOOPSPERMSEC / 1000),
(CONFIG_BOARD_LOOPSPERMSEC / 10) % 100);
#if defined(CONFIG_ARCH_PERF_EVENTS)
procfs_sprintf(buf, buf_size, &file_off, "cpu MHz\t\t: %lu.%02lu\n",
up_perf_getfreq() / 1000000,
(up_perf_getfreq() / 10000) % 100);
#endif
procfs_sprintf(buf, buf_size, &file_off, "cpu MHz\t\t: %u.%03u\n",
CONFIG_ARCH_CPUINFO_FREQ_KHZ / 1000,
CONFIG_ARCH_CPUINFO_FREQ_KHZ % 1000);
/* CPU Features */

View file

@ -73,11 +73,9 @@ ssize_t up_show_cpuinfo(char *buf, size_t buf_size, off_t file_off)
procfs_sprintf(buf, buf_size, &file_off, "BogoMIPS\t: %u.%02u\n",
(CONFIG_BOARD_LOOPSPERMSEC / 1000),
(CONFIG_BOARD_LOOPSPERMSEC / 10) % 100);
#if defined(CONFIG_ARCH_PERF_EVENTS)
procfs_sprintf(buf, buf_size, &file_off, "cpu MHz\t\t: %lu.%02lu\n",
up_perf_getfreq() / 1000000,
(up_perf_getfreq() / 10000) % 100);
#endif
procfs_sprintf(buf, buf_size, &file_off, "cpu MHz\t\t: %u.%03u\n",
CONFIG_ARCH_CPUINFO_FREQ_KHZ / 1000,
CONFIG_ARCH_CPUINFO_FREQ_KHZ % 1000);
/* CPU Features */

View file

@ -70,11 +70,9 @@ ssize_t up_show_cpuinfo(char *buf, size_t buf_size, off_t file_off)
procfs_sprintf(buf, buf_size, &file_off, "BogoMIPS\t: %u.%02u\n",
(CONFIG_BOARD_LOOPSPERMSEC / 1000),
(CONFIG_BOARD_LOOPSPERMSEC / 10) % 100);
#if defined(CONFIG_ARCH_PERF_EVENTS)
procfs_sprintf(buf, buf_size, &file_off, "cpu MHz\t\t: %lu.%02lu\n",
up_perf_getfreq() / 1000000,
(up_perf_getfreq() / 10000) % 100);
#endif
procfs_sprintf(buf, buf_size, &file_off, "cpu MHz\t\t: %u.%03u\n",
CONFIG_ARCH_CPUINFO_FREQ_KHZ / 1000,
CONFIG_ARCH_CPUINFO_FREQ_KHZ % 1000);
/* CPU Features */

View file

@ -73,11 +73,9 @@ ssize_t up_show_cpuinfo(char *buf, size_t buf_size, off_t file_off)
procfs_sprintf(buf, buf_size, &file_off, "BogoMIPS\t: %u.%02u\n",
(CONFIG_BOARD_LOOPSPERMSEC / 1000),
(CONFIG_BOARD_LOOPSPERMSEC / 10) % 100);
#if defined(CONFIG_ARCH_PERF_EVENTS)
procfs_sprintf(buf, buf_size, &file_off, "cpu MHz\t\t: %lu.%02lu\n",
up_perf_getfreq() / 1000000,
(up_perf_getfreq() / 10000) % 100);
#endif
procfs_sprintf(buf, buf_size, &file_off, "cpu MHz\t\t: %u.%03u\n",
CONFIG_ARCH_CPUINFO_FREQ_KHZ / 1000,
CONFIG_ARCH_CPUINFO_FREQ_KHZ % 1000);
/* CPU Features */

View file

@ -74,11 +74,9 @@ ssize_t up_show_cpuinfo(char *buf, size_t buf_size, off_t file_off)
procfs_sprintf(buf, buf_size, &file_off, "BogoMIPS\t: %u.%02u\n",
(CONFIG_BOARD_LOOPSPERMSEC / 1000),
(CONFIG_BOARD_LOOPSPERMSEC / 10) % 100);
#if defined(CONFIG_ARCH_PERF_EVENTS)
procfs_sprintf(buf, buf_size, &file_off, "cpu MHz\t\t: %lu.%02lu\n",
up_perf_getfreq() / 1000000,
(up_perf_getfreq() / 10000) % 100);
#endif
procfs_sprintf(buf, buf_size, &file_off, "cpu MHz\t\t: %u.%03u\n",
CONFIG_ARCH_CPUINFO_FREQ_KHZ / 1000,
CONFIG_ARCH_CPUINFO_FREQ_KHZ % 1000);
/* Cpu features */

View file

@ -73,11 +73,9 @@ ssize_t up_show_cpuinfo(char *buf, size_t buf_size, off_t file_off)
procfs_sprintf(buf, buf_size, &file_off, "BogoMIPS\t: %u.%02u\n",
(CONFIG_BOARD_LOOPSPERMSEC / 1000),
(CONFIG_BOARD_LOOPSPERMSEC / 10) % 100);
#if defined(CONFIG_ARCH_PERF_EVENTS)
procfs_sprintf(buf, buf_size, &file_off, "cpu MHz\t\t: %lu.%02lu\n",
up_perf_getfreq() / 1000000,
(up_perf_getfreq() / 10000) % 100);
#endif
procfs_sprintf(buf, buf_size, &file_off, "cpu MHz\t\t: %u.%03u\n",
CONFIG_ARCH_CPUINFO_FREQ_KHZ / 1000,
CONFIG_ARCH_CPUINFO_FREQ_KHZ % 1000);
/* CPU Features */

View file

@ -105,11 +105,9 @@ ssize_t up_show_cpuinfo(char *buf, size_t buf_size, off_t file_off)
(CONFIG_BOARD_LOOPSPERMSEC / 1000),
(CONFIG_BOARD_LOOPSPERMSEC / 10) % 100);
#if defined(CONFIG_ARCH_PERF_EVENTS)
procfs_sprintf(buf, buf_size, &file_off, "cpu MHz\t\t: %lu.%02lu\n",
up_perf_getfreq() / 1000000,
(up_perf_getfreq() / 10000) % 100);
#endif
procfs_sprintf(buf, buf_size, &file_off, "cpu MHz\t\t: %u.%03u\n",
CONFIG_ARCH_CPUINFO_FREQ_KHZ / 1000,
CONFIG_ARCH_CPUINFO_FREQ_KHZ % 1000);
/* Features */