diff options
author | Zhang Rui <rui.zhang@intel.com> | 2022-08-20 14:39:52 +0300 |
---|---|---|
committer | Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> | 2023-03-22 23:36:49 +0300 |
commit | 143584e8484fd5225efc4da490d744d26d2cf64e (patch) | |
tree | 7eaf9c8c15478e73487b4b04745e39f076dca8fb /tools | |
parent | d0d1a603c5fea39ada5d3c48f8b7273a2109af07 (diff) | |
download | linux-143584e8484fd5225efc4da490d744d26d2cf64e.tar.xz |
tools/power/x86/intel-speed-select: Abstract is_punit_valid
Allow platform specific implementation to identify a valid punit.
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>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/power/x86/intel-speed-select/isst-core-mbox.c | 10 | ||||
-rw-r--r-- | tools/power/x86/intel-speed-select/isst-core.c | 9 | ||||
-rw-r--r-- | tools/power/x86/intel-speed-select/isst.h | 1 |
3 files changed, 13 insertions, 7 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 221caa35c10c..0d14286e0bae 100644 --- a/tools/power/x86/intel-speed-select/isst-core-mbox.c +++ b/tools/power/x86/intel-speed-select/isst-core-mbox.c @@ -29,12 +29,22 @@ static char *mbox_get_trl_level_name(int level) } } +static int mbox_is_punit_valid(struct isst_id *id) +{ + if (id->cpu < 0) + return 0; + + if (id->pkg < 0 || id->die < 0 || id->punit) + return 0; + return 1; +} 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, }; 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 bf7b667d5ffa..714ecd710935 100644 --- a/tools/power/x86/intel-speed-select/isst-core.c +++ b/tools/power/x86/intel-speed-select/isst-core.c @@ -62,13 +62,8 @@ char *isst_get_trl_level_name(int level) int isst_is_punit_valid(struct isst_id *id) { - if (id->cpu < 0) - return 0; - - if (id->pkg < 0 || id->die < 0 || id->punit) - return 0; - - return 1; + CHECK_CB(is_punit_valid); + return isst_ops->is_punit_valid(id); } static int isst_send_mmio_command(unsigned int cpu, unsigned int reg, int write, diff --git a/tools/power/x86/intel-speed-select/isst.h b/tools/power/x86/intel-speed-select/isst.h index 7bb74d0912c2..ce3638c0ab4d 100644 --- a/tools/power/x86/intel-speed-select/isst.h +++ b/tools/power/x86/intel-speed-select/isst.h @@ -185,6 +185,7 @@ struct isst_platform_ops { int (*get_disp_freq_multiplier)(void); int (*get_trl_max_levels)(void); char *(*get_trl_level_name)(int level); + int (*is_punit_valid)(struct isst_id *id); }; extern int is_cpu_in_power_domain(int cpu, struct isst_id *id); |