linux/drivers/gpu/drm/amd/amdgpu/ih_v6_1.c

/*
 * Copyright 2023 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.
 *
 */

#include <linux/pci.h>

#include "amdgpu.h"
#include "amdgpu_ih.h"

#include "oss/osssys_6_1_0_offset.h"
#include "oss/osssys_6_1_0_sh_mask.h"

#include "soc15_common.h"
#include "ih_v6_1.h"

#define MAX_REARM_RETRY

static void ih_v6_1_set_interrupt_funcs(struct amdgpu_device *adev);

/**
 * ih_v6_1_init_register_offset - Initialize register offset for ih rings
 *
 * @adev: amdgpu_device pointer
 *
 * Initialize register offset ih rings (IH_V6_0).
 */
static void ih_v6_1_init_register_offset(struct amdgpu_device *adev)
{}

/**
 * force_update_wptr_for_self_int - Force update the wptr for self interrupt
 *
 * @adev: amdgpu_device pointer
 * @threshold: threshold to trigger the wptr reporting
 * @timeout: timeout to trigger the wptr reporting
 * @enabled: Enable/disable timeout flush mechanism
 *
 * threshold input range: 0 ~ 15, default 0,
 * real_threshold = 2^threshold
 * timeout input range: 0 ~ 20, default 8,
 * real_timeout = (2^timeout) * 1024 / (socclk_freq)
 *
 * Force update wptr for self interrupt ( >= SIENNA_CICHLID).
 */
static void
force_update_wptr_for_self_int(struct amdgpu_device *adev,
			       u32 threshold, u32 timeout, bool enabled)
{}

/**
 * ih_v6_1_toggle_ring_interrupts - toggle the interrupt ring buffer
 *
 * @adev: amdgpu_device pointer
 * @ih: amdgpu_ih_ring pointer
 * @enable: true - enable the interrupts, false - disable the interrupts
 *
 * Toggle the interrupt ring buffer (IH_V6_0)
 */
static int ih_v6_1_toggle_ring_interrupts(struct amdgpu_device *adev,
					  struct amdgpu_ih_ring *ih,
					  bool enable)
{}

/**
 * ih_v6_1_toggle_interrupts - Toggle all the available interrupt ring buffers
 *
 * @adev: amdgpu_device pointer
 * @enable: enable or disable interrupt ring buffers
 *
 * Toggle all the available interrupt ring buffers (IH_V6_0).
 */
static int ih_v6_1_toggle_interrupts(struct amdgpu_device *adev, bool enable)
{}

static uint32_t ih_v6_1_rb_cntl(struct amdgpu_ih_ring *ih, uint32_t ih_rb_cntl)
{}

static uint32_t ih_v6_1_doorbell_rptr(struct amdgpu_ih_ring *ih)
{}

/**
 * ih_v6_1_enable_ring - enable an ih ring buffer
 *
 * @adev: amdgpu_device pointer
 * @ih: amdgpu_ih_ring pointer
 *
 * Enable an ih ring buffer (IH_V6_0)
 */
static int ih_v6_1_enable_ring(struct amdgpu_device *adev,
				      struct amdgpu_ih_ring *ih)
{}

/**
 * ih_v6_1_irq_init - init and enable the interrupt ring
 *
 * @adev: amdgpu_device pointer
 *
 * Allocate a ring buffer for the interrupt controller,
 * enable the RLC, disable interrupts, enable the IH
 * ring buffer and enable it.
 * Called at device load and reume.
 * Returns 0 for success, errors for failure.
 */
static int ih_v6_1_irq_init(struct amdgpu_device *adev)
{}

/**
 * ih_v6_1_irq_disable - disable interrupts
 *
 * @adev: amdgpu_device pointer
 *
 * Disable interrupts on the hw.
 */
static void ih_v6_1_irq_disable(struct amdgpu_device *adev)
{}

/**
 * ih_v6_1_get_wptr - get the IH ring buffer wptr
 *
 * @adev: amdgpu_device pointer
 * @ih: amdgpu_ih_ring pointer
 *
 * Get the IH ring buffer wptr from either the register
 * or the writeback memory buffer.  Also check for
 * ring buffer overflow and deal with it.
 * Returns the value of the wptr.
 */
static u32 ih_v6_1_get_wptr(struct amdgpu_device *adev,
			      struct amdgpu_ih_ring *ih)
{}

/**
 * ih_v6_1_irq_rearm - rearm IRQ if lost
 *
 * @adev: amdgpu_device pointer
 * @ih: amdgpu_ih_ring pointer
 *
 */
static void ih_v6_1_irq_rearm(struct amdgpu_device *adev,
			       struct amdgpu_ih_ring *ih)
{}

/**
 * ih_v6_1_set_rptr - set the IH ring buffer rptr
 *
 * @adev: amdgpu_device pointer
 * @ih: amdgpu_ih_ring pointer
 *
 * Set the IH ring buffer rptr.
 */
static void ih_v6_1_set_rptr(struct amdgpu_device *adev,
			       struct amdgpu_ih_ring *ih)
{}

/**
 * ih_v6_1_self_irq - dispatch work for ring 1
 *
 * @adev: amdgpu_device pointer
 * @source: irq source
 * @entry: IV with WPTR update
 *
 * Update the WPTR from the IV and schedule work to handle the entries.
 */
static int ih_v6_1_self_irq(struct amdgpu_device *adev,
			      struct amdgpu_irq_src *source,
			      struct amdgpu_iv_entry *entry)
{}

static const struct amdgpu_irq_src_funcs ih_v6_1_self_irq_funcs =;

static void ih_v6_1_set_self_irq_funcs(struct amdgpu_device *adev)
{}

static int ih_v6_1_early_init(void *handle)
{}

static int ih_v6_1_sw_init(void *handle)
{}

static int ih_v6_1_sw_fini(void *handle)
{}

static int ih_v6_1_hw_init(void *handle)
{}

static int ih_v6_1_hw_fini(void *handle)
{}

static int ih_v6_1_suspend(void *handle)
{}

static int ih_v6_1_resume(void *handle)
{}

static bool ih_v6_1_is_idle(void *handle)
{}

static int ih_v6_1_wait_for_idle(void *handle)
{}

static int ih_v6_1_soft_reset(void *handle)
{}

static void ih_v6_1_update_clockgating_state(struct amdgpu_device *adev,
					       bool enable)
{}

static int ih_v6_1_set_clockgating_state(void *handle,
					   enum amd_clockgating_state state)
{}

static void ih_v6_1_update_ih_mem_power_gating(struct amdgpu_device *adev,
					       bool enable)
{}

static int ih_v6_1_set_powergating_state(void *handle,
					 enum amd_powergating_state state)
{}

static void ih_v6_1_get_clockgating_state(void *handle, u64 *flags)
{}

static const struct amd_ip_funcs ih_v6_1_ip_funcs =;

static const struct amdgpu_ih_funcs ih_v6_1_funcs =;

static void ih_v6_1_set_interrupt_funcs(struct amdgpu_device *adev)
{}

const struct amdgpu_ip_block_version ih_v6_1_ip_block =;