#define SWSMU_CODE_LAYER_L2
#include <linux/firmware.h>
#include <linux/pci.h>
#include <linux/i2c.h>
#include "amdgpu.h"
#include "amdgpu_dpm.h"
#include "amdgpu_smu.h"
#include "atomfirmware.h"
#include "amdgpu_atomfirmware.h"
#include "amdgpu_atombios.h"
#include "soc15_common.h"
#include "smu_v11_0.h"
#include "smu11_driver_if_navi10.h"
#include "atom.h"
#include "navi10_ppt.h"
#include "smu_v11_0_pptable.h"
#include "smu_v11_0_ppsmc.h"
#include "nbio/nbio_2_3_offset.h"
#include "nbio/nbio_2_3_sh_mask.h"
#include "thm/thm_11_0_2_offset.h"
#include "thm/thm_11_0_2_sh_mask.h"
#include "asic_reg/mp/mp_11_0_sh_mask.h"
#include "smu_cmn.h"
#include "smu_11_0_cdr_table.h"
#undef pr_err
#undef pr_warn
#undef pr_info
#undef pr_debug
#define FEATURE_MASK(feature) …
#define SMC_DPM_FEATURE …
#define SMU_11_0_GFX_BUSY_THRESHOLD …
static struct cmn2asic_msg_mapping navi10_message_map[SMU_MSG_MAX_COUNT] = …;
static struct cmn2asic_mapping navi10_clk_map[SMU_CLK_COUNT] = …;
static struct cmn2asic_mapping navi10_feature_mask_map[SMU_FEATURE_COUNT] = …;
static struct cmn2asic_mapping navi10_table_map[SMU_TABLE_COUNT] = …;
static struct cmn2asic_mapping navi10_pwr_src_map[SMU_POWER_SOURCE_COUNT] = …;
static struct cmn2asic_mapping navi10_workload_map[PP_SMC_POWER_PROFILE_COUNT] = …;
static const uint8_t navi1x_throttler_map[] = …;
static bool is_asic_secure(struct smu_context *smu)
{ … }
static int
navi10_get_allowed_feature_mask(struct smu_context *smu,
uint32_t *feature_mask, uint32_t num)
{ … }
static void navi10_check_bxco_support(struct smu_context *smu)
{ … }
static int navi10_check_powerplay_table(struct smu_context *smu)
{ … }
static int navi10_append_powerplay_table(struct smu_context *smu)
{ … }
static int navi10_store_powerplay_table(struct smu_context *smu)
{ … }
static int navi10_setup_pptable(struct smu_context *smu)
{ … }
static int navi10_tables_init(struct smu_context *smu)
{ … }
static int navi10_get_legacy_smu_metrics_data(struct smu_context *smu,
MetricsMember_t member,
uint32_t *value)
{ … }
static int navi10_get_smu_metrics_data(struct smu_context *smu,
MetricsMember_t member,
uint32_t *value)
{ … }
static int navi12_get_legacy_smu_metrics_data(struct smu_context *smu,
MetricsMember_t member,
uint32_t *value)
{ … }
static int navi12_get_smu_metrics_data(struct smu_context *smu,
MetricsMember_t member,
uint32_t *value)
{ … }
static int navi1x_get_smu_metrics_data(struct smu_context *smu,
MetricsMember_t member,
uint32_t *value)
{ … }
static int navi10_allocate_dpm_context(struct smu_context *smu)
{ … }
static int navi10_init_smc_tables(struct smu_context *smu)
{ … }
static int navi10_set_default_dpm_table(struct smu_context *smu)
{ … }
static int navi10_dpm_set_vcn_enable(struct smu_context *smu, bool enable)
{ … }
static int navi10_dpm_set_jpeg_enable(struct smu_context *smu, bool enable)
{ … }
static int navi10_get_current_clk_freq_by_table(struct smu_context *smu,
enum smu_clk_type clk_type,
uint32_t *value)
{ … }
static int navi10_is_support_fine_grained_dpm(struct smu_context *smu, enum smu_clk_type clk_type)
{ … }
static inline bool navi10_od_feature_is_supported(struct smu_11_0_overdrive_table *od_table, enum SMU_11_0_ODFEATURE_CAP cap)
{ … }
static void navi10_od_setting_get_range(struct smu_11_0_overdrive_table *od_table,
enum SMU_11_0_ODSETTING_ID setting,
uint32_t *min, uint32_t *max)
{ … }
static int navi10_emit_clk_levels(struct smu_context *smu,
enum smu_clk_type clk_type,
char *buf,
int *offset)
{ … }
static int navi10_print_clk_levels(struct smu_context *smu,
enum smu_clk_type clk_type, char *buf)
{ … }
static int navi10_force_clk_levels(struct smu_context *smu,
enum smu_clk_type clk_type, uint32_t mask)
{ … }
static int navi10_populate_umd_state_clk(struct smu_context *smu)
{ … }
static int navi10_get_clock_by_type_with_latency(struct smu_context *smu,
enum smu_clk_type clk_type,
struct pp_clock_levels_with_latency *clocks)
{ … }
static int navi10_pre_display_config_changed(struct smu_context *smu)
{ … }
static int navi10_display_config_changed(struct smu_context *smu)
{ … }
static bool navi10_is_dpm_running(struct smu_context *smu)
{ … }
static int navi10_get_fan_speed_rpm(struct smu_context *smu,
uint32_t *speed)
{ … }
static int navi10_get_fan_parameters(struct smu_context *smu)
{ … }
static int navi10_get_power_profile_mode(struct smu_context *smu, char *buf)
{ … }
static int navi10_set_power_profile_mode(struct smu_context *smu, long *input, uint32_t size)
{ … }
static int navi10_notify_smc_display_config(struct smu_context *smu)
{ … }
static int navi10_set_watermarks_table(struct smu_context *smu,
struct pp_smu_wm_range_sets *clock_ranges)
{ … }
static int navi10_read_sensor(struct smu_context *smu,
enum amd_pp_sensors sensor,
void *data, uint32_t *size)
{ … }
static int navi10_get_uclk_dpm_states(struct smu_context *smu, uint32_t *clocks_in_khz, uint32_t *num_states)
{ … }
static int navi10_get_thermal_temperature_range(struct smu_context *smu,
struct smu_temperature_range *range)
{ … }
static int navi10_display_disable_memory_clock_switch(struct smu_context *smu,
bool disable_memory_clock_switch)
{ … }
static int navi10_get_power_limit(struct smu_context *smu,
uint32_t *current_power_limit,
uint32_t *default_power_limit,
uint32_t *max_power_limit,
uint32_t *min_power_limit)
{ … }
static int navi10_update_pcie_parameters(struct smu_context *smu,
uint8_t pcie_gen_cap,
uint8_t pcie_width_cap)
{ … }
static inline void navi10_dump_od_table(struct smu_context *smu,
OverDriveTable_t *od_table)
{ … }
static int navi10_od_setting_check_range(struct smu_context *smu,
struct smu_11_0_overdrive_table *od_table,
enum SMU_11_0_ODSETTING_ID setting,
uint32_t value)
{ … }
static int navi10_overdrive_get_gfx_clk_base_voltage(struct smu_context *smu,
uint16_t *voltage,
uint32_t freq)
{ … }
static int navi10_baco_enter(struct smu_context *smu)
{ … }
static int navi10_baco_exit(struct smu_context *smu)
{ … }
static int navi10_set_default_od_settings(struct smu_context *smu)
{ … }
static int navi10_od_edit_dpm_table(struct smu_context *smu, enum PP_OD_DPM_TABLE_COMMAND type, long input[], uint32_t size)
{ … }
static int navi10_run_btc(struct smu_context *smu)
{ … }
static bool navi10_need_umc_cdr_workaround(struct smu_context *smu)
{ … }
static int navi10_umc_hybrid_cdr_workaround(struct smu_context *smu)
{ … }
static int navi10_set_dummy_pstates_table_location(struct smu_context *smu)
{ … }
static int navi10_run_umc_cdr_workaround(struct smu_context *smu)
{ … }
static ssize_t navi10_get_legacy_gpu_metrics(struct smu_context *smu,
void **table)
{ … }
static int navi10_i2c_xfer(struct i2c_adapter *i2c_adap,
struct i2c_msg *msg, int num_msgs)
{ … }
static u32 navi10_i2c_func(struct i2c_adapter *adap)
{ … }
static const struct i2c_algorithm navi10_i2c_algo = …;
static const struct i2c_adapter_quirks navi10_i2c_control_quirks = …;
static int navi10_i2c_control_init(struct smu_context *smu)
{ … }
static void navi10_i2c_control_fini(struct smu_context *smu)
{ … }
static ssize_t navi10_get_gpu_metrics(struct smu_context *smu,
void **table)
{ … }
static ssize_t navi12_get_legacy_gpu_metrics(struct smu_context *smu,
void **table)
{ … }
static ssize_t navi12_get_gpu_metrics(struct smu_context *smu,
void **table)
{ … }
static ssize_t navi1x_get_gpu_metrics(struct smu_context *smu,
void **table)
{ … }
static int navi10_enable_mgpu_fan_boost(struct smu_context *smu)
{ … }
static int navi10_post_smu_init(struct smu_context *smu)
{ … }
static int navi10_get_default_config_table_settings(struct smu_context *smu,
struct config_table_setting *table)
{ … }
static int navi10_set_config_table(struct smu_context *smu,
struct config_table_setting *table)
{ … }
static const struct pptable_funcs navi10_ppt_funcs = …;
void navi10_set_ppt_funcs(struct smu_context *smu)
{ … }