Commit e7d7b82d authored by Zhang Rui's avatar Zhang Rui

tools/power/turbostat: Relocate lpi probing code

Introduce probe_lpi(), and move all lpi probing related code into it.
Signed-off-by: default avatarZhang Rui <rui.zhang@intel.com>
Reviewed-by: default avatarLen Brown <len.brown@intel.com>
parent 2538d167
...@@ -5374,6 +5374,26 @@ void probe_cstates(void) ...@@ -5374,6 +5374,26 @@ void probe_cstates(void)
dump_sysfs_cstate_config(); dump_sysfs_cstate_config();
} }
void probe_lpi(void)
{
if (!access("/sys/devices/system/cpu/cpuidle/low_power_idle_cpu_residency_us", R_OK))
BIC_PRESENT(BIC_CPU_LPI);
else
BIC_NOT_PRESENT(BIC_CPU_LPI);
if (!access(sys_lpi_file_sysfs, R_OK)) {
sys_lpi_file = sys_lpi_file_sysfs;
BIC_PRESENT(BIC_SYS_LPI);
} else if (!access(sys_lpi_file_debugfs, R_OK)) {
sys_lpi_file = sys_lpi_file_debugfs;
BIC_PRESENT(BIC_SYS_LPI);
} else {
sys_lpi_file_sysfs = NULL;
BIC_NOT_PRESENT(BIC_SYS_LPI);
}
}
void probe_pstates(void) void probe_pstates(void)
{ {
probe_bclk(); probe_bclk();
...@@ -5570,6 +5590,8 @@ void process_cpuid() ...@@ -5570,6 +5590,8 @@ void process_cpuid()
probe_cstates(); probe_cstates();
probe_lpi();
probe_intel_uncore_frequency(); probe_intel_uncore_frequency();
probe_graphics(); probe_graphics();
...@@ -5579,27 +5601,11 @@ void process_cpuid() ...@@ -5579,27 +5601,11 @@ void process_cpuid()
if (platform->has_nhm_msrs) if (platform->has_nhm_msrs)
BIC_PRESENT(BIC_SMI); BIC_PRESENT(BIC_SMI);
if (!access("/sys/devices/system/cpu/cpuidle/low_power_idle_cpu_residency_us", R_OK))
BIC_PRESENT(BIC_CPU_LPI);
else
BIC_NOT_PRESENT(BIC_CPU_LPI);
if (!access("/sys/devices/system/cpu/cpu0/thermal_throttle/core_throttle_count", R_OK)) if (!access("/sys/devices/system/cpu/cpu0/thermal_throttle/core_throttle_count", R_OK))
BIC_PRESENT(BIC_CORE_THROT_CNT); BIC_PRESENT(BIC_CORE_THROT_CNT);
else else
BIC_NOT_PRESENT(BIC_CORE_THROT_CNT); BIC_NOT_PRESENT(BIC_CORE_THROT_CNT);
if (!access(sys_lpi_file_sysfs, R_OK)) {
sys_lpi_file = sys_lpi_file_sysfs;
BIC_PRESENT(BIC_SYS_LPI);
} else if (!access(sys_lpi_file_debugfs, R_OK)) {
sys_lpi_file = sys_lpi_file_debugfs;
BIC_PRESENT(BIC_SYS_LPI);
} else {
sys_lpi_file_sysfs = NULL;
BIC_NOT_PRESENT(BIC_SYS_LPI);
}
if (!quiet) if (!quiet)
decode_misc_feature_control(); decode_misc_feature_control();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment