aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorNils Wallménius <nils.wallmenius@gmail.com>2016-09-22 15:13:49 -0400
committerAlex Deucher <alexander.deucher@amd.com>2016-09-23 10:50:22 -0400
commita1c1a1de43457e35816e84b948052af7ee68e158 (patch)
tree8e29eb96ac034c1c94261c882b0e54b828b54743 /drivers/gpu
parentbeb86f29c9c7f2d04f9a42c4c61cc469c3689779 (diff)
drm/amdgpu: Constify tables
Mark some powerplay tables as 'const' and adjust pointers acessing them to avoid introducing warnings. Signed-off-by: Nils Wallménius <nils.wallmenius@gmail.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c2
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/smu7_powertune.c12
-rw-r--r--drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.c10
-rw-r--r--drivers/gpu/drm/amd/powerplay/smumgr/iceland_smumgr.h2
-rw-r--r--drivers/gpu/drm/amd/powerplay/smumgr/tonga_smc.c13
-rw-r--r--drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.h2
6 files changed, 20 insertions, 21 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
index a3832f2d893b..508245d49d33 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
@@ -4278,7 +4278,7 @@ static int smu7_get_clock_by_type(struct pp_hwmgr *hwmgr, enum amd_pp_clock_type
4278 return 0; 4278 return 0;
4279} 4279}
4280 4280
4281static struct pp_hwmgr_func smu7_hwmgr_funcs = { 4281static const struct pp_hwmgr_func smu7_hwmgr_funcs = {
4282 .backend_init = &smu7_hwmgr_backend_init, 4282 .backend_init = &smu7_hwmgr_backend_init,
4283 .backend_fini = &phm_hwmgr_backend_fini, 4283 .backend_fini = &phm_hwmgr_backend_fini,
4284 .asic_setup = &smu7_setup_asic_task, 4284 .asic_setup = &smu7_setup_asic_task,
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_powertune.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_powertune.c
index 260fce050175..41b634ffa5b0 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_powertune.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_powertune.c
@@ -31,7 +31,7 @@
31 31
32static uint32_t DIDTBlock_Info = SQ_IR_MASK | TCP_IR_MASK | TD_PCC_MASK; 32static uint32_t DIDTBlock_Info = SQ_IR_MASK | TCP_IR_MASK | TD_PCC_MASK;
33 33
34static struct gpu_pt_config_reg GCCACConfig_Polaris10[] = { 34static const struct gpu_pt_config_reg GCCACConfig_Polaris10[] = {
35/* --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 35/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
36 * Offset Mask Shift Value Type 36 * Offset Mask Shift Value Type
37 * --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 37 * ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@@ -62,7 +62,7 @@ static struct gpu_pt_config_reg GCCACConfig_Polaris10[] = {
62 { 0xFFFFFFFF } 62 { 0xFFFFFFFF }
63}; 63};
64 64
65static struct gpu_pt_config_reg GCCACConfig_Polaris11[] = { 65static const struct gpu_pt_config_reg GCCACConfig_Polaris11[] = {
66/* --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 66/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
67 * Offset Mask Shift Value Type 67 * Offset Mask Shift Value Type
68 * --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 68 * ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@@ -93,7 +93,7 @@ static struct gpu_pt_config_reg GCCACConfig_Polaris11[] = {
93 { 0xFFFFFFFF } 93 { 0xFFFFFFFF }
94}; 94};
95 95
96static struct gpu_pt_config_reg DIDTConfig_Polaris10[] = { 96static const struct gpu_pt_config_reg DIDTConfig_Polaris10[] = {
97/* --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 97/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
98 * Offset Mask Shift Value Type 98 * Offset Mask Shift Value Type
99 * --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 99 * ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@@ -235,7 +235,7 @@ static struct gpu_pt_config_reg DIDTConfig_Polaris10[] = {
235 { 0xFFFFFFFF } 235 { 0xFFFFFFFF }
236}; 236};
237 237
238static struct gpu_pt_config_reg DIDTConfig_Polaris11[] = { 238static const struct gpu_pt_config_reg DIDTConfig_Polaris11[] = {
239/* --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 239/* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
240 * Offset Mask Shift Value Type 240 * Offset Mask Shift Value Type
241 * --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 241 * ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@@ -427,9 +427,9 @@ static int smu7_enable_didt(struct pp_hwmgr *hwmgr, const bool enable)
427} 427}
428 428
429static int smu7_program_pt_config_registers(struct pp_hwmgr *hwmgr, 429static int smu7_program_pt_config_registers(struct pp_hwmgr *hwmgr,
430 struct gpu_pt_config_reg *cac_config_regs) 430 const struct gpu_pt_config_reg *cac_config_regs)
431{ 431{
432 struct gpu_pt_config_reg *config_regs = cac_config_regs; 432 const struct gpu_pt_config_reg *config_regs = cac_config_regs;
433 uint32_t cache = 0; 433 uint32_t cache = 0;
434 uint32_t data = 0; 434 uint32_t data = 0;
435 435
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.c b/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.c
index 40f18685a7f4..eda802bc63c8 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.c
@@ -63,7 +63,7 @@
63#define DEVICE_ID_VI_ICELAND_M_6902 0x6902 63#define DEVICE_ID_VI_ICELAND_M_6902 0x6902
64#define DEVICE_ID_VI_ICELAND_M_6903 0x6903 64#define DEVICE_ID_VI_ICELAND_M_6903 0x6903
65 65
66static struct iceland_pt_defaults defaults_iceland = { 66static const struct iceland_pt_defaults defaults_iceland = {
67 /* 67 /*
68 * sviLoadLIneEn, SviLoadLineVddC, TDC_VDDC_ThrottleReleaseLimitPerc, 68 * sviLoadLIneEn, SviLoadLineVddC, TDC_VDDC_ThrottleReleaseLimitPerc,
69 * TDC_MAWt, TdcWaterfallCtl, DTEAmbientTempBase, DisplayCac, BAPM_TEMP_GRADIENT 69 * TDC_MAWt, TdcWaterfallCtl, DTEAmbientTempBase, DisplayCac, BAPM_TEMP_GRADIENT
@@ -74,7 +74,7 @@ static struct iceland_pt_defaults defaults_iceland = {
74}; 74};
75 75
76/* 35W - XT, XTL */ 76/* 35W - XT, XTL */
77static struct iceland_pt_defaults defaults_icelandxt = { 77static const struct iceland_pt_defaults defaults_icelandxt = {
78 /* 78 /*
79 * sviLoadLIneEn, SviLoadLineVddC, 79 * sviLoadLIneEn, SviLoadLineVddC,
80 * TDC_VDDC_ThrottleReleaseLimitPerc, TDC_MAWt, 80 * TDC_VDDC_ThrottleReleaseLimitPerc, TDC_MAWt,
@@ -87,7 +87,7 @@ static struct iceland_pt_defaults defaults_icelandxt = {
87}; 87};
88 88
89/* 25W - PRO, LE */ 89/* 25W - PRO, LE */
90static struct iceland_pt_defaults defaults_icelandpro = { 90static const struct iceland_pt_defaults defaults_icelandpro = {
91 /* 91 /*
92 * sviLoadLIneEn, SviLoadLineVddC, 92 * sviLoadLIneEn, SviLoadLineVddC,
93 * TDC_VDDC_ThrottleReleaseLimitPerc, TDC_MAWt, 93 * TDC_VDDC_ThrottleReleaseLimitPerc, TDC_MAWt,
@@ -1740,11 +1740,11 @@ static int iceland_populate_bapm_parameters_in_dpm_table(struct pp_hwmgr *hwmgr)
1740{ 1740{
1741 struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend); 1741 struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);
1742 struct iceland_smumgr *smu_data = (struct iceland_smumgr *)(hwmgr->smumgr->backend); 1742 struct iceland_smumgr *smu_data = (struct iceland_smumgr *)(hwmgr->smumgr->backend);
1743 struct iceland_pt_defaults *defaults = smu_data->power_tune_defaults; 1743 const struct iceland_pt_defaults *defaults = smu_data->power_tune_defaults;
1744 SMU71_Discrete_DpmTable *dpm_table = &(smu_data->smc_state_table); 1744 SMU71_Discrete_DpmTable *dpm_table = &(smu_data->smc_state_table);
1745 struct phm_cac_tdp_table *cac_dtp_table = hwmgr->dyn_state.cac_dtp_table; 1745 struct phm_cac_tdp_table *cac_dtp_table = hwmgr->dyn_state.cac_dtp_table;
1746 struct phm_ppm_table *ppm = hwmgr->dyn_state.ppm_parameter_table; 1746 struct phm_ppm_table *ppm = hwmgr->dyn_state.ppm_parameter_table;
1747 uint16_t *def1, *def2; 1747 const uint16_t *def1, *def2;
1748 int i, j, k; 1748 int i, j, k;
1749 1749
1750 1750
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smumgr.h b/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smumgr.h
index cfadfeeea039..8eae01b37c40 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smumgr.h
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/iceland_smumgr.h
@@ -62,7 +62,7 @@ struct iceland_smumgr {
62 struct SMU71_Discrete_DpmTable smc_state_table; 62 struct SMU71_Discrete_DpmTable smc_state_table;
63 struct SMU71_Discrete_PmFuses power_tune_table; 63 struct SMU71_Discrete_PmFuses power_tune_table;
64 struct SMU71_Discrete_Ulv ulv_setting; 64 struct SMU71_Discrete_Ulv ulv_setting;
65 struct iceland_pt_defaults *power_tune_defaults; 65 const struct iceland_pt_defaults *power_tune_defaults;
66 SMU71_Discrete_MCRegisters mc_regs; 66 SMU71_Discrete_MCRegisters mc_regs;
67 struct iceland_mc_reg_table mc_reg_table; 67 struct iceland_mc_reg_table mc_reg_table;
68 uint32_t activity_target[SMU71_MAX_LEVELS_GRAPHICS]; 68 uint32_t activity_target[SMU71_MAX_LEVELS_GRAPHICS];
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smc.c b/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smc.c
index 4dfd3f60a967..de2a24d85f48 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smc.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smc.c
@@ -58,7 +58,7 @@
58#define VDDC_VDDCI_DELTA 200 58#define VDDC_VDDCI_DELTA 200
59 59
60 60
61static struct tonga_pt_defaults tonga_power_tune_data_set_array[POWERTUNE_DEFAULT_SET_MAX] = { 61static const struct tonga_pt_defaults tonga_power_tune_data_set_array[POWERTUNE_DEFAULT_SET_MAX] = {
62/* sviLoadLIneEn, SviLoadLineVddC, TDC_VDDC_ThrottleReleaseLimitPerc, TDC_MAWt, 62/* sviLoadLIneEn, SviLoadLineVddC, TDC_VDDC_ThrottleReleaseLimitPerc, TDC_MAWt,
63 * TdcWaterfallCtl, DTEAmbientTempBase, DisplayCac, BAPM_TEMP_GRADIENT 63 * TdcWaterfallCtl, DTEAmbientTempBase, DisplayCac, BAPM_TEMP_GRADIENT
64 */ 64 */
@@ -1815,14 +1815,13 @@ static int tonga_populate_bapm_parameters_in_dpm_table(struct pp_hwmgr *hwmgr)
1815{ 1815{
1816 struct tonga_smumgr *smu_data = 1816 struct tonga_smumgr *smu_data =
1817 (struct tonga_smumgr *)(hwmgr->smumgr->backend); 1817 (struct tonga_smumgr *)(hwmgr->smumgr->backend);
1818 struct tonga_pt_defaults *defaults = smu_data->power_tune_defaults; 1818 const struct tonga_pt_defaults *defaults = smu_data->power_tune_defaults;
1819 SMU72_Discrete_DpmTable *dpm_table = &(smu_data->smc_state_table); 1819 SMU72_Discrete_DpmTable *dpm_table = &(smu_data->smc_state_table);
1820 struct phm_ppt_v1_information *table_info = 1820 struct phm_ppt_v1_information *table_info =
1821 (struct phm_ppt_v1_information *)(hwmgr->pptable); 1821 (struct phm_ppt_v1_information *)(hwmgr->pptable);
1822 struct phm_cac_tdp_table *cac_dtp_table = table_info->cac_dtp_table; 1822 struct phm_cac_tdp_table *cac_dtp_table = table_info->cac_dtp_table;
1823 int i, j, k; 1823 int i, j, k;
1824 uint16_t *pdef1; 1824 const uint16_t *pdef1, *pdef2;
1825 uint16_t *pdef2;
1826 1825
1827 dpm_table->DefaultTdp = PP_HOST_TO_SMC_US( 1826 dpm_table->DefaultTdp = PP_HOST_TO_SMC_US(
1828 (uint16_t)(cac_dtp_table->usTDP * 256)); 1827 (uint16_t)(cac_dtp_table->usTDP * 256));
@@ -1863,7 +1862,7 @@ static int tonga_populate_svi_load_line(struct pp_hwmgr *hwmgr)
1863{ 1862{
1864 struct tonga_smumgr *smu_data = 1863 struct tonga_smumgr *smu_data =
1865 (struct tonga_smumgr *)(hwmgr->smumgr->backend); 1864 (struct tonga_smumgr *)(hwmgr->smumgr->backend);
1866 struct tonga_pt_defaults *defaults = smu_data->power_tune_defaults; 1865 const struct tonga_pt_defaults *defaults = smu_data->power_tune_defaults;
1867 1866
1868 smu_data->power_tune_table.SviLoadLineEn = defaults->svi_load_line_en; 1867 smu_data->power_tune_table.SviLoadLineEn = defaults->svi_load_line_en;
1869 smu_data->power_tune_table.SviLoadLineVddC = defaults->svi_load_line_vddC; 1868 smu_data->power_tune_table.SviLoadLineVddC = defaults->svi_load_line_vddC;
@@ -1878,7 +1877,7 @@ static int tonga_populate_tdc_limit(struct pp_hwmgr *hwmgr)
1878 uint16_t tdc_limit; 1877 uint16_t tdc_limit;
1879 struct tonga_smumgr *smu_data = 1878 struct tonga_smumgr *smu_data =
1880 (struct tonga_smumgr *)(hwmgr->smumgr->backend); 1879 (struct tonga_smumgr *)(hwmgr->smumgr->backend);
1881 struct tonga_pt_defaults *defaults = smu_data->power_tune_defaults; 1880 const struct tonga_pt_defaults *defaults = smu_data->power_tune_defaults;
1882 struct phm_ppt_v1_information *table_info = 1881 struct phm_ppt_v1_information *table_info =
1883 (struct phm_ppt_v1_information *)(hwmgr->pptable); 1882 (struct phm_ppt_v1_information *)(hwmgr->pptable);
1884 1883
@@ -1899,7 +1898,7 @@ static int tonga_populate_dw8(struct pp_hwmgr *hwmgr, uint32_t fuse_table_offset
1899{ 1898{
1900 struct tonga_smumgr *smu_data = 1899 struct tonga_smumgr *smu_data =
1901 (struct tonga_smumgr *)(hwmgr->smumgr->backend); 1900 (struct tonga_smumgr *)(hwmgr->smumgr->backend);
1902 struct tonga_pt_defaults *defaults = smu_data->power_tune_defaults; 1901 const struct tonga_pt_defaults *defaults = smu_data->power_tune_defaults;
1903 uint32_t temp; 1902 uint32_t temp;
1904 1903
1905 if (smu7_read_smc_sram_dword(hwmgr->smumgr, 1904 if (smu7_read_smc_sram_dword(hwmgr->smumgr,
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.h b/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.h
index edb5f203f7f5..8c4f761d5bc8 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.h
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.h
@@ -48,7 +48,7 @@ struct tonga_smumgr {
48 struct SMU72_Discrete_DpmTable smc_state_table; 48 struct SMU72_Discrete_DpmTable smc_state_table;
49 struct SMU72_Discrete_Ulv ulv_setting; 49 struct SMU72_Discrete_Ulv ulv_setting;
50 struct SMU72_Discrete_PmFuses power_tune_table; 50 struct SMU72_Discrete_PmFuses power_tune_table;
51 struct tonga_pt_defaults *power_tune_defaults; 51 const struct tonga_pt_defaults *power_tune_defaults;
52 SMU72_Discrete_MCRegisters mc_regs; 52 SMU72_Discrete_MCRegisters mc_regs;
53 struct tonga_mc_reg_table mc_reg_table; 53 struct tonga_mc_reg_table mc_reg_table;
54 54