linux/drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c

/*
 * Copyright 2019 Advanced Micro Devices, Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 *
 */

#define SWSMU_CODE_LAYER_L2

#include <linux/firmware.h>
#include "amdgpu.h"
#include "amdgpu_dpm.h"
#include "amdgpu_smu.h"
#include "atomfirmware.h"
#include "amdgpu_atomfirmware.h"
#include "amdgpu_atombios.h"
#include "smu_v13_0.h"
#include "smu13_driver_if_aldebaran.h"
#include "soc15_common.h"
#include "atom.h"
#include "aldebaran_ppt.h"
#include "smu_v13_0_pptable.h"
#include "aldebaran_ppsmc.h"
#include "nbio/nbio_7_4_offset.h"
#include "nbio/nbio_7_4_sh_mask.h"
#include "thm/thm_11_0_2_offset.h"
#include "thm/thm_11_0_2_sh_mask.h"
#include "amdgpu_xgmi.h"
#include <linux/pci.h>
#include "amdgpu_ras.h"
#include "smu_cmn.h"
#include "mp/mp_13_0_2_offset.h"

/*
 * DO NOT use these for err/warn/info/debug messages.
 * Use dev_err, dev_warn, dev_info and dev_dbg instead.
 * They are more MGPU friendly.
 */
#undef pr_err
#undef pr_warn
#undef pr_info
#undef pr_debug

#define ALDEBARAN_FEA_MAP(smu_feature, aldebaran_feature)

#define FEATURE_MASK(feature)
#define SMC_DPM_FEATURE

/* possible frequency drift (1Mhz) */
#define EPSILON

#define smnPCIE_ESM_CTRL

/*
 * SMU support ECCTABLE since version 68.42.0,
 * use this to check ECCTALE feature whether support
 */
#define SUPPORT_ECCTABLE_SMU_VERSION

/*
 * SMU support mca_ceumc_addr in ECCTABLE since version 68.55.0,
 * use this to check mca_ceumc_addr record whether support
 */
#define SUPPORT_ECCTABLE_V2_SMU_VERSION

/*
 * SMU support BAD CHENNEL info MSG since version 68.51.00,
 * use this to check ECCTALE feature whether support
 */
#define SUPPORT_BAD_CHANNEL_INFO_MSG_VERSION

static const struct smu_temperature_range smu13_thermal_policy[] =;

static const struct cmn2asic_msg_mapping aldebaran_message_map[SMU_MSG_MAX_COUNT] =;

static const struct cmn2asic_mapping aldebaran_clk_map[SMU_CLK_COUNT] =;

static const struct cmn2asic_mapping aldebaran_feature_mask_map[SMU_FEATURE_COUNT] =;

static const struct cmn2asic_mapping aldebaran_table_map[SMU_TABLE_COUNT] =;

static const uint8_t aldebaran_throttler_map[] =;

static int aldebaran_tables_init(struct smu_context *smu)
{}

static int aldebaran_select_plpd_policy(struct smu_context *smu, int level)
{}

static int aldebaran_allocate_dpm_context(struct smu_context *smu)
{}

static int aldebaran_init_smc_tables(struct smu_context *smu)
{}

static int aldebaran_get_allowed_feature_mask(struct smu_context *smu,
					      uint32_t *feature_mask, uint32_t num)
{}

static int aldebaran_set_default_dpm_table(struct smu_context *smu)
{}

static int aldebaran_check_powerplay_table(struct smu_context *smu)
{}

static int aldebaran_store_powerplay_table(struct smu_context *smu)
{}

static int aldebaran_append_powerplay_table(struct smu_context *smu)
{}

static int aldebaran_setup_pptable(struct smu_context *smu)
{}

static bool aldebaran_is_primary(struct smu_context *smu)
{}

static int aldebaran_run_board_btc(struct smu_context *smu)
{}

static int aldebaran_run_btc(struct smu_context *smu)
{}

static int aldebaran_populate_umd_state_clk(struct smu_context *smu)
{}

static void aldebaran_get_clk_table(struct smu_context *smu,
				    struct pp_clock_levels_with_latency *clocks,
				    struct smu_13_0_dpm_table *dpm_table)
{}

static int aldebaran_freqs_in_same_level(int32_t frequency1,
					 int32_t frequency2)
{}

static int aldebaran_get_smu_metrics_data(struct smu_context *smu,
					  MetricsMember_t member,
					  uint32_t *value)
{}

