#include <linux/firmware.h>
#include <linux/module.h>
#include "amdgpu.h"
#include "amdgpu_ih.h"
#include "amdgpu_gfx.h"
#include "cikd.h"
#include "cik.h"
#include "cik_structs.h"
#include "atom.h"
#include "amdgpu_ucode.h"
#include "clearstate_ci.h"
#include "dce/dce_8_0_d.h"
#include "dce/dce_8_0_sh_mask.h"
#include "bif/bif_4_1_d.h"
#include "bif/bif_4_1_sh_mask.h"
#include "gca/gfx_7_0_d.h"
#include "gca/gfx_7_2_enum.h"
#include "gca/gfx_7_2_sh_mask.h"
#include "gmc/gmc_7_0_d.h"
#include "gmc/gmc_7_0_sh_mask.h"
#include "oss/oss_2_0_d.h"
#include "oss/oss_2_0_sh_mask.h"
#define NUM_SIMD_PER_CU …
#define GFX7_NUM_GFX_RINGS …
#define GFX7_MEC_HPD_SIZE …
static void gfx_v7_0_set_ring_funcs(struct amdgpu_device *adev);
static void gfx_v7_0_set_irq_funcs(struct amdgpu_device *adev);
static void gfx_v7_0_set_gds_init(struct amdgpu_device *adev);
MODULE_FIRMWARE(…) …;
MODULE_FIRMWARE(…) …;
MODULE_FIRMWARE(…) …;
MODULE_FIRMWARE(…) …;
MODULE_FIRMWARE(…) …;
MODULE_FIRMWARE(…) …;
MODULE_FIRMWARE(…) …;
MODULE_FIRMWARE(…) …;
MODULE_FIRMWARE(…) …;
MODULE_FIRMWARE(…) …;
MODULE_FIRMWARE(…) …;
MODULE_FIRMWARE(…) …;
MODULE_FIRMWARE(…) …;
MODULE_FIRMWARE(…) …;
MODULE_FIRMWARE(…) …;
MODULE_FIRMWARE(…) …;
MODULE_FIRMWARE(…) …;
MODULE_FIRMWARE(…) …;
MODULE_FIRMWARE(…) …;
MODULE_FIRMWARE(…) …;
MODULE_FIRMWARE(…) …;
MODULE_FIRMWARE(…) …;
MODULE_FIRMWARE(…) …;
MODULE_FIRMWARE(…) …;
MODULE_FIRMWARE(…) …;
MODULE_FIRMWARE(…) …;
static const struct amdgpu_gds_reg_offset amdgpu_gds_reg_offset[] = …;
static const u32 spectre_rlc_save_restore_register_list[] = …;
static const u32 kalindi_rlc_save_restore_register_list[] = …;
static u32 gfx_v7_0_get_csb_size(struct amdgpu_device *adev);
static void gfx_v7_0_get_csb_buffer(struct amdgpu_device *adev, volatile u32 *buffer);
static void gfx_v7_0_init_pg(struct amdgpu_device *adev);
static void gfx_v7_0_get_cu_info(struct amdgpu_device *adev);
static void gfx_v7_0_free_microcode(struct amdgpu_device *adev)
{ … }
static int gfx_v7_0_init_microcode(struct amdgpu_device *adev)
{ … }
static void gfx_v7_0_tiling_mode_table_init(struct amdgpu_device *adev)
{ … }
static void gfx_v7_0_select_se_sh(struct amdgpu_device *adev,
u32 se_num, u32 sh_num, u32 instance,
int xcc_id)
{ … }
static u32 gfx_v7_0_get_rb_active_bitmap(struct amdgpu_device *adev)
{ … }
static void
gfx_v7_0_raster_config(struct amdgpu_device *adev, u32 *rconf, u32 *rconf1)
{ … }
static void
gfx_v7_0_write_harvested_raster_configs(struct amdgpu_device *adev,
u32 raster_config, u32 raster_config_1,
unsigned rb_mask, unsigned num_rb)
{ … }
static void gfx_v7_0_setup_rb(struct amdgpu_device *adev)
{ … }
#define DEFAULT_SH_MEM_BASES …
static void gfx_v7_0_init_compute_vmid(struct amdgpu_device *adev)
{ … }
static void gfx_v7_0_init_gds_vmid(struct amdgpu_device *adev)
{ … }
static void gfx_v7_0_config_init(struct amdgpu_device *adev)
{ … }
static void gfx_v7_0_constants_init(struct amdgpu_device *adev)
{ … }
static int gfx_v7_0_ring_test_ring(struct amdgpu_ring *ring)
{ … }
static void gfx_v7_0_ring_emit_hdp_flush(struct amdgpu_ring *ring)
{ … }
static void gfx_v7_0_ring_emit_vgt_flush(struct amdgpu_ring *ring)
{ … }
static void gfx_v7_0_ring_emit_fence_gfx(struct amdgpu_ring *ring, u64 addr,
u64 seq, unsigned flags)
{ … }
static void gfx_v7_0_ring_emit_fence_compute(struct amdgpu_ring *ring,
u64 addr, u64 seq,
unsigned flags)
{ … }
static void gfx_v7_0_ring_emit_ib_gfx(struct amdgpu_ring *ring,
struct amdgpu_job *job,
struct amdgpu_ib *ib,
uint32_t flags)
{ … }
static void gfx_v7_0_ring_emit_ib_compute(struct amdgpu_ring *ring,
struct amdgpu_job *job,
struct amdgpu_ib *ib,
uint32_t flags)
{ … }
static void gfx_v7_ring_emit_cntxcntl(struct amdgpu_ring *ring, uint32_t flags)
{ … }
static int gfx_v7_0_ring_test_ib(struct amdgpu_ring *ring, long timeout)
{ … }
static void gfx_v7_0_cp_gfx_enable(struct amdgpu_device *adev, bool enable)
{ … }
static int gfx_v7_0_cp_gfx_load_microcode(struct amdgpu_device *adev)
{ … }
static int gfx_v7_0_cp_gfx_start(struct amdgpu_device *adev)
{ … }
static int gfx_v7_0_cp_gfx_resume(struct amdgpu_device *adev)
{ … }
static u64 gfx_v7_0_ring_get_rptr(struct amdgpu_ring *ring)
{ … }
static u64 gfx_v7_0_ring_get_wptr_gfx(struct amdgpu_ring *ring)
{ … }
static void gfx_v7_0_ring_set_wptr_gfx(struct amdgpu_ring *ring)
{ … }
static u64 gfx_v7_0_ring_get_wptr_compute(struct amdgpu_ring *ring)
{ … }
static void gfx_v7_0_ring_set_wptr_compute(struct amdgpu_ring *ring)
{ … }
static void gfx_v7_0_cp_compute_enable(struct amdgpu_device *adev, bool enable)
{ … }
static int gfx_v7_0_cp_compute_load_microcode(struct amdgpu_device *adev)
{ … }
static void gfx_v7_0_cp_compute_fini(struct amdgpu_device *adev)
{ … }
static void gfx_v7_0_mec_fini(struct amdgpu_device *adev)
{ … }
static int gfx_v7_0_mec_init(struct amdgpu_device *adev)
{ … }
static void gfx_v7_0_compute_pipe_init(struct amdgpu_device *adev,
int mec, int pipe)
{ … }
static int gfx_v7_0_mqd_deactivate(struct amdgpu_device *adev)
{ … }
static void gfx_v7_0_mqd_init(struct amdgpu_device *adev,
struct cik_mqd *mqd,
uint64_t mqd_gpu_addr,
struct amdgpu_ring *ring)
{ … }
static int gfx_v7_0_mqd_commit(struct amdgpu_device *adev, struct cik_mqd *mqd)
{ … }
static int gfx_v7_0_compute_queue_init(struct amdgpu_device *adev, int ring_id)
{ … }
static int gfx_v7_0_cp_compute_resume(struct amdgpu_device *adev)
{ … }
static void gfx_v7_0_cp_enable(struct amdgpu_device *adev, bool enable)
{ … }
static int gfx_v7_0_cp_load_microcode(struct amdgpu_device *adev)
{ … }
static void gfx_v7_0_enable_gui_idle_interrupt(struct amdgpu_device *adev,
bool enable)
{ … }
static int gfx_v7_0_cp_resume(struct amdgpu_device *adev)
{ … }
static void gfx_v7_0_ring_emit_pipeline_sync(struct amdgpu_ring *ring)
{ … }
static void gfx_v7_0_ring_emit_vm_flush(struct amdgpu_ring *ring,
unsigned vmid, uint64_t pd_addr)
{ … }
static void gfx_v7_0_ring_emit_wreg(struct amdgpu_ring *ring,
uint32_t reg, uint32_t val)
{ … }
static int gfx_v7_0_rlc_init(struct amdgpu_device *adev)
{ … }
static void gfx_v7_0_enable_lbpw(struct amdgpu_device *adev, bool enable)
{ … }
static void gfx_v7_0_wait_for_rlc_serdes(struct amdgpu_device *adev)
{ … }
static void gfx_v7_0_update_rlc(struct amdgpu_device *adev, u32 rlc)
{ … }
static u32 gfx_v7_0_halt_rlc(struct amdgpu_device *adev)
{ … }
static bool gfx_v7_0_is_rlc_enabled(struct amdgpu_device *adev)
{ … }
static void gfx_v7_0_set_safe_mode(struct amdgpu_device *adev, int xcc_id)
{ … }
static void gfx_v7_0_unset_safe_mode(struct amdgpu_device *adev, int xcc_id)
{ … }
static void gfx_v7_0_rlc_stop(struct amdgpu_device *adev)
{ … }
static void gfx_v7_0_rlc_start(struct amdgpu_device *adev)
{ … }
static void gfx_v7_0_rlc_reset(struct amdgpu_device *adev)
{ … }
static int gfx_v7_0_rlc_resume(struct amdgpu_device *adev)
{ … }
static void gfx_v7_0_update_spm_vmid(struct amdgpu_device *adev, struct amdgpu_ring *ring, unsigned vmid)
{ … }
static void gfx_v7_0_enable_cgcg(struct amdgpu_device *adev, bool enable)
{ … }
static void gfx_v7_0_enable_mgcg(struct amdgpu_device *adev, bool enable)
{ … }
static void gfx_v7_0_update_cg(struct amdgpu_device *adev,
bool enable)
{ … }
static void gfx_v7_0_enable_sclk_slowdown_on_pu(struct amdgpu_device *adev,
bool enable)
{ … }
static void gfx_v7_0_enable_sclk_slowdown_on_pd(struct amdgpu_device *adev,
bool enable)
{ … }
static void gfx_v7_0_enable_cp_pg(struct amdgpu_device *adev, bool enable)
{ … }
static void gfx_v7_0_enable_gds_pg(struct amdgpu_device *adev, bool enable)
{ … }
static int gfx_v7_0_cp_pg_table_num(struct amdgpu_device *adev)
{ … }
static void gfx_v7_0_enable_gfx_cgpg(struct amdgpu_device *adev,
bool enable)
{ … }
static void gfx_v7_0_set_user_cu_inactive_bitmap(struct amdgpu_device *adev,
u32 bitmap)
{ … }
static u32 gfx_v7_0_get_cu_active_bitmap(struct amdgpu_device *adev)
{ … }
static void gfx_v7_0_init_ao_cu_mask(struct amdgpu_device *adev)
{ … }
static void gfx_v7_0_enable_gfx_static_mgpg(struct amdgpu_device *adev,
bool enable)
{ … }
static void gfx_v7_0_enable_gfx_dynamic_mgpg(struct amdgpu_device *adev,
bool enable)
{ … }
#define RLC_SAVE_AND_RESTORE_STARTING_OFFSET …
#define RLC_CLEAR_STATE_DESCRIPTOR_OFFSET …
static void gfx_v7_0_init_gfx_cgpg(struct amdgpu_device *adev)
{ … }
static void gfx_v7_0_update_gfx_pg(struct amdgpu_device *adev, bool enable)
{ … }
static u32 gfx_v7_0_get_csb_size(struct amdgpu_device *adev)
{ … }
static void gfx_v7_0_get_csb_buffer(struct amdgpu_device *adev,
volatile u32 *buffer)
{ … }
static void gfx_v7_0_init_pg(struct amdgpu_device *adev)
{ … }
static void gfx_v7_0_fini_pg(struct amdgpu_device *adev)
{ … }
static uint64_t gfx_v7_0_get_gpu_clock_counter(struct amdgpu_device *adev)
{ … }
static void gfx_v7_0_ring_emit_gds_switch(struct amdgpu_ring *ring,
uint32_t vmid,
uint32_t gds_base, uint32_t gds_size,
uint32_t gws_base, uint32_t gws_size,
uint32_t oa_base, uint32_t oa_size)
{ … }
static void gfx_v7_0_ring_soft_recovery(struct amdgpu_ring *ring, unsigned vmid)
{ … }
static uint32_t wave_read_ind(struct amdgpu_device *adev, uint32_t simd, uint32_t wave, uint32_t address)
{ … }
static void wave_read_regs(struct amdgpu_device *adev, uint32_t simd,
uint32_t wave, uint32_t thread,
uint32_t regno, uint32_t num, uint32_t *out)
{ … }
static void gfx_v7_0_read_wave_data(struct amdgpu_device *adev, uint32_t xcc_id, uint32_t simd, uint32_t wave, uint32_t *dst, int *no_fields)
{ … }
static void gfx_v7_0_read_wave_sgprs(struct amdgpu_device *adev, uint32_t xcc_id, uint32_t simd,
uint32_t wave, uint32_t start,
uint32_t size, uint32_t *dst)
{ … }
static void gfx_v7_0_select_me_pipe_q(struct amdgpu_device *adev,
u32 me, u32 pipe, u32 q, u32 vm, u32 xcc_id)
{ … }
static const struct amdgpu_gfx_funcs gfx_v7_0_gfx_funcs = …;
static const struct amdgpu_rlc_funcs gfx_v7_0_rlc_funcs = …;
static int gfx_v7_0_early_init(void *handle)
{ … }
static int gfx_v7_0_late_init(void *handle)
{ … }
static void gfx_v7_0_gpu_early_init(struct amdgpu_device *adev)
{ … }
static int gfx_v7_0_compute_ring_init(struct amdgpu_device *adev, int ring_id,
int mec, int pipe, int queue)
{ … }
static int gfx_v7_0_sw_init(void *handle)
{ … }
static int gfx_v7_0_sw_fini(void *handle)
{ … }
static int gfx_v7_0_hw_init(void *handle)
{ … }
static int gfx_v7_0_hw_fini(void *handle)
{ … }
static int gfx_v7_0_suspend(void *handle)
{ … }
static int gfx_v7_0_resume(void *handle)
{ … }
static bool gfx_v7_0_is_idle(void *handle)
{ … }
static int gfx_v7_0_wait_for_idle(void *handle)
{ … }
static int gfx_v7_0_soft_reset(void *handle)
{ … }
static void gfx_v7_0_set_gfx_eop_interrupt_state(struct amdgpu_device *adev,
enum amdgpu_interrupt_state state)
{ … }
static void gfx_v7_0_set_compute_eop_interrupt_state(struct amdgpu_device *adev,
int me, int pipe,
enum amdgpu_interrupt_state state)
{ … }
static int gfx_v7_0_set_priv_reg_fault_state(struct amdgpu_device *adev,
struct amdgpu_irq_src *src,
unsigned type,
enum amdgpu_interrupt_state state)
{ … }
static int gfx_v7_0_set_priv_inst_fault_state(struct amdgpu_device *adev,
struct amdgpu_irq_src *src,
unsigned type,
enum amdgpu_interrupt_state state)
{ … }
static int gfx_v7_0_set_eop_interrupt_state(struct amdgpu_device *adev,
struct amdgpu_irq_src *src,
unsigned type,
enum amdgpu_interrupt_state state)
{ … }
static int gfx_v7_0_eop_irq(struct amdgpu_device *adev,
struct amdgpu_irq_src *source,
struct amdgpu_iv_entry *entry)
{ … }
static void gfx_v7_0_fault(struct amdgpu_device *adev,
struct amdgpu_iv_entry *entry)
{ … }
static int gfx_v7_0_priv_reg_irq(struct amdgpu_device *adev,
struct amdgpu_irq_src *source,
struct amdgpu_iv_entry *entry)
{ … }
static int gfx_v7_0_priv_inst_irq(struct amdgpu_device *adev,
struct amdgpu_irq_src *source,
struct amdgpu_iv_entry *entry)
{ … }
static int gfx_v7_0_set_clockgating_state(void *handle,
enum amd_clockgating_state state)
{ … }
static int gfx_v7_0_set_powergating_state(void *handle,
enum amd_powergating_state state)
{ … }
static void gfx_v7_0_emit_mem_sync(struct amdgpu_ring *ring)
{ … }
static void gfx_v7_0_emit_mem_sync_compute(struct amdgpu_ring *ring)
{ … }
static const struct amd_ip_funcs gfx_v7_0_ip_funcs = …;
static const struct amdgpu_ring_funcs gfx_v7_0_ring_funcs_gfx = …;
static const struct amdgpu_ring_funcs gfx_v7_0_ring_funcs_compute = …;
static void gfx_v7_0_set_ring_funcs(struct amdgpu_device *adev)
{ … }
static const struct amdgpu_irq_src_funcs gfx_v7_0_eop_irq_funcs = …;
static const struct amdgpu_irq_src_funcs gfx_v7_0_priv_reg_irq_funcs = …;
static const struct amdgpu_irq_src_funcs gfx_v7_0_priv_inst_irq_funcs = …;
static void gfx_v7_0_set_irq_funcs(struct amdgpu_device *adev)
{ … }
static void gfx_v7_0_set_gds_init(struct amdgpu_device *adev)
{ … }
static void gfx_v7_0_get_cu_info(struct amdgpu_device *adev)
{ … }
const struct amdgpu_ip_block_version gfx_v7_1_ip_block = …;
const struct amdgpu_ip_block_version gfx_v7_2_ip_block = …;
const struct amdgpu_ip_block_version gfx_v7_3_ip_block = …;