Path: blob/master/drivers/gpu/drm/amd/pm/legacy-dpm/kv_dpm.h
26535 views
/*1* Copyright 2013 Advanced Micro Devices, Inc.2*3* Permission is hereby granted, free of charge, to any person obtaining a4* copy of this software and associated documentation files (the "Software"),5* to deal in the Software without restriction, including without limitation6* the rights to use, copy, modify, merge, publish, distribute, sublicense,7* and/or sell copies of the Software, and to permit persons to whom the8* Software is furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice shall be included in11* all copies or substantial portions of the Software.12*13* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR14* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,15* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL16* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR17* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,18* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR19* OTHER DEALINGS IN THE SOFTWARE.20*21*/22#ifndef __KV_DPM_H__23#define __KV_DPM_H__2425#define SMU__NUM_SCLK_DPM_STATE 826#define SMU__NUM_MCLK_DPM_LEVELS 427#define SMU__NUM_LCLK_DPM_LEVELS 828#define SMU__NUM_PCIE_DPM_LEVELS 0 /* ??? */29#include "smu7_fusion.h"30#include "ppsmc.h"3132#define SUMO_MAX_HARDWARE_POWERLEVELS 53334#define SUMO_MAX_NUMBER_VOLTAGES 43536struct sumo_vid_mapping_entry {37u16 vid_2bit;38u16 vid_7bit;39};4041struct sumo_vid_mapping_table {42u32 num_entries;43struct sumo_vid_mapping_entry entries[SUMO_MAX_NUMBER_VOLTAGES];44};4546struct sumo_sclk_voltage_mapping_entry {47u32 sclk_frequency;48u16 vid_2bit;49u16 rsv;50};5152struct sumo_sclk_voltage_mapping_table {53u32 num_max_dpm_entries;54struct sumo_sclk_voltage_mapping_entry entries[SUMO_MAX_HARDWARE_POWERLEVELS];55};5657#define TRINITY_AT_DFLT 305859#define KV_NUM_NBPSTATES 46061enum kv_pt_config_reg_type {62KV_CONFIGREG_MMR = 0,63KV_CONFIGREG_SMC_IND,64KV_CONFIGREG_DIDT_IND,65KV_CONFIGREG_CACHE,66KV_CONFIGREG_MAX67};6869struct kv_pt_config_reg {70u32 offset;71u32 mask;72u32 shift;73u32 value;74enum kv_pt_config_reg_type type;75};7677struct kv_lcac_config_values {78u32 block_id;79u32 signal_id;80u32 t;81};8283struct kv_lcac_config_reg {84u32 cntl;85u32 block_mask;86u32 block_shift;87u32 signal_mask;88u32 signal_shift;89u32 t_mask;90u32 t_shift;91u32 enable_mask;92u32 enable_shift;93};9495struct kv_pl {96u32 sclk;97u8 vddc_index;98u8 ds_divider_index;99u8 ss_divider_index;100u8 allow_gnb_slow;101u8 force_nbp_state;102u8 display_wm;103u8 vce_wm;104};105106struct kv_ps {107struct kv_pl levels[SUMO_MAX_HARDWARE_POWERLEVELS];108u32 num_levels;109bool need_dfs_bypass;110u8 dpm0_pg_nb_ps_lo;111u8 dpm0_pg_nb_ps_hi;112u8 dpmx_nb_ps_lo;113u8 dpmx_nb_ps_hi;114};115116struct kv_sys_info {117u32 bootup_uma_clk;118u32 bootup_sclk;119u32 dentist_vco_freq;120u32 nb_dpm_enable;121u32 nbp_memory_clock[KV_NUM_NBPSTATES];122u32 nbp_n_clock[KV_NUM_NBPSTATES];123u16 bootup_nb_voltage_index;124u8 htc_tmp_lmt;125u8 htc_hyst_lmt;126struct sumo_sclk_voltage_mapping_table sclk_voltage_mapping_table;127struct sumo_vid_mapping_table vid_mapping_table;128u32 uma_channel_number;129};130131struct kv_power_info {132u32 at[SUMO_MAX_HARDWARE_POWERLEVELS];133u32 voltage_drop_t;134struct kv_sys_info sys_info;135struct kv_pl boot_pl;136bool enable_nb_ps_policy;137bool disable_nb_ps3_in_battery;138bool video_start;139bool battery_state;140u32 lowest_valid;141u32 highest_valid;142u16 high_voltage_t;143bool cac_enabled;144bool bapm_enable;145/* smc offsets */146u32 sram_end;147u32 dpm_table_start;148u32 soft_regs_start;149/* dpm SMU tables */150u8 graphics_dpm_level_count;151u8 uvd_level_count;152u8 vce_level_count;153u8 acp_level_count;154u8 samu_level_count;155u16 fps_high_t;156SMU7_Fusion_GraphicsLevel graphics_level[SMU__NUM_SCLK_DPM_STATE];157SMU7_Fusion_ACPILevel acpi_level;158SMU7_Fusion_UvdLevel uvd_level[SMU7_MAX_LEVELS_UVD];159SMU7_Fusion_ExtClkLevel vce_level[SMU7_MAX_LEVELS_VCE];160SMU7_Fusion_ExtClkLevel acp_level[SMU7_MAX_LEVELS_ACP];161SMU7_Fusion_ExtClkLevel samu_level[SMU7_MAX_LEVELS_SAMU];162u8 uvd_boot_level;163u8 vce_boot_level;164u8 acp_boot_level;165u8 samu_boot_level;166u8 uvd_interval;167u8 vce_interval;168u8 acp_interval;169u8 samu_interval;170u8 graphics_boot_level;171u8 graphics_interval;172u8 graphics_therm_throttle_enable;173u8 graphics_voltage_change_enable;174u8 graphics_clk_slow_enable;175u8 graphics_clk_slow_divider;176u8 fps_low_t;177u32 low_sclk_interrupt_t;178bool uvd_power_gated;179bool vce_power_gated;180bool acp_power_gated;181bool samu_power_gated;182bool nb_dpm_enabled;183/* flags */184bool enable_didt;185bool enable_dpm;186bool enable_auto_thermal_throttling;187bool enable_nb_dpm;188/* caps */189bool caps_cac;190bool caps_power_containment;191bool caps_sq_ramping;192bool caps_db_ramping;193bool caps_td_ramping;194bool caps_tcp_ramping;195bool caps_sclk_throttle_low_notification;196bool caps_fps;197bool caps_uvd_dpm;198bool caps_uvd_pg;199bool caps_vce_pg;200bool caps_samu_pg;201bool caps_acp_pg;202bool caps_stable_p_state;203bool caps_enable_dfs_bypass;204bool caps_sclk_ds;205struct amdgpu_ps current_rps;206struct kv_ps current_ps;207struct amdgpu_ps requested_rps;208struct kv_ps requested_ps;209};210211/* XXX are these ok? */212#define KV_TEMP_RANGE_MIN (90 * 1000)213#define KV_TEMP_RANGE_MAX (120 * 1000)214215/* kv_smc.c */216int amdgpu_kv_notify_message_to_smu(struct amdgpu_device *adev, u32 id);217int amdgpu_kv_dpm_get_enable_mask(struct amdgpu_device *adev, u32 *enable_mask);218int amdgpu_kv_send_msg_to_smc_with_parameter(struct amdgpu_device *adev,219PPSMC_Msg msg, u32 parameter);220int amdgpu_kv_read_smc_sram_dword(struct amdgpu_device *adev, u32 smc_address,221u32 *value, u32 limit);222int amdgpu_kv_smc_dpm_enable(struct amdgpu_device *adev, bool enable);223int amdgpu_kv_smc_bapm_enable(struct amdgpu_device *adev, bool enable);224int amdgpu_kv_copy_bytes_to_smc(struct amdgpu_device *adev,225u32 smc_start_address,226const u8 *src, u32 byte_count, u32 limit);227228#endif229230231