1 1.3 riastrad /* $NetBSD: hwmgr.h,v 1.3 2021/12/19 10:59:02 riastradh Exp $ */ 2 1.1 riastrad 3 1.1 riastrad /* 4 1.1 riastrad * Copyright 2015 Advanced Micro Devices, Inc. 5 1.1 riastrad * 6 1.1 riastrad * Permission is hereby granted, free of charge, to any person obtaining a 7 1.1 riastrad * copy of this software and associated documentation files (the "Software"), 8 1.1 riastrad * to deal in the Software without restriction, including without limitation 9 1.1 riastrad * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 1.1 riastrad * and/or sell copies of the Software, and to permit persons to whom the 11 1.1 riastrad * Software is furnished to do so, subject to the following conditions: 12 1.1 riastrad * 13 1.1 riastrad * The above copyright notice and this permission notice shall be included in 14 1.1 riastrad * all copies or substantial portions of the Software. 15 1.1 riastrad * 16 1.1 riastrad * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 1.1 riastrad * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 1.1 riastrad * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19 1.1 riastrad * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 1.1 riastrad * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 1.1 riastrad * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 1.1 riastrad * OTHER DEALINGS IN THE SOFTWARE. 23 1.1 riastrad * 24 1.1 riastrad */ 25 1.1 riastrad #ifndef _HWMGR_H_ 26 1.1 riastrad #define _HWMGR_H_ 27 1.1 riastrad 28 1.1 riastrad #include <linux/seq_file.h> 29 1.1 riastrad #include "amd_powerplay.h" 30 1.1 riastrad #include "hardwaremanager.h" 31 1.1 riastrad #include "hwmgr_ppt.h" 32 1.1 riastrad #include "ppatomctrl.h" 33 1.1 riastrad #include "power_state.h" 34 1.1 riastrad #include "smu_helper.h" 35 1.1 riastrad 36 1.1 riastrad struct pp_hwmgr; 37 1.1 riastrad struct phm_fan_speed_info; 38 1.1 riastrad struct pp_atomctrl_voltage_table; 39 1.1 riastrad 40 1.1 riastrad #define VOLTAGE_SCALE 4 41 1.1 riastrad #define VOLTAGE_VID_OFFSET_SCALE1 625 42 1.1 riastrad #define VOLTAGE_VID_OFFSET_SCALE2 100 43 1.1 riastrad 44 1.1 riastrad enum DISPLAY_GAP { 45 1.1 riastrad DISPLAY_GAP_VBLANK_OR_WM = 0, /* Wait for vblank or MCHG watermark. */ 46 1.1 riastrad DISPLAY_GAP_VBLANK = 1, /* Wait for vblank. */ 47 1.1 riastrad DISPLAY_GAP_WATERMARK = 2, /* Wait for MCHG watermark. (Note that HW may deassert WM in VBI depending on DC_STUTTER_CNTL.) */ 48 1.1 riastrad DISPLAY_GAP_IGNORE = 3 /* Do not wait. */ 49 1.1 riastrad }; 50 1.1 riastrad typedef enum DISPLAY_GAP DISPLAY_GAP; 51 1.1 riastrad 52 1.1 riastrad enum BACO_STATE { 53 1.1 riastrad BACO_STATE_OUT = 0, 54 1.1 riastrad BACO_STATE_IN, 55 1.1 riastrad }; 56 1.1 riastrad 57 1.1 riastrad struct vi_dpm_level { 58 1.1 riastrad bool enabled; 59 1.1 riastrad uint32_t value; 60 1.1 riastrad uint32_t param1; 61 1.1 riastrad }; 62 1.1 riastrad 63 1.1 riastrad struct vi_dpm_table { 64 1.1 riastrad uint32_t count; 65 1.1 riastrad struct vi_dpm_level dpm_level[1]; 66 1.1 riastrad }; 67 1.1 riastrad 68 1.1 riastrad #define PCIE_PERF_REQ_REMOVE_REGISTRY 0 69 1.1 riastrad #define PCIE_PERF_REQ_FORCE_LOWPOWER 1 70 1.1 riastrad #define PCIE_PERF_REQ_GEN1 2 71 1.1 riastrad #define PCIE_PERF_REQ_GEN2 3 72 1.1 riastrad #define PCIE_PERF_REQ_GEN3 4 73 1.1 riastrad 74 1.1 riastrad enum PHM_BackEnd_Magic { 75 1.1 riastrad PHM_Dummy_Magic = 0xAA5555AA, 76 1.1 riastrad PHM_RV770_Magic = 0xDCBAABCD, 77 1.1 riastrad PHM_Kong_Magic = 0x239478DF, 78 1.1 riastrad PHM_NIslands_Magic = 0x736C494E, 79 1.1 riastrad PHM_Sumo_Magic = 0x8339FA11, 80 1.1 riastrad PHM_SIslands_Magic = 0x369431AC, 81 1.1 riastrad PHM_Trinity_Magic = 0x96751873, 82 1.1 riastrad PHM_CIslands_Magic = 0x38AC78B0, 83 1.1 riastrad PHM_Kv_Magic = 0xDCBBABC0, 84 1.1 riastrad PHM_VIslands_Magic = 0x20130307, 85 1.1 riastrad PHM_Cz_Magic = 0x67DCBA25, 86 1.1 riastrad PHM_Rv_Magic = 0x20161121 87 1.1 riastrad }; 88 1.1 riastrad 89 1.1 riastrad struct phm_set_power_state_input { 90 1.1 riastrad const struct pp_hw_power_state *pcurrent_state; 91 1.1 riastrad const struct pp_hw_power_state *pnew_state; 92 1.1 riastrad }; 93 1.1 riastrad 94 1.1 riastrad struct phm_clock_array { 95 1.1 riastrad uint32_t count; 96 1.1 riastrad uint32_t values[1]; 97 1.1 riastrad }; 98 1.1 riastrad 99 1.1 riastrad struct phm_clock_voltage_dependency_record { 100 1.1 riastrad uint32_t clk; 101 1.1 riastrad uint32_t v; 102 1.1 riastrad }; 103 1.1 riastrad 104 1.1 riastrad struct phm_vceclock_voltage_dependency_record { 105 1.1 riastrad uint32_t ecclk; 106 1.1 riastrad uint32_t evclk; 107 1.1 riastrad uint32_t v; 108 1.1 riastrad }; 109 1.1 riastrad 110 1.1 riastrad struct phm_uvdclock_voltage_dependency_record { 111 1.1 riastrad uint32_t vclk; 112 1.1 riastrad uint32_t dclk; 113 1.1 riastrad uint32_t v; 114 1.1 riastrad }; 115 1.1 riastrad 116 1.1 riastrad struct phm_samuclock_voltage_dependency_record { 117 1.1 riastrad uint32_t samclk; 118 1.1 riastrad uint32_t v; 119 1.1 riastrad }; 120 1.1 riastrad 121 1.1 riastrad struct phm_acpclock_voltage_dependency_record { 122 1.1 riastrad uint32_t acpclk; 123 1.1 riastrad uint32_t v; 124 1.1 riastrad }; 125 1.1 riastrad 126 1.1 riastrad struct phm_clock_voltage_dependency_table { 127 1.1 riastrad uint32_t count; /* Number of entries. */ 128 1.1 riastrad struct phm_clock_voltage_dependency_record entries[1]; /* Dynamically allocate count entries. */ 129 1.1 riastrad }; 130 1.1 riastrad 131 1.1 riastrad struct phm_phase_shedding_limits_record { 132 1.1 riastrad uint32_t Voltage; 133 1.1 riastrad uint32_t Sclk; 134 1.1 riastrad uint32_t Mclk; 135 1.1 riastrad }; 136 1.1 riastrad 137 1.1 riastrad struct phm_uvd_clock_voltage_dependency_record { 138 1.1 riastrad uint32_t vclk; 139 1.1 riastrad uint32_t dclk; 140 1.1 riastrad uint32_t v; 141 1.1 riastrad }; 142 1.1 riastrad 143 1.1 riastrad struct phm_uvd_clock_voltage_dependency_table { 144 1.1 riastrad uint8_t count; 145 1.1 riastrad struct phm_uvd_clock_voltage_dependency_record entries[1]; 146 1.1 riastrad }; 147 1.1 riastrad 148 1.1 riastrad struct phm_acp_clock_voltage_dependency_record { 149 1.1 riastrad uint32_t acpclk; 150 1.1 riastrad uint32_t v; 151 1.1 riastrad }; 152 1.1 riastrad 153 1.1 riastrad struct phm_acp_clock_voltage_dependency_table { 154 1.1 riastrad uint32_t count; 155 1.1 riastrad struct phm_acp_clock_voltage_dependency_record entries[1]; 156 1.1 riastrad }; 157 1.1 riastrad 158 1.1 riastrad struct phm_vce_clock_voltage_dependency_record { 159 1.1 riastrad uint32_t ecclk; 160 1.1 riastrad uint32_t evclk; 161 1.1 riastrad uint32_t v; 162 1.1 riastrad }; 163 1.1 riastrad 164 1.1 riastrad struct phm_phase_shedding_limits_table { 165 1.1 riastrad uint32_t count; 166 1.1 riastrad struct phm_phase_shedding_limits_record entries[1]; 167 1.1 riastrad }; 168 1.1 riastrad 169 1.1 riastrad struct phm_vceclock_voltage_dependency_table { 170 1.1 riastrad uint8_t count; /* Number of entries. */ 171 1.1 riastrad struct phm_vceclock_voltage_dependency_record entries[1]; /* Dynamically allocate count entries. */ 172 1.1 riastrad }; 173 1.1 riastrad 174 1.1 riastrad struct phm_uvdclock_voltage_dependency_table { 175 1.1 riastrad uint8_t count; /* Number of entries. */ 176 1.1 riastrad struct phm_uvdclock_voltage_dependency_record entries[1]; /* Dynamically allocate count entries. */ 177 1.1 riastrad }; 178 1.1 riastrad 179 1.1 riastrad struct phm_samuclock_voltage_dependency_table { 180 1.1 riastrad uint8_t count; /* Number of entries. */ 181 1.1 riastrad struct phm_samuclock_voltage_dependency_record entries[1]; /* Dynamically allocate count entries. */ 182 1.1 riastrad }; 183 1.1 riastrad 184 1.1 riastrad struct phm_acpclock_voltage_dependency_table { 185 1.1 riastrad uint32_t count; /* Number of entries. */ 186 1.1 riastrad struct phm_acpclock_voltage_dependency_record entries[1]; /* Dynamically allocate count entries. */ 187 1.1 riastrad }; 188 1.1 riastrad 189 1.1 riastrad struct phm_vce_clock_voltage_dependency_table { 190 1.1 riastrad uint8_t count; 191 1.1 riastrad struct phm_vce_clock_voltage_dependency_record entries[1]; 192 1.1 riastrad }; 193 1.1 riastrad 194 1.1 riastrad 195 1.1 riastrad enum SMU_ASIC_RESET_MODE 196 1.1 riastrad { 197 1.1 riastrad SMU_ASIC_RESET_MODE_0, 198 1.1 riastrad SMU_ASIC_RESET_MODE_1, 199 1.1 riastrad SMU_ASIC_RESET_MODE_2, 200 1.1 riastrad }; 201 1.1 riastrad 202 1.1 riastrad struct pp_smumgr_func { 203 1.3 riastrad const char *name; 204 1.1 riastrad int (*smu_init)(struct pp_hwmgr *hwmgr); 205 1.1 riastrad int (*smu_fini)(struct pp_hwmgr *hwmgr); 206 1.1 riastrad int (*start_smu)(struct pp_hwmgr *hwmgr); 207 1.1 riastrad int (*check_fw_load_finish)(struct pp_hwmgr *hwmgr, 208 1.1 riastrad uint32_t firmware); 209 1.1 riastrad int (*request_smu_load_fw)(struct pp_hwmgr *hwmgr); 210 1.1 riastrad int (*request_smu_load_specific_fw)(struct pp_hwmgr *hwmgr, 211 1.1 riastrad uint32_t firmware); 212 1.1 riastrad uint32_t (*get_argument)(struct pp_hwmgr *hwmgr); 213 1.1 riastrad int (*send_msg_to_smc)(struct pp_hwmgr *hwmgr, uint16_t msg); 214 1.1 riastrad int (*send_msg_to_smc_with_parameter)(struct pp_hwmgr *hwmgr, 215 1.1 riastrad uint16_t msg, uint32_t parameter); 216 1.1 riastrad int (*download_pptable_settings)(struct pp_hwmgr *hwmgr, 217 1.1 riastrad void **table); 218 1.1 riastrad int (*upload_pptable_settings)(struct pp_hwmgr *hwmgr); 219 1.1 riastrad int (*update_smc_table)(struct pp_hwmgr *hwmgr, uint32_t type); 220 1.1 riastrad int (*process_firmware_header)(struct pp_hwmgr *hwmgr); 221 1.1 riastrad int (*update_sclk_threshold)(struct pp_hwmgr *hwmgr); 222 1.1 riastrad int (*thermal_setup_fan_table)(struct pp_hwmgr *hwmgr); 223 1.1 riastrad int (*thermal_avfs_enable)(struct pp_hwmgr *hwmgr); 224 1.1 riastrad int (*init_smc_table)(struct pp_hwmgr *hwmgr); 225 1.1 riastrad int (*populate_all_graphic_levels)(struct pp_hwmgr *hwmgr); 226 1.1 riastrad int (*populate_all_memory_levels)(struct pp_hwmgr *hwmgr); 227 1.1 riastrad int (*initialize_mc_reg_table)(struct pp_hwmgr *hwmgr); 228 1.1 riastrad uint32_t (*get_offsetof)(uint32_t type, uint32_t member); 229 1.1 riastrad uint32_t (*get_mac_definition)(uint32_t value); 230 1.1 riastrad bool (*is_dpm_running)(struct pp_hwmgr *hwmgr); 231 1.1 riastrad bool (*is_hw_avfs_present)(struct pp_hwmgr *hwmgr); 232 1.1 riastrad int (*update_dpm_settings)(struct pp_hwmgr *hwmgr, void *profile_setting); 233 1.1 riastrad int (*smc_table_manager)(struct pp_hwmgr *hwmgr, uint8_t *table, uint16_t table_id, bool rw); /*rw: true for read, false for write */ 234 1.1 riastrad }; 235 1.1 riastrad 236 1.1 riastrad struct pp_hwmgr_func { 237 1.1 riastrad int (*backend_init)(struct pp_hwmgr *hw_mgr); 238 1.1 riastrad int (*backend_fini)(struct pp_hwmgr *hw_mgr); 239 1.1 riastrad int (*asic_setup)(struct pp_hwmgr *hw_mgr); 240 1.1 riastrad int (*get_power_state_size)(struct pp_hwmgr *hw_mgr); 241 1.1 riastrad 242 1.1 riastrad int (*apply_state_adjust_rules)(struct pp_hwmgr *hwmgr, 243 1.1 riastrad struct pp_power_state *prequest_ps, 244 1.1 riastrad const struct pp_power_state *pcurrent_ps); 245 1.1 riastrad 246 1.1 riastrad int (*apply_clocks_adjust_rules)(struct pp_hwmgr *hwmgr); 247 1.1 riastrad 248 1.1 riastrad int (*force_dpm_level)(struct pp_hwmgr *hw_mgr, 249 1.1 riastrad enum amd_dpm_forced_level level); 250 1.1 riastrad 251 1.1 riastrad int (*dynamic_state_management_enable)( 252 1.1 riastrad struct pp_hwmgr *hw_mgr); 253 1.1 riastrad int (*dynamic_state_management_disable)( 254 1.1 riastrad struct pp_hwmgr *hw_mgr); 255 1.1 riastrad 256 1.1 riastrad int (*patch_boot_state)(struct pp_hwmgr *hwmgr, 257 1.1 riastrad struct pp_hw_power_state *hw_ps); 258 1.1 riastrad 259 1.1 riastrad int (*get_pp_table_entry)(struct pp_hwmgr *hwmgr, 260 1.1 riastrad unsigned long, struct pp_power_state *); 261 1.1 riastrad int (*get_num_of_pp_table_entries)(struct pp_hwmgr *hwmgr); 262 1.1 riastrad int (*powerdown_uvd)(struct pp_hwmgr *hwmgr); 263 1.1 riastrad void (*powergate_vce)(struct pp_hwmgr *hwmgr, bool bgate); 264 1.1 riastrad void (*powergate_uvd)(struct pp_hwmgr *hwmgr, bool bgate); 265 1.1 riastrad void (*powergate_acp)(struct pp_hwmgr *hwmgr, bool bgate); 266 1.1 riastrad uint32_t (*get_mclk)(struct pp_hwmgr *hwmgr, bool low); 267 1.1 riastrad uint32_t (*get_sclk)(struct pp_hwmgr *hwmgr, bool low); 268 1.1 riastrad int (*power_state_set)(struct pp_hwmgr *hwmgr, 269 1.1 riastrad const void *state); 270 1.1 riastrad int (*notify_smc_display_config_after_ps_adjustment)(struct pp_hwmgr *hwmgr); 271 1.1 riastrad int (*pre_display_config_changed)(struct pp_hwmgr *hwmgr); 272 1.1 riastrad int (*display_config_changed)(struct pp_hwmgr *hwmgr); 273 1.1 riastrad int (*disable_clock_power_gating)(struct pp_hwmgr *hwmgr); 274 1.1 riastrad int (*update_clock_gatings)(struct pp_hwmgr *hwmgr, 275 1.1 riastrad const uint32_t *msg_id); 276 1.1 riastrad int (*set_max_fan_rpm_output)(struct pp_hwmgr *hwmgr, uint16_t us_max_fan_pwm); 277 1.1 riastrad int (*set_max_fan_pwm_output)(struct pp_hwmgr *hwmgr, uint16_t us_max_fan_pwm); 278 1.1 riastrad int (*stop_thermal_controller)(struct pp_hwmgr *hwmgr); 279 1.1 riastrad int (*get_fan_speed_info)(struct pp_hwmgr *hwmgr, struct phm_fan_speed_info *fan_speed_info); 280 1.1 riastrad void (*set_fan_control_mode)(struct pp_hwmgr *hwmgr, uint32_t mode); 281 1.1 riastrad uint32_t (*get_fan_control_mode)(struct pp_hwmgr *hwmgr); 282 1.1 riastrad int (*set_fan_speed_percent)(struct pp_hwmgr *hwmgr, uint32_t percent); 283 1.1 riastrad int (*get_fan_speed_percent)(struct pp_hwmgr *hwmgr, uint32_t *speed); 284 1.1 riastrad int (*set_fan_speed_rpm)(struct pp_hwmgr *hwmgr, uint32_t percent); 285 1.1 riastrad int (*get_fan_speed_rpm)(struct pp_hwmgr *hwmgr, uint32_t *speed); 286 1.1 riastrad int (*reset_fan_speed_to_default)(struct pp_hwmgr *hwmgr); 287 1.1 riastrad int (*uninitialize_thermal_controller)(struct pp_hwmgr *hwmgr); 288 1.1 riastrad int (*register_irq_handlers)(struct pp_hwmgr *hwmgr); 289 1.1 riastrad bool (*check_smc_update_required_for_display_configuration)(struct pp_hwmgr *hwmgr); 290 1.1 riastrad int (*check_states_equal)(struct pp_hwmgr *hwmgr, 291 1.1 riastrad const struct pp_hw_power_state *pstate1, 292 1.1 riastrad const struct pp_hw_power_state *pstate2, 293 1.1 riastrad bool *equal); 294 1.1 riastrad int (*set_cpu_power_state)(struct pp_hwmgr *hwmgr); 295 1.1 riastrad int (*store_cc6_data)(struct pp_hwmgr *hwmgr, uint32_t separation_time, 296 1.1 riastrad bool cc6_disable, bool pstate_disable, 297 1.1 riastrad bool pstate_switch_disable); 298 1.1 riastrad int (*get_dal_power_level)(struct pp_hwmgr *hwmgr, 299 1.1 riastrad struct amd_pp_simple_clock_info *info); 300 1.1 riastrad int (*get_performance_level)(struct pp_hwmgr *, const struct pp_hw_power_state *, 301 1.1 riastrad PHM_PerformanceLevelDesignation, uint32_t, PHM_PerformanceLevel *); 302 1.1 riastrad int (*get_current_shallow_sleep_clocks)(struct pp_hwmgr *hwmgr, 303 1.1 riastrad const struct pp_hw_power_state *state, struct pp_clock_info *clock_info); 304 1.1 riastrad int (*get_clock_by_type)(struct pp_hwmgr *hwmgr, enum amd_pp_clock_type type, struct amd_pp_clocks *clocks); 305 1.1 riastrad int (*get_clock_by_type_with_latency)(struct pp_hwmgr *hwmgr, 306 1.1 riastrad enum amd_pp_clock_type type, 307 1.1 riastrad struct pp_clock_levels_with_latency *clocks); 308 1.1 riastrad int (*get_clock_by_type_with_voltage)(struct pp_hwmgr *hwmgr, 309 1.1 riastrad enum amd_pp_clock_type type, 310 1.1 riastrad struct pp_clock_levels_with_voltage *clocks); 311 1.1 riastrad int (*set_watermarks_for_clocks_ranges)(struct pp_hwmgr *hwmgr, void *clock_ranges); 312 1.1 riastrad int (*display_clock_voltage_request)(struct pp_hwmgr *hwmgr, 313 1.1 riastrad struct pp_display_clock_request *clock); 314 1.1 riastrad int (*get_max_high_clocks)(struct pp_hwmgr *hwmgr, struct amd_pp_simple_clock_info *clocks); 315 1.1 riastrad int (*power_off_asic)(struct pp_hwmgr *hwmgr); 316 1.1 riastrad int (*force_clock_level)(struct pp_hwmgr *hwmgr, enum pp_clock_type type, uint32_t mask); 317 1.1 riastrad int (*print_clock_levels)(struct pp_hwmgr *hwmgr, enum pp_clock_type type, char *buf); 318 1.1 riastrad int (*powergate_gfx)(struct pp_hwmgr *hwmgr, bool enable); 319 1.1 riastrad int (*get_sclk_od)(struct pp_hwmgr *hwmgr); 320 1.1 riastrad int (*set_sclk_od)(struct pp_hwmgr *hwmgr, uint32_t value); 321 1.1 riastrad int (*get_mclk_od)(struct pp_hwmgr *hwmgr); 322 1.1 riastrad int (*set_mclk_od)(struct pp_hwmgr *hwmgr, uint32_t value); 323 1.1 riastrad int (*read_sensor)(struct pp_hwmgr *hwmgr, int idx, void *value, int *size); 324 1.1 riastrad int (*avfs_control)(struct pp_hwmgr *hwmgr, bool enable); 325 1.1 riastrad int (*disable_smc_firmware_ctf)(struct pp_hwmgr *hwmgr); 326 1.1 riastrad int (*set_active_display_count)(struct pp_hwmgr *hwmgr, uint32_t count); 327 1.1 riastrad int (*set_min_deep_sleep_dcefclk)(struct pp_hwmgr *hwmgr, uint32_t clock); 328 1.1 riastrad int (*start_thermal_controller)(struct pp_hwmgr *hwmgr, struct PP_TemperatureRange *range); 329 1.1 riastrad int (*notify_cac_buffer_info)(struct pp_hwmgr *hwmgr, 330 1.1 riastrad uint32_t virtual_addr_low, 331 1.1 riastrad uint32_t virtual_addr_hi, 332 1.1 riastrad uint32_t mc_addr_low, 333 1.1 riastrad uint32_t mc_addr_hi, 334 1.1 riastrad uint32_t size); 335 1.1 riastrad int (*update_nbdpm_pstate)(struct pp_hwmgr *hwmgr, 336 1.1 riastrad bool enable, 337 1.1 riastrad bool lock); 338 1.1 riastrad int (*get_thermal_temperature_range)(struct pp_hwmgr *hwmgr, 339 1.1 riastrad struct PP_TemperatureRange *range); 340 1.1 riastrad int (*get_power_profile_mode)(struct pp_hwmgr *hwmgr, char *buf); 341 1.1 riastrad int (*set_power_profile_mode)(struct pp_hwmgr *hwmgr, long *input, uint32_t size); 342 1.1 riastrad int (*odn_edit_dpm_table)(struct pp_hwmgr *hwmgr, 343 1.1 riastrad enum PP_OD_DPM_TABLE_COMMAND type, 344 1.1 riastrad long *input, uint32_t size); 345 1.1 riastrad int (*set_power_limit)(struct pp_hwmgr *hwmgr, uint32_t n); 346 1.1 riastrad int (*powergate_mmhub)(struct pp_hwmgr *hwmgr); 347 1.1 riastrad int (*smus_notify_pwe)(struct pp_hwmgr *hwmgr); 348 1.1 riastrad int (*powergate_sdma)(struct pp_hwmgr *hwmgr, bool bgate); 349 1.1 riastrad int (*enable_mgpu_fan_boost)(struct pp_hwmgr *hwmgr); 350 1.1 riastrad int (*set_hard_min_dcefclk_by_freq)(struct pp_hwmgr *hwmgr, uint32_t clock); 351 1.1 riastrad int (*set_hard_min_fclk_by_freq)(struct pp_hwmgr *hwmgr, uint32_t clock); 352 1.1 riastrad int (*get_asic_baco_capability)(struct pp_hwmgr *hwmgr, bool *cap); 353 1.1 riastrad int (*get_asic_baco_state)(struct pp_hwmgr *hwmgr, enum BACO_STATE *state); 354 1.1 riastrad int (*set_asic_baco_state)(struct pp_hwmgr *hwmgr, enum BACO_STATE state); 355 1.1 riastrad int (*get_ppfeature_status)(struct pp_hwmgr *hwmgr, char *buf); 356 1.1 riastrad int (*set_ppfeature_status)(struct pp_hwmgr *hwmgr, uint64_t ppfeature_masks); 357 1.1 riastrad int (*set_mp1_state)(struct pp_hwmgr *hwmgr, enum pp_mp1_state mp1_state); 358 1.1 riastrad int (*asic_reset)(struct pp_hwmgr *hwmgr, enum SMU_ASIC_RESET_MODE mode); 359 1.1 riastrad int (*smu_i2c_bus_access)(struct pp_hwmgr *hwmgr, bool aquire); 360 1.1 riastrad int (*set_df_cstate)(struct pp_hwmgr *hwmgr, enum pp_df_cstate state); 361 1.1 riastrad int (*set_xgmi_pstate)(struct pp_hwmgr *hwmgr, uint32_t pstate); 362 1.1 riastrad int (*disable_power_features_for_compute_performance)(struct pp_hwmgr *hwmgr, 363 1.1 riastrad bool disable); 364 1.1 riastrad }; 365 1.1 riastrad 366 1.1 riastrad struct pp_table_func { 367 1.1 riastrad int (*pptable_init)(struct pp_hwmgr *hw_mgr); 368 1.1 riastrad int (*pptable_fini)(struct pp_hwmgr *hw_mgr); 369 1.1 riastrad int (*pptable_get_number_of_vce_state_table_entries)(struct pp_hwmgr *hw_mgr); 370 1.1 riastrad int (*pptable_get_vce_state_table_entry)( 371 1.1 riastrad struct pp_hwmgr *hwmgr, 372 1.1 riastrad unsigned long i, 373 1.1 riastrad struct amd_vce_state *vce_state, 374 1.1 riastrad void **clock_info, 375 1.1 riastrad unsigned long *flag); 376 1.1 riastrad }; 377 1.1 riastrad 378 1.1 riastrad union phm_cac_leakage_record { 379 1.1 riastrad struct { 380 1.1 riastrad uint16_t Vddc; /* in CI, we use it for StdVoltageHiSidd */ 381 1.1 riastrad uint32_t Leakage; /* in CI, we use it for StdVoltageLoSidd */ 382 1.1 riastrad }; 383 1.1 riastrad struct { 384 1.1 riastrad uint16_t Vddc1; 385 1.1 riastrad uint16_t Vddc2; 386 1.1 riastrad uint16_t Vddc3; 387 1.1 riastrad }; 388 1.1 riastrad }; 389 1.1 riastrad 390 1.1 riastrad struct phm_cac_leakage_table { 391 1.1 riastrad uint32_t count; 392 1.1 riastrad union phm_cac_leakage_record entries[1]; 393 1.1 riastrad }; 394 1.1 riastrad 395 1.1 riastrad struct phm_samu_clock_voltage_dependency_record { 396 1.1 riastrad uint32_t samclk; 397 1.1 riastrad uint32_t v; 398 1.1 riastrad }; 399 1.1 riastrad 400 1.1 riastrad 401 1.1 riastrad struct phm_samu_clock_voltage_dependency_table { 402 1.1 riastrad uint8_t count; 403 1.1 riastrad struct phm_samu_clock_voltage_dependency_record entries[1]; 404 1.1 riastrad }; 405 1.1 riastrad 406 1.1 riastrad struct phm_cac_tdp_table { 407 1.1 riastrad uint16_t usTDP; 408 1.1 riastrad uint16_t usConfigurableTDP; 409 1.1 riastrad uint16_t usTDC; 410 1.1 riastrad uint16_t usBatteryPowerLimit; 411 1.1 riastrad uint16_t usSmallPowerLimit; 412 1.1 riastrad uint16_t usLowCACLeakage; 413 1.1 riastrad uint16_t usHighCACLeakage; 414 1.1 riastrad uint16_t usMaximumPowerDeliveryLimit; 415 1.1 riastrad uint16_t usEDCLimit; 416 1.1 riastrad uint16_t usOperatingTempMinLimit; 417 1.1 riastrad uint16_t usOperatingTempMaxLimit; 418 1.1 riastrad uint16_t usOperatingTempStep; 419 1.1 riastrad uint16_t usOperatingTempHyst; 420 1.1 riastrad uint16_t usDefaultTargetOperatingTemp; 421 1.1 riastrad uint16_t usTargetOperatingTemp; 422 1.1 riastrad uint16_t usPowerTuneDataSetID; 423 1.1 riastrad uint16_t usSoftwareShutdownTemp; 424 1.1 riastrad uint16_t usClockStretchAmount; 425 1.1 riastrad uint16_t usTemperatureLimitHotspot; 426 1.1 riastrad uint16_t usTemperatureLimitLiquid1; 427 1.1 riastrad uint16_t usTemperatureLimitLiquid2; 428 1.1 riastrad uint16_t usTemperatureLimitVrVddc; 429 1.1 riastrad uint16_t usTemperatureLimitVrMvdd; 430 1.1 riastrad uint16_t usTemperatureLimitPlx; 431 1.1 riastrad uint8_t ucLiquid1_I2C_address; 432 1.1 riastrad uint8_t ucLiquid2_I2C_address; 433 1.1 riastrad uint8_t ucLiquid_I2C_Line; 434 1.1 riastrad uint8_t ucVr_I2C_address; 435 1.1 riastrad uint8_t ucVr_I2C_Line; 436 1.1 riastrad uint8_t ucPlx_I2C_address; 437 1.1 riastrad uint8_t ucPlx_I2C_Line; 438 1.1 riastrad uint32_t usBoostPowerLimit; 439 1.1 riastrad uint8_t ucCKS_LDO_REFSEL; 440 1.1 riastrad }; 441 1.1 riastrad 442 1.1 riastrad struct phm_tdp_table { 443 1.1 riastrad uint16_t usTDP; 444 1.1 riastrad uint16_t usConfigurableTDP; 445 1.1 riastrad uint16_t usTDC; 446 1.1 riastrad uint16_t usBatteryPowerLimit; 447 1.1 riastrad uint16_t usSmallPowerLimit; 448 1.1 riastrad uint16_t usLowCACLeakage; 449 1.1 riastrad uint16_t usHighCACLeakage; 450 1.1 riastrad uint16_t usMaximumPowerDeliveryLimit; 451 1.1 riastrad uint16_t usEDCLimit; 452 1.1 riastrad uint16_t usOperatingTempMinLimit; 453 1.1 riastrad uint16_t usOperatingTempMaxLimit; 454 1.1 riastrad uint16_t usOperatingTempStep; 455 1.1 riastrad uint16_t usOperatingTempHyst; 456 1.1 riastrad uint16_t usDefaultTargetOperatingTemp; 457 1.1 riastrad uint16_t usTargetOperatingTemp; 458 1.1 riastrad uint16_t usPowerTuneDataSetID; 459 1.1 riastrad uint16_t usSoftwareShutdownTemp; 460 1.1 riastrad uint16_t usClockStretchAmount; 461 1.1 riastrad uint16_t usTemperatureLimitTedge; 462 1.1 riastrad uint16_t usTemperatureLimitHotspot; 463 1.1 riastrad uint16_t usTemperatureLimitLiquid1; 464 1.1 riastrad uint16_t usTemperatureLimitLiquid2; 465 1.1 riastrad uint16_t usTemperatureLimitHBM; 466 1.1 riastrad uint16_t usTemperatureLimitVrVddc; 467 1.1 riastrad uint16_t usTemperatureLimitVrMvdd; 468 1.1 riastrad uint16_t usTemperatureLimitPlx; 469 1.1 riastrad uint8_t ucLiquid1_I2C_address; 470 1.1 riastrad uint8_t ucLiquid2_I2C_address; 471 1.1 riastrad uint8_t ucLiquid_I2C_Line; 472 1.1 riastrad uint8_t ucVr_I2C_address; 473 1.1 riastrad uint8_t ucVr_I2C_Line; 474 1.1 riastrad uint8_t ucPlx_I2C_address; 475 1.1 riastrad uint8_t ucPlx_I2C_Line; 476 1.1 riastrad uint8_t ucLiquid_I2C_LineSDA; 477 1.1 riastrad uint8_t ucVr_I2C_LineSDA; 478 1.1 riastrad uint8_t ucPlx_I2C_LineSDA; 479 1.1 riastrad uint32_t usBoostPowerLimit; 480 1.1 riastrad uint16_t usBoostStartTemperature; 481 1.1 riastrad uint16_t usBoostStopTemperature; 482 1.1 riastrad uint32_t ulBoostClock; 483 1.1 riastrad }; 484 1.1 riastrad 485 1.1 riastrad struct phm_ppm_table { 486 1.1 riastrad uint8_t ppm_design; 487 1.1 riastrad uint16_t cpu_core_number; 488 1.1 riastrad uint32_t platform_tdp; 489 1.1 riastrad uint32_t small_ac_platform_tdp; 490 1.1 riastrad uint32_t platform_tdc; 491 1.1 riastrad uint32_t small_ac_platform_tdc; 492 1.1 riastrad uint32_t apu_tdp; 493 1.1 riastrad uint32_t dgpu_tdp; 494 1.1 riastrad uint32_t dgpu_ulv_power; 495 1.1 riastrad uint32_t tj_max; 496 1.1 riastrad }; 497 1.1 riastrad 498 1.1 riastrad struct phm_vq_budgeting_record { 499 1.1 riastrad uint32_t ulCUs; 500 1.1 riastrad uint32_t ulSustainableSOCPowerLimitLow; 501 1.1 riastrad uint32_t ulSustainableSOCPowerLimitHigh; 502 1.1 riastrad uint32_t ulMinSclkLow; 503 1.1 riastrad uint32_t ulMinSclkHigh; 504 1.1 riastrad uint8_t ucDispConfig; 505 1.1 riastrad uint32_t ulDClk; 506 1.1 riastrad uint32_t ulEClk; 507 1.1 riastrad uint32_t ulSustainableSclk; 508 1.1 riastrad uint32_t ulSustainableCUs; 509 1.1 riastrad }; 510 1.1 riastrad 511 1.1 riastrad struct phm_vq_budgeting_table { 512 1.1 riastrad uint8_t numEntries; 513 1.1 riastrad struct phm_vq_budgeting_record entries[1]; 514 1.1 riastrad }; 515 1.1 riastrad 516 1.1 riastrad struct phm_clock_and_voltage_limits { 517 1.1 riastrad uint32_t sclk; 518 1.1 riastrad uint32_t mclk; 519 1.1 riastrad uint32_t gfxclk; 520 1.1 riastrad uint16_t vddc; 521 1.1 riastrad uint16_t vddci; 522 1.1 riastrad uint16_t vddgfx; 523 1.1 riastrad uint16_t vddmem; 524 1.1 riastrad }; 525 1.1 riastrad 526 1.1 riastrad /* Structure to hold PPTable information */ 527 1.1 riastrad 528 1.1 riastrad struct phm_ppt_v1_information { 529 1.1 riastrad struct phm_ppt_v1_clock_voltage_dependency_table *vdd_dep_on_sclk; 530 1.1 riastrad struct phm_ppt_v1_clock_voltage_dependency_table *vdd_dep_on_mclk; 531 1.1 riastrad struct phm_ppt_v1_clock_voltage_dependency_table *vdd_dep_on_socclk; 532 1.1 riastrad struct phm_ppt_v1_clock_voltage_dependency_table *vdd_dep_on_dcefclk; 533 1.1 riastrad struct phm_clock_array *valid_sclk_values; 534 1.1 riastrad struct phm_clock_array *valid_mclk_values; 535 1.1 riastrad struct phm_clock_array *valid_socclk_values; 536 1.1 riastrad struct phm_clock_array *valid_dcefclk_values; 537 1.1 riastrad struct phm_clock_and_voltage_limits max_clock_voltage_on_dc; 538 1.1 riastrad struct phm_clock_and_voltage_limits max_clock_voltage_on_ac; 539 1.1 riastrad struct phm_clock_voltage_dependency_table *vddc_dep_on_dal_pwrl; 540 1.1 riastrad struct phm_ppm_table *ppm_parameter_table; 541 1.1 riastrad struct phm_cac_tdp_table *cac_dtp_table; 542 1.1 riastrad struct phm_tdp_table *tdp_table; 543 1.1 riastrad struct phm_ppt_v1_mm_clock_voltage_dependency_table *mm_dep_table; 544 1.1 riastrad struct phm_ppt_v1_voltage_lookup_table *vddc_lookup_table; 545 1.1 riastrad struct phm_ppt_v1_voltage_lookup_table *vddgfx_lookup_table; 546 1.1 riastrad struct phm_ppt_v1_voltage_lookup_table *vddmem_lookup_table; 547 1.1 riastrad struct phm_ppt_v1_pcie_table *pcie_table; 548 1.1 riastrad struct phm_ppt_v1_gpio_table *gpio_table; 549 1.1 riastrad uint16_t us_ulv_voltage_offset; 550 1.1 riastrad uint16_t us_ulv_smnclk_did; 551 1.1 riastrad uint16_t us_ulv_mp1clk_did; 552 1.1 riastrad uint16_t us_ulv_gfxclk_bypass; 553 1.1 riastrad uint16_t us_gfxclk_slew_rate; 554 1.1 riastrad uint16_t us_min_gfxclk_freq_limit; 555 1.1 riastrad }; 556 1.1 riastrad 557 1.1 riastrad struct phm_ppt_v2_information { 558 1.1 riastrad struct phm_ppt_v1_clock_voltage_dependency_table *vdd_dep_on_sclk; 559 1.1 riastrad struct phm_ppt_v1_clock_voltage_dependency_table *vdd_dep_on_mclk; 560 1.1 riastrad struct phm_ppt_v1_clock_voltage_dependency_table *vdd_dep_on_socclk; 561 1.1 riastrad struct phm_ppt_v1_clock_voltage_dependency_table *vdd_dep_on_dcefclk; 562 1.1 riastrad struct phm_ppt_v1_clock_voltage_dependency_table *vdd_dep_on_pixclk; 563 1.1 riastrad struct phm_ppt_v1_clock_voltage_dependency_table *vdd_dep_on_dispclk; 564 1.1 riastrad struct phm_ppt_v1_clock_voltage_dependency_table *vdd_dep_on_phyclk; 565 1.1 riastrad struct phm_ppt_v1_mm_clock_voltage_dependency_table *mm_dep_table; 566 1.1 riastrad 567 1.1 riastrad struct phm_clock_voltage_dependency_table *vddc_dep_on_dalpwrl; 568 1.1 riastrad 569 1.1 riastrad struct phm_clock_array *valid_sclk_values; 570 1.1 riastrad struct phm_clock_array *valid_mclk_values; 571 1.1 riastrad struct phm_clock_array *valid_socclk_values; 572 1.1 riastrad struct phm_clock_array *valid_dcefclk_values; 573 1.1 riastrad 574 1.1 riastrad struct phm_clock_and_voltage_limits max_clock_voltage_on_dc; 575 1.1 riastrad struct phm_clock_and_voltage_limits max_clock_voltage_on_ac; 576 1.1 riastrad 577 1.1 riastrad struct phm_ppm_table *ppm_parameter_table; 578 1.1 riastrad struct phm_cac_tdp_table *cac_dtp_table; 579 1.1 riastrad struct phm_tdp_table *tdp_table; 580 1.1 riastrad 581 1.1 riastrad struct phm_ppt_v1_voltage_lookup_table *vddc_lookup_table; 582 1.1 riastrad struct phm_ppt_v1_voltage_lookup_table *vddgfx_lookup_table; 583 1.1 riastrad struct phm_ppt_v1_voltage_lookup_table *vddmem_lookup_table; 584 1.1 riastrad struct phm_ppt_v1_voltage_lookup_table *vddci_lookup_table; 585 1.1 riastrad 586 1.1 riastrad struct phm_ppt_v1_pcie_table *pcie_table; 587 1.1 riastrad 588 1.1 riastrad uint16_t us_ulv_voltage_offset; 589 1.1 riastrad uint16_t us_ulv_smnclk_did; 590 1.1 riastrad uint16_t us_ulv_mp1clk_did; 591 1.1 riastrad uint16_t us_ulv_gfxclk_bypass; 592 1.1 riastrad uint16_t us_gfxclk_slew_rate; 593 1.1 riastrad uint16_t us_min_gfxclk_freq_limit; 594 1.1 riastrad 595 1.1 riastrad uint8_t uc_gfx_dpm_voltage_mode; 596 1.1 riastrad uint8_t uc_soc_dpm_voltage_mode; 597 1.1 riastrad uint8_t uc_uclk_dpm_voltage_mode; 598 1.1 riastrad uint8_t uc_uvd_dpm_voltage_mode; 599 1.1 riastrad uint8_t uc_vce_dpm_voltage_mode; 600 1.1 riastrad uint8_t uc_mp0_dpm_voltage_mode; 601 1.1 riastrad uint8_t uc_dcef_dpm_voltage_mode; 602 1.1 riastrad }; 603 1.1 riastrad 604 1.1 riastrad struct phm_ppt_v3_information 605 1.1 riastrad { 606 1.1 riastrad uint8_t uc_thermal_controller_type; 607 1.1 riastrad 608 1.1 riastrad uint16_t us_small_power_limit1; 609 1.1 riastrad uint16_t us_small_power_limit2; 610 1.1 riastrad uint16_t us_boost_power_limit; 611 1.1 riastrad 612 1.1 riastrad uint16_t us_od_turbo_power_limit; 613 1.1 riastrad uint16_t us_od_powersave_power_limit; 614 1.1 riastrad uint16_t us_software_shutdown_temp; 615 1.1 riastrad 616 1.1 riastrad uint32_t *power_saving_clock_max; 617 1.1 riastrad uint32_t *power_saving_clock_min; 618 1.1 riastrad 619 1.1 riastrad uint8_t *od_feature_capabilities; 620 1.1 riastrad uint32_t *od_settings_max; 621 1.1 riastrad uint32_t *od_settings_min; 622 1.1 riastrad 623 1.1 riastrad void *smc_pptable; 624 1.1 riastrad }; 625 1.1 riastrad 626 1.1 riastrad struct phm_dynamic_state_info { 627 1.1 riastrad struct phm_clock_voltage_dependency_table *vddc_dependency_on_sclk; 628 1.1 riastrad struct phm_clock_voltage_dependency_table *vddci_dependency_on_mclk; 629 1.1 riastrad struct phm_clock_voltage_dependency_table *vddc_dependency_on_mclk; 630 1.1 riastrad struct phm_clock_voltage_dependency_table *mvdd_dependency_on_mclk; 631 1.1 riastrad struct phm_clock_voltage_dependency_table *vddc_dep_on_dal_pwrl; 632 1.1 riastrad struct phm_clock_array *valid_sclk_values; 633 1.1 riastrad struct phm_clock_array *valid_mclk_values; 634 1.1 riastrad struct phm_clock_and_voltage_limits max_clock_voltage_on_dc; 635 1.1 riastrad struct phm_clock_and_voltage_limits max_clock_voltage_on_ac; 636 1.1 riastrad uint32_t mclk_sclk_ratio; 637 1.1 riastrad uint32_t sclk_mclk_delta; 638 1.1 riastrad uint32_t vddc_vddci_delta; 639 1.1 riastrad uint32_t min_vddc_for_pcie_gen2; 640 1.1 riastrad struct phm_cac_leakage_table *cac_leakage_table; 641 1.1 riastrad struct phm_phase_shedding_limits_table *vddc_phase_shed_limits_table; 642 1.1 riastrad 643 1.1 riastrad struct phm_vce_clock_voltage_dependency_table 644 1.1 riastrad *vce_clock_voltage_dependency_table; 645 1.1 riastrad struct phm_uvd_clock_voltage_dependency_table 646 1.1 riastrad *uvd_clock_voltage_dependency_table; 647 1.1 riastrad struct phm_acp_clock_voltage_dependency_table 648 1.1 riastrad *acp_clock_voltage_dependency_table; 649 1.1 riastrad struct phm_samu_clock_voltage_dependency_table 650 1.1 riastrad *samu_clock_voltage_dependency_table; 651 1.1 riastrad 652 1.1 riastrad struct phm_ppm_table *ppm_parameter_table; 653 1.1 riastrad struct phm_cac_tdp_table *cac_dtp_table; 654 1.1 riastrad struct phm_clock_voltage_dependency_table *vdd_gfx_dependency_on_sclk; 655 1.1 riastrad }; 656 1.1 riastrad 657 1.1 riastrad struct pp_fan_info { 658 1.1 riastrad bool bNoFan; 659 1.1 riastrad uint8_t ucTachometerPulsesPerRevolution; 660 1.1 riastrad uint32_t ulMinRPM; 661 1.1 riastrad uint32_t ulMaxRPM; 662 1.1 riastrad }; 663 1.1 riastrad 664 1.1 riastrad struct pp_advance_fan_control_parameters { 665 1.1 riastrad uint16_t usTMin; /* The temperature, in 0.01 centigrades, below which we just run at a minimal PWM. */ 666 1.1 riastrad uint16_t usTMed; /* The middle temperature where we change slopes. */ 667 1.1 riastrad uint16_t usTHigh; /* The high temperature for setting the second slope. */ 668 1.1 riastrad uint16_t usPWMMin; /* The minimum PWM value in percent (0.01% increments). */ 669 1.1 riastrad uint16_t usPWMMed; /* The PWM value (in percent) at TMed. */ 670 1.1 riastrad uint16_t usPWMHigh; /* The PWM value at THigh. */ 671 1.1 riastrad uint8_t ucTHyst; /* Temperature hysteresis. Integer. */ 672 1.1 riastrad uint32_t ulCycleDelay; /* The time between two invocations of the fan control routine in microseconds. */ 673 1.1 riastrad uint16_t usTMax; /* The max temperature */ 674 1.1 riastrad uint8_t ucFanControlMode; 675 1.1 riastrad uint16_t usFanPWMMinLimit; 676 1.1 riastrad uint16_t usFanPWMMaxLimit; 677 1.1 riastrad uint16_t usFanPWMStep; 678 1.1 riastrad uint16_t usDefaultMaxFanPWM; 679 1.1 riastrad uint16_t usFanOutputSensitivity; 680 1.1 riastrad uint16_t usDefaultFanOutputSensitivity; 681 1.1 riastrad uint16_t usMaxFanPWM; /* The max Fan PWM value for Fuzzy Fan Control feature */ 682 1.1 riastrad uint16_t usFanRPMMinLimit; /* Minimum limit range in percentage, need to calculate based on minRPM/MaxRpm */ 683 1.1 riastrad uint16_t usFanRPMMaxLimit; /* Maximum limit range in percentage, usually set to 100% by default */ 684 1.1 riastrad uint16_t usFanRPMStep; /* Step increments/decerements, in percent */ 685 1.1 riastrad uint16_t usDefaultMaxFanRPM; /* The max Fan RPM value for Fuzzy Fan Control feature, default from PPTable */ 686 1.1 riastrad uint16_t usMaxFanRPM; /* The max Fan RPM value for Fuzzy Fan Control feature, user defined */ 687 1.1 riastrad uint16_t usFanCurrentLow; /* Low current */ 688 1.1 riastrad uint16_t usFanCurrentHigh; /* High current */ 689 1.1 riastrad uint16_t usFanRPMLow; /* Low RPM */ 690 1.1 riastrad uint16_t usFanRPMHigh; /* High RPM */ 691 1.1 riastrad uint32_t ulMinFanSCLKAcousticLimit; /* Minimum Fan Controller SCLK Frequency Acoustic Limit. */ 692 1.1 riastrad uint8_t ucTargetTemperature; /* Advanced fan controller target temperature. */ 693 1.1 riastrad uint8_t ucMinimumPWMLimit; /* The minimum PWM that the advanced fan controller can set. This should be set to the highest PWM that will run the fan at its lowest RPM. */ 694 1.1 riastrad uint16_t usFanGainEdge; /* The following is added for Fiji */ 695 1.1 riastrad uint16_t usFanGainHotspot; 696 1.1 riastrad uint16_t usFanGainLiquid; 697 1.1 riastrad uint16_t usFanGainVrVddc; 698 1.1 riastrad uint16_t usFanGainVrMvdd; 699 1.1 riastrad uint16_t usFanGainPlx; 700 1.1 riastrad uint16_t usFanGainHbm; 701 1.1 riastrad uint8_t ucEnableZeroRPM; 702 1.1 riastrad uint8_t ucFanStopTemperature; 703 1.1 riastrad uint8_t ucFanStartTemperature; 704 1.1 riastrad uint32_t ulMaxFanSCLKAcousticLimit; /* Maximum Fan Controller SCLK Frequency Acoustic Limit. */ 705 1.1 riastrad uint32_t ulTargetGfxClk; 706 1.1 riastrad uint16_t usZeroRPMStartTemperature; 707 1.1 riastrad uint16_t usZeroRPMStopTemperature; 708 1.1 riastrad uint16_t usMGpuThrottlingRPMLimit; 709 1.1 riastrad }; 710 1.1 riastrad 711 1.1 riastrad struct pp_thermal_controller_info { 712 1.1 riastrad uint8_t ucType; 713 1.1 riastrad uint8_t ucI2cLine; 714 1.1 riastrad uint8_t ucI2cAddress; 715 1.1 riastrad uint8_t use_hw_fan_control; 716 1.1 riastrad struct pp_fan_info fanInfo; 717 1.1 riastrad struct pp_advance_fan_control_parameters advanceFanControlParameters; 718 1.1 riastrad }; 719 1.1 riastrad 720 1.1 riastrad struct phm_microcode_version_info { 721 1.1 riastrad uint32_t SMC; 722 1.1 riastrad uint32_t DMCU; 723 1.1 riastrad uint32_t MC; 724 1.1 riastrad uint32_t NB; 725 1.1 riastrad }; 726 1.1 riastrad 727 1.1 riastrad enum PP_TABLE_VERSION { 728 1.1 riastrad PP_TABLE_V0 = 0, 729 1.1 riastrad PP_TABLE_V1, 730 1.1 riastrad PP_TABLE_V2, 731 1.1 riastrad PP_TABLE_MAX 732 1.1 riastrad }; 733 1.1 riastrad 734 1.1 riastrad /** 735 1.1 riastrad * The main hardware manager structure. 736 1.1 riastrad */ 737 1.1 riastrad #define Workload_Policy_Max 6 738 1.1 riastrad 739 1.1 riastrad struct pp_hwmgr { 740 1.1 riastrad void *adev; 741 1.1 riastrad uint32_t chip_family; 742 1.1 riastrad uint32_t chip_id; 743 1.1 riastrad uint32_t smu_version; 744 1.1 riastrad bool not_vf; 745 1.1 riastrad bool pm_en; 746 1.1 riastrad bool pp_one_vf; 747 1.1 riastrad struct mutex smu_lock; 748 1.1 riastrad 749 1.1 riastrad uint32_t pp_table_version; 750 1.1 riastrad void *device; 751 1.1 riastrad struct pp_smumgr *smumgr; 752 1.1 riastrad const void *soft_pp_table; 753 1.1 riastrad uint32_t soft_pp_table_size; 754 1.1 riastrad void *hardcode_pp_table; 755 1.1 riastrad bool need_pp_table_upload; 756 1.1 riastrad 757 1.1 riastrad struct amd_vce_state vce_states[AMD_MAX_VCE_LEVELS]; 758 1.1 riastrad uint32_t num_vce_state_tables; 759 1.1 riastrad 760 1.1 riastrad enum amd_dpm_forced_level dpm_level; 761 1.1 riastrad enum amd_dpm_forced_level saved_dpm_level; 762 1.1 riastrad enum amd_dpm_forced_level request_dpm_level; 763 1.1 riastrad uint32_t usec_timeout; 764 1.1 riastrad void *pptable; 765 1.1 riastrad struct phm_platform_descriptor platform_descriptor; 766 1.1 riastrad void *backend; 767 1.1 riastrad 768 1.1 riastrad void *smu_backend; 769 1.1 riastrad const struct pp_smumgr_func *smumgr_funcs; 770 1.1 riastrad bool is_kicker; 771 1.1 riastrad 772 1.1 riastrad enum PP_DAL_POWERLEVEL dal_power_level; 773 1.1 riastrad struct phm_dynamic_state_info dyn_state; 774 1.1 riastrad const struct pp_hwmgr_func *hwmgr_func; 775 1.1 riastrad const struct pp_table_func *pptable_func; 776 1.1 riastrad 777 1.1 riastrad struct pp_power_state *ps; 778 1.1 riastrad uint32_t num_ps; 779 1.1 riastrad struct pp_thermal_controller_info thermal_controller; 780 1.1 riastrad bool fan_ctrl_is_in_default_mode; 781 1.1 riastrad uint32_t fan_ctrl_default_mode; 782 1.1 riastrad bool fan_ctrl_enabled; 783 1.1 riastrad uint32_t tmin; 784 1.1 riastrad struct phm_microcode_version_info microcode_version_info; 785 1.1 riastrad uint32_t ps_size; 786 1.1 riastrad struct pp_power_state *current_ps; 787 1.1 riastrad struct pp_power_state *request_ps; 788 1.1 riastrad struct pp_power_state *boot_ps; 789 1.1 riastrad struct pp_power_state *uvd_ps; 790 1.1 riastrad const struct amd_pp_display_configuration *display_config; 791 1.1 riastrad uint32_t feature_mask; 792 1.1 riastrad bool avfs_supported; 793 1.1 riastrad /* UMD Pstate */ 794 1.1 riastrad bool en_umd_pstate; 795 1.1 riastrad uint32_t power_profile_mode; 796 1.1 riastrad uint32_t default_power_profile_mode; 797 1.1 riastrad uint32_t pstate_sclk; 798 1.1 riastrad uint32_t pstate_mclk; 799 1.1 riastrad bool od_enabled; 800 1.1 riastrad uint32_t power_limit; 801 1.1 riastrad uint32_t default_power_limit; 802 1.1 riastrad uint32_t workload_mask; 803 1.1 riastrad uint32_t workload_prority[Workload_Policy_Max]; 804 1.1 riastrad uint32_t workload_setting[Workload_Policy_Max]; 805 1.1 riastrad bool gfxoff_state_changed_by_workload; 806 1.1 riastrad }; 807 1.1 riastrad 808 1.1 riastrad int hwmgr_early_init(struct pp_hwmgr *hwmgr); 809 1.1 riastrad int hwmgr_sw_init(struct pp_hwmgr *hwmgr); 810 1.1 riastrad int hwmgr_sw_fini(struct pp_hwmgr *hwmgr); 811 1.1 riastrad int hwmgr_hw_init(struct pp_hwmgr *hwmgr); 812 1.1 riastrad int hwmgr_hw_fini(struct pp_hwmgr *hwmgr); 813 1.1 riastrad int hwmgr_suspend(struct pp_hwmgr *hwmgr); 814 1.1 riastrad int hwmgr_resume(struct pp_hwmgr *hwmgr); 815 1.1 riastrad 816 1.1 riastrad int hwmgr_handle_task(struct pp_hwmgr *hwmgr, 817 1.1 riastrad enum amd_pp_task task_id, 818 1.1 riastrad enum amd_pm_state_type *user_state); 819 1.1 riastrad 820 1.1 riastrad 821 1.1 riastrad #define PHM_ENTIRE_REGISTER_MASK 0xFFFFFFFFU 822 1.1 riastrad 823 1.1 riastrad 824 1.1 riastrad #endif /* _HWMGR_H_ */ 825