linux/drivers/gpu/drm/amd/display/dc/resource/dcn20/dcn20_resource.c

/*
* Copyright 2016 Advanced Micro Devices, Inc.
 * Copyright 2019 Raptor Engineering, LLC
 *
 * 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.
 *
 * Authors: AMD
 *
 */

#include "dm_services.h"
#include "dc.h"

#include "dcn20/dcn20_init.h"

#include "resource.h"
#include "include/irq_service_interface.h"
#include "dcn20/dcn20_resource.h"

#include "dml/dcn20/dcn20_fpu.h"

#include "dcn10/dcn10_hubp.h"
#include "dcn10/dcn10_ipp.h"
#include "dcn20/dcn20_hubbub.h"
#include "dcn20/dcn20_mpc.h"
#include "dcn20/dcn20_hubp.h"
#include "irq/dcn20/irq_service_dcn20.h"
#include "dcn20/dcn20_dpp.h"
#include "dcn20/dcn20_optc.h"
#include "dcn20/dcn20_hwseq.h"
#include "dce110/dce110_hwseq.h"
#include "dcn10/dcn10_resource.h"
#include "dcn20/dcn20_opp.h"

#include "dcn20/dcn20_dsc.h"

#include "dcn20/dcn20_link_encoder.h"
#include "dcn20/dcn20_stream_encoder.h"
#include "dce/dce_clock_source.h"
#include "dce/dce_audio.h"
#include "dce/dce_hwseq.h"
#include "virtual/virtual_stream_encoder.h"
#include "dce110/dce110_resource.h"
#include "dml/display_mode_vba.h"
#include "dcn20/dcn20_dccg.h"
#include "dcn20/dcn20_vmid.h"
#include "dce/dce_panel_cntl.h"

#include "dcn20/dcn20_dwb.h"
#include "dcn20/dcn20_mmhubbub.h"

#include "navi10_ip_offset.h"

#include "dcn/dcn_2_0_0_offset.h"
#include "dcn/dcn_2_0_0_sh_mask.h"
#include "dpcs/dpcs_2_0_0_offset.h"
#include "dpcs/dpcs_2_0_0_sh_mask.h"

#include "nbio/nbio_2_3_offset.h"

#include "mmhub/mmhub_2_0_0_offset.h"
#include "mmhub/mmhub_2_0_0_sh_mask.h"

#include "reg_helper.h"
#include "dce/dce_abm.h"
#include "dce/dce_dmcu.h"
#include "dce/dce_aux.h"
#include "dce/dce_i2c.h"
#include "vm_helper.h"

#include "link_enc_cfg.h"
#include "link.h"

#define DC_LOGGER_INIT(logger)

#ifndef mmDP0_DP_DPHY_INTERNAL_CTRL
	#define mmDP0_DP_DPHY_INTERNAL_CTRL
	#define mmDP0_DP_DPHY_INTERNAL_CTRL_BASE_IDX
	#define mmDP1_DP_DPHY_INTERNAL_CTRL
	#define mmDP1_DP_DPHY_INTERNAL_CTRL_BASE_IDX
	#define mmDP2_DP_DPHY_INTERNAL_CTRL
	#define mmDP2_DP_DPHY_INTERNAL_CTRL_BASE_IDX
	#define mmDP3_DP_DPHY_INTERNAL_CTRL
	#define mmDP3_DP_DPHY_INTERNAL_CTRL_BASE_IDX
	#define mmDP4_DP_DPHY_INTERNAL_CTRL
	#define mmDP4_DP_DPHY_INTERNAL_CTRL_BASE_IDX
	#define mmDP5_DP_DPHY_INTERNAL_CTRL
	#define mmDP5_DP_DPHY_INTERNAL_CTRL_BASE_IDX
	#define mmDP6_DP_DPHY_INTERNAL_CTRL
	#define mmDP6_DP_DPHY_INTERNAL_CTRL_BASE_IDX
#endif


enum dcn20_clk_src_array_id {};

/* begin *********************
 * macros to expend register list macro defined in HW object header file */

/* DCN */
#define BASE_INNER(seg)

#define BASE(seg)

#define SR(reg_name)

#define SRI(reg_name, block, id)

#define SRI2_DWB(reg_name, block, id)
#define SF_DWB(reg_name, field_name, post_fix)

#define SF_DWB2(reg_name, block, id, field_name, post_fix)

#define SRIR(var_name, reg_name, block, id)

#define SRII(reg_name, block, id)

#define DCCG_SRII(reg_name, block, id)

#define VUPDATE_SRII(reg_name, block, id)

/* NBIO */
#define NBIO_BASE_INNER(seg)

#define NBIO_BASE(seg)

