tools/power/x86/intel-speed-select: Convert more function to use isst_id

With pkg and die info added into struct isst_id, more functions can
be converted to use struct isst_id as parameter.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
This commit is contained in:
Zhang Rui 2022-08-20 23:58:20 +08:00 committed by Srinivas Pandruvada
parent 32d6ab4551
commit 30e0600e2f
4 changed files with 10 additions and 11 deletions

View File

@ -582,7 +582,7 @@ static void set_cpu_present_cpu_mask(void)
}
}
int get_max_punit_core_id(int pkg_id, int die_id)
int get_max_punit_core_id(struct isst_id *id)
{
int max_id = 0;
int i;
@ -592,8 +592,8 @@ int get_max_punit_core_id(int pkg_id, int die_id)
if (!CPU_ISSET_S(i, present_cpumask_size, present_cpumask))
continue;
if (cpu_map[i].pkg_id == pkg_id &&
cpu_map[i].die_id == die_id &&
if (cpu_map[i].pkg_id == id->pkg &&
cpu_map[i].die_id == id->die &&
cpu_map[i].punit_cpu_core > max_id)
max_id = cpu_map[i].punit_cpu_core;
}
@ -601,10 +601,10 @@ int get_max_punit_core_id(int pkg_id, int die_id)
return max_id;
}
int get_cpu_count(int pkg_id, int die_id)
int get_cpu_count(struct isst_id *id)
{
if (pkg_id < MAX_PACKAGE_COUNT && die_id < MAX_DIE_PER_PACKAGE)
return cpu_cnt[pkg_id][die_id];
if (id->pkg < MAX_PACKAGE_COUNT && id->die < MAX_DIE_PER_PACKAGE)
return cpu_cnt[id->pkg][id->die];
return 0;
}

View File

@ -412,7 +412,7 @@ int isst_get_pbf_info(struct isst_id *id, int level, struct isst_pbf_info *pbf_i
pbf_info->core_cpumask_size = alloc_cpu_set(&pbf_info->core_cpumask);
max_punit_core = get_max_punit_core_id(get_physical_package_id(id->cpu), get_physical_die_id(id->cpu));
max_punit_core = get_max_punit_core_id(id);
max_mask_index = max_punit_core > 32 ? 2 : 1;
for (i = 0; i < max_mask_index; ++i) {

View File

@ -377,8 +377,7 @@ void isst_ctdp_display_information(struct isst_id *id, FILE *outf, int tdp_level
format_and_print(outf, level + 1, header, NULL);
snprintf(header, sizeof(header), "cpu-count");
j = get_cpu_count(get_physical_package_id(id->cpu),
get_physical_die_id(id->cpu));
j = get_cpu_count(id);
snprintf(value, sizeof(value), "%d", j);
format_and_print(outf, level + 2, header, value);

View File

@ -179,8 +179,8 @@ struct isst_pkg_ctdp {
};
extern int get_topo_max_cpus(void);
extern int get_cpu_count(int pkg_id, int die_id);
extern int get_max_punit_core_id(int pkg_id, int die_id);
extern int get_cpu_count(struct isst_id *id);
extern int get_max_punit_core_id(struct isst_id *id);
/* Common interfaces */
FILE *get_output_file(void);