mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-14 07:44:21 +08:00
tools/power/x86/intel-speed-select: Abstract read_pm_config
Allow platform specific implementation to get SST-CP capability and current state. 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
a59a6c0cad
commit
8f54104f7a
@ -40,6 +40,24 @@ static int mbox_is_punit_valid(struct isst_id *id)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int mbox_read_pm_config(struct isst_id *id, int *cp_state, int *cp_cap)
|
||||
{
|
||||
unsigned int resp;
|
||||
int ret;
|
||||
|
||||
ret = isst_send_mbox_command(id->cpu, READ_PM_CONFIG, PM_FEATURE, 0, 0,
|
||||
&resp);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
debug_printf("cpu:%d READ_PM_CONFIG resp:%x\n", id->cpu, resp);
|
||||
|
||||
*cp_state = resp & BIT(16);
|
||||
*cp_cap = resp & BIT(0) ? 1 : 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mbox_get_config_levels(struct isst_id *id, struct isst_pkg_ctdp *pkg_dev)
|
||||
{
|
||||
unsigned int resp;
|
||||
@ -803,6 +821,7 @@ static struct isst_platform_ops mbox_ops = {
|
||||
.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,
|
||||
.read_pm_config = mbox_read_pm_config,
|
||||
.get_config_levels = mbox_get_config_levels,
|
||||
.get_ctdp_control = mbox_get_ctdp_control,
|
||||
.get_tdp_info = mbox_get_tdp_info,
|
||||
|
@ -249,20 +249,8 @@ int isst_send_msr_command(unsigned int cpu, unsigned int msr, int write,
|
||||
|
||||
int isst_read_pm_config(struct isst_id *id, int *cp_state, int *cp_cap)
|
||||
{
|
||||
unsigned int resp;
|
||||
int ret;
|
||||
|
||||
ret = isst_send_mbox_command(id->cpu, READ_PM_CONFIG, PM_FEATURE, 0, 0,
|
||||
&resp);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
debug_printf("cpu:%d READ_PM_CONFIG resp:%x\n", id->cpu, resp);
|
||||
|
||||
*cp_state = resp & BIT(16);
|
||||
*cp_cap = resp & BIT(0) ? 1 : 0;
|
||||
|
||||
return 0;
|
||||
CHECK_CB(read_pm_config);
|
||||
return isst_ops->read_pm_config(id, cp_state, cp_cap);
|
||||
}
|
||||
|
||||
int isst_get_ctdp_levels(struct isst_id *id, struct isst_pkg_ctdp *pkg_dev)
|
||||
|
@ -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 (*read_pm_config)(struct isst_id *id, int *cp_state, int *cp_cap);
|
||||
int (*get_config_levels)(struct isst_id *id, struct isst_pkg_ctdp *pkg_ctdp);
|
||||
int (*get_ctdp_control)(struct isst_id *id, int config_index, struct isst_pkg_ctdp_level_info *ctdp_level);
|
||||
int (*get_tdp_info)(struct isst_id *id, int config_index, struct isst_pkg_ctdp_level_info *ctdp_level);
|
||||
|
Loading…
Reference in New Issue
Block a user