#define NBIO_SR(reg_name)

/* MMHUB */
#define MMHUB_BASE_INNER(seg)

#define MMHUB_BASE(seg)

#define MMHUB_SR(reg_name)

static const struct bios_registers bios_regs =;

#define clk_src_regs(index, pllid)

static const struct dce110_clk_src_regs clk_src_regs[] =;

static const struct dce110_clk_src_shift cs_shift =;

static const struct dce110_clk_src_mask cs_mask =;

static const struct dce_dmcu_registers dmcu_regs =;

static const struct dce_dmcu_shift dmcu_shift =;

static const struct dce_dmcu_mask dmcu_mask =;

static const struct dce_abm_registers abm_regs =;

static const struct dce_abm_shift abm_shift =;

static const struct dce_abm_mask abm_mask =;

#define audio_regs(id)

static const struct dce_audio_registers audio_regs[] =;

#define DCE120_AUD_COMMON_MASK_SH_LIST(mask_sh)

static const struct dce_audio_shift audio_shift =;

static const struct dce_audio_mask audio_mask =;

#define stream_enc_regs(id)

static const struct dcn10_stream_enc_registers stream_enc_regs[] =;

static const struct dcn10_stream_encoder_shift se_shift =;

static const struct dcn10_stream_encoder_mask se_mask =;


#define aux_regs(id)

static const struct dcn10_link_enc_aux_registers link_enc_aux_regs[] =;

#define hpd_regs(id)

static const struct dcn10_link_enc_hpd_registers link_enc_hpd_regs[] =;

#define link_regs(id, phyid)

static const struct dcn10_link_enc_registers link_enc_regs[] =;

static const struct dcn10_link_enc_shift le_shift =;

static const struct dcn10_link_enc_mask le_mask =;

static const struct dce_panel_cntl_registers panel_cntl_regs[] =;

static const struct dce_panel_cntl_shift panel_cntl_shift =;

static const struct dce_panel_cntl_mask panel_cntl_mask =;

#define ipp_regs(id)

static const struct dcn10_ipp_registers ipp_regs[] =;

static const struct dcn10_ipp_shift ipp_shift =;

static const struct dcn10_ipp_mask ipp_mask =;

#define opp_regs(id)

static const struct dcn20_opp_registers opp_regs[] =;

static const struct dcn20_opp_shift opp_shift =;

static const struct dcn20_opp_mask opp_mask =;

#define aux_engine_regs(id)

static const struct dce110_aux_registers aux_engine_regs[] =;

#define tf_regs(id)

static const struct dcn2_dpp_registers tf_regs[] =;

static const struct dcn2_dpp_shift tf_shift =;

static const struct dcn2_dpp_mask tf_mask =;

#define dwbc_regs_dcn2(id)

static const struct dcn20_dwbc_registers dwbc20_regs[] =;

static const struct dcn20_dwbc_shift dwbc20_shift =;

static const struct dcn20_dwbc_mask dwbc20_mask =;

#define mcif_wb_regs_dcn2(id)

static const struct dcn20_mmhubbub_registers mcif_wb20_regs[] =;

static const struct dcn20_mmhubbub_shift mcif_wb20_shift =;

static const struct dcn20_mmhubbub_mask mcif_wb20_mask =;

static const struct dcn20_mpc_registers mpc_regs =;

static const struct dcn20_mpc_shift mpc_shift =;

static const struct dcn20_mpc_mask mpc_mask =;

#define tg_regs(id)


static const struct dcn_optc_registers tg_regs[] =;

static const struct dcn_optc_shift tg_shift =;

static const struct dcn_optc_mask tg_mask =;

#define hubp_regs(id)

static const struct dcn_hubp2_registers hubp_regs[] =;

static const struct dcn_hubp2_shift hubp_shift =;

static const struct dcn_hubp2_mask hubp_mask =;

static const struct dcn_hubbub_registers hubbub_reg =;

static const struct dcn_hubbub_shift hubbub_shift =;

static const struct dcn_hubbub_mask hubbub_mask =;

#define vmid_regs(id)

static const struct dcn_vmid_registers vmid_regs[] =;

static const struct dcn20_vmid_shift vmid_shifts =;

static const struct dcn20_vmid_mask vmid_masks =;

static const struct dce110_aux_registers_shift aux_shift =;

static const struct dce110_aux_registers_mask aux_mask =;

static int map_transmitter_id_to_phy_instance(
	enum transmitter transmitter)
{}

#define dsc_regsDCN20(id)

static const struct dcn20_dsc_registers dsc_regs[] =;

static const struct dcn20_dsc_shift dsc_shift =;

static const struct dcn20_dsc_mask dsc_mask =;

