Commit bf3486fd authored by Dave Airlie's avatar Dave Airlie Committed by Alex Deucher

amdgpu/pp: slim down the pwr virus tables.

This is what I'd call slightly overengineered, we waste 40k on
storing a value that is write or end, when we could just use the
register value to denote end.

Remove the virus command parameter, and save
   text	   data	    bss	    dec	    hex	filename
1412724	  17982	   1008	1431714	 15d8a2	../drm-next-build/drivers/gpu/drm/amd/amdgpu/amdgpu.o
1331332	  17982	   1008	1350322	 149ab2	../drm-next-build/drivers/gpu/drm/amd/amdgpu/amdgpu.o
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 819c4b94
...@@ -166,25 +166,15 @@ static int fiji_setup_pwr_virus(struct pp_hwmgr *hwmgr) ...@@ -166,25 +166,15 @@ static int fiji_setup_pwr_virus(struct pp_hwmgr *hwmgr)
uint32_t reg, data; uint32_t reg, data;
const PWR_Command_Table *pvirus = PwrVirusTable; const PWR_Command_Table *pvirus = PwrVirusTable;
struct smu7_smumgr *smu_data = (struct smu7_smumgr *)(hwmgr->smu_backend);
for (i = 0; i < PWR_VIRUS_TABLE_SIZE; i++) { for (i = 0; i < PWR_VIRUS_TABLE_SIZE; i++) {
switch (pvirus->command) {
case PwrCmdWrite:
reg = pvirus->reg; reg = pvirus->reg;
data = pvirus->data; data = pvirus->data;
if (reg != 0xffffffff)
cgs_write_register(hwmgr->device, reg, data); cgs_write_register(hwmgr->device, reg, data);
break; else {
case PwrCmdEnd:
result = 0; result = 0;
break; break;
default:
pr_info("Table Exit with Invalid Command!");
smu_data->avfs.avfs_btc_status = AVFS_BTC_VIRUS_FAIL;
result = -EINVAL;
break;
} }
pvirus++; pvirus++;
} }
......
...@@ -67,25 +67,15 @@ static int polaris10_setup_pwr_virus(struct pp_hwmgr *hwmgr) ...@@ -67,25 +67,15 @@ static int polaris10_setup_pwr_virus(struct pp_hwmgr *hwmgr)
uint32_t reg, data; uint32_t reg, data;
const PWR_Command_Table *pvirus = pwr_virus_table; const PWR_Command_Table *pvirus = pwr_virus_table;
struct smu7_smumgr *smu_data = (struct smu7_smumgr *)(hwmgr->smu_backend);
for (i = 0; i < PWR_VIRUS_TABLE_SIZE; i++) { for (i = 0; i < PWR_VIRUS_TABLE_SIZE; i++) {
switch (pvirus->command) {
case PwrCmdWrite:
reg = pvirus->reg; reg = pvirus->reg;
data = pvirus->data; data = pvirus->data;
if (reg != 0xffffffff) {
cgs_write_register(hwmgr->device, reg, data); cgs_write_register(hwmgr->device, reg, data);
break; } else {
case PwrCmdEnd:
result = 0; result = 0;
break; break;
default:
pr_info("Table Exit with Invalid Command!");
smu_data->avfs.avfs_btc_status = AVFS_BTC_VIRUS_FAIL;
result = -EINVAL;
break;
} }
pvirus++; pvirus++;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment