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

/*
 * Copyright 2021 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 <linux/pci.h>
#include <linux/i2c.h>
#include "amdgpu.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_v13_0_7.h"
#include "soc15_common.h"
#include "atom.h"
#include "smu_v13_0_7_ppt.h"
#include "smu_v13_0_7_pptable.h"
#include "smu_v13_0_7_ppsmc.h"
#include "nbio/nbio_4_3_0_offset.h"
#include "nbio/nbio_4_3_0_sh_mask.h"
#include "mp/mp_13_0_0_offset.h"
#include "mp/mp_13_0_0_sh_mask.h"

#include "asic_reg/mp/mp_13_0_0_sh_mask.h"
#include "smu_cmn.h"
#include "amdgpu_ras.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 to_amdgpu_device(x)

#define FEATURE_MASK(feature)
#define SMC_DPM_FEATURE

#define smnMP1_FIRMWARE_FLAGS_SMU_13_0_7

#define MP0_MP1_DATA_REGION_SIZE_COMBOPPTABLE

#define PP_OD_FEATURE_GFXCLK_FMIN
#define PP_OD_FEATURE_GFXCLK_FMAX
#define PP_OD_FEATURE_UCLK_FMIN
#define PP_OD_FEATURE_UCLK_FMAX
#define PP_OD_FEATURE_GFX_VF_CURVE
#define PP_OD_FEATURE_FAN_CURVE_TEMP
#define PP_OD_FEATURE_FAN_CURVE_PWM
#define PP_OD_FEATURE_FAN_ACOUSTIC_LIMIT
#define PP_OD_FEATURE_FAN_ACOUSTIC_TARGET
#define PP_OD_FEATURE_FAN_TARGET_TEMPERATURE
#define PP_OD_FEATURE_FAN_MINIMUM_PWM

#define LINK_SPEED_MAX

static struct cmn2asic_msg_mapping smu_v13_0_7_message_map[SMU_MSG_MAX_COUNT] =;

static struct cmn2asic_mapping smu_v13_0_7_clk_map[SMU_CLK_COUNT] =;

static struct cmn2asic_mapping smu_v13_0_7_feature_mask_map[SMU_FEATURE_COUNT] =;

static struct cmn2asic_mapping smu_v13_0_7_table_map[SMU_TABLE_COUNT] =;

static struct cmn2asic_mapping smu_v13_0_7_pwr_src_map[SMU_POWER_SOURCE_COUNT] =;

static struct cmn2asic_mapping smu_v13_0_7_workload_map[PP_SMC_POWER_PROFILE_COUNT] =;

static const uint8_t smu_v13_0_7_throttler_map[] =;

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

static int smu_v13_0_7_check_powerplay_table(struct smu_context *smu)
{}

static int smu_v13_0_7_store_powerplay_table(struct smu_context *smu)
{}

static int smu_v13_0_7_check_fw_status(struct smu_context *smu)
{}

#ifndef atom_smc_dpm_info_table_13_0_7
struct atom_smc_dpm_info_table_13_0_7 {};
#endif

static int smu_v13_0_7_append_powerplay_table(struct smu_context *smu)
{}

static int smu_v13_0_7_get_pptable_from_pmfw(struct smu_context *smu,
					     void **table,
					     uint32_t *size)
{}

static int smu_v13_0_7_setup_pptable(struct smu_context *smu)
{}

static int smu_v13_0_7_tables_init(struct smu_context *smu)
{}

static int smu_v13_0_7_allocate_dpm_context(struct smu_context *smu)
{}

static int smu_v13_0_7_init_smc_tables(struct smu_context *smu)
{}

static int smu_v13_0_7_set_default_dpm_table(struct smu_context *smu)
{}

static bool smu_v13_0_7_is_dpm_running(struct smu_context *smu)
{}

static void smu_v13_0_7_dump_pptable(struct smu_context *smu)
{}

static uint32_t smu_v13_0_7_get_throttler_status(SmuMetrics_t *metrics)
{}

#define SMU_13_0_7_BUSY_THRESHOLD
static int smu_v13_0_7_get_smu_metrics_data(struct smu_context *smu,
					    MetricsMember_t member,
					    uint32_t *value)
{}

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

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

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

static bool smu_v13_0_7_is_od_feature_supported(struct smu_context *smu,
						int od_feature_bit)
{}

static void smu_v13_0_7_get_od_setting_limits(struct smu_context *smu,
					      int od_feature_bit,
					      int32_t *min,
					      int32_t *max)
{}

static void smu_v13_0_7_dump_od_table(struct smu_context *smu,
				      OverDriveTableExternal_t *od_table)
{}

static int smu_v13_0_7_get_overdrive_table(struct smu_context *smu,
					   OverDriveTableExternal_t *od_table)
{}

static int smu_v13_0_7_upload_overdrive_table(struct smu_context *smu,
					      OverDriveTableExternal_t *od_table)
{}

static int smu_v13_0_7_print_clk_levels(struct smu_context *smu,
					enum smu_clk_type clk_type,
					char *buf)
{}

static int smu_v13_0_7_od_restore_table_single(struct smu_context *smu, long input)
{}

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

static int smu_v13_0_7_force_clk_levels(struct smu_context *smu,
					enum smu_clk_type clk_type,
					uint32_t mask)
{}

static const struct smu_temperature_range smu13_thermal_policy[] =;

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

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

static void smu_v13_0_7_set_supported_od_feature_mask(struct smu_context *smu)
{}

static int smu_v13_0_7_set_default_od_settings(struct smu_context *smu)
{}

static int smu_v13_0_7_restore_user_od_settings(struct smu_context *smu)
{}

static int smu_v13_0_7_populate_umd_state_clk(struct smu_context *smu)
{}

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

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

static int smu_v13_0_7_enable_mgpu_fan_boost(struct smu_context *smu)
{}

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

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

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

static bool smu_v13_0_7_is_mode1_reset_supported(struct smu_context *smu)
{}

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

static bool smu_v13_0_7_wbrf_support_check(struct smu_context *smu)
{}

static int smu_v13_0_7_set_power_limit(struct smu_context *smu,
				       enum smu_ppt_limit_type limit_type,
				       uint32_t limit)
{}

static const struct pptable_funcs smu_v13_0_7_ppt_funcs =;

void smu_v13_0_7_set_ppt_funcs(struct smu_context *smu)
{}