static const struct dccg_registers dccg_regs =;

static const struct dccg_shift dccg_shift =;

static const struct dccg_mask dccg_mask =;

static const struct resource_caps res_cap_nv10 =;

static const struct dc_plane_cap plane_cap =;
static const struct resource_caps res_cap_nv14 =;

static const struct dc_debug_options debug_defaults_drv =;

void dcn20_dpp_destroy(struct dpp **dpp)
{}

struct dpp *dcn20_dpp_create(
	struct dc_context *ctx,
	uint32_t inst)
{}

struct input_pixel_processor *dcn20_ipp_create(
	struct dc_context *ctx, uint32_t inst)
{}


struct output_pixel_processor *dcn20_opp_create(
	struct dc_context *ctx, uint32_t inst)
{}

struct dce_aux *dcn20_aux_engine_create(
	struct dc_context *ctx,
	uint32_t inst)
{}
#define i2c_inst_regs(id)

static const struct dce_i2c_registers i2c_hw_regs[] =;

static const struct dce_i2c_shift i2c_shifts =;

static const struct dce_i2c_mask i2c_masks =;

struct dce_i2c_hw *dcn20_i2c_hw_create(
	struct dc_context *ctx,
	uint32_t inst)
{}
struct mpc *dcn20_mpc_create(struct dc_context *ctx)
{}

struct hubbub *dcn20_hubbub_create(struct dc_context *ctx)
{}

struct timing_generator *dcn20_timing_generator_create(
		struct dc_context *ctx,
		uint32_t instance)
{}

static const struct encoder_feature_support link_enc_feature =;

struct link_encoder *dcn20_link_encoder_create(
	struct dc_context *ctx,
	const struct encoder_init_data *enc_init_data)
{}

static struct panel_cntl *dcn20_panel_cntl_create(const struct panel_cntl_init_data *init_data)
{}

static struct clock_source *dcn20_clock_source_create(
	struct dc_context *ctx,
	struct dc_bios *bios,
	enum clock_source_id id,
	const struct dce110_clk_src_regs *regs,
	bool dp_clk_src)
{}

static void read_dce_straps(
	struct dc_context *ctx,
	struct resource_straps *straps)
{}

static struct audio *dcn20_create_audio(
		struct dc_context *ctx, unsigned int inst)
{}

struct stream_encoder *dcn20_stream_encoder_create(
	enum engine_id eng_id,
	struct dc_context *ctx)
{}

static const struct dce_hwseq_registers hwseq_reg =;

static const struct dce_hwseq_shift hwseq_shift =;

static const struct dce_hwseq_mask hwseq_mask =;

struct dce_hwseq *dcn20_hwseq_create(
	struct dc_context *ctx)
{}

static const struct resource_create_funcs res_create_funcs =;

static void dcn20_pp_smu_destroy(struct pp_smu_funcs **pp_smu);

void dcn20_clock_source_destroy(struct clock_source **clk_src)
{}


struct display_stream_compressor *dcn20_dsc_create(
	struct dc_context *ctx, uint32_t inst)
{}

void dcn20_dsc_destroy(struct display_stream_compressor **dsc)
{}


static void dcn20_resource_destruct(struct dcn20_resource_pool *pool)
{}

struct hubp *dcn20_hubp_create(
	struct dc_context *ctx,
	uint32_t inst)
{}

static void get_pixel_clock_parameters(
	struct pipe_ctx *pipe_ctx,
	struct pixel_clk_params *pixel_clk_params)
{}

static void build_clamping_params(struct dc_stream_state *stream)
{}

void dcn20_build_pipe_pix_clk_params(struct pipe_ctx *pipe_ctx)
{}

static enum dc_status build_pipe_hw_param(struct pipe_ctx *pipe_ctx)
{}

enum dc_status dcn20_build_mapped_resource(const struct dc *dc, struct dc_state *context, struct dc_stream_state *stream)
{}


void dcn20_acquire_dsc(const struct dc *dc,
			struct resource_context *res_ctx,
			struct display_stream_compressor **dsc,
			int pipe_idx)
{}

void dcn20_release_dsc(struct resource_context *res_ctx,
			const struct resource_pool *pool,
			struct display_stream_compressor **dsc)
{}



enum dc_status dcn20_add_dsc_to_stream_resource(struct dc *dc,
		struct dc_state *dc_ctx,
		struct dc_stream_state *dc_stream)
{}


static enum dc_status remove_dsc_from_stream_resource(struct dc *dc,
		struct dc_state *new_ctx,
		struct dc_stream_state *dc_stream)
{}


enum dc_status dcn20_add_stream_to_ctx(struct dc *dc, struct dc_state *new_ctx, struct dc_stream_state *dc_stream)
{}


