#include <linux/delay.h>
#include <linux/firmware.h>
#include <linux/module.h>
#include <linux/pci.h>
#include "amdgpu.h"
#include "amdgpu_ucode.h"
#include "amdgpu_trace.h"
#include "gc/gc_10_3_0_offset.h"
#include "gc/gc_10_3_0_sh_mask.h"
#include "ivsrcid/sdma0/irqsrcs_sdma0_5_0.h"
#include "ivsrcid/sdma1/irqsrcs_sdma1_5_0.h"
#include "ivsrcid/sdma2/irqsrcs_sdma2_5_0.h"
#include "ivsrcid/sdma3/irqsrcs_sdma3_5_0.h"
#include "soc15_common.h"
#include "soc15.h"
#include "navi10_sdma_pkt_open.h"
#include "nbio_v2_3.h"
#include "sdma_common.h"
#include "sdma_v5_2.h"
MODULE_FIRMWARE(…) …;
MODULE_FIRMWARE(…) …;
MODULE_FIRMWARE(…) …;
MODULE_FIRMWARE(…) …;
MODULE_FIRMWARE(…) …;
MODULE_FIRMWARE(…) …;
MODULE_FIRMWARE(…) …;
MODULE_FIRMWARE(…) …;
#define SDMA1_REG_OFFSET …
#define SDMA3_REG_OFFSET …
#define SDMA0_HYP_DEC_REG_START …
#define SDMA0_HYP_DEC_REG_END …
#define SDMA1_HYP_DEC_REG_OFFSET …
static void sdma_v5_2_set_ring_funcs(struct amdgpu_device *adev);
static void sdma_v5_2_set_buffer_funcs(struct amdgpu_device *adev);
static void sdma_v5_2_set_vm_pte_funcs(struct amdgpu_device *adev);
static void sdma_v5_2_set_irq_funcs(struct amdgpu_device *adev);
static u32 sdma_v5_2_get_reg_offset(struct amdgpu_device *adev, u32 instance, u32 internal_offset)
{ … }
static unsigned sdma_v5_2_ring_init_cond_exec(struct amdgpu_ring *ring,
uint64_t addr)
{ … }
static uint64_t sdma_v5_2_ring_get_rptr(struct amdgpu_ring *ring)
{ … }
static uint64_t sdma_v5_2_ring_get_wptr(struct amdgpu_ring *ring)
{ … }
static void sdma_v5_2_ring_set_wptr(struct amdgpu_ring *ring)
{ … }
static void sdma_v5_2_ring_insert_nop(struct amdgpu_ring *ring, uint32_t count)
{ … }
static void sdma_v5_2_ring_emit_ib(struct amdgpu_ring *ring,
struct amdgpu_job *job,
struct amdgpu_ib *ib,
uint32_t flags)
{ … }
static void sdma_v5_2_ring_emit_mem_sync(struct amdgpu_ring *ring)
{ … }
static void sdma_v5_2_ring_emit_hdp_flush(struct amdgpu_ring *ring)
{ … }
static void sdma_v5_2_ring_emit_fence(struct amdgpu_ring *ring, u64 addr, u64 seq,
unsigned flags)
{ … }
static void sdma_v5_2_gfx_stop(struct amdgpu_device *adev)
{ … }
static void sdma_v5_2_rlc_stop(struct amdgpu_device *adev)
{ … }
static void sdma_v5_2_ctx_switch_enable(struct amdgpu_device *adev, bool enable)
{ … }
static void sdma_v5_2_enable(struct amdgpu_device *adev, bool enable)
{ … }
static int sdma_v5_2_gfx_resume(struct amdgpu_device *adev)
{ … }
static int sdma_v5_2_rlc_resume(struct amdgpu_device *adev)
{ … }
static int sdma_v5_2_load_microcode(struct amdgpu_device *adev)
{ … }
static int sdma_v5_2_soft_reset(void *handle)
{ … }
static int sdma_v5_2_start(struct amdgpu_device *adev)
{ … }
static int sdma_v5_2_mqd_init(struct amdgpu_device *adev, void *mqd,
struct amdgpu_mqd_prop *prop)
{ … }
static void sdma_v5_2_set_mqd_funcs(struct amdgpu_device *adev)
{ … }
static int sdma_v5_2_ring_test_ring(struct amdgpu_ring *ring)
{ … }
static int sdma_v5_2_ring_test_ib(struct amdgpu_ring *ring, long timeout)
{ … }
static void sdma_v5_2_vm_copy_pte(struct amdgpu_ib *ib,
uint64_t pe, uint64_t src,
unsigned count)
{ … }
static void sdma_v5_2_vm_write_pte(struct amdgpu_ib *ib, uint64_t pe,
uint64_t value, unsigned count,
uint32_t incr)
{ … }
static void sdma_v5_2_vm_set_pte_pde(struct amdgpu_ib *ib,
uint64_t pe,
uint64_t addr, unsigned count,
uint32_t incr, uint64_t flags)
{ … }
static void sdma_v5_2_ring_pad_ib(struct amdgpu_ring *ring, struct amdgpu_ib *ib)
{ … }
static void sdma_v5_2_ring_emit_pipeline_sync(struct amdgpu_ring *ring)
{ … }
static void sdma_v5_2_ring_emit_vm_flush(struct amdgpu_ring *ring,
unsigned vmid, uint64_t pd_addr)
{ … }
static void sdma_v5_2_ring_emit_wreg(struct amdgpu_ring *ring,
uint32_t reg, uint32_t val)
{ … }
static void sdma_v5_2_ring_emit_reg_wait(struct amdgpu_ring *ring, uint32_t reg,
uint32_t val, uint32_t mask)
{ … }
static void sdma_v5_2_ring_emit_reg_write_reg_wait(struct amdgpu_ring *ring,
uint32_t reg0, uint32_t reg1,
uint32_t ref, uint32_t mask)
{ … }
static int sdma_v5_2_early_init(void *handle)
{ … }
static unsigned sdma_v5_2_seq_to_irq_id(int seq_num)
{ … }
static unsigned sdma_v5_2_seq_to_trap_id(int seq_num)
{ … }
static int sdma_v5_2_sw_init(void *handle)
{ … }
static int sdma_v5_2_sw_fini(void *handle)
{ … }
static int sdma_v5_2_hw_init(void *handle)
{ … }
static int sdma_v5_2_hw_fini(void *handle)
{ … }
static int sdma_v5_2_suspend(void *handle)
{ … }
static int sdma_v5_2_resume(void *handle)
{ … }
static bool sdma_v5_2_is_idle(void *handle)
{ … }
static int sdma_v5_2_wait_for_idle(void *handle)
{ … }
static int sdma_v5_2_ring_preempt_ib(struct amdgpu_ring *ring)
{ … }
static int sdma_v5_2_set_trap_irq_state(struct amdgpu_device *adev,
struct amdgpu_irq_src *source,
unsigned type,
enum amdgpu_interrupt_state state)
{ … }
static int sdma_v5_2_process_trap_irq(struct amdgpu_device *adev,
struct amdgpu_irq_src *source,
struct amdgpu_iv_entry *entry)
{ … }
static int sdma_v5_2_process_illegal_inst_irq(struct amdgpu_device *adev,
struct amdgpu_irq_src *source,
struct amdgpu_iv_entry *entry)
{ … }
static bool sdma_v5_2_firmware_mgcg_support(struct amdgpu_device *adev,
int i)
{ … }
static void sdma_v5_2_update_medium_grain_clock_gating(struct amdgpu_device *adev,
bool enable)
{ … }
static void sdma_v5_2_update_medium_grain_light_sleep(struct amdgpu_device *adev,
bool enable)
{ … }
static int sdma_v5_2_set_clockgating_state(void *handle,
enum amd_clockgating_state state)
{ … }
static int sdma_v5_2_set_powergating_state(void *handle,
enum amd_powergating_state state)
{ … }
static void sdma_v5_2_get_clockgating_state(void *handle, u64 *flags)
{ … }
static void sdma_v5_2_ring_begin_use(struct amdgpu_ring *ring)
{ … }
static void sdma_v5_2_ring_end_use(struct amdgpu_ring *ring)
{ … }
const struct amd_ip_funcs sdma_v5_2_ip_funcs = …;
static const struct amdgpu_ring_funcs sdma_v5_2_ring_funcs = …;
static void sdma_v5_2_set_ring_funcs(struct amdgpu_device *adev)
{ … }
static const struct amdgpu_irq_src_funcs sdma_v5_2_trap_irq_funcs = …;
static const struct amdgpu_irq_src_funcs sdma_v5_2_illegal_inst_irq_funcs = …;
static void sdma_v5_2_set_irq_funcs(struct amdgpu_device *adev)
{ … }
static void sdma_v5_2_emit_copy_buffer(struct amdgpu_ib *ib,
uint64_t src_offset,
uint64_t dst_offset,
uint32_t byte_count,
uint32_t copy_flags)
{ … }
static void sdma_v5_2_emit_fill_buffer(struct amdgpu_ib *ib,
uint32_t src_data,
uint64_t dst_offset,
uint32_t byte_count)
{ … }
static const struct amdgpu_buffer_funcs sdma_v5_2_buffer_funcs = …;
static void sdma_v5_2_set_buffer_funcs(struct amdgpu_device *adev)
{ … }
static const struct amdgpu_vm_pte_funcs sdma_v5_2_vm_pte_funcs = …;
static void sdma_v5_2_set_vm_pte_funcs(struct amdgpu_device *adev)
{ … }
const struct amdgpu_ip_block_version sdma_v5_2_ip_block = …;