Commit 871e5e72 authored by Kevin Wang's avatar Kevin Wang Committed by Alex Deucher
Browse files

drm/amd/powerplay: replace smu->table_count with SMU_TABLE_COUNT in smu (v2)



fix bellow patch issue:
drm/amd/powerplay: introduce smu table id type to handle the smu table
for each asic
----
"This patch introduces new smu table type, it's to handle the
 different smu table
 defines for each asic with the same smu ip."

before:
use smu->table_count to represent the actual table count in smc firmware
use actual table count to check smu function parameter about smu table
after:
use logic table count "SMU_TABLE_COUNT" to check function parameter
because table id already mapped in smu driver,
and smu function will use logic table id not actual table id to check func parameter.

v2: squash in warning fix

Signed-off-by: default avatarKevin Wang <kevin1.wang@amd.com>
Reviewed-by: default avatarEvan Quan <evan.quan@amd.com>
Acked-by: default avatarHuang Rui <ray.huang@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent f1d59e00
Loading
Loading
Loading
Loading
+4 −9
Original line number Diff line number Diff line
@@ -482,7 +482,7 @@ int smu_update_table(struct smu_context *smu, enum smu_table_id table_index, int
	int ret = 0;
	int table_id = smu_table_get_index(smu, table_index);

	if (!table_data || table_id >= smu_table->table_count || table_id < 0)
	if (!table_data || table_id >= SMU_TABLE_COUNT || table_id < 0)
		return -EINVAL;

	table = &smu_table->tables[table_index];
@@ -911,14 +911,10 @@ static int smu_init_fb_allocations(struct smu_context *smu)
	struct amdgpu_device *adev = smu->adev;
	struct smu_table_context *smu_table = &smu->smu_table;
	struct smu_table *tables = smu_table->tables;
	uint32_t table_count = smu_table->table_count;
	uint32_t i = 0;
	int32_t ret = 0;

	if (table_count <= 0)
		return -EINVAL;

	for (i = 0 ; i < table_count; i++) {
	for (i = 0; i < SMU_TABLE_COUNT; i++) {
		if (tables[i].size == 0)
			continue;
		ret = amdgpu_bo_create_kernel(adev,
@@ -949,13 +945,12 @@ static int smu_fini_fb_allocations(struct smu_context *smu)
{
	struct smu_table_context *smu_table = &smu->smu_table;
	struct smu_table *tables = smu_table->tables;
	uint32_t table_count = smu_table->table_count;
	uint32_t i = 0;

	if (table_count == 0 || tables == NULL)
	if (!tables)
		return 0;

	for (i = 0 ; i < table_count; i++) {
	for (i = 0; i < SMU_TABLE_COUNT; i++) {
		if (tables[i].size == 0)
			continue;
		amdgpu_bo_free_kernel(&tables[i].bo,
+0 −3
Original line number Diff line number Diff line
@@ -1931,8 +1931,5 @@ static const struct pptable_funcs arcturus_ppt_funcs = {

void arcturus_set_ppt_funcs(struct smu_context *smu)
{
	struct smu_table_context *smu_table = &smu->smu_table;

	smu->ppt_funcs = &arcturus_ppt_funcs;
	smu_table->table_count = TABLE_COUNT;
}
+0 −1
Original line number Diff line number Diff line
@@ -259,7 +259,6 @@ struct smu_table_context
	struct smu_bios_boot_up_values	boot_values;
	void                            *driver_pptable;
	struct smu_table		*tables;
	uint32_t			table_count;
	struct smu_table		memory_pool;
	uint8_t                         thermal_controller_type;
	uint16_t			TDPODLimit;
+0 −3
Original line number Diff line number Diff line
@@ -1631,8 +1631,5 @@ static const struct pptable_funcs navi10_ppt_funcs = {

void navi10_set_ppt_funcs(struct smu_context *smu)
{
	struct smu_table_context *smu_table = &smu->smu_table;

	smu->ppt_funcs = &navi10_ppt_funcs;
	smu_table->table_count = TABLE_COUNT;
}
+0 −3
Original line number Diff line number Diff line
@@ -187,9 +187,6 @@ static const struct pptable_funcs renoir_ppt_funcs = {

void renoir_set_ppt_funcs(struct smu_context *smu)
{
	struct smu_table_context *smu_table = &smu->smu_table;

	smu->ppt_funcs = &renoir_ppt_funcs;
	smu->smc_if_version = SMU12_DRIVER_IF_VERSION;
	smu_table->table_count = TABLE_COUNT;
}
Loading