Back to home page

OSCL-LXR

 
 

    


0001 /*
0002 * Copyright 2020 Advanced Micro Devices, Inc.
0003  *
0004  * Permission is hereby granted, free of charge, to any person obtaining a
0005  * copy of this software and associated documentation files (the "Software"),
0006  * to deal in the Software without restriction, including without limitation
0007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
0008  * and/or sell copies of the Software, and to permit persons to whom the
0009  * Software is furnished to do so, subject to the following conditions:
0010  *
0011  * The above copyright notice and this permission notice shall be included in
0012  * all copies or substantial portions of the Software.
0013  *
0014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0015  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
0017  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
0018  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
0019  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
0020  * OTHER DEALINGS IN THE SOFTWARE.
0021  *
0022  * Authors: AMD
0023  *
0024  */
0025 #include "dm_services.h"
0026 #include "dcn301_hubbub.h"
0027 #include "reg_helper.h"
0028 
0029 #define REG(reg)\
0030     hubbub1->regs->reg
0031 #define DC_LOGGER \
0032     hubbub1->base.ctx->logger
0033 #define CTX \
0034     hubbub1->base.ctx
0035 
0036 #undef FN
0037 #define FN(reg_name, field_name) \
0038     hubbub1->shifts->field_name, hubbub1->masks->field_name
0039 
0040 #define REG(reg)\
0041     hubbub1->regs->reg
0042 
0043 #define CTX \
0044     hubbub1->base.ctx
0045 
0046 #undef FN
0047 #define FN(reg_name, field_name) \
0048     hubbub1->shifts->field_name, hubbub1->masks->field_name
0049 
0050 
0051 static const struct hubbub_funcs hubbub301_funcs = {
0052     .update_dchub = hubbub2_update_dchub,
0053     .init_dchub_sys_ctx = hubbub21_init_dchub,
0054     .init_vm_ctx = hubbub2_init_vm_ctx,
0055     .dcc_support_swizzle = hubbub3_dcc_support_swizzle,
0056     .dcc_support_pixel_format = hubbub2_dcc_support_pixel_format,
0057     .get_dcc_compression_cap = hubbub3_get_dcc_compression_cap,
0058     .wm_read_state = hubbub21_wm_read_state,
0059     .get_dchub_ref_freq = hubbub2_get_dchub_ref_freq,
0060     .program_watermarks = hubbub3_program_watermarks,
0061     .allow_self_refresh_control = hubbub1_allow_self_refresh_control,
0062     .is_allow_self_refresh_enabled = hubbub1_is_allow_self_refresh_enabled,
0063     .verify_allow_pstate_change_high = hubbub1_verify_allow_pstate_change_high,
0064     .force_wm_propagate_to_pipes = hubbub3_force_wm_propagate_to_pipes,
0065     .force_pstate_change_control = hubbub3_force_pstate_change_control,
0066     .hubbub_read_state = hubbub2_read_state,
0067 };
0068 
0069 void hubbub301_construct(struct dcn20_hubbub *hubbub3,
0070     struct dc_context *ctx,
0071     const struct dcn_hubbub_registers *hubbub_regs,
0072     const struct dcn_hubbub_shift *hubbub_shift,
0073     const struct dcn_hubbub_mask *hubbub_mask)
0074 {
0075     hubbub3->base.ctx = ctx;
0076     hubbub3->base.funcs = &hubbub301_funcs;
0077     hubbub3->regs = hubbub_regs;
0078     hubbub3->shifts = hubbub_shift;
0079     hubbub3->masks = hubbub_mask;
0080 
0081     hubbub3->debug_test_index_pstate = 0xB;
0082     hubbub3->detile_buf_size = 184 * 1024; /* 184KB for DCN3 */
0083 }