enum dc_status dcn20_remove_stream_from_ctx(struct dc *dc, struct dc_state *new_ctx, struct dc_stream_state *dc_stream)
{}

/**
 * dcn20_split_stream_for_odm - Check if stream can be splited for ODM
 *
 * @dc: DC object with resource pool info required for pipe split
 * @res_ctx: Persistent state of resources
 * @prev_odm_pipe: Reference to the previous ODM pipe
 * @next_odm_pipe: Reference to the next ODM pipe
 *
 * This function takes a logically active pipe and a logically free pipe and
 * halves all the scaling parameters that need to be halved while populating
 * the free pipe with the required resources and configuring the next/previous
 * ODM pipe pointers.
 *
 * Return:
 * Return true if split stream for ODM is possible, otherwise, return false.
 */
bool dcn20_split_stream_for_odm(
		const struct dc *dc,
		struct resource_context *res_ctx,
		struct pipe_ctx *prev_odm_pipe,
		struct pipe_ctx *next_odm_pipe)
{}

void dcn20_split_stream_for_mpc(
		struct resource_context *res_ctx,
		const struct resource_pool *pool,
		struct pipe_ctx *primary_pipe,
		struct pipe_ctx *secondary_pipe)
{}

unsigned int dcn20_calc_max_scaled_time(
		unsigned int time_per_pixel,
		enum mmhubbub_wbif_mode mode,
		unsigned int urgent_watermark)
{}

void dcn20_set_mcif_arb_params(
		struct dc *dc,
		struct dc_state *context,
		display_e2e_pipe_params_st *pipes,
		int pipe_cnt)
{}

bool dcn20_validate_dsc(struct dc *dc, struct dc_state *new_ctx)
{}

struct pipe_ctx *dcn20_find_secondary_pipe(struct dc *dc,
		struct resource_context *res_ctx,
		const struct resource_pool *pool,
		const struct pipe_ctx *primary_pipe)
{}

void dcn20_merge_pipes_for_validate(
		struct dc *dc,
		struct dc_state *context)
{}

int dcn20_validate_apply_pipe_split_flags(
		struct dc *dc,
		struct dc_state *context,
		int vlevel,
		int *split,
		bool *merge)
{}

bool dcn20_fast_validate_bw(
		struct dc *dc,
		struct dc_state *context,
		display_e2e_pipe_params_st *pipes,
		int *pipe_cnt_out,
		int *pipe_split_from,
		int *vlevel_out,
		bool fast_validate)
{}

bool dcn20_validate_bandwidth(struct dc *dc, struct dc_state *context,
		bool fast_validate)
{}

struct pipe_ctx *dcn20_acquire_free_pipe_for_layer(
		const struct dc_state *cur_ctx,
		struct dc_state *new_ctx,
		const struct resource_pool *pool,
		const struct pipe_ctx *opp_head)
{}

bool dcn20_get_dcc_compression_cap(const struct dc *dc,
		const struct dc_dcc_surface_param *input,
		struct dc_surface_dcc_cap *output)
{}

static void dcn20_destroy_resource_pool(struct resource_pool **pool)
{}


static struct dc_cap_funcs cap_funcs =;


enum dc_status dcn20_patch_unknown_plane_state(struct dc_plane_state *plane_state)
{}

void dcn20_release_pipe(struct dc_state *context,
			struct pipe_ctx *pipe,
			const struct resource_pool *pool)
{}

static const struct resource_funcs dcn20_res_pool_funcs =;

bool dcn20_dwbc_create(struct dc_context *ctx, struct resource_pool *pool)
{}

bool dcn20_mmhubbub_create(struct dc_context *ctx, struct resource_pool *pool)
{}

static struct pp_smu_funcs *dcn20_pp_smu_create(struct dc_context *ctx)
{}

static void dcn20_pp_smu_destroy(struct pp_smu_funcs **pp_smu)
{}

static struct _vcs_dpi_soc_bounding_box_st *get_asic_rev_soc_bb(
	uint32_t hw_internal_rev)
{}

static struct _vcs_dpi_ip_params_st *get_asic_rev_ip_params(
	uint32_t hw_internal_rev)
{}

static enum dml_project get_dml_project_version(uint32_t hw_internal_rev)
{}

static bool init_soc_bounding_box(struct dc *dc,
				  struct dcn20_resource_pool *pool)
{}

static bool dcn20_resource_construct(
	uint8_t num_virtual_links,
	struct dc *dc,
	struct dcn20_resource_pool *pool)
{}

struct resource_pool *dcn20_create_resource_pool(
		const struct dc_init_data *init_data,
		struct dc *dc)
{}