aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNils Wallménius <nils.wallmenius@gmail.com>2016-04-25 15:31:34 -0400
committerAlex Deucher <alexander.deucher@amd.com>2016-05-04 20:30:34 -0400
commit909a0631b1e64428a98002ad1ea470fa83d95843 (patch)
treeef3021f8a78c3640ac9a7694f544ec30e995718f
parent58174c2787c8fe7f36b195fbacf4ac174341d889 (diff)
drm/amdgpu: Constify some tables
Some more tables with constant data were added with the polaris support v2: missed a few Signed-off-by: Nils Wallménius <nils.wallmenius@gmail.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c32
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.h2
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_powertune.c14
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_thermal.c8
-rw-r--r--drivers/gpu/drm/amd/powerplay/inc/polaris10_pwrvirus.h2
-rw-r--r--drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c11
6 files changed, 36 insertions, 33 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c
index b146ec8a69bb..010199fb7126 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c
@@ -99,16 +99,17 @@
99#define TCLK (PCIE_BUS_CLK / 10) 99#define TCLK (PCIE_BUS_CLK / 10)
100 100
101 101
102uint16_t polaris10_clock_stretcher_lookup_table[2][4] = { {600, 1050, 3, 0}, 102static const uint16_t polaris10_clock_stretcher_lookup_table[2][4] =
103 {600, 1050, 6, 1} }; 103{ {600, 1050, 3, 0}, {600, 1050, 6, 1} };
104 104
105/* [FF, SS] type, [] 4 voltage ranges, and [Floor Freq, Boundary Freq, VID min , VID max] */ 105/* [FF, SS] type, [] 4 voltage ranges, and [Floor Freq, Boundary Freq, VID min , VID max] */
106uint32_t polaris10_clock_stretcher_ddt_table[2][4][4] = { { {265, 529, 120, 128}, {325, 650, 96, 119}, {430, 860, 32, 95}, {0, 0, 0, 31} }, 106static const uint32_t polaris10_clock_stretcher_ddt_table[2][4][4] =
107 { {275, 550, 104, 112}, {319, 638, 96, 103}, {360, 720, 64, 95}, {384, 768, 32, 63} } }; 107{ { {265, 529, 120, 128}, {325, 650, 96, 119}, {430, 860, 32, 95}, {0, 0, 0, 31} },
108 { {275, 550, 104, 112}, {319, 638, 96, 103}, {360, 720, 64, 95}, {384, 768, 32, 63} } };
108 109
109/* [Use_For_Low_freq] value, [0%, 5%, 10%, 7.14%, 14.28%, 20%] (coming from PWR_CKS_CNTL.stretch_amount reg spec) */ 110/* [Use_For_Low_freq] value, [0%, 5%, 10%, 7.14%, 14.28%, 20%] (coming from PWR_CKS_CNTL.stretch_amount reg spec) */
110uint8_t polaris10_clock_stretch_amount_conversion[2][6] = { {0, 1, 3, 2, 4, 5}, 111static const uint8_t polaris10_clock_stretch_amount_conversion[2][6] =
111 {0, 2, 4, 5, 6, 5} }; 112{ {0, 1, 3, 2, 4, 5}, {0, 2, 4, 5, 6, 5} };
112 113
113/** Values for the CG_THERMAL_CTRL::DPM_EVENT_SRC field. */ 114/** Values for the CG_THERMAL_CTRL::DPM_EVENT_SRC field. */
114enum DPM_EVENT_SRC { 115enum DPM_EVENT_SRC {
@@ -119,7 +120,7 @@ enum DPM_EVENT_SRC {
119 DPM_EVENT_SRC_DIGITAL_OR_EXTERNAL = 4 120 DPM_EVENT_SRC_DIGITAL_OR_EXTERNAL = 4
120}; 121};
121 122
122const unsigned long PhwPolaris10_Magic = (unsigned long)(PHM_VIslands_Magic); 123static const unsigned long PhwPolaris10_Magic = (unsigned long)(PHM_VIslands_Magic);
123 124
124struct polaris10_power_state *cast_phw_polaris10_power_state( 125struct polaris10_power_state *cast_phw_polaris10_power_state(
125 struct pp_hw_power_state *hw_ps) 126 struct pp_hw_power_state *hw_ps)
@@ -1069,14 +1070,15 @@ static int polaris10_get_dependency_volt_by_clk(struct pp_hwmgr *hwmgr,
1069 return 0; 1070 return 0;
1070} 1071}
1071 1072
1072sclkFcwRange_t Range_Table[NUM_SCLK_RANGE] = { {VCO_2_4, POSTDIV_DIV_BY_16, 75, 160, 112}, 1073static const sclkFcwRange_t Range_Table[NUM_SCLK_RANGE] =
1073 {VCO_3_6, POSTDIV_DIV_BY_16, 112, 224, 160}, 1074{ {VCO_2_4, POSTDIV_DIV_BY_16, 75, 160, 112},
1074 {VCO_2_4, POSTDIV_DIV_BY_8, 75, 160, 112}, 1075 {VCO_3_6, POSTDIV_DIV_BY_16, 112, 224, 160},
1075 {VCO_3_6, POSTDIV_DIV_BY_8, 112, 224, 160}, 1076 {VCO_2_4, POSTDIV_DIV_BY_8, 75, 160, 112},
1076 {VCO_2_4, POSTDIV_DIV_BY_4, 75, 160, 112}, 1077 {VCO_3_6, POSTDIV_DIV_BY_8, 112, 224, 160},
1077 {VCO_3_6, POSTDIV_DIV_BY_4, 112, 216, 160}, 1078 {VCO_2_4, POSTDIV_DIV_BY_4, 75, 160, 112},
1078 {VCO_2_4, POSTDIV_DIV_BY_2, 75, 160, 108}, 1079 {VCO_3_6, POSTDIV_DIV_BY_4, 112, 216, 160},
1079 {VCO_3_6, POSTDIV_DIV_BY_2, 112, 216, 160} }; 1080 {VCO_2_4, POSTDIV_DIV_BY_2, 75, 160, 108},
1081 {VCO_3_6, POSTDIV_DIV_BY_2, 112, 216, 160} };
1080 1082
1081static void polaris10_get_sclk_range_table(struct pp_hwmgr *hwmgr) 1083static void polaris10_get_sclk_range_table(struct pp_hwmgr *hwmgr)
1082{ 1084{
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.h b/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.h
index b02296444f2f..beedf35cbfa6 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.h
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.h
@@ -264,7 +264,7 @@ struct polaris10_hwmgr {
264 bool enable_tdc_limit_feature; 264 bool enable_tdc_limit_feature;
265 bool enable_pkg_pwr_tracking_feature; 265 bool enable_pkg_pwr_tracking_feature;
266 bool disable_uvd_power_tune_feature; 266 bool disable_uvd_power_tune_feature;
267 struct polaris10_pt_defaults *power_tune_defaults; 267 const struct polaris10_pt_defaults *power_tune_defaults;
268 struct SMU74_Discrete_PmFuses power_tune_table; 268 struct SMU74_Discrete_PmFuses power_tune_table;
269 uint32_t dte_tj_offset; 269 uint32_t dte_tj_offset;
270 uint32_t fast_watermark_threshold; 270 uint32_t fast_watermark_threshold;
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_powertune.c b/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_powertune.c
index 02bcedc7f549..0b99ab3ba0c5 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_powertune.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_powertune.c
@@ -32,7 +32,7 @@
32#define VOLTAGE_SCALE 4 32#define VOLTAGE_SCALE 4
33#define POWERTUNE_DEFAULT_SET_MAX 1 33#define POWERTUNE_DEFAULT_SET_MAX 1
34 34
35struct polaris10_pt_defaults polaris10_power_tune_data_set_array[POWERTUNE_DEFAULT_SET_MAX] = { 35static const struct polaris10_pt_defaults polaris10_power_tune_data_set_array[POWERTUNE_DEFAULT_SET_MAX] = {
36 /* sviLoadLIneEn, SviLoadLineVddC, TDC_VDDC_ThrottleReleaseLimitPerc, TDC_MAWt, 36 /* sviLoadLIneEn, SviLoadLineVddC, TDC_VDDC_ThrottleReleaseLimitPerc, TDC_MAWt,
37 * TdcWaterfallCtl, DTEAmbientTempBase, DisplayCac, BAPM_TEMP_GRADIENT */ 37 * TdcWaterfallCtl, DTEAmbientTempBase, DisplayCac, BAPM_TEMP_GRADIENT */
38 { 1, 0xF, 0xFD, 0x19, 5, 45, 0, 0xB0000, 38 { 1, 0xF, 0xFD, 0x19, 5, 45, 0, 0xB0000,
@@ -67,7 +67,7 @@ static uint16_t scale_fan_gain_settings(uint16_t raw_setting)
67int polaris10_populate_bapm_parameters_in_dpm_table(struct pp_hwmgr *hwmgr) 67int polaris10_populate_bapm_parameters_in_dpm_table(struct pp_hwmgr *hwmgr)
68{ 68{
69 struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 69 struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend);
70 struct polaris10_pt_defaults *defaults = data->power_tune_defaults; 70 const struct polaris10_pt_defaults *defaults = data->power_tune_defaults;
71 SMU74_Discrete_DpmTable *dpm_table = &(data->smc_state_table); 71 SMU74_Discrete_DpmTable *dpm_table = &(data->smc_state_table);
72 struct phm_ppt_v1_information *table_info = 72 struct phm_ppt_v1_information *table_info =
73 (struct phm_ppt_v1_information *)(hwmgr->pptable); 73 (struct phm_ppt_v1_information *)(hwmgr->pptable);
@@ -75,8 +75,8 @@ int polaris10_populate_bapm_parameters_in_dpm_table(struct pp_hwmgr *hwmgr)
75 struct pp_advance_fan_control_parameters *fan_table= 75 struct pp_advance_fan_control_parameters *fan_table=
76 &hwmgr->thermal_controller.advanceFanControlParameters; 76 &hwmgr->thermal_controller.advanceFanControlParameters;
77 int i, j, k; 77 int i, j, k;
78 uint16_t *pdef1; 78 const uint16_t *pdef1;
79 uint16_t *pdef2; 79 const uint16_t *pdef2;
80 80
81 dpm_table->DefaultTdp = PP_HOST_TO_SMC_US((uint16_t)(cac_dtp_table->usTDP * 128)); 81 dpm_table->DefaultTdp = PP_HOST_TO_SMC_US((uint16_t)(cac_dtp_table->usTDP * 128));
82 dpm_table->TargetTdp = PP_HOST_TO_SMC_US((uint16_t)(cac_dtp_table->usTDP * 128)); 82 dpm_table->TargetTdp = PP_HOST_TO_SMC_US((uint16_t)(cac_dtp_table->usTDP * 128));
@@ -114,7 +114,7 @@ int polaris10_populate_bapm_parameters_in_dpm_table(struct pp_hwmgr *hwmgr)
114static int polaris10_populate_svi_load_line(struct pp_hwmgr *hwmgr) 114static int polaris10_populate_svi_load_line(struct pp_hwmgr *hwmgr)
115{ 115{
116 struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 116 struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend);
117 struct polaris10_pt_defaults *defaults = data->power_tune_defaults; 117 const struct polaris10_pt_defaults *defaults = data->power_tune_defaults;
118 118
119 data->power_tune_table.SviLoadLineEn = defaults->SviLoadLineEn; 119 data->power_tune_table.SviLoadLineEn = defaults->SviLoadLineEn;
120 data->power_tune_table.SviLoadLineVddC = defaults->SviLoadLineVddC; 120 data->power_tune_table.SviLoadLineVddC = defaults->SviLoadLineVddC;
@@ -130,7 +130,7 @@ static int polaris10_populate_tdc_limit(struct pp_hwmgr *hwmgr)
130 struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 130 struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend);
131 struct phm_ppt_v1_information *table_info = 131 struct phm_ppt_v1_information *table_info =
132 (struct phm_ppt_v1_information *)(hwmgr->pptable); 132 (struct phm_ppt_v1_information *)(hwmgr->pptable);
133 struct polaris10_pt_defaults *defaults = data->power_tune_defaults; 133 const struct polaris10_pt_defaults *defaults = data->power_tune_defaults;
134 134
135 tdc_limit = (uint16_t)(table_info->cac_dtp_table->usTDC * 128); 135 tdc_limit = (uint16_t)(table_info->cac_dtp_table->usTDC * 128);
136 data->power_tune_table.TDC_VDDC_PkgLimit = 136 data->power_tune_table.TDC_VDDC_PkgLimit =
@@ -145,7 +145,7 @@ static int polaris10_populate_tdc_limit(struct pp_hwmgr *hwmgr)
145static int polaris10_populate_dw8(struct pp_hwmgr *hwmgr, uint32_t fuse_table_offset) 145static int polaris10_populate_dw8(struct pp_hwmgr *hwmgr, uint32_t fuse_table_offset)
146{ 146{
147 struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend); 147 struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend);
148 struct polaris10_pt_defaults *defaults = data->power_tune_defaults; 148 const struct polaris10_pt_defaults *defaults = data->power_tune_defaults;
149 uint32_t temp; 149 uint32_t temp;
150 150
151 if (polaris10_read_smc_sram_dword(hwmgr->smumgr, 151 if (polaris10_read_smc_sram_dword(hwmgr->smumgr,
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_thermal.c b/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_thermal.c
index d39c89bbdab0..956e00ca361a 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_thermal.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_thermal.c
@@ -638,7 +638,7 @@ static int tf_polaris10_thermal_avfs_enable(struct pp_hwmgr *hwmgr,
638 return ret; 638 return ret;
639} 639}
640 640
641static struct phm_master_table_item 641static const struct phm_master_table_item
642polaris10_thermal_start_thermal_controller_master_list[] = { 642polaris10_thermal_start_thermal_controller_master_list[] = {
643 {NULL, tf_polaris10_thermal_initialize}, 643 {NULL, tf_polaris10_thermal_initialize},
644 {NULL, tf_polaris10_thermal_set_temperature_range}, 644 {NULL, tf_polaris10_thermal_set_temperature_range},
@@ -654,14 +654,14 @@ polaris10_thermal_start_thermal_controller_master_list[] = {
654 {NULL, NULL} 654 {NULL, NULL}
655}; 655};
656 656
657static struct phm_master_table_header 657static const struct phm_master_table_header
658polaris10_thermal_start_thermal_controller_master = { 658polaris10_thermal_start_thermal_controller_master = {
659 0, 659 0,
660 PHM_MasterTableFlag_None, 660 PHM_MasterTableFlag_None,
661 polaris10_thermal_start_thermal_controller_master_list 661 polaris10_thermal_start_thermal_controller_master_list
662}; 662};
663 663
664static struct phm_master_table_item 664static const struct phm_master_table_item
665polaris10_thermal_set_temperature_range_master_list[] = { 665polaris10_thermal_set_temperature_range_master_list[] = {
666 {NULL, tf_polaris10_thermal_disable_alert}, 666 {NULL, tf_polaris10_thermal_disable_alert},
667 {NULL, tf_polaris10_thermal_set_temperature_range}, 667 {NULL, tf_polaris10_thermal_set_temperature_range},
@@ -669,7 +669,7 @@ polaris10_thermal_set_temperature_range_master_list[] = {
669 {NULL, NULL} 669 {NULL, NULL}
670}; 670};
671 671
672struct phm_master_table_header 672static const struct phm_master_table_header
673polaris10_thermal_set_temperature_range_master = { 673polaris10_thermal_set_temperature_range_master = {
674 0, 674 0,
675 PHM_MasterTableFlag_None, 675 PHM_MasterTableFlag_None,
diff --git a/drivers/gpu/drm/amd/powerplay/inc/polaris10_pwrvirus.h b/drivers/gpu/drm/amd/powerplay/inc/polaris10_pwrvirus.h
index 933103e6ad08..f497e7d98e6d 100644
--- a/drivers/gpu/drm/amd/powerplay/inc/polaris10_pwrvirus.h
+++ b/drivers/gpu/drm/amd/powerplay/inc/polaris10_pwrvirus.h
@@ -50,7 +50,7 @@ typedef struct PWR_Command_Table PWR_Command_Table;
50 50
51#define PWR_VIRUS_TABLE_SIZE 10031 51#define PWR_VIRUS_TABLE_SIZE 10031
52 52
53static PWR_Command_Table pwr_virus_table[PWR_VIRUS_TABLE_SIZE] = { 53static const PWR_Command_Table pwr_virus_table[PWR_VIRUS_TABLE_SIZE] = {
54 { PwrCmdWrite, 0x00000000, mmRLC_CNTL }, 54 { PwrCmdWrite, 0x00000000, mmRLC_CNTL },
55 { PwrCmdWrite, 0x00000002, mmRLC_SRM_CNTL }, 55 { PwrCmdWrite, 0x00000002, mmRLC_SRM_CNTL },
56 { PwrCmdWrite, 0x15000000, mmCP_ME_CNTL }, 56 { PwrCmdWrite, 0x15000000, mmCP_ME_CNTL },
diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c
index 667e055edd01..de618ead9db8 100644
--- a/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c
+++ b/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c
@@ -49,7 +49,7 @@
49 49
50#define SMC_RAM_END 0x40000 50#define SMC_RAM_END 0x40000
51 51
52SMU74_Discrete_GraphicsLevel avfs_graphics_level_polaris10[8] = { 52static const SMU74_Discrete_GraphicsLevel avfs_graphics_level_polaris10[8] = {
53 /* Min pcie DeepSleep Activity CgSpll CgSpll CcPwr CcPwr Sclk Enabled Enabled Voltage Power */ 53 /* Min pcie DeepSleep Activity CgSpll CgSpll CcPwr CcPwr Sclk Enabled Enabled Voltage Power */
54 /* Voltage, DpmLevel, DivId, Level, FuncCntl3, FuncCntl4, DynRm, DynRm1 Did, Padding,ForActivity, ForThrottle, UpHyst, DownHyst, DownHyst, Throttle */ 54 /* Voltage, DpmLevel, DivId, Level, FuncCntl3, FuncCntl4, DynRm, DynRm1 Did, Padding,ForActivity, ForThrottle, UpHyst, DownHyst, DownHyst, Throttle */
55 { 0x3c0fd047, 0x00, 0x03, 0x1e00, 0x00200410, 0x87020000, 0, 0, 0x16, 0, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, { 0x30750000, 0, 0, 0, 0, 0, 0, 0 } }, 55 { 0x3c0fd047, 0x00, 0x03, 0x1e00, 0x00200410, 0x87020000, 0, 0, 0x16, 0, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, { 0x30750000, 0, 0, 0, 0, 0, 0, 0 } },
@@ -62,8 +62,9 @@ SMU74_Discrete_GraphicsLevel avfs_graphics_level_polaris10[8] = {
62 { 0xf811d047, 0x01, 0x00, 0x1e00, 0x00000610, 0x87020000, 0, 0, 0x0c, 0, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, { 0x80380100, 0, 0, 0, 0, 0, 0, 0 } } 62 { 0xf811d047, 0x01, 0x00, 0x1e00, 0x00000610, 0x87020000, 0, 0, 0x0c, 0, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, { 0x80380100, 0, 0, 0, 0, 0, 0, 0 } }
63}; 63};
64 64
65SMU74_Discrete_MemoryLevel avfs_memory_level_polaris10 = {0x50140000, 0x50140000, 0x00320000, 0x00, 0x00, 65static const SMU74_Discrete_MemoryLevel avfs_memory_level_polaris10 =
66 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x0000, 0x00, 0x00}; 66 {0x50140000, 0x50140000, 0x00320000, 0x00, 0x00,
67 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x0000, 0x00, 0x00};
67 68
68/** 69/**
69* Set the address for reading/writing the SMC SRAM space. 70* Set the address for reading/writing the SMC SRAM space.
@@ -200,7 +201,7 @@ int polaris10_copy_bytes_to_smc(struct pp_smumgr *smumgr, uint32_t smc_start_add
200 201
201static int polaris10_program_jump_on_start(struct pp_smumgr *smumgr) 202static int polaris10_program_jump_on_start(struct pp_smumgr *smumgr)
202{ 203{
203 static unsigned char data[4] = { 0xE0, 0x00, 0x80, 0x40 }; 204 static const unsigned char data[4] = { 0xE0, 0x00, 0x80, 0x40 };
204 205
205 polaris10_copy_bytes_to_smc(smumgr, 0x0, data, 4, sizeof(data)+1); 206 polaris10_copy_bytes_to_smc(smumgr, 0x0, data, 4, sizeof(data)+1);
206 207
@@ -616,7 +617,7 @@ static int polaris10_setup_pwr_virus(struct pp_smumgr *smumgr)
616 int result = -1; 617 int result = -1;
617 uint32_t reg, data; 618 uint32_t reg, data;
618 619
619 PWR_Command_Table *pvirus = pwr_virus_table; 620 const PWR_Command_Table *pvirus = pwr_virus_table;
620 struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(smumgr->backend); 621 struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(smumgr->backend);
621 622
622 623