summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhang Rui <rui.zhang@intel.com>2022-08-08 15:23:26 +0300
committerSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>2023-03-22 23:36:50 +0300
commit724387448a45346768ca23ea92b99c67c89b82c8 (patch)
treee90c3860cff52b0f450d5e4983231a05d1c5b265
parent143584e8484fd5225efc4da490d744d26d2cf64e (diff)
downloadlinux-724387448a45346768ca23ea92b99c67c89b82c8.tar.xz
tools/power/x86/intel-speed-select: Abstract get_config_levels
Allow platform specific implementation to get SST-PP level. 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>
-rw-r--r--tools/power/x86/intel-speed-select/isst-core-mbox.c28
-rw-r--r--tools/power/x86/intel-speed-select/isst-core.c25
-rw-r--r--tools/power/x86/intel-speed-select/isst.h1
3 files changed, 31 insertions, 23 deletions
diff --git a/tools/power/x86/intel-speed-select/isst-core-mbox.c b/tools/power/x86/intel-speed-select/isst-core-mbox.c
index 0d14286e0bae..2d8043845ef3 100644
--- a/tools/power/x86/intel-speed-select/isst-core-mbox.c
+++ b/tools/power/x86/intel-speed-select/isst-core-mbox.c
@@ -40,11 +40,39 @@ static int mbox_is_punit_valid(struct isst_id *id)
return 1;
}
+static int mbox_get_config_levels(struct isst_id *id, struct isst_pkg_ctdp *pkg_dev)
+{
+ unsigned int resp;
+ int ret;
+
+ ret = isst_send_mbox_command(id->cpu, CONFIG_TDP,
+ CONFIG_TDP_GET_LEVELS_INFO, 0, 0, &resp);
+ if (ret) {
+ pkg_dev->levels = 0;
+ pkg_dev->locked = 1;
+ pkg_dev->current_level = 0;
+ pkg_dev->version = 0;
+ pkg_dev->enabled = 0;
+ return 0;
+ }
+
+ debug_printf("cpu:%d CONFIG_TDP_GET_LEVELS_INFO resp:%x\n", id->cpu, resp);
+
+ pkg_dev->version = resp & 0xff;
+ pkg_dev->levels = (resp >> 8) & 0xff;
+ pkg_dev->current_level = (resp >> 16) & 0xff;
+ pkg_dev->locked = !!(resp & BIT(24));
+ pkg_dev->enabled = !!(resp & BIT(31));
+
+ return 0;
+}
+
static struct isst_platform_ops mbox_ops = {
.get_disp_freq_multiplier = mbox_get_disp_freq_multiplier,
.get_trl_max_levels = mbox_get_trl_max_levels,
.get_trl_level_name = mbox_get_trl_level_name,
.is_punit_valid = mbox_is_punit_valid,
+ .get_config_levels = mbox_get_config_levels,
};
struct isst_platform_ops *mbox_get_platform_ops(void)
diff --git a/tools/power/x86/intel-speed-select/isst-core.c b/tools/power/x86/intel-speed-select/isst-core.c
index 714ecd710935..0cc5075a7178 100644
--- a/tools/power/x86/intel-speed-select/isst-core.c
+++ b/tools/power/x86/intel-speed-select/isst-core.c
@@ -287,29 +287,8 @@ int isst_read_pm_config(struct isst_id *id, int *cp_state, int *cp_cap)
int isst_get_ctdp_levels(struct isst_id *id, struct isst_pkg_ctdp *pkg_dev)
{
- unsigned int resp;
- int ret;
-
- ret = isst_send_mbox_command(id->cpu, CONFIG_TDP,
- CONFIG_TDP_GET_LEVELS_INFO, 0, 0, &resp);
- if (ret) {
- pkg_dev->levels = 0;
- pkg_dev->locked = 1;
- pkg_dev->current_level = 0;
- pkg_dev->version = 0;
- pkg_dev->enabled = 0;
- return 0;
- }
-
- debug_printf("cpu:%d CONFIG_TDP_GET_LEVELS_INFO resp:%x\n", id->cpu, resp);
-
- pkg_dev->version = resp & 0xff;
- pkg_dev->levels = (resp >> 8) & 0xff;
- pkg_dev->current_level = (resp >> 16) & 0xff;
- pkg_dev->locked = !!(resp & BIT(24));
- pkg_dev->enabled = !!(resp & BIT(31));
-
- return 0;
+ CHECK_CB(get_config_levels);
+ return isst_ops->get_config_levels(id, pkg_dev);
}
int isst_get_ctdp_control(struct isst_id *id, int config_index,
diff --git a/tools/power/x86/intel-speed-select/isst.h b/tools/power/x86/intel-speed-select/isst.h
index ce3638c0ab4d..03ad9e305b9d 100644
--- a/tools/power/x86/intel-speed-select/isst.h
+++ b/tools/power/x86/intel-speed-select/isst.h
@@ -186,6 +186,7 @@ struct isst_platform_ops {
int (*get_trl_max_levels)(void);
char *(*get_trl_level_name)(int level);
int (*is_punit_valid)(struct isst_id *id);
+ int (*get_config_levels)(struct isst_id *id, struct isst_pkg_ctdp *pkg_ctdp);
};
extern int is_cpu_in_power_domain(int cpu, struct isst_id *id);