tools/power/x86/intel-speed-select: Move code right before its caller
Some functions are defined far from its only caller. Rearrange the code. No functional changes are expected. Signed-off-by: Zhang Rui <rui.zhang@intel.com> [srinivas.pandruvada@linux.intel.com: changelog edits] Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
This commit is contained in:
parent
e107dec9a8
commit
e4cbd0f13f
|
@ -312,107 +312,6 @@ int isst_get_pwr_info(struct isst_id *id, int config_index,
|
|||
return isst_ops->get_pwr_info(id, config_index, ctdp_level);
|
||||
}
|
||||
|
||||
void isst_get_uncore_p0_p1_info(struct isst_id *id, int config_index,
|
||||
struct isst_pkg_ctdp_level_info *ctdp_level)
|
||||
{
|
||||
unsigned int resp;
|
||||
int ret;
|
||||
|
||||
ctdp_level->uncore_pm = 0;
|
||||
ctdp_level->uncore_p0 = 0;
|
||||
ctdp_level->uncore_p1 = 0;
|
||||
|
||||
ret = isst_send_mbox_command(id->cpu, CONFIG_TDP,
|
||||
CONFIG_TDP_GET_RATIO_INFO, 0,
|
||||
(BIT(16) | config_index), &resp);
|
||||
if (ret)
|
||||
goto try_uncore_mbox;
|
||||
|
||||
ctdp_level->uncore_p0 = resp & GENMASK(7, 0);
|
||||
ctdp_level->uncore_p1 = (resp & GENMASK(15, 8)) >> 8;
|
||||
ctdp_level->uncore_pm = (resp & GENMASK(31, 24)) >> 24;
|
||||
|
||||
debug_printf(
|
||||
"cpu:%d ctdp:%d CONFIG_TDP_GET_RATIO_INFO resp:%x uncore p0:%d uncore p1:%d uncore pm:%d\n",
|
||||
id->cpu, config_index, resp, ctdp_level->uncore_p0, ctdp_level->uncore_p1,
|
||||
ctdp_level->uncore_pm);
|
||||
|
||||
return;
|
||||
|
||||
try_uncore_mbox:
|
||||
ret = isst_send_mbox_command(id->cpu, CONFIG_TDP,
|
||||
CONFIG_TDP_GET_UNCORE_P0_P1_INFO, 0,
|
||||
config_index, &resp);
|
||||
if (ret) {
|
||||
ctdp_level->uncore_p0 = 0;
|
||||
ctdp_level->uncore_p1 = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
ctdp_level->uncore_p0 = resp & GENMASK(7, 0);
|
||||
ctdp_level->uncore_p1 = (resp & GENMASK(15, 8)) >> 8;
|
||||
debug_printf(
|
||||
"cpu:%d ctdp:%d CONFIG_TDP_GET_UNCORE_P0_P1_INFO resp:%x uncore p0:%d uncore p1:%d\n",
|
||||
id->cpu, config_index, resp, ctdp_level->uncore_p0,
|
||||
ctdp_level->uncore_p1);
|
||||
}
|
||||
|
||||
void isst_get_p1_info(struct isst_id *id, int config_index,
|
||||
struct isst_pkg_ctdp_level_info *ctdp_level)
|
||||
{
|
||||
unsigned int resp;
|
||||
int ret;
|
||||
ret = isst_send_mbox_command(id->cpu, CONFIG_TDP, CONFIG_TDP_GET_P1_INFO, 0,
|
||||
config_index, &resp);
|
||||
if (ret) {
|
||||
ctdp_level->sse_p1 = 0;
|
||||
ctdp_level->avx2_p1 = 0;
|
||||
ctdp_level->avx512_p1 = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
ctdp_level->sse_p1 = resp & GENMASK(7, 0);
|
||||
ctdp_level->avx2_p1 = (resp & GENMASK(15, 8)) >> 8;
|
||||
ctdp_level->avx512_p1 = (resp & GENMASK(23, 16)) >> 16;
|
||||
debug_printf(
|
||||
"cpu:%d ctdp:%d CONFIG_TDP_GET_P1_INFO resp:%x sse_p1:%d avx2_p1:%d avx512_p1:%d\n",
|
||||
id->cpu, config_index, resp, ctdp_level->sse_p1,
|
||||
ctdp_level->avx2_p1, ctdp_level->avx512_p1);
|
||||
}
|
||||
|
||||
void isst_get_uncore_mem_freq(struct isst_id *id, int config_index,
|
||||
struct isst_pkg_ctdp_level_info *ctdp_level)
|
||||
{
|
||||
unsigned int resp;
|
||||
int ret;
|
||||
|
||||
ret = isst_send_mbox_command(id->cpu, CONFIG_TDP, CONFIG_TDP_GET_MEM_FREQ,
|
||||
0, config_index, &resp);
|
||||
if (ret) {
|
||||
ctdp_level->mem_freq = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
ctdp_level->mem_freq = resp & GENMASK(7, 0);
|
||||
if (is_spr_platform()) {
|
||||
ctdp_level->mem_freq *= 200;
|
||||
} else if (is_icx_platform()) {
|
||||
if (ctdp_level->mem_freq < 7) {
|
||||
ctdp_level->mem_freq = (12 - ctdp_level->mem_freq) * 133.33 * 2 * 10;
|
||||
ctdp_level->mem_freq /= 10;
|
||||
if (ctdp_level->mem_freq % 10 > 5)
|
||||
ctdp_level->mem_freq++;
|
||||
} else {
|
||||
ctdp_level->mem_freq = 0;
|
||||
}
|
||||
} else {
|
||||
ctdp_level->mem_freq = 0;
|
||||
}
|
||||
debug_printf(
|
||||
"cpu:%d ctdp:%d CONFIG_TDP_GET_MEM_FREQ resp:%x uncore mem_freq:%d\n",
|
||||
id->cpu, config_index, resp, ctdp_level->mem_freq);
|
||||
}
|
||||
|
||||
int isst_get_tjmax_info(struct isst_id *id, int config_index,
|
||||
struct isst_pkg_ctdp_level_info *ctdp_level)
|
||||
{
|
||||
|
@ -917,6 +816,108 @@ void isst_get_process_ctdp_complete(struct isst_id *id, struct isst_pkg_ctdp *pk
|
|||
}
|
||||
}
|
||||
|
||||
void isst_get_uncore_p0_p1_info(struct isst_id *id, int config_index,
|
||||
struct isst_pkg_ctdp_level_info *ctdp_level)
|
||||
{
|
||||
unsigned int resp;
|
||||
int ret;
|
||||
|
||||
ctdp_level->uncore_pm = 0;
|
||||
ctdp_level->uncore_p0 = 0;
|
||||
ctdp_level->uncore_p1 = 0;
|
||||
|
||||
ret = isst_send_mbox_command(id->cpu, CONFIG_TDP,
|
||||
CONFIG_TDP_GET_RATIO_INFO, 0,
|
||||
(BIT(16) | config_index) , &resp);
|
||||
if (ret) {
|
||||
goto try_uncore_mbox;
|
||||
}
|
||||
|
||||
ctdp_level->uncore_p0 = resp & GENMASK(7, 0);
|
||||
ctdp_level->uncore_p1 = (resp & GENMASK(15, 8)) >> 8;
|
||||
ctdp_level->uncore_pm = (resp & GENMASK(31, 24)) >> 24;
|
||||
|
||||
debug_printf(
|
||||
"cpu:%d ctdp:%d CONFIG_TDP_GET_RATIO_INFO resp:%x uncore p0:%d uncore p1:%d uncore pm:%d\n",
|
||||
id->cpu, config_index, resp, ctdp_level->uncore_p0, ctdp_level->uncore_p1,
|
||||
ctdp_level->uncore_pm);
|
||||
|
||||
return;
|
||||
|
||||
try_uncore_mbox:
|
||||
ret = isst_send_mbox_command(id->cpu, CONFIG_TDP,
|
||||
CONFIG_TDP_GET_UNCORE_P0_P1_INFO, 0,
|
||||
config_index, &resp);
|
||||
if (ret) {
|
||||
ctdp_level->uncore_p0 = 0;
|
||||
ctdp_level->uncore_p1 = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
ctdp_level->uncore_p0 = resp & GENMASK(7, 0);
|
||||
ctdp_level->uncore_p1 = (resp & GENMASK(15, 8)) >> 8;
|
||||
debug_printf(
|
||||
"cpu:%d ctdp:%d CONFIG_TDP_GET_UNCORE_P0_P1_INFO resp:%x uncore p0:%d uncore p1:%d\n",
|
||||
id->cpu, config_index, resp, ctdp_level->uncore_p0,
|
||||
ctdp_level->uncore_p1);
|
||||
}
|
||||
|
||||
void isst_get_p1_info(struct isst_id *id, int config_index,
|
||||
struct isst_pkg_ctdp_level_info *ctdp_level)
|
||||
{
|
||||
unsigned int resp;
|
||||
int ret;
|
||||
ret = isst_send_mbox_command(id->cpu, CONFIG_TDP, CONFIG_TDP_GET_P1_INFO, 0,
|
||||
config_index, &resp);
|
||||
if (ret) {
|
||||
ctdp_level->sse_p1 = 0;
|
||||
ctdp_level->avx2_p1 = 0;
|
||||
ctdp_level->avx512_p1 = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
ctdp_level->sse_p1 = resp & GENMASK(7, 0);
|
||||
ctdp_level->avx2_p1 = (resp & GENMASK(15, 8)) >> 8;
|
||||
ctdp_level->avx512_p1 = (resp & GENMASK(23, 16)) >> 16;
|
||||
debug_printf(
|
||||
"cpu:%d ctdp:%d CONFIG_TDP_GET_P1_INFO resp:%x sse_p1:%d avx2_p1:%d avx512_p1:%d\n",
|
||||
id->cpu, config_index, resp, ctdp_level->sse_p1,
|
||||
ctdp_level->avx2_p1, ctdp_level->avx512_p1);
|
||||
}
|
||||
|
||||
void isst_get_uncore_mem_freq(struct isst_id *id, int config_index,
|
||||
struct isst_pkg_ctdp_level_info *ctdp_level)
|
||||
{
|
||||
unsigned int resp;
|
||||
int ret;
|
||||
|
||||
ret = isst_send_mbox_command(id->cpu, CONFIG_TDP, CONFIG_TDP_GET_MEM_FREQ,
|
||||
0, config_index, &resp);
|
||||
if (ret) {
|
||||
ctdp_level->mem_freq = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
ctdp_level->mem_freq = resp & GENMASK(7, 0);
|
||||
if (is_spr_platform()) {
|
||||
ctdp_level->mem_freq *= 200;
|
||||
} else if (is_icx_platform()) {
|
||||
if (ctdp_level->mem_freq < 7) {
|
||||
ctdp_level->mem_freq = (12 - ctdp_level->mem_freq) * 133.33 * 2 * 10;
|
||||
ctdp_level->mem_freq /= 10;
|
||||
if (ctdp_level->mem_freq % 10 > 5)
|
||||
ctdp_level->mem_freq++;
|
||||
} else {
|
||||
ctdp_level->mem_freq = 0;
|
||||
}
|
||||
} else {
|
||||
ctdp_level->mem_freq = 0;
|
||||
}
|
||||
debug_printf(
|
||||
"cpu:%d ctdp:%d CONFIG_TDP_GET_MEM_FREQ resp:%x uncore mem_freq:%d\n",
|
||||
id->cpu, config_index, resp, ctdp_level->mem_freq);
|
||||
}
|
||||
|
||||
int isst_get_process_ctdp(struct isst_id *id, int tdp_level, struct isst_pkg_ctdp *pkg_dev)
|
||||
{
|
||||
int i, ret, valid = 0;
|
||||
|
|
Loading…
Reference in New Issue