static int aldebaran_get_current_clk_freq_by_table(struct smu_context *smu,
						   enum smu_clk_type clk_type,
						   uint32_t *value)
{}

static int aldebaran_emit_clk_levels(struct smu_context *smu,
				     enum smu_clk_type type, char *buf, int *offset)
{}

static int aldebaran_upload_dpm_level(struct smu_context *smu,
				      bool max,
				      uint32_t feature_mask,
				      uint32_t level)
{}

static int aldebaran_force_clk_levels(struct smu_context *smu,
				      enum smu_clk_type type, uint32_t mask)
{}

static int aldebaran_get_thermal_temperature_range(struct smu_context *smu,
						   struct smu_temperature_range *range)
{}

static int aldebaran_get_current_activity_percent(struct smu_context *smu,
						  enum amd_pp_sensors sensor,
						  uint32_t *value)
{}

static int aldebaran_thermal_get_temperature(struct smu_context *smu,
					     enum amd_pp_sensors sensor,
					     uint32_t *value)
{}

static int aldebaran_read_sensor(struct smu_context *smu,
				 enum amd_pp_sensors sensor,
				 void *data, uint32_t *size)
{}

static int aldebaran_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 aldebaran_set_power_limit(struct smu_context *smu,
				     enum smu_ppt_limit_type limit_type,
				     uint32_t limit)
{}

static int aldebaran_system_features_control(struct  smu_context *smu, bool enable)
{}

static int aldebaran_set_performance_level(struct smu_context *smu,
					   enum amd_dpm_forced_level level)
{}

static int aldebaran_set_soft_freq_limited_range(struct smu_context *smu,
					  enum smu_clk_type clk_type,
					  uint32_t min,
					  uint32_t max)
{}

static int aldebaran_usr_edit_dpm_table(struct smu_context *smu, enum PP_OD_DPM_TABLE_COMMAND type,
							long input[], uint32_t size)
{}

static bool aldebaran_is_dpm_running(struct smu_context *smu)
{}

static int aldebaran_i2c_xfer(struct i2c_adapter *i2c_adap,
			      struct i2c_msg *msg, int num_msgs)
{}

static u32 aldebaran_i2c_func(struct i2c_adapter *adap)
{}


static const struct i2c_algorithm aldebaran_i2c_algo =;

static const struct i2c_adapter_quirks aldebaran_i2c_control_quirks =;

static int aldebaran_i2c_control_init(struct smu_context *smu)
{}

static void aldebaran_i2c_control_fini(struct smu_context *smu)
{}

static void aldebaran_get_unique_id(struct smu_context *smu)
{}

static int aldebaran_get_bamaco_support(struct smu_context *smu)
{}

static int aldebaran_set_df_cstate(struct smu_context *smu,
				   enum pp_df_cstate state)
{}

static const struct throttling_logging_label {} logging_label[] =;
static void aldebaran_log_thermal_throttling_event(struct smu_context *smu)
{}

static int aldebaran_get_current_pcie_link_speed(struct smu_context *smu)
{}

static ssize_t aldebaran_get_gpu_metrics(struct smu_context *smu,
					 void **table)
{}

static int aldebaran_check_ecc_table_support(struct smu_context *smu,
		int *ecctable_version)
{}

static ssize_t aldebaran_get_ecc_info(struct smu_context *smu,
					 void *table)
{}

static int aldebaran_mode1_reset(struct smu_context *smu)
{}

static int aldebaran_mode2_reset(struct smu_context *smu)
{}

static int aldebaran_smu_handle_passthrough_sbr(struct smu_context *smu, bool enable)
{}

static bool aldebaran_is_mode1_reset_supported(struct smu_context *smu)
{}

static bool aldebaran_is_mode2_reset_supported(struct smu_context *smu)
{}

static int aldebaran_set_mp1_state(struct smu_context *smu,
				   enum pp_mp1_state mp1_state)
{}

static int aldebaran_smu_send_hbm_bad_page_num(struct smu_context *smu,
		uint32_t size)
{}

static int aldebaran_check_bad_channel_info_support(struct smu_context *smu)
{}

static int aldebaran_send_hbm_bad_channel_flag(struct smu_context *smu,
		uint32_t size)
{}

static const struct pptable_funcs aldebaran_ppt_funcs =;

void aldebaran_set_ppt_funcs(struct smu_context *smu)
{}