Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright 2012-15 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 
0026 #ifndef __DAL_DCHUBBUB_H__
0027 #define __DAL_DCHUBBUB_H__
0028 
0029 
0030 enum dcc_control {
0031     dcc_control__256_256_xxx,
0032     dcc_control__128_128_xxx,
0033     dcc_control__256_64_64,
0034     dcc_control__256_128_128,
0035 };
0036 
0037 enum segment_order {
0038     segment_order__na,
0039     segment_order__contiguous,
0040     segment_order__non_contiguous,
0041 };
0042 
0043 struct dcn_hubbub_wm_set {
0044     uint32_t wm_set;
0045     uint32_t data_urgent;
0046     uint32_t pte_meta_urgent;
0047     uint32_t sr_enter;
0048     uint32_t sr_exit;
0049     uint32_t dram_clk_chanage;
0050     uint32_t usr_retrain;
0051     uint32_t fclk_pstate_change;
0052 };
0053 
0054 struct dcn_hubbub_wm {
0055     struct dcn_hubbub_wm_set sets[4];
0056 };
0057 
0058 enum dcn_hubbub_page_table_depth {
0059     DCN_PAGE_TABLE_DEPTH_1_LEVEL,
0060     DCN_PAGE_TABLE_DEPTH_2_LEVEL,
0061     DCN_PAGE_TABLE_DEPTH_3_LEVEL,
0062     DCN_PAGE_TABLE_DEPTH_4_LEVEL
0063 };
0064 
0065 enum dcn_hubbub_page_table_block_size {
0066     DCN_PAGE_TABLE_BLOCK_SIZE_4KB = 0,
0067     DCN_PAGE_TABLE_BLOCK_SIZE_64KB = 4,
0068     DCN_PAGE_TABLE_BLOCK_SIZE_32KB = 3
0069 };
0070 
0071 struct dcn_hubbub_phys_addr_config {
0072     struct {
0073         uint64_t fb_top;
0074         uint64_t fb_offset;
0075         uint64_t fb_base;
0076         uint64_t agp_top;
0077         uint64_t agp_bot;
0078         uint64_t agp_base;
0079     } system_aperture;
0080 
0081     struct {
0082         uint64_t page_table_start_addr;
0083         uint64_t page_table_end_addr;
0084         uint64_t page_table_base_addr;
0085     } gart_config;
0086 
0087     uint64_t page_table_default_page_addr;
0088 };
0089 
0090 struct dcn_hubbub_virt_addr_config {
0091     uint64_t                page_table_start_addr;
0092     uint64_t                page_table_end_addr;
0093     enum dcn_hubbub_page_table_block_size   page_table_block_size;
0094     enum dcn_hubbub_page_table_depth    page_table_depth;
0095     uint64_t                page_table_base_addr;
0096 };
0097 
0098 struct hubbub_addr_config {
0099     struct dcn_hubbub_phys_addr_config pa_config;
0100     struct dcn_hubbub_virt_addr_config va_config;
0101     struct {
0102         uint64_t aperture_check_fault;
0103         uint64_t generic_fault;
0104     } default_addrs;
0105 };
0106 
0107 struct dcn_hubbub_state {
0108     uint32_t vm_fault_addr_msb;
0109     uint32_t vm_fault_addr_lsb;
0110     uint32_t vm_error_status;
0111     uint32_t vm_error_vmid;
0112     uint32_t vm_error_pipe;
0113     uint32_t vm_error_mode;
0114 };
0115 
0116 struct hubbub_funcs {
0117     void (*update_dchub)(
0118             struct hubbub *hubbub,
0119             struct dchub_init_data *dh_data);
0120 
0121     int (*init_dchub_sys_ctx)(
0122             struct hubbub *hubbub,
0123             struct dcn_hubbub_phys_addr_config *pa_config);
0124     void (*init_vm_ctx)(
0125             struct hubbub *hubbub,
0126             struct dcn_hubbub_virt_addr_config *va_config,
0127             int vmid);
0128 
0129     bool (*get_dcc_compression_cap)(struct hubbub *hubbub,
0130             const struct dc_dcc_surface_param *input,
0131             struct dc_surface_dcc_cap *output);
0132 
0133     bool (*dcc_support_swizzle)(
0134             enum swizzle_mode_values swizzle,
0135             unsigned int bytes_per_element,
0136             enum segment_order *segment_order_horz,
0137             enum segment_order *segment_order_vert);
0138 
0139     bool (*dcc_support_pixel_format)(
0140             enum surface_pixel_format format,
0141             unsigned int *bytes_per_element);
0142 
0143     void (*wm_read_state)(struct hubbub *hubbub,
0144             struct dcn_hubbub_wm *wm);
0145 
0146     void (*get_dchub_ref_freq)(struct hubbub *hubbub,
0147             unsigned int dccg_ref_freq_inKhz,
0148             unsigned int *dchub_ref_freq_inKhz);
0149 
0150     bool (*program_watermarks)(
0151             struct hubbub *hubbub,
0152             struct dcn_watermark_set *watermarks,
0153             unsigned int refclk_mhz,
0154             bool safe_to_lower);
0155 
0156     bool (*is_allow_self_refresh_enabled)(struct hubbub *hubbub);
0157     void (*allow_self_refresh_control)(struct hubbub *hubbub, bool allow);
0158 
0159     bool (*verify_allow_pstate_change_high)(struct hubbub *hubbub);
0160 
0161     void (*apply_DEDCN21_147_wa)(struct hubbub *hubbub);
0162 
0163     void (*force_wm_propagate_to_pipes)(struct hubbub *hubbub);
0164 
0165     void (*hubbub_read_state)(struct hubbub *hubbub, struct dcn_hubbub_state *hubbub_state);
0166 
0167     void (*force_pstate_change_control)(struct hubbub *hubbub, bool force, bool allow);
0168 
0169     void (*init_watermarks)(struct hubbub *hubbub);
0170     void (*program_det_size)(struct hubbub *hubbub, int hubp_inst, unsigned det_buffer_size_in_kbyte);
0171     void (*program_compbuf_size)(struct hubbub *hubbub, unsigned compbuf_size_kb, bool safe_to_increase);
0172     void (*init_crb)(struct hubbub *hubbub);
0173     void (*force_usr_retraining_allow)(struct hubbub *hubbub, bool allow);
0174 };
0175 
0176 struct hubbub {
0177     const struct hubbub_funcs *funcs;
0178     struct dc_context *ctx;
0179     bool riommu_active;
0180 };
0181 
0182 #endif