linux/drivers/gpu/drm/amd/pm/swsmu/smu11/arcturus_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_v11_0.h"
#include "smu11_driver_if_arcturus.h"
#include "soc15_common.h"
#include "atom.h"
#include "arcturus_ppt.h"
#include "smu_v11_0_pptable.h"
#include "arcturus_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/i2c.h>
#include <linux/pci.h>
#include "amdgpu_ras.h"
#include "smu_cmn.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 ARCTURUS_FEA_MAP(smu_feature, arcturus_feature)

#define SMU_FEATURES_LOW_MASK
#define SMU_FEATURES_LOW_SHIFT
#define SMU_FEATURES_HIGH_MASK
#define SMU_FEATURES_HIGH_SHIFT

#define SMC_DPM_FEATURE

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

#define smnPCIE_ESM_CTRL

#define mmCG_FDO_CTRL0_ARCT
#define mmCG_FDO_CTRL0_ARCT_BASE_IDX

#define mmCG_FDO_CTRL1_ARCT
#define mmCG_FDO_CTRL1_ARCT_BASE_IDX

#define mmCG_FDO_CTRL2_ARCT
#define mmCG_FDO_CTRL2_ARCT_BASE_IDX

#define mmCG_TACH_CTRL_ARCT
#define mmCG_TACH_CTRL_ARCT_BASE_IDX

#define mmCG_TACH_STATUS_ARCT
#define mmCG_TACH_STATUS_ARCT_BASE_IDX

#define mmCG_THERMAL_STATUS_ARCT
#define mmCG_THERMAL_STATUS_ARCT_BASE_IDX

static const struct cmn2asic_msg_mapping arcturus_message_map[SMU_MSG_MAX_COUNT] =;

static const struct cmn2asic_mapping arcturus_clk_map[SMU_CLK_COUNT] =;

static const struct cmn2asic_mapping arcturus_feature_mask_map[SMU_FEATURE_COUNT] =;

static const struct cmn2asic_mapping arcturus_table_map[SMU_TABLE_COUNT] =;

static const struct cmn2asic_mapping arcturus_pwr_src_map[SMU_POWER_SOURCE_COUNT] =;

static const struct cmn2asic_mapping arcturus_workload_map[PP_SMC_POWER_PROFILE_COUNT] =;

static const uint8_t arcturus_throttler_map[] =;

static int arcturus_tables_init(struct smu_context *smu)
{}

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

static int arcturus_allocate_dpm_context(struct smu_context *smu)
{}

static int arcturus_init_smc_tables(struct smu_context *smu)
{}

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

static int arcturus_set_default_dpm_table(struct smu_context *smu)
{}

static void arcturus_check_bxco_support(struct smu_context *smu)
{}

static void arcturus_check_fan_support(struct smu_context *smu)
{}

static int arcturus_check_powerplay_table(struct smu_context *smu)
{}

static int arcturus_store_powerplay_table(struct smu_context *smu)
{}

static int arcturus_append_powerplay_table(struct smu_context *smu)
{}

static int arcturus_setup_pptable(struct smu_context *smu)
{}

static int arcturus_run_btc(struct smu_context *smu)
{}

static int arcturus_populate_umd_state_clk(struct smu_context *smu)
{}

static void arcturus_get_clk_table(struct smu_context *smu,
				   struct pp_clock_levels_with_latency *clocks,
				   struct smu_11_0_dpm_table *dpm_table)
{}

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

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

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

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

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

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

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

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

static int arcturus_set_fan_static_mode(struct smu_context *smu,
					uint32_t mode)
{}

static int arcturus_get_fan_speed_rpm(struct smu_context *smu,
				      uint32_t *speed)
{}

static int arcturus_set_fan_speed_pwm(struct smu_context *smu,
				      uint32_t speed)
{}

static int arcturus_set_fan_speed_rpm(struct smu_context *smu,
				      uint32_t speed)
{}

static int arcturus_get_fan_speed_pwm(struct smu_context *smu,
				      uint32_t *speed)
{}

static int arcturus_get_fan_parameters(struct smu_context *smu)
{}

static int arcturus_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 arcturus_get_power_profile_mode(struct smu_context *smu,
					   char *buf)
{}

static int arcturus_set_power_profile_mode(struct smu_context *smu,
					   long *input,
					   uint32_t size)
{}

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

static void arcturus_dump_pptable(struct smu_context *smu)
{}

static bool arcturus_is_dpm_running(struct smu_context *smu)
{}

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

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

static u32 arcturus_i2c_func(struct i2c_adapter *adap)
{}


static const struct i2c_algorithm arcturus_i2c_algo =;


static const struct i2c_adapter_quirks arcturus_i2c_control_quirks =;

static int arcturus_i2c_control_init(struct smu_context *smu)
{}

static void arcturus_i2c_control_fini(struct smu_context *smu)
{}

static void arcturus_get_unique_id(struct smu_context *smu)
{}

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

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

static uint16_t arcturus_get_current_pcie_link_speed(struct smu_context *smu)
{}

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

static const struct pptable_funcs arcturus_ppt_funcs =;

void arcturus_set_ppt_funcs(struct smu_context *smu)
{}