#include "pp_debug.h"
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/pci.h>
#include <linux/slab.h>
#include <linux/gfp.h>
#include "smumgr.h"
#include "tonga_smumgr.h"
#include "smu_ucode_xfer_vi.h"
#include "tonga_ppsmc.h"
#include "smu/smu_7_1_2_d.h"
#include "smu/smu_7_1_2_sh_mask.h"
#include "cgs_common.h"
#include "smu7_smumgr.h"
#include "smu7_dyn_defaults.h"
#include "smu7_hwmgr.h"
#include "hardwaremanager.h"
#include "ppatomctrl.h"
#include "atombios.h"
#include "pppcielanes.h"
#include "pp_endian.h"
#include "gmc/gmc_8_1_d.h"
#include "gmc/gmc_8_1_sh_mask.h"
#include "bif/bif_5_0_d.h"
#include "bif/bif_5_0_sh_mask.h"
#include "dce/dce_10_0_d.h"
#include "dce/dce_10_0_sh_mask.h"
#define POWERTUNE_DEFAULT_SET_MAX …
#define MC_CG_ARB_FREQ_F1 …
#define VDDC_VDDCI_DELTA …
static const struct tonga_pt_defaults tonga_power_tune_data_set_array[POWERTUNE_DEFAULT_SET_MAX] = …;
static const uint16_t tonga_clock_stretcher_lookup_table[2][4] = …;
static const uint32_t tonga_clock_stretcher_ddt_table[2][4][4] = …;
static const uint8_t tonga_clock_stretch_amount_conversion[2][6] = …;
static int tonga_start_in_protection_mode(struct pp_hwmgr *hwmgr)
{ … }
static int tonga_start_in_non_protection_mode(struct pp_hwmgr *hwmgr)
{ … }
static int tonga_start_smu(struct pp_hwmgr *hwmgr)
{ … }
static int tonga_smu_init(struct pp_hwmgr *hwmgr)
{ … }
static int tonga_get_dependency_volt_by_clk(struct pp_hwmgr *hwmgr,
phm_ppt_v1_clock_voltage_dependency_table *allowed_clock_voltage_table,
uint32_t clock, SMU_VoltageLevel *voltage, uint32_t *mvdd)
{ … }
static int tonga_populate_smc_vddc_table(struct pp_hwmgr *hwmgr,
SMU72_Discrete_DpmTable *table)
{ … }
static int tonga_populate_smc_vdd_gfx_table(struct pp_hwmgr *hwmgr,
SMU72_Discrete_DpmTable *table)
{ … }
static int tonga_populate_smc_vdd_ci_table(struct pp_hwmgr *hwmgr,
SMU72_Discrete_DpmTable *table)
{ … }
static int tonga_populate_smc_mvdd_table(struct pp_hwmgr *hwmgr,
SMU72_Discrete_DpmTable *table)
{ … }
static int tonga_populate_cac_tables(struct pp_hwmgr *hwmgr,
SMU72_Discrete_DpmTable *table)
{ … }
static int tonga_populate_smc_voltage_tables(struct pp_hwmgr *hwmgr,
SMU72_Discrete_DpmTable *table)
{ … }
static int tonga_populate_ulv_level(struct pp_hwmgr *hwmgr,
struct SMU72_Discrete_Ulv *state)
{ … }
static int tonga_populate_ulv_state(struct pp_hwmgr *hwmgr,
struct SMU72_Discrete_DpmTable *table)
{ … }
static int tonga_populate_smc_link_level(struct pp_hwmgr *hwmgr, SMU72_Discrete_DpmTable *table)
{ … }
static int tonga_calculate_sclk_params(struct pp_hwmgr *hwmgr,
uint32_t engine_clock, SMU72_Discrete_GraphicsLevel *sclk)
{ … }
static int tonga_populate_single_graphic_level(struct pp_hwmgr *hwmgr,
uint32_t engine_clock,
SMU72_Discrete_GraphicsLevel *graphic_level)
{ … }
static int tonga_populate_all_graphic_levels(struct pp_hwmgr *hwmgr)
{ … }
static int tonga_calculate_mclk_params(
struct pp_hwmgr *hwmgr,
uint32_t memory_clock,
SMU72_Discrete_MemoryLevel *mclk,
bool strobe_mode,
bool dllStateOn
)
{ … }
static uint8_t tonga_get_mclk_frequency_ratio(uint32_t memory_clock,
bool strobe_mode)
{ … }
static uint8_t tonga_get_ddr3_mclk_frequency_ratio(uint32_t memory_clock)
{ … }
static int tonga_populate_single_memory_level(
struct pp_hwmgr *hwmgr,
uint32_t memory_clock,
SMU72_Discrete_MemoryLevel *memory_level
)
{ … }
static int tonga_populate_all_memory_levels(struct pp_hwmgr *hwmgr)
{ … }
static int tonga_populate_mvdd_value(struct pp_hwmgr *hwmgr,
uint32_t mclk, SMIO_Pattern *smio_pattern)
{ … }
static int tonga_populate_smc_acpi_level(struct pp_hwmgr *hwmgr,
SMU72_Discrete_DpmTable *table)
{ … }
static int tonga_populate_smc_uvd_level(struct pp_hwmgr *hwmgr,
SMU72_Discrete_DpmTable *table)
{ … }
static int tonga_populate_smc_vce_level(struct pp_hwmgr *hwmgr,
SMU72_Discrete_DpmTable *table)
{ … }
static int tonga_populate_smc_acp_level(struct pp_hwmgr *hwmgr,
SMU72_Discrete_DpmTable *table)
{ … }
static int tonga_populate_memory_timing_parameters(
struct pp_hwmgr *hwmgr,
uint32_t engine_clock,
uint32_t memory_clock,
struct SMU72_Discrete_MCArbDramTimingTableEntry *arb_regs
)
{ … }
static int tonga_program_memory_timing_parameters(struct pp_hwmgr *hwmgr)
{ … }
static int tonga_populate_smc_boot_level(struct pp_hwmgr *hwmgr,
SMU72_Discrete_DpmTable *table)
{ … }
static int tonga_populate_clock_stretcher_data_table(struct pp_hwmgr *hwmgr)
{ … }
static int tonga_populate_vr_config(struct pp_hwmgr *hwmgr,
SMU72_Discrete_DpmTable *table)
{ … }
static int tonga_init_arb_table_index(struct pp_hwmgr *hwmgr)
{ … }
static int tonga_populate_bapm_parameters_in_dpm_table(struct pp_hwmgr *hwmgr)
{ … }
static int tonga_populate_svi_load_line(struct pp_hwmgr *hwmgr)
{ … }
static int tonga_populate_tdc_limit(struct pp_hwmgr *hwmgr)
{ … }
static int tonga_populate_dw8(struct pp_hwmgr *hwmgr, uint32_t fuse_table_offset)
{ … }
static int tonga_populate_temperature_scaler(struct pp_hwmgr *hwmgr)
{ … }
static int tonga_populate_fuzzy_fan(struct pp_hwmgr *hwmgr)
{ … }
static int tonga_populate_gnb_lpml(struct pp_hwmgr *hwmgr)
{ … }
static int tonga_populate_bapm_vddc_base_leakage_sidd(struct pp_hwmgr *hwmgr)
{ … }
static int tonga_populate_pm_fuses(struct pp_hwmgr *hwmgr)
{ … }
static int tonga_populate_mc_reg_address(struct pp_hwmgr *hwmgr,
SMU72_Discrete_MCRegisters *mc_reg_table)
{ … }
static void tonga_convert_mc_registers(
const struct tonga_mc_reg_entry *entry,
SMU72_Discrete_MCRegisterSet *data,
uint32_t num_entries, uint32_t valid_flag)
{ … }
static int tonga_convert_mc_reg_table_entry_to_smc(
struct pp_hwmgr *hwmgr,
const uint32_t memory_clock,
SMU72_Discrete_MCRegisterSet *mc_reg_table_data
)
{ … }
static int tonga_convert_mc_reg_table_to_smc(struct pp_hwmgr *hwmgr,
SMU72_Discrete_MCRegisters *mc_regs)
{ … }
static int tonga_update_and_upload_mc_reg_table(struct pp_hwmgr *hwmgr)
{ … }
static int tonga_populate_initial_mc_reg_table(struct pp_hwmgr *hwmgr)
{ … }
static void tonga_initialize_power_tune_defaults(struct pp_hwmgr *hwmgr)
{ … }
static int tonga_init_smc_table(struct pp_hwmgr *hwmgr)
{ … }
static int tonga_thermal_setup_fan_table(struct pp_hwmgr *hwmgr)
{ … }
static int tonga_program_mem_timing_parameters(struct pp_hwmgr *hwmgr)
{ … }
static int tonga_update_sclk_threshold(struct pp_hwmgr *hwmgr)
{ … }
static uint32_t tonga_get_offsetof(uint32_t type, uint32_t member)
{ … }
static uint32_t tonga_get_mac_definition(uint32_t value)
{ … }
static int tonga_update_uvd_smc_table(struct pp_hwmgr *hwmgr)
{ … }
static int tonga_update_vce_smc_table(struct pp_hwmgr *hwmgr)
{ … }
static int tonga_update_smc_table(struct pp_hwmgr *hwmgr, uint32_t type)
{ … }
static int tonga_process_firmware_header(struct pp_hwmgr *hwmgr)
{ … }
static uint8_t tonga_get_memory_modile_index(struct pp_hwmgr *hwmgr)
{ … }
static bool tonga_check_s0_mc_reg_index(uint16_t in_reg, uint16_t *out_reg)
{ … }
static int tonga_set_s0_mc_reg_index(struct tonga_mc_reg_table *table)
{ … }
static int tonga_copy_vbios_smc_reg_table(const pp_atomctrl_mc_reg_table *table,
struct tonga_mc_reg_table *ni_table)
{ … }
static int tonga_set_mc_special_registers(struct pp_hwmgr *hwmgr,
struct tonga_mc_reg_table *table)
{ … }
static int tonga_set_valid_flag(struct tonga_mc_reg_table *table)
{ … }
static int tonga_initialize_mc_reg_table(struct pp_hwmgr *hwmgr)
{ … }
static bool tonga_is_dpm_running(struct pp_hwmgr *hwmgr)
{ … }
static int tonga_update_dpm_settings(struct pp_hwmgr *hwmgr,
void *profile_setting)
{ … }
const struct pp_smumgr_func tonga_smu_funcs = …;