aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorRex Zhu <Rex.Zhu@amd.com>2018-03-06 00:31:13 -0500
committerAlex Deucher <alexander.deucher@amd.com>2018-03-07 16:10:11 -0500
commitbb03c9c4a917ed602a6b9b01824dbfde5f6b9248 (patch)
treeb4d6e37148183e16789441fbbf00746c5181d9d4 /drivers/gpu
parent819a3e9ab48d899485fdf11e6035b566a11a2eeb (diff)
drm/amd/pp: Drop wrapper functions for upper/lower_32_bits
replace smu_upper_32_bits/smu_lower_32_bits with the standard kernel macros Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Rex Zhu <Rex.Zhu@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/amd/powerplay/inc/smumgr.h5
-rw-r--r--drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c24
-rw-r--r--drivers/gpu/drm/amd/powerplay/smumgr/rv_smumgr.c8
-rw-r--r--drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.c12
-rw-r--r--drivers/gpu/drm/amd/powerplay/smumgr/vega10_smumgr.c12
5 files changed, 28 insertions, 33 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/inc/smumgr.h b/drivers/gpu/drm/amd/powerplay/inc/smumgr.h
index 8872c5cb4f67..9bba0a069ed6 100644
--- a/drivers/gpu/drm/amd/powerplay/inc/smumgr.h
+++ b/drivers/gpu/drm/amd/powerplay/inc/smumgr.h
@@ -26,11 +26,6 @@
26#include "amd_powerplay.h" 26#include "amd_powerplay.h"
27#include "hwmgr.h" 27#include "hwmgr.h"
28 28
29#define smu_lower_32_bits(n) ((uint32_t)(n))
30#define smu_upper_32_bits(n) ((uint32_t)(((n)>>16)>>16))
31
32
33
34enum AVFS_BTC_STATUS { 29enum AVFS_BTC_STATUS {
35 AVFS_BTC_BOOT = 0, 30 AVFS_BTC_BOOT = 0,
36 AVFS_BTC_BOOT_STARTEDSMU, 31 AVFS_BTC_BOOT_STARTEDSMU,
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c
index df585392b2d7..957739aa6db9 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/cz_smumgr.c
@@ -204,11 +204,11 @@ static int cz_load_mec_firmware(struct pp_hwmgr *hwmgr)
204 tmp = PHM_SET_FIELD(tmp, CP_CPC_IC_BASE_CNTL, MTYPE, 1); 204 tmp = PHM_SET_FIELD(tmp, CP_CPC_IC_BASE_CNTL, MTYPE, 1);
205 cgs_write_register(hwmgr->device, mmCP_CPC_IC_BASE_CNTL, tmp); 205 cgs_write_register(hwmgr->device, mmCP_CPC_IC_BASE_CNTL, tmp);
206 206
207 reg_data = smu_lower_32_bits(info.mc_addr) & 207 reg_data = lower_32_bits(info.mc_addr) &
208 PHM_FIELD_MASK(CP_CPC_IC_BASE_LO, IC_BASE_LO); 208 PHM_FIELD_MASK(CP_CPC_IC_BASE_LO, IC_BASE_LO);
209 cgs_write_register(hwmgr->device, mmCP_CPC_IC_BASE_LO, reg_data); 209 cgs_write_register(hwmgr->device, mmCP_CPC_IC_BASE_LO, reg_data);
210 210
211 reg_data = smu_upper_32_bits(info.mc_addr) & 211 reg_data = upper_32_bits(info.mc_addr) &
212 PHM_FIELD_MASK(CP_CPC_IC_BASE_HI, IC_BASE_HI); 212 PHM_FIELD_MASK(CP_CPC_IC_BASE_HI, IC_BASE_HI);
213 cgs_write_register(hwmgr->device, mmCP_CPC_IC_BASE_HI, reg_data); 213 cgs_write_register(hwmgr->device, mmCP_CPC_IC_BASE_HI, reg_data);
214 214
@@ -347,8 +347,8 @@ static int cz_smu_populate_single_scratch_task(
347 return -EINVAL; 347 return -EINVAL;
348 } 348 }
349 349
350 task->addr.low = smu_lower_32_bits(cz_smu->scratch_buffer[i].mc_addr); 350 task->addr.low = lower_32_bits(cz_smu->scratch_buffer[i].mc_addr);
351 task->addr.high = smu_upper_32_bits(cz_smu->scratch_buffer[i].mc_addr); 351 task->addr.high = upper_32_bits(cz_smu->scratch_buffer[i].mc_addr);
352 task->size_bytes = cz_smu->scratch_buffer[i].data_size; 352 task->size_bytes = cz_smu->scratch_buffer[i].data_size;
353 353
354 if (CZ_SCRATCH_ENTRY_DATA_ID_IH_REGISTERS == fw_enum) { 354 if (CZ_SCRATCH_ENTRY_DATA_ID_IH_REGISTERS == fw_enum) {
@@ -384,8 +384,8 @@ static int cz_smu_populate_single_ucode_load_task(
384 return -EINVAL; 384 return -EINVAL;
385 } 385 }
386 386
387 task->addr.low = smu_lower_32_bits(cz_smu->driver_buffer[i].mc_addr); 387 task->addr.low = lower_32_bits(cz_smu->driver_buffer[i].mc_addr);
388 task->addr.high = smu_upper_32_bits(cz_smu->driver_buffer[i].mc_addr); 388 task->addr.high = upper_32_bits(cz_smu->driver_buffer[i].mc_addr);
389 task->size_bytes = cz_smu->driver_buffer[i].data_size; 389 task->size_bytes = cz_smu->driver_buffer[i].data_size;
390 390
391 return 0; 391 return 0;
@@ -613,11 +613,11 @@ static int cz_download_pptable_settings(struct pp_hwmgr *hwmgr, void **table)
613 613
614 cz_send_msg_to_smc_with_parameter(hwmgr, 614 cz_send_msg_to_smc_with_parameter(hwmgr,
615 PPSMC_MSG_SetClkTableAddrHi, 615 PPSMC_MSG_SetClkTableAddrHi,
616 smu_upper_32_bits(cz_smu->scratch_buffer[i].mc_addr)); 616 upper_32_bits(cz_smu->scratch_buffer[i].mc_addr));
617 617
618 cz_send_msg_to_smc_with_parameter(hwmgr, 618 cz_send_msg_to_smc_with_parameter(hwmgr,
619 PPSMC_MSG_SetClkTableAddrLo, 619 PPSMC_MSG_SetClkTableAddrLo,
620 smu_lower_32_bits(cz_smu->scratch_buffer[i].mc_addr)); 620 lower_32_bits(cz_smu->scratch_buffer[i].mc_addr));
621 621
622 cz_send_msg_to_smc_with_parameter(hwmgr, PPSMC_MSG_ExecuteJob, 622 cz_send_msg_to_smc_with_parameter(hwmgr, PPSMC_MSG_ExecuteJob,
623 cz_smu->toc_entry_clock_table); 623 cz_smu->toc_entry_clock_table);
@@ -640,11 +640,11 @@ static int cz_upload_pptable_settings(struct pp_hwmgr *hwmgr)
640 640
641 cz_send_msg_to_smc_with_parameter(hwmgr, 641 cz_send_msg_to_smc_with_parameter(hwmgr,
642 PPSMC_MSG_SetClkTableAddrHi, 642 PPSMC_MSG_SetClkTableAddrHi,
643 smu_upper_32_bits(cz_smu->scratch_buffer[i].mc_addr)); 643 upper_32_bits(cz_smu->scratch_buffer[i].mc_addr));
644 644
645 cz_send_msg_to_smc_with_parameter(hwmgr, 645 cz_send_msg_to_smc_with_parameter(hwmgr,
646 PPSMC_MSG_SetClkTableAddrLo, 646 PPSMC_MSG_SetClkTableAddrLo,
647 smu_lower_32_bits(cz_smu->scratch_buffer[i].mc_addr)); 647 lower_32_bits(cz_smu->scratch_buffer[i].mc_addr));
648 648
649 cz_send_msg_to_smc_with_parameter(hwmgr, PPSMC_MSG_ExecuteJob, 649 cz_send_msg_to_smc_with_parameter(hwmgr, PPSMC_MSG_ExecuteJob,
650 cz_smu->toc_entry_clock_table); 650 cz_smu->toc_entry_clock_table);
@@ -675,11 +675,11 @@ static int cz_request_smu_load_fw(struct pp_hwmgr *hwmgr)
675 675
676 cz_send_msg_to_smc_with_parameter(hwmgr, 676 cz_send_msg_to_smc_with_parameter(hwmgr,
677 PPSMC_MSG_DriverDramAddrHi, 677 PPSMC_MSG_DriverDramAddrHi,
678 smu_upper_32_bits(cz_smu->toc_buffer.mc_addr)); 678 upper_32_bits(cz_smu->toc_buffer.mc_addr));
679 679
680 cz_send_msg_to_smc_with_parameter(hwmgr, 680 cz_send_msg_to_smc_with_parameter(hwmgr,
681 PPSMC_MSG_DriverDramAddrLo, 681 PPSMC_MSG_DriverDramAddrLo,
682 smu_lower_32_bits(cz_smu->toc_buffer.mc_addr)); 682 lower_32_bits(cz_smu->toc_buffer.mc_addr));
683 683
684 cz_send_msg_to_smc(hwmgr, PPSMC_MSG_InitJobs); 684 cz_send_msg_to_smc(hwmgr, PPSMC_MSG_InitJobs);
685 685
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/rv_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/rv_smumgr.c
index 9a0aedbf2b59..cf9ef7add56b 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/rv_smumgr.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/rv_smumgr.c
@@ -169,11 +169,11 @@ int rv_copy_table_from_smc(struct pp_hwmgr *hwmgr,
169 "Invalid SMU Table Length!", return -EINVAL;); 169 "Invalid SMU Table Length!", return -EINVAL;);
170 PP_ASSERT_WITH_CODE(rv_send_msg_to_smc_with_parameter(hwmgr, 170 PP_ASSERT_WITH_CODE(rv_send_msg_to_smc_with_parameter(hwmgr,
171 PPSMC_MSG_SetDriverDramAddrHigh, 171 PPSMC_MSG_SetDriverDramAddrHigh,
172 smu_upper_32_bits(priv->smu_tables.entry[table_id].mc_addr)) == 0, 172 upper_32_bits(priv->smu_tables.entry[table_id].mc_addr)) == 0,
173 "[CopyTableFromSMC] Attempt to Set Dram Addr High Failed!", return -EINVAL;); 173 "[CopyTableFromSMC] Attempt to Set Dram Addr High Failed!", return -EINVAL;);
174 PP_ASSERT_WITH_CODE(rv_send_msg_to_smc_with_parameter(hwmgr, 174 PP_ASSERT_WITH_CODE(rv_send_msg_to_smc_with_parameter(hwmgr,
175 PPSMC_MSG_SetDriverDramAddrLow, 175 PPSMC_MSG_SetDriverDramAddrLow,
176 smu_lower_32_bits(priv->smu_tables.entry[table_id].mc_addr)) == 0, 176 lower_32_bits(priv->smu_tables.entry[table_id].mc_addr)) == 0,
177 "[CopyTableFromSMC] Attempt to Set Dram Addr Low Failed!", 177 "[CopyTableFromSMC] Attempt to Set Dram Addr Low Failed!",
178 return -EINVAL;); 178 return -EINVAL;);
179 PP_ASSERT_WITH_CODE(rv_send_msg_to_smc_with_parameter(hwmgr, 179 PP_ASSERT_WITH_CODE(rv_send_msg_to_smc_with_parameter(hwmgr,
@@ -206,12 +206,12 @@ int rv_copy_table_to_smc(struct pp_hwmgr *hwmgr,
206 206
207 PP_ASSERT_WITH_CODE(rv_send_msg_to_smc_with_parameter(hwmgr, 207 PP_ASSERT_WITH_CODE(rv_send_msg_to_smc_with_parameter(hwmgr,
208 PPSMC_MSG_SetDriverDramAddrHigh, 208 PPSMC_MSG_SetDriverDramAddrHigh,
209 smu_upper_32_bits(priv->smu_tables.entry[table_id].mc_addr)) == 0, 209 upper_32_bits(priv->smu_tables.entry[table_id].mc_addr)) == 0,
210 "[CopyTableToSMC] Attempt to Set Dram Addr High Failed!", 210 "[CopyTableToSMC] Attempt to Set Dram Addr High Failed!",
211 return -EINVAL;); 211 return -EINVAL;);
212 PP_ASSERT_WITH_CODE(rv_send_msg_to_smc_with_parameter(hwmgr, 212 PP_ASSERT_WITH_CODE(rv_send_msg_to_smc_with_parameter(hwmgr,
213 PPSMC_MSG_SetDriverDramAddrLow, 213 PPSMC_MSG_SetDriverDramAddrLow,
214 smu_lower_32_bits(priv->smu_tables.entry[table_id].mc_addr)) == 0, 214 lower_32_bits(priv->smu_tables.entry[table_id].mc_addr)) == 0,
215 "[CopyTableToSMC] Attempt to Set Dram Addr Low Failed!", 215 "[CopyTableToSMC] Attempt to Set Dram Addr Low Failed!",
216 return -EINVAL;); 216 return -EINVAL;);
217 PP_ASSERT_WITH_CODE(rv_send_msg_to_smc_with_parameter(hwmgr, 217 PP_ASSERT_WITH_CODE(rv_send_msg_to_smc_with_parameter(hwmgr,
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.c
index 92dd4bc8a05e..7394bb46b8b2 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/smu7_smumgr.c
@@ -369,8 +369,8 @@ static int smu7_populate_single_firmware_entry(struct pp_hwmgr *hwmgr,
369 if (!result) { 369 if (!result) {
370 entry->version = info.fw_version; 370 entry->version = info.fw_version;
371 entry->id = (uint16_t)fw_type; 371 entry->id = (uint16_t)fw_type;
372 entry->image_addr_high = smu_upper_32_bits(info.mc_addr); 372 entry->image_addr_high = upper_32_bits(info.mc_addr);
373 entry->image_addr_low = smu_lower_32_bits(info.mc_addr); 373 entry->image_addr_low = lower_32_bits(info.mc_addr);
374 entry->meta_data_addr_high = 0; 374 entry->meta_data_addr_high = 0;
375 entry->meta_data_addr_low = 0; 375 entry->meta_data_addr_low = 0;
376 376
@@ -412,10 +412,10 @@ int smu7_request_smu_load_fw(struct pp_hwmgr *hwmgr)
412 if (!cgs_is_virtualization_enabled(hwmgr->device)) { 412 if (!cgs_is_virtualization_enabled(hwmgr->device)) {
413 smu7_send_msg_to_smc_with_parameter(hwmgr, 413 smu7_send_msg_to_smc_with_parameter(hwmgr,
414 PPSMC_MSG_SMU_DRAM_ADDR_HI, 414 PPSMC_MSG_SMU_DRAM_ADDR_HI,
415 smu_upper_32_bits(smu_data->smu_buffer.mc_addr)); 415 upper_32_bits(smu_data->smu_buffer.mc_addr));
416 smu7_send_msg_to_smc_with_parameter(hwmgr, 416 smu7_send_msg_to_smc_with_parameter(hwmgr,
417 PPSMC_MSG_SMU_DRAM_ADDR_LO, 417 PPSMC_MSG_SMU_DRAM_ADDR_LO,
418 smu_lower_32_bits(smu_data->smu_buffer.mc_addr)); 418 lower_32_bits(smu_data->smu_buffer.mc_addr));
419 } 419 }
420 fw_to_load = UCODE_ID_RLC_G_MASK 420 fw_to_load = UCODE_ID_RLC_G_MASK
421 + UCODE_ID_SDMA0_MASK 421 + UCODE_ID_SDMA0_MASK
@@ -472,8 +472,8 @@ int smu7_request_smu_load_fw(struct pp_hwmgr *hwmgr)
472 UCODE_ID_MEC_STORAGE, &toc->entry[toc->num_entries++]), 472 UCODE_ID_MEC_STORAGE, &toc->entry[toc->num_entries++]),
473 "Failed to Get Firmware Entry.", return -EINVAL); 473 "Failed to Get Firmware Entry.", return -EINVAL);
474 474
475 smu7_send_msg_to_smc_with_parameter(hwmgr, PPSMC_MSG_DRV_DRAM_ADDR_HI, smu_upper_32_bits(smu_data->header_buffer.mc_addr)); 475 smu7_send_msg_to_smc_with_parameter(hwmgr, PPSMC_MSG_DRV_DRAM_ADDR_HI, upper_32_bits(smu_data->header_buffer.mc_addr));
476 smu7_send_msg_to_smc_with_parameter(hwmgr, PPSMC_MSG_DRV_DRAM_ADDR_LO, smu_lower_32_bits(smu_data->header_buffer.mc_addr)); 476 smu7_send_msg_to_smc_with_parameter(hwmgr, PPSMC_MSG_DRV_DRAM_ADDR_LO, lower_32_bits(smu_data->header_buffer.mc_addr));
477 477
478 if (smu7_send_msg_to_smc_with_parameter(hwmgr, PPSMC_MSG_LoadUcodes, fw_to_load)) 478 if (smu7_send_msg_to_smc_with_parameter(hwmgr, PPSMC_MSG_LoadUcodes, fw_to_load))
479 pr_err("Fail to Request SMU Load uCode"); 479 pr_err("Fail to Request SMU Load uCode");
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/vega10_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/vega10_smumgr.c
index 1658e471d322..b7be91e7235b 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/vega10_smumgr.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/vega10_smumgr.c
@@ -230,10 +230,10 @@ int vega10_copy_table_from_smc(struct pp_hwmgr *hwmgr,
230 "Invalid SMU Table Length!", return -EINVAL); 230 "Invalid SMU Table Length!", return -EINVAL);
231 vega10_send_msg_to_smc_with_parameter(hwmgr, 231 vega10_send_msg_to_smc_with_parameter(hwmgr,
232 PPSMC_MSG_SetDriverDramAddrHigh, 232 PPSMC_MSG_SetDriverDramAddrHigh,
233 smu_upper_32_bits(priv->smu_tables.entry[table_id].mc_addr)); 233 upper_32_bits(priv->smu_tables.entry[table_id].mc_addr));
234 vega10_send_msg_to_smc_with_parameter(hwmgr, 234 vega10_send_msg_to_smc_with_parameter(hwmgr,
235 PPSMC_MSG_SetDriverDramAddrLow, 235 PPSMC_MSG_SetDriverDramAddrLow,
236 smu_lower_32_bits(priv->smu_tables.entry[table_id].mc_addr)); 236 lower_32_bits(priv->smu_tables.entry[table_id].mc_addr));
237 vega10_send_msg_to_smc_with_parameter(hwmgr, 237 vega10_send_msg_to_smc_with_parameter(hwmgr,
238 PPSMC_MSG_TransferTableSmu2Dram, 238 PPSMC_MSG_TransferTableSmu2Dram,
239 priv->smu_tables.entry[table_id].table_id); 239 priv->smu_tables.entry[table_id].table_id);
@@ -267,10 +267,10 @@ int vega10_copy_table_to_smc(struct pp_hwmgr *hwmgr,
267 267
268 vega10_send_msg_to_smc_with_parameter(hwmgr, 268 vega10_send_msg_to_smc_with_parameter(hwmgr,
269 PPSMC_MSG_SetDriverDramAddrHigh, 269 PPSMC_MSG_SetDriverDramAddrHigh,
270 smu_upper_32_bits(priv->smu_tables.entry[table_id].mc_addr)); 270 upper_32_bits(priv->smu_tables.entry[table_id].mc_addr));
271 vega10_send_msg_to_smc_with_parameter(hwmgr, 271 vega10_send_msg_to_smc_with_parameter(hwmgr,
272 PPSMC_MSG_SetDriverDramAddrLow, 272 PPSMC_MSG_SetDriverDramAddrLow,
273 smu_lower_32_bits(priv->smu_tables.entry[table_id].mc_addr)); 273 lower_32_bits(priv->smu_tables.entry[table_id].mc_addr));
274 vega10_send_msg_to_smc_with_parameter(hwmgr, 274 vega10_send_msg_to_smc_with_parameter(hwmgr,
275 PPSMC_MSG_TransferTableDram2Smu, 275 PPSMC_MSG_TransferTableDram2Smu,
276 priv->smu_tables.entry[table_id].table_id); 276 priv->smu_tables.entry[table_id].table_id);
@@ -337,10 +337,10 @@ int vega10_set_tools_address(struct pp_hwmgr *hwmgr)
337 if (priv->smu_tables.entry[TOOLSTABLE].mc_addr) { 337 if (priv->smu_tables.entry[TOOLSTABLE].mc_addr) {
338 vega10_send_msg_to_smc_with_parameter(hwmgr, 338 vega10_send_msg_to_smc_with_parameter(hwmgr,
339 PPSMC_MSG_SetToolsDramAddrHigh, 339 PPSMC_MSG_SetToolsDramAddrHigh,
340 smu_upper_32_bits(priv->smu_tables.entry[TOOLSTABLE].mc_addr)); 340 upper_32_bits(priv->smu_tables.entry[TOOLSTABLE].mc_addr));
341 vega10_send_msg_to_smc_with_parameter(hwmgr, 341 vega10_send_msg_to_smc_with_parameter(hwmgr,
342 PPSMC_MSG_SetToolsDramAddrLow, 342 PPSMC_MSG_SetToolsDramAddrLow,
343 smu_lower_32_bits(priv->smu_tables.entry[TOOLSTABLE].mc_addr)); 343 lower_32_bits(priv->smu_tables.entry[TOOLSTABLE].mc_addr));
344 } 344 }
345 return 0; 345 return 0;
346} 346}