1bbeb64d0SHarry Wentland /* 2bbeb64d0SHarry Wentland * Copyright 2016 Advanced Micro Devices, Inc. 3bbeb64d0SHarry Wentland * 4bbeb64d0SHarry Wentland * Permission is hereby granted, free of charge, to any person obtaining a 5bbeb64d0SHarry Wentland * copy of this software and associated documentation files (the "Software"), 6bbeb64d0SHarry Wentland * to deal in the Software without restriction, including without limitation 7bbeb64d0SHarry Wentland * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8bbeb64d0SHarry Wentland * and/or sell copies of the Software, and to permit persons to whom the 9bbeb64d0SHarry Wentland * Software is furnished to do so, subject to the following conditions: 10bbeb64d0SHarry Wentland * 11bbeb64d0SHarry Wentland * The above copyright notice and this permission notice shall be included in 12bbeb64d0SHarry Wentland * all copies or substantial portions of the Software. 13bbeb64d0SHarry Wentland * 14bbeb64d0SHarry Wentland * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15bbeb64d0SHarry Wentland * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16bbeb64d0SHarry Wentland * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17bbeb64d0SHarry Wentland * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18bbeb64d0SHarry Wentland * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19bbeb64d0SHarry Wentland * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20bbeb64d0SHarry Wentland * OTHER DEALINGS IN THE SOFTWARE. 21bbeb64d0SHarry Wentland * 22bbeb64d0SHarry Wentland * Authors: AMD 23bbeb64d0SHarry Wentland * 24bbeb64d0SHarry Wentland */ 25bbeb64d0SHarry Wentland 26bbeb64d0SHarry Wentland 27bbeb64d0SHarry Wentland #include "dcn20_hubbub.h" 28bbeb64d0SHarry Wentland #include "reg_helper.h" 29057fc695SJun Lei #include "clk_mgr.h" 30bbeb64d0SHarry Wentland 31bbeb64d0SHarry Wentland #define REG(reg)\ 32bbeb64d0SHarry Wentland hubbub1->regs->reg 33bbeb64d0SHarry Wentland 34bbeb64d0SHarry Wentland #define CTX \ 35bbeb64d0SHarry Wentland hubbub1->base.ctx 36bbeb64d0SHarry Wentland 37bbeb64d0SHarry Wentland #undef FN 38bbeb64d0SHarry Wentland #define FN(reg_name, field_name) \ 39bbeb64d0SHarry Wentland hubbub1->shifts->field_name, hubbub1->masks->field_name 40bbeb64d0SHarry Wentland 41bbeb64d0SHarry Wentland #define REG(reg)\ 42bbeb64d0SHarry Wentland hubbub1->regs->reg 43bbeb64d0SHarry Wentland 44bbeb64d0SHarry Wentland #define CTX \ 45bbeb64d0SHarry Wentland hubbub1->base.ctx 46bbeb64d0SHarry Wentland 47bbeb64d0SHarry Wentland #undef FN 48bbeb64d0SHarry Wentland #define FN(reg_name, field_name) \ 49bbeb64d0SHarry Wentland hubbub1->shifts->field_name, hubbub1->masks->field_name 50bbeb64d0SHarry Wentland 51bda9afdaSDmytro Laktyushkin #ifdef NUM_VMID 52bda9afdaSDmytro Laktyushkin #undef NUM_VMID 53bda9afdaSDmytro Laktyushkin #endif 54bda9afdaSDmytro Laktyushkin #define NUM_VMID 16 55bda9afdaSDmytro Laktyushkin 56bbeb64d0SHarry Wentland bool hubbub2_dcc_support_swizzle( 57bbeb64d0SHarry Wentland enum swizzle_mode_values swizzle, 58bbeb64d0SHarry Wentland unsigned int bytes_per_element, 59bbeb64d0SHarry Wentland enum segment_order *segment_order_horz, 60bbeb64d0SHarry Wentland enum segment_order *segment_order_vert) 61bbeb64d0SHarry Wentland { 62bbeb64d0SHarry Wentland bool standard_swizzle = false; 63bbeb64d0SHarry Wentland bool display_swizzle = false; 64bbeb64d0SHarry Wentland bool render_swizzle = false; 65bbeb64d0SHarry Wentland 66bbeb64d0SHarry Wentland switch (swizzle) { 67bbeb64d0SHarry Wentland case DC_SW_4KB_S: 68bbeb64d0SHarry Wentland case DC_SW_64KB_S: 69bbeb64d0SHarry Wentland case DC_SW_VAR_S: 70bbeb64d0SHarry Wentland case DC_SW_4KB_S_X: 71bbeb64d0SHarry Wentland case DC_SW_64KB_S_X: 72bbeb64d0SHarry Wentland case DC_SW_VAR_S_X: 73bbeb64d0SHarry Wentland standard_swizzle = true; 74bbeb64d0SHarry Wentland break; 75bbeb64d0SHarry Wentland case DC_SW_64KB_R_X: 76bbeb64d0SHarry Wentland render_swizzle = true; 77bbeb64d0SHarry Wentland break; 78bbeb64d0SHarry Wentland case DC_SW_4KB_D: 79bbeb64d0SHarry Wentland case DC_SW_64KB_D: 80bbeb64d0SHarry Wentland case DC_SW_VAR_D: 81bbeb64d0SHarry Wentland case DC_SW_4KB_D_X: 82bbeb64d0SHarry Wentland case DC_SW_64KB_D_X: 83bbeb64d0SHarry Wentland case DC_SW_VAR_D_X: 84bbeb64d0SHarry Wentland display_swizzle = true; 85bbeb64d0SHarry Wentland break; 86bbeb64d0SHarry Wentland default: 87bbeb64d0SHarry Wentland break; 88bbeb64d0SHarry Wentland } 89bbeb64d0SHarry Wentland 90bbeb64d0SHarry Wentland if (standard_swizzle) { 91bbeb64d0SHarry Wentland if (bytes_per_element == 1) { 92bbeb64d0SHarry Wentland *segment_order_horz = segment_order__contiguous; 93bbeb64d0SHarry Wentland *segment_order_vert = segment_order__na; 94bbeb64d0SHarry Wentland return true; 95bbeb64d0SHarry Wentland } 96bbeb64d0SHarry Wentland if (bytes_per_element == 2) { 97bbeb64d0SHarry Wentland *segment_order_horz = segment_order__non_contiguous; 98bbeb64d0SHarry Wentland *segment_order_vert = segment_order__contiguous; 99bbeb64d0SHarry Wentland return true; 100bbeb64d0SHarry Wentland } 101bbeb64d0SHarry Wentland if (bytes_per_element == 4) { 102bbeb64d0SHarry Wentland *segment_order_horz = segment_order__non_contiguous; 103bbeb64d0SHarry Wentland *segment_order_vert = segment_order__contiguous; 104bbeb64d0SHarry Wentland return true; 105bbeb64d0SHarry Wentland } 106bbeb64d0SHarry Wentland if (bytes_per_element == 8) { 107bbeb64d0SHarry Wentland *segment_order_horz = segment_order__na; 108bbeb64d0SHarry Wentland *segment_order_vert = segment_order__contiguous; 109bbeb64d0SHarry Wentland return true; 110bbeb64d0SHarry Wentland } 111bbeb64d0SHarry Wentland } 112bbeb64d0SHarry Wentland if (render_swizzle) { 113bbeb64d0SHarry Wentland if (bytes_per_element == 2) { 114bbeb64d0SHarry Wentland *segment_order_horz = segment_order__contiguous; 115bbeb64d0SHarry Wentland *segment_order_vert = segment_order__contiguous; 116bbeb64d0SHarry Wentland return true; 117bbeb64d0SHarry Wentland } 118bbeb64d0SHarry Wentland if (bytes_per_element == 4) { 119bbeb64d0SHarry Wentland *segment_order_horz = segment_order__non_contiguous; 120bbeb64d0SHarry Wentland *segment_order_vert = segment_order__contiguous; 121bbeb64d0SHarry Wentland return true; 122bbeb64d0SHarry Wentland } 123bbeb64d0SHarry Wentland if (bytes_per_element == 8) { 124bbeb64d0SHarry Wentland *segment_order_horz = segment_order__contiguous; 125bbeb64d0SHarry Wentland *segment_order_vert = segment_order__non_contiguous; 126bbeb64d0SHarry Wentland return true; 127bbeb64d0SHarry Wentland } 128bbeb64d0SHarry Wentland } 129bbeb64d0SHarry Wentland if (display_swizzle && bytes_per_element == 8) { 130bbeb64d0SHarry Wentland *segment_order_horz = segment_order__contiguous; 131bbeb64d0SHarry Wentland *segment_order_vert = segment_order__non_contiguous; 132bbeb64d0SHarry Wentland return true; 133bbeb64d0SHarry Wentland } 134bbeb64d0SHarry Wentland 135bbeb64d0SHarry Wentland return false; 136bbeb64d0SHarry Wentland } 137bbeb64d0SHarry Wentland 138bbeb64d0SHarry Wentland bool hubbub2_dcc_support_pixel_format( 139bbeb64d0SHarry Wentland enum surface_pixel_format format, 140bbeb64d0SHarry Wentland unsigned int *bytes_per_element) 141bbeb64d0SHarry Wentland { 142bbeb64d0SHarry Wentland /* DML: get_bytes_per_element */ 143bbeb64d0SHarry Wentland switch (format) { 144bbeb64d0SHarry Wentland case SURFACE_PIXEL_FORMAT_GRPH_ARGB1555: 145bbeb64d0SHarry Wentland case SURFACE_PIXEL_FORMAT_GRPH_RGB565: 146bbeb64d0SHarry Wentland *bytes_per_element = 2; 147bbeb64d0SHarry Wentland return true; 148bbeb64d0SHarry Wentland case SURFACE_PIXEL_FORMAT_GRPH_ARGB8888: 149bbeb64d0SHarry Wentland case SURFACE_PIXEL_FORMAT_GRPH_ABGR8888: 150bbeb64d0SHarry Wentland case SURFACE_PIXEL_FORMAT_GRPH_ARGB2101010: 151bbeb64d0SHarry Wentland case SURFACE_PIXEL_FORMAT_GRPH_ABGR2101010: 152bbeb64d0SHarry Wentland case SURFACE_PIXEL_FORMAT_GRPH_RGB111110_FIX: 153bbeb64d0SHarry Wentland case SURFACE_PIXEL_FORMAT_GRPH_BGR101111_FIX: 154bbeb64d0SHarry Wentland case SURFACE_PIXEL_FORMAT_GRPH_RGB111110_FLOAT: 155bbeb64d0SHarry Wentland case SURFACE_PIXEL_FORMAT_GRPH_BGR101111_FLOAT: 1568f712e3eSBhawanpreet Lakha case SURFACE_PIXEL_FORMAT_GRPH_RGBE: 1578f712e3eSBhawanpreet Lakha case SURFACE_PIXEL_FORMAT_GRPH_RGBE_ALPHA: 158bbeb64d0SHarry Wentland *bytes_per_element = 4; 159bbeb64d0SHarry Wentland return true; 160bbeb64d0SHarry Wentland case SURFACE_PIXEL_FORMAT_GRPH_ARGB16161616: 161050cd3d6SMario Kleiner case SURFACE_PIXEL_FORMAT_GRPH_ABGR16161616: 162bbeb64d0SHarry Wentland case SURFACE_PIXEL_FORMAT_GRPH_ARGB16161616F: 163bbeb64d0SHarry Wentland case SURFACE_PIXEL_FORMAT_GRPH_ABGR16161616F: 164bbeb64d0SHarry Wentland *bytes_per_element = 8; 165bbeb64d0SHarry Wentland return true; 166bbeb64d0SHarry Wentland default: 167bbeb64d0SHarry Wentland return false; 168bbeb64d0SHarry Wentland } 169bbeb64d0SHarry Wentland } 170bbeb64d0SHarry Wentland 171bbeb64d0SHarry Wentland static void hubbub2_get_blk256_size(unsigned int *blk256_width, unsigned int *blk256_height, 172bbeb64d0SHarry Wentland unsigned int bytes_per_element) 173bbeb64d0SHarry Wentland { 174bbeb64d0SHarry Wentland /* copied from DML. might want to refactor DML to leverage from DML */ 175bbeb64d0SHarry Wentland /* DML : get_blk256_size */ 176bbeb64d0SHarry Wentland if (bytes_per_element == 1) { 177bbeb64d0SHarry Wentland *blk256_width = 16; 178bbeb64d0SHarry Wentland *blk256_height = 16; 179bbeb64d0SHarry Wentland } else if (bytes_per_element == 2) { 180bbeb64d0SHarry Wentland *blk256_width = 16; 181bbeb64d0SHarry Wentland *blk256_height = 8; 182bbeb64d0SHarry Wentland } else if (bytes_per_element == 4) { 183bbeb64d0SHarry Wentland *blk256_width = 8; 184bbeb64d0SHarry Wentland *blk256_height = 8; 185bbeb64d0SHarry Wentland } else if (bytes_per_element == 8) { 186bbeb64d0SHarry Wentland *blk256_width = 8; 187bbeb64d0SHarry Wentland *blk256_height = 4; 188bbeb64d0SHarry Wentland } 189bbeb64d0SHarry Wentland } 190bbeb64d0SHarry Wentland 191bbeb64d0SHarry Wentland static void hubbub2_det_request_size( 192ec4388a2SDmytro Laktyushkin unsigned int detile_buf_size, 193bbeb64d0SHarry Wentland unsigned int height, 194bbeb64d0SHarry Wentland unsigned int width, 195bbeb64d0SHarry Wentland unsigned int bpe, 196bbeb64d0SHarry Wentland bool *req128_horz_wc, 197bbeb64d0SHarry Wentland bool *req128_vert_wc) 198bbeb64d0SHarry Wentland { 199bbeb64d0SHarry Wentland unsigned int blk256_height = 0; 200bbeb64d0SHarry Wentland unsigned int blk256_width = 0; 201bbeb64d0SHarry Wentland unsigned int swath_bytes_horz_wc, swath_bytes_vert_wc; 202bbeb64d0SHarry Wentland 203bbeb64d0SHarry Wentland hubbub2_get_blk256_size(&blk256_width, &blk256_height, bpe); 204bbeb64d0SHarry Wentland 2050cd32625SBob Yang swath_bytes_horz_wc = width * blk256_height * bpe; 2060cd32625SBob Yang swath_bytes_vert_wc = height * blk256_width * bpe; 207bbeb64d0SHarry Wentland 208bbeb64d0SHarry Wentland *req128_horz_wc = (2 * swath_bytes_horz_wc <= detile_buf_size) ? 209bbeb64d0SHarry Wentland false : /* full 256B request */ 210bbeb64d0SHarry Wentland true; /* half 128b request */ 211bbeb64d0SHarry Wentland 212bbeb64d0SHarry Wentland *req128_vert_wc = (2 * swath_bytes_vert_wc <= detile_buf_size) ? 213bbeb64d0SHarry Wentland false : /* full 256B request */ 214bbeb64d0SHarry Wentland true; /* half 128b request */ 215bbeb64d0SHarry Wentland } 216bbeb64d0SHarry Wentland 217bbeb64d0SHarry Wentland bool hubbub2_get_dcc_compression_cap(struct hubbub *hubbub, 218bbeb64d0SHarry Wentland const struct dc_dcc_surface_param *input, 219bbeb64d0SHarry Wentland struct dc_surface_dcc_cap *output) 220bbeb64d0SHarry Wentland { 221bbeb64d0SHarry Wentland struct dc *dc = hubbub->ctx->dc; 222bbeb64d0SHarry Wentland /* implement section 1.6.2.1 of DCN1_Programming_Guide.docx */ 223bbeb64d0SHarry Wentland enum dcc_control dcc_control; 224bbeb64d0SHarry Wentland unsigned int bpe; 225bbeb64d0SHarry Wentland enum segment_order segment_order_horz, segment_order_vert; 226bbeb64d0SHarry Wentland bool req128_horz_wc, req128_vert_wc; 227bbeb64d0SHarry Wentland 228bbeb64d0SHarry Wentland memset(output, 0, sizeof(*output)); 229bbeb64d0SHarry Wentland 230bbeb64d0SHarry Wentland if (dc->debug.disable_dcc == DCC_DISABLE) 231bbeb64d0SHarry Wentland return false; 232bbeb64d0SHarry Wentland 233bbeb64d0SHarry Wentland if (!hubbub->funcs->dcc_support_pixel_format(input->format, 234bbeb64d0SHarry Wentland &bpe)) 235bbeb64d0SHarry Wentland return false; 236bbeb64d0SHarry Wentland 237bbeb64d0SHarry Wentland if (!hubbub->funcs->dcc_support_swizzle(input->swizzle_mode, bpe, 238bbeb64d0SHarry Wentland &segment_order_horz, &segment_order_vert)) 239bbeb64d0SHarry Wentland return false; 240bbeb64d0SHarry Wentland 241ec4388a2SDmytro Laktyushkin hubbub2_det_request_size(TO_DCN20_HUBBUB(hubbub)->detile_buf_size, 242ec4388a2SDmytro Laktyushkin input->surface_size.height, input->surface_size.width, 243bbeb64d0SHarry Wentland bpe, &req128_horz_wc, &req128_vert_wc); 244bbeb64d0SHarry Wentland 245bbeb64d0SHarry Wentland if (!req128_horz_wc && !req128_vert_wc) { 246bbeb64d0SHarry Wentland dcc_control = dcc_control__256_256_xxx; 247bbeb64d0SHarry Wentland } else if (input->scan == SCAN_DIRECTION_HORIZONTAL) { 248bbeb64d0SHarry Wentland if (!req128_horz_wc) 249bbeb64d0SHarry Wentland dcc_control = dcc_control__256_256_xxx; 250bbeb64d0SHarry Wentland else if (segment_order_horz == segment_order__contiguous) 251bbeb64d0SHarry Wentland dcc_control = dcc_control__128_128_xxx; 252bbeb64d0SHarry Wentland else 253bbeb64d0SHarry Wentland dcc_control = dcc_control__256_64_64; 254bbeb64d0SHarry Wentland } else if (input->scan == SCAN_DIRECTION_VERTICAL) { 255bbeb64d0SHarry Wentland if (!req128_vert_wc) 256bbeb64d0SHarry Wentland dcc_control = dcc_control__256_256_xxx; 257bbeb64d0SHarry Wentland else if (segment_order_vert == segment_order__contiguous) 258bbeb64d0SHarry Wentland dcc_control = dcc_control__128_128_xxx; 259bbeb64d0SHarry Wentland else 260bbeb64d0SHarry Wentland dcc_control = dcc_control__256_64_64; 261bbeb64d0SHarry Wentland } else { 262bbeb64d0SHarry Wentland if ((req128_horz_wc && 263bbeb64d0SHarry Wentland segment_order_horz == segment_order__non_contiguous) || 264bbeb64d0SHarry Wentland (req128_vert_wc && 265bbeb64d0SHarry Wentland segment_order_vert == segment_order__non_contiguous)) 266bbeb64d0SHarry Wentland /* access_dir not known, must use most constraining */ 267bbeb64d0SHarry Wentland dcc_control = dcc_control__256_64_64; 268bbeb64d0SHarry Wentland else 269bbeb64d0SHarry Wentland /* reg128 is true for either horz and vert 270bbeb64d0SHarry Wentland * but segment_order is contiguous 271bbeb64d0SHarry Wentland */ 272bbeb64d0SHarry Wentland dcc_control = dcc_control__128_128_xxx; 273bbeb64d0SHarry Wentland } 274bbeb64d0SHarry Wentland 275bbeb64d0SHarry Wentland /* Exception for 64KB_R_X */ 276bbeb64d0SHarry Wentland if ((bpe == 2) && (input->swizzle_mode == DC_SW_64KB_R_X)) 277bbeb64d0SHarry Wentland dcc_control = dcc_control__128_128_xxx; 278bbeb64d0SHarry Wentland 279bbeb64d0SHarry Wentland if (dc->debug.disable_dcc == DCC_HALF_REQ_DISALBE && 280bbeb64d0SHarry Wentland dcc_control != dcc_control__256_256_xxx) 281bbeb64d0SHarry Wentland return false; 282bbeb64d0SHarry Wentland 283bbeb64d0SHarry Wentland switch (dcc_control) { 284bbeb64d0SHarry Wentland case dcc_control__256_256_xxx: 285bbeb64d0SHarry Wentland output->grph.rgb.max_uncompressed_blk_size = 256; 286bbeb64d0SHarry Wentland output->grph.rgb.max_compressed_blk_size = 256; 287bbeb64d0SHarry Wentland output->grph.rgb.independent_64b_blks = false; 288bbeb64d0SHarry Wentland break; 289bbeb64d0SHarry Wentland case dcc_control__128_128_xxx: 290bbeb64d0SHarry Wentland output->grph.rgb.max_uncompressed_blk_size = 128; 291bbeb64d0SHarry Wentland output->grph.rgb.max_compressed_blk_size = 128; 292bbeb64d0SHarry Wentland output->grph.rgb.independent_64b_blks = false; 293bbeb64d0SHarry Wentland break; 294bbeb64d0SHarry Wentland case dcc_control__256_64_64: 295bbeb64d0SHarry Wentland output->grph.rgb.max_uncompressed_blk_size = 256; 296bbeb64d0SHarry Wentland output->grph.rgb.max_compressed_blk_size = 64; 297bbeb64d0SHarry Wentland output->grph.rgb.independent_64b_blks = true; 298bbeb64d0SHarry Wentland break; 299d905c33aSChris Park default: 300d905c33aSChris Park ASSERT(false); 301d905c33aSChris Park break; 302bbeb64d0SHarry Wentland } 303bbeb64d0SHarry Wentland output->capable = true; 304bbeb64d0SHarry Wentland output->const_color_support = true; 305bbeb64d0SHarry Wentland 306bbeb64d0SHarry Wentland return true; 307bbeb64d0SHarry Wentland } 308bbeb64d0SHarry Wentland 3093979efceSJun Lei static enum dcn_hubbub_page_table_depth page_table_depth_to_hw(unsigned int page_table_depth) 3103979efceSJun Lei { 3113979efceSJun Lei enum dcn_hubbub_page_table_depth depth = 0; 3123979efceSJun Lei 3133979efceSJun Lei switch (page_table_depth) { 3143979efceSJun Lei case 1: 3153979efceSJun Lei depth = DCN_PAGE_TABLE_DEPTH_1_LEVEL; 3163979efceSJun Lei break; 3173979efceSJun Lei case 2: 3183979efceSJun Lei depth = DCN_PAGE_TABLE_DEPTH_2_LEVEL; 3193979efceSJun Lei break; 3203979efceSJun Lei case 3: 3213979efceSJun Lei depth = DCN_PAGE_TABLE_DEPTH_3_LEVEL; 3223979efceSJun Lei break; 3233979efceSJun Lei case 4: 3243979efceSJun Lei depth = DCN_PAGE_TABLE_DEPTH_4_LEVEL; 3253979efceSJun Lei break; 3263979efceSJun Lei default: 3273979efceSJun Lei ASSERT(false); 3283979efceSJun Lei break; 3293979efceSJun Lei } 3303979efceSJun Lei 3313979efceSJun Lei return depth; 3323979efceSJun Lei } 3333979efceSJun Lei 3343979efceSJun Lei static enum dcn_hubbub_page_table_block_size page_table_block_size_to_hw(unsigned int page_table_block_size) 3353979efceSJun Lei { 3363979efceSJun Lei enum dcn_hubbub_page_table_block_size block_size = 0; 3373979efceSJun Lei 3383979efceSJun Lei switch (page_table_block_size) { 3393979efceSJun Lei case 4096: 3403979efceSJun Lei block_size = DCN_PAGE_TABLE_BLOCK_SIZE_4KB; 3413979efceSJun Lei break; 3423979efceSJun Lei case 65536: 3433979efceSJun Lei block_size = DCN_PAGE_TABLE_BLOCK_SIZE_64KB; 3443979efceSJun Lei break; 3458f712e3eSBhawanpreet Lakha case 32768: 3468f712e3eSBhawanpreet Lakha block_size = DCN_PAGE_TABLE_BLOCK_SIZE_32KB; 3478f712e3eSBhawanpreet Lakha break; 3483979efceSJun Lei default: 3493979efceSJun Lei ASSERT(false); 350a6f30079SDmytro Laktyushkin block_size = page_table_block_size; 3513979efceSJun Lei break; 3523979efceSJun Lei } 3533979efceSJun Lei 3543979efceSJun Lei return block_size; 3553979efceSJun Lei } 356bbeb64d0SHarry Wentland 357bda9afdaSDmytro Laktyushkin void hubbub2_init_vm_ctx(struct hubbub *hubbub, 358bda9afdaSDmytro Laktyushkin struct dcn_hubbub_virt_addr_config *va_config, 359bda9afdaSDmytro Laktyushkin int vmid) 360bbeb64d0SHarry Wentland { 361bbeb64d0SHarry Wentland struct dcn20_hubbub *hubbub1 = TO_DCN20_HUBBUB(hubbub); 362bbeb64d0SHarry Wentland struct dcn_vmid_page_table_config virt_config; 363bbeb64d0SHarry Wentland 364bda9afdaSDmytro Laktyushkin virt_config.page_table_start_addr = va_config->page_table_start_addr >> 12; 365bda9afdaSDmytro Laktyushkin virt_config.page_table_end_addr = va_config->page_table_end_addr >> 12; 366bda9afdaSDmytro Laktyushkin virt_config.depth = page_table_depth_to_hw(va_config->page_table_depth); 367bda9afdaSDmytro Laktyushkin virt_config.block_size = page_table_block_size_to_hw(va_config->page_table_block_size); 368bda9afdaSDmytro Laktyushkin virt_config.page_table_base_addr = va_config->page_table_base_addr; 369bbeb64d0SHarry Wentland 370bda9afdaSDmytro Laktyushkin dcn20_vmid_setup(&hubbub1->vmid[vmid], &virt_config); 371bda9afdaSDmytro Laktyushkin } 372bda9afdaSDmytro Laktyushkin 373bda9afdaSDmytro Laktyushkin int hubbub2_init_dchub_sys_ctx(struct hubbub *hubbub, 374bda9afdaSDmytro Laktyushkin struct dcn_hubbub_phys_addr_config *pa_config) 375bda9afdaSDmytro Laktyushkin { 376bda9afdaSDmytro Laktyushkin struct dcn20_hubbub *hubbub1 = TO_DCN20_HUBBUB(hubbub); 377bda9afdaSDmytro Laktyushkin struct dcn_vmid_page_table_config phys_config; 378bda9afdaSDmytro Laktyushkin 379bda9afdaSDmytro Laktyushkin REG_SET(DCN_VM_FB_LOCATION_BASE, 0, 380b48935b3SJun Lei FB_BASE, pa_config->system_aperture.fb_base >> 24); 381bda9afdaSDmytro Laktyushkin REG_SET(DCN_VM_FB_LOCATION_TOP, 0, 382b48935b3SJun Lei FB_TOP, pa_config->system_aperture.fb_top >> 24); 383bda9afdaSDmytro Laktyushkin REG_SET(DCN_VM_FB_OFFSET, 0, 384b48935b3SJun Lei FB_OFFSET, pa_config->system_aperture.fb_offset >> 24); 385bda9afdaSDmytro Laktyushkin REG_SET(DCN_VM_AGP_BOT, 0, 386b48935b3SJun Lei AGP_BOT, pa_config->system_aperture.agp_bot >> 24); 387bda9afdaSDmytro Laktyushkin REG_SET(DCN_VM_AGP_TOP, 0, 388b48935b3SJun Lei AGP_TOP, pa_config->system_aperture.agp_top >> 24); 389bda9afdaSDmytro Laktyushkin REG_SET(DCN_VM_AGP_BASE, 0, 390b48935b3SJun Lei AGP_BASE, pa_config->system_aperture.agp_base >> 24); 391bda9afdaSDmytro Laktyushkin 392ee80de54SJaehyun Chung REG_SET(DCN_VM_PROTECTION_FAULT_DEFAULT_ADDR_MSB, 0, 393ee80de54SJaehyun Chung DCN_VM_PROTECTION_FAULT_DEFAULT_ADDR_MSB, (pa_config->page_table_default_page_addr >> 44) & 0xF); 394ee80de54SJaehyun Chung REG_SET(DCN_VM_PROTECTION_FAULT_DEFAULT_ADDR_LSB, 0, 395ee80de54SJaehyun Chung DCN_VM_PROTECTION_FAULT_DEFAULT_ADDR_LSB, (pa_config->page_table_default_page_addr >> 12) & 0xFFFFFFFF); 396ee80de54SJaehyun Chung 397bda9afdaSDmytro Laktyushkin if (pa_config->gart_config.page_table_start_addr != pa_config->gart_config.page_table_end_addr) { 398bda9afdaSDmytro Laktyushkin phys_config.page_table_start_addr = pa_config->gart_config.page_table_start_addr >> 12; 399bda9afdaSDmytro Laktyushkin phys_config.page_table_end_addr = pa_config->gart_config.page_table_end_addr >> 12; 400bda9afdaSDmytro Laktyushkin phys_config.page_table_base_addr = pa_config->gart_config.page_table_base_addr; 401b48935b3SJun Lei phys_config.depth = 0; 402b48935b3SJun Lei phys_config.block_size = 0; 403bbeb64d0SHarry Wentland // Init VMID 0 based on PA config 404bbeb64d0SHarry Wentland dcn20_vmid_setup(&hubbub1->vmid[0], &phys_config); 4053979efceSJun Lei } 406bbeb64d0SHarry Wentland 407bda9afdaSDmytro Laktyushkin return NUM_VMID; 4083979efceSJun Lei } 409bbeb64d0SHarry Wentland 410bbeb64d0SHarry Wentland void hubbub2_update_dchub(struct hubbub *hubbub, 411bbeb64d0SHarry Wentland struct dchub_init_data *dh_data) 412bbeb64d0SHarry Wentland { 413bbeb64d0SHarry Wentland struct dcn20_hubbub *hubbub1 = TO_DCN20_HUBBUB(hubbub); 414bbeb64d0SHarry Wentland 4155fc43055SJulian Parkin if (REG(DCN_VM_FB_LOCATION_TOP) == 0) 416bbeb64d0SHarry Wentland return; 4175fc43055SJulian Parkin 418bbeb64d0SHarry Wentland switch (dh_data->fb_mode) { 419bbeb64d0SHarry Wentland case FRAME_BUFFER_MODE_ZFB_ONLY: 420bbeb64d0SHarry Wentland /*For ZFB case need to put DCHUB FB BASE and TOP upside down to indicate ZFB mode*/ 4215fc43055SJulian Parkin REG_UPDATE(DCN_VM_FB_LOCATION_TOP, 4225fc43055SJulian Parkin FB_TOP, 0); 423bbeb64d0SHarry Wentland 4245fc43055SJulian Parkin REG_UPDATE(DCN_VM_FB_LOCATION_BASE, 4255fc43055SJulian Parkin FB_BASE, 0xFFFFFF); 426bbeb64d0SHarry Wentland 4275fc43055SJulian Parkin /*This field defines the 24 MSBs, bits [47:24] of the 48 bit AGP Base*/ 4285fc43055SJulian Parkin REG_UPDATE(DCN_VM_AGP_BASE, 4295fc43055SJulian Parkin AGP_BASE, dh_data->zfb_phys_addr_base >> 24); 430bbeb64d0SHarry Wentland 4315fc43055SJulian Parkin /*This field defines the bottom range of the AGP aperture and represents the 24*/ 4325fc43055SJulian Parkin /*MSBs, bits [47:24] of the 48 address bits*/ 4335fc43055SJulian Parkin REG_UPDATE(DCN_VM_AGP_BOT, 4345fc43055SJulian Parkin AGP_BOT, dh_data->zfb_mc_base_addr >> 24); 435bbeb64d0SHarry Wentland 4365fc43055SJulian Parkin /*This field defines the top range of the AGP aperture and represents the 24*/ 4375fc43055SJulian Parkin /*MSBs, bits [47:24] of the 48 address bits*/ 4385fc43055SJulian Parkin REG_UPDATE(DCN_VM_AGP_TOP, 4395fc43055SJulian Parkin AGP_TOP, (dh_data->zfb_mc_base_addr + 4405fc43055SJulian Parkin dh_data->zfb_size_in_byte - 1) >> 24); 441bbeb64d0SHarry Wentland break; 442bbeb64d0SHarry Wentland case FRAME_BUFFER_MODE_MIXED_ZFB_AND_LOCAL: 443bbeb64d0SHarry Wentland /*Should not touch FB LOCATION (done by VBIOS on AsicInit table)*/ 444bbeb64d0SHarry Wentland 4455fc43055SJulian Parkin /*This field defines the 24 MSBs, bits [47:24] of the 48 bit AGP Base*/ 4465fc43055SJulian Parkin REG_UPDATE(DCN_VM_AGP_BASE, 4475fc43055SJulian Parkin AGP_BASE, dh_data->zfb_phys_addr_base >> 24); 448bbeb64d0SHarry Wentland 4495fc43055SJulian Parkin /*This field defines the bottom range of the AGP aperture and represents the 24*/ 4505fc43055SJulian Parkin /*MSBs, bits [47:24] of the 48 address bits*/ 4515fc43055SJulian Parkin REG_UPDATE(DCN_VM_AGP_BOT, 4525fc43055SJulian Parkin AGP_BOT, dh_data->zfb_mc_base_addr >> 24); 453bbeb64d0SHarry Wentland 4545fc43055SJulian Parkin /*This field defines the top range of the AGP aperture and represents the 24*/ 4555fc43055SJulian Parkin /*MSBs, bits [47:24] of the 48 address bits*/ 4565fc43055SJulian Parkin REG_UPDATE(DCN_VM_AGP_TOP, 4575fc43055SJulian Parkin AGP_TOP, (dh_data->zfb_mc_base_addr + 4585fc43055SJulian Parkin dh_data->zfb_size_in_byte - 1) >> 24); 459bbeb64d0SHarry Wentland break; 460bbeb64d0SHarry Wentland case FRAME_BUFFER_MODE_LOCAL_ONLY: 4615fc43055SJulian Parkin /*Should not touch FB LOCATION (should be done by VBIOS)*/ 462bbeb64d0SHarry Wentland 4635fc43055SJulian Parkin /*This field defines the 24 MSBs, bits [47:24] of the 48 bit AGP Base*/ 4645fc43055SJulian Parkin REG_UPDATE(DCN_VM_AGP_BASE, 4655fc43055SJulian Parkin AGP_BASE, 0); 466bbeb64d0SHarry Wentland 4675fc43055SJulian Parkin /*This field defines the bottom range of the AGP aperture and represents the 24*/ 4685fc43055SJulian Parkin /*MSBs, bits [47:24] of the 48 address bits*/ 4695fc43055SJulian Parkin REG_UPDATE(DCN_VM_AGP_BOT, 4705fc43055SJulian Parkin AGP_BOT, 0xFFFFFF); 4715fc43055SJulian Parkin 4725fc43055SJulian Parkin /*This field defines the top range of the AGP aperture and represents the 24*/ 4735fc43055SJulian Parkin /*MSBs, bits [47:24] of the 48 address bits*/ 4745fc43055SJulian Parkin REG_UPDATE(DCN_VM_AGP_TOP, 4755fc43055SJulian Parkin AGP_TOP, 0); 476bbeb64d0SHarry Wentland break; 477bbeb64d0SHarry Wentland default: 478bbeb64d0SHarry Wentland break; 479bbeb64d0SHarry Wentland } 480bbeb64d0SHarry Wentland 481bbeb64d0SHarry Wentland dh_data->dchub_initialzied = true; 482bbeb64d0SHarry Wentland dh_data->dchub_info_valid = false; 483bbeb64d0SHarry Wentland } 484bbeb64d0SHarry Wentland 485bbeb64d0SHarry Wentland void hubbub2_wm_read_state(struct hubbub *hubbub, 486bbeb64d0SHarry Wentland struct dcn_hubbub_wm *wm) 487bbeb64d0SHarry Wentland { 488bbeb64d0SHarry Wentland struct dcn20_hubbub *hubbub1 = TO_DCN20_HUBBUB(hubbub); 489bbeb64d0SHarry Wentland 490bbeb64d0SHarry Wentland struct dcn_hubbub_wm_set *s; 491bbeb64d0SHarry Wentland 492bbeb64d0SHarry Wentland memset(wm, 0, sizeof(struct dcn_hubbub_wm)); 493bbeb64d0SHarry Wentland 494bbeb64d0SHarry Wentland s = &wm->sets[0]; 495bbeb64d0SHarry Wentland s->wm_set = 0; 496bbeb64d0SHarry Wentland s->data_urgent = REG_READ(DCHUBBUB_ARB_DATA_URGENCY_WATERMARK_A); 497bbeb64d0SHarry Wentland if (REG(DCHUBBUB_ARB_PTE_META_URGENCY_WATERMARK_A)) 498bbeb64d0SHarry Wentland s->pte_meta_urgent = REG_READ(DCHUBBUB_ARB_PTE_META_URGENCY_WATERMARK_A); 499bbeb64d0SHarry Wentland if (REG(DCHUBBUB_ARB_ALLOW_SR_ENTER_WATERMARK_A)) { 500bbeb64d0SHarry Wentland s->sr_enter = REG_READ(DCHUBBUB_ARB_ALLOW_SR_ENTER_WATERMARK_A); 501bbeb64d0SHarry Wentland s->sr_exit = REG_READ(DCHUBBUB_ARB_ALLOW_SR_EXIT_WATERMARK_A); 502bbeb64d0SHarry Wentland } 503bbeb64d0SHarry Wentland s->dram_clk_chanage = REG_READ(DCHUBBUB_ARB_ALLOW_DRAM_CLK_CHANGE_WATERMARK_A); 504bbeb64d0SHarry Wentland 505bbeb64d0SHarry Wentland s = &wm->sets[1]; 506bbeb64d0SHarry Wentland s->wm_set = 1; 507bbeb64d0SHarry Wentland s->data_urgent = REG_READ(DCHUBBUB_ARB_DATA_URGENCY_WATERMARK_B); 508bbeb64d0SHarry Wentland if (REG(DCHUBBUB_ARB_PTE_META_URGENCY_WATERMARK_B)) 509bbeb64d0SHarry Wentland s->pte_meta_urgent = REG_READ(DCHUBBUB_ARB_PTE_META_URGENCY_WATERMARK_B); 510bbeb64d0SHarry Wentland if (REG(DCHUBBUB_ARB_ALLOW_SR_ENTER_WATERMARK_B)) { 511bbeb64d0SHarry Wentland s->sr_enter = REG_READ(DCHUBBUB_ARB_ALLOW_SR_ENTER_WATERMARK_B); 512bbeb64d0SHarry Wentland s->sr_exit = REG_READ(DCHUBBUB_ARB_ALLOW_SR_EXIT_WATERMARK_B); 513bbeb64d0SHarry Wentland } 514bbeb64d0SHarry Wentland s->dram_clk_chanage = REG_READ(DCHUBBUB_ARB_ALLOW_DRAM_CLK_CHANGE_WATERMARK_B); 515bbeb64d0SHarry Wentland 516bbeb64d0SHarry Wentland s = &wm->sets[2]; 517bbeb64d0SHarry Wentland s->wm_set = 2; 518bbeb64d0SHarry Wentland s->data_urgent = REG_READ(DCHUBBUB_ARB_DATA_URGENCY_WATERMARK_C); 519bbeb64d0SHarry Wentland if (REG(DCHUBBUB_ARB_PTE_META_URGENCY_WATERMARK_C)) 520bbeb64d0SHarry Wentland s->pte_meta_urgent = REG_READ(DCHUBBUB_ARB_PTE_META_URGENCY_WATERMARK_C); 521bbeb64d0SHarry Wentland if (REG(DCHUBBUB_ARB_ALLOW_SR_ENTER_WATERMARK_C)) { 522bbeb64d0SHarry Wentland s->sr_enter = REG_READ(DCHUBBUB_ARB_ALLOW_SR_ENTER_WATERMARK_C); 523bbeb64d0SHarry Wentland s->sr_exit = REG_READ(DCHUBBUB_ARB_ALLOW_SR_EXIT_WATERMARK_C); 524bbeb64d0SHarry Wentland } 525bbeb64d0SHarry Wentland s->dram_clk_chanage = REG_READ(DCHUBBUB_ARB_ALLOW_DRAM_CLK_CHANGE_WATERMARK_C); 526bbeb64d0SHarry Wentland 527bbeb64d0SHarry Wentland s = &wm->sets[3]; 528bbeb64d0SHarry Wentland s->wm_set = 3; 529bbeb64d0SHarry Wentland s->data_urgent = REG_READ(DCHUBBUB_ARB_DATA_URGENCY_WATERMARK_D); 530bbeb64d0SHarry Wentland if (REG(DCHUBBUB_ARB_PTE_META_URGENCY_WATERMARK_D)) 531bbeb64d0SHarry Wentland s->pte_meta_urgent = REG_READ(DCHUBBUB_ARB_PTE_META_URGENCY_WATERMARK_D); 532bbeb64d0SHarry Wentland if (REG(DCHUBBUB_ARB_ALLOW_SR_ENTER_WATERMARK_D)) { 533bbeb64d0SHarry Wentland s->sr_enter = REG_READ(DCHUBBUB_ARB_ALLOW_SR_ENTER_WATERMARK_D); 534bbeb64d0SHarry Wentland s->sr_exit = REG_READ(DCHUBBUB_ARB_ALLOW_SR_EXIT_WATERMARK_D); 535bbeb64d0SHarry Wentland } 536bbeb64d0SHarry Wentland s->dram_clk_chanage = REG_READ(DCHUBBUB_ARB_ALLOW_DRAM_CLK_CHANGE_WATERMARK_D); 537bbeb64d0SHarry Wentland } 538bbeb64d0SHarry Wentland 539bbeb64d0SHarry Wentland void hubbub2_get_dchub_ref_freq(struct hubbub *hubbub, 540bbeb64d0SHarry Wentland unsigned int dccg_ref_freq_inKhz, 541bbeb64d0SHarry Wentland unsigned int *dchub_ref_freq_inKhz) 542bbeb64d0SHarry Wentland { 543bbeb64d0SHarry Wentland struct dcn20_hubbub *hubbub1 = TO_DCN20_HUBBUB(hubbub); 544bbeb64d0SHarry Wentland uint32_t ref_div = 0; 545bbeb64d0SHarry Wentland uint32_t ref_en = 0; 546bbeb64d0SHarry Wentland 547bbeb64d0SHarry Wentland REG_GET_2(DCHUBBUB_GLOBAL_TIMER_CNTL, DCHUBBUB_GLOBAL_TIMER_REFDIV, &ref_div, 548bbeb64d0SHarry Wentland DCHUBBUB_GLOBAL_TIMER_ENABLE, &ref_en); 549bbeb64d0SHarry Wentland 550bbeb64d0SHarry Wentland if (ref_en) { 551bbeb64d0SHarry Wentland if (ref_div == 2) 552bbeb64d0SHarry Wentland *dchub_ref_freq_inKhz = dccg_ref_freq_inKhz / 2; 553bbeb64d0SHarry Wentland else 554bbeb64d0SHarry Wentland *dchub_ref_freq_inKhz = dccg_ref_freq_inKhz; 555bbeb64d0SHarry Wentland 556bbeb64d0SHarry Wentland // DC hub reference frequency must be around 50Mhz, otherwise there may be 557bbeb64d0SHarry Wentland // overflow/underflow issues when doing HUBBUB programming 558bbeb64d0SHarry Wentland if (*dchub_ref_freq_inKhz < 40000 || *dchub_ref_freq_inKhz > 60000) 559bbeb64d0SHarry Wentland ASSERT_CRITICAL(false); 560bbeb64d0SHarry Wentland 561bbeb64d0SHarry Wentland return; 562bbeb64d0SHarry Wentland } else { 563bbeb64d0SHarry Wentland *dchub_ref_freq_inKhz = dccg_ref_freq_inKhz; 564bbeb64d0SHarry Wentland 565bbeb64d0SHarry Wentland // HUBBUB global timer must be enabled. 566bbeb64d0SHarry Wentland ASSERT_CRITICAL(false); 567bbeb64d0SHarry Wentland return; 568bbeb64d0SHarry Wentland } 569bbeb64d0SHarry Wentland } 570bbeb64d0SHarry Wentland 57189e94bc5SYongqiang Sun static bool hubbub2_program_watermarks( 572040a4d63SYongqiang Sun struct hubbub *hubbub, 573040a4d63SYongqiang Sun struct dcn_watermark_set *watermarks, 574040a4d63SYongqiang Sun unsigned int refclk_mhz, 575040a4d63SYongqiang Sun bool safe_to_lower) 576040a4d63SYongqiang Sun { 577040a4d63SYongqiang Sun struct dcn20_hubbub *hubbub1 = TO_DCN20_HUBBUB(hubbub); 57889e94bc5SYongqiang Sun bool wm_pending = false; 579040a4d63SYongqiang Sun /* 580040a4d63SYongqiang Sun * Need to clamp to max of the register values (i.e. no wrap) 581040a4d63SYongqiang Sun * for dcn1, all wm registers are 21-bit wide 582040a4d63SYongqiang Sun */ 58389e94bc5SYongqiang Sun if (hubbub1_program_urgent_watermarks(hubbub, watermarks, refclk_mhz, safe_to_lower)) 58489e94bc5SYongqiang Sun wm_pending = true; 58589e94bc5SYongqiang Sun 58689e94bc5SYongqiang Sun if (hubbub1_program_stutter_watermarks(hubbub, watermarks, refclk_mhz, safe_to_lower)) 58789e94bc5SYongqiang Sun wm_pending = true; 588057fc695SJun Lei 589057fc695SJun Lei /* 590057fc695SJun Lei * There's a special case when going from p-state support to p-state unsupported 591057fc695SJun Lei * here we are going to LOWER watermarks to go to dummy p-state only, but this has 592057fc695SJun Lei * to be done prepare_bandwidth, not optimize 593057fc695SJun Lei */ 594057fc695SJun Lei if (hubbub1->base.ctx->dc->clk_mgr->clks.prev_p_state_change_support == true && 595057fc695SJun Lei hubbub1->base.ctx->dc->clk_mgr->clks.p_state_change_support == false) 596057fc695SJun Lei safe_to_lower = true; 597057fc695SJun Lei 598040a4d63SYongqiang Sun hubbub1_program_pstate_watermarks(hubbub, watermarks, refclk_mhz, safe_to_lower); 599040a4d63SYongqiang Sun 600040a4d63SYongqiang Sun REG_SET(DCHUBBUB_ARB_SAT_LEVEL, 0, 601040a4d63SYongqiang Sun DCHUBBUB_ARB_SAT_LEVEL, 60 * refclk_mhz); 602040a4d63SYongqiang Sun REG_UPDATE(DCHUBBUB_ARB_DF_REQ_OUTSTAND, DCHUBBUB_ARB_MIN_REQ_OUTSTAND, 180); 603040a4d63SYongqiang Sun 6047f7652eeSMartin Leung hubbub->funcs->allow_self_refresh_control(hubbub, !hubbub->ctx->dc->debug.disable_stutter); 60589e94bc5SYongqiang Sun return wm_pending; 606040a4d63SYongqiang Sun } 607040a4d63SYongqiang Sun 608*98e95e4fSJosip Pavic void hubbub2_read_state(struct hubbub *hubbub, struct dcn_hubbub_state *hubbub_state) 609*98e95e4fSJosip Pavic { 610*98e95e4fSJosip Pavic struct dcn20_hubbub *hubbub1 = TO_DCN20_HUBBUB(hubbub); 611*98e95e4fSJosip Pavic 612*98e95e4fSJosip Pavic if (REG(DCN_VM_FAULT_ADDR_MSB)) 613*98e95e4fSJosip Pavic hubbub_state->vm_fault_addr_msb = REG_READ(DCN_VM_FAULT_ADDR_MSB); 614*98e95e4fSJosip Pavic 615*98e95e4fSJosip Pavic if (REG(DCN_VM_FAULT_ADDR_LSB)) 616*98e95e4fSJosip Pavic hubbub_state->vm_fault_addr_msb = REG_READ(DCN_VM_FAULT_ADDR_LSB); 617*98e95e4fSJosip Pavic 618*98e95e4fSJosip Pavic if (REG(DCN_VM_FAULT_CNTL)) 619*98e95e4fSJosip Pavic REG_GET(DCN_VM_FAULT_CNTL, DCN_VM_ERROR_STATUS_MODE, &hubbub_state->vm_error_mode); 620*98e95e4fSJosip Pavic 621*98e95e4fSJosip Pavic if (REG(DCN_VM_FAULT_STATUS)) { 622*98e95e4fSJosip Pavic REG_GET(DCN_VM_FAULT_STATUS, DCN_VM_ERROR_STATUS, &hubbub_state->vm_error_status); 623*98e95e4fSJosip Pavic REG_GET(DCN_VM_FAULT_STATUS, DCN_VM_ERROR_VMID, &hubbub_state->vm_error_vmid); 624*98e95e4fSJosip Pavic REG_GET(DCN_VM_FAULT_STATUS, DCN_VM_ERROR_PIPE, &hubbub_state->vm_error_pipe); 625*98e95e4fSJosip Pavic } 626*98e95e4fSJosip Pavic } 627*98e95e4fSJosip Pavic 628bbeb64d0SHarry Wentland static const struct hubbub_funcs hubbub2_funcs = { 629bbeb64d0SHarry Wentland .update_dchub = hubbub2_update_dchub, 630bda9afdaSDmytro Laktyushkin .init_dchub_sys_ctx = hubbub2_init_dchub_sys_ctx, 631bda9afdaSDmytro Laktyushkin .init_vm_ctx = hubbub2_init_vm_ctx, 632bbeb64d0SHarry Wentland .dcc_support_swizzle = hubbub2_dcc_support_swizzle, 633bbeb64d0SHarry Wentland .dcc_support_pixel_format = hubbub2_dcc_support_pixel_format, 634bbeb64d0SHarry Wentland .get_dcc_compression_cap = hubbub2_get_dcc_compression_cap, 635bbeb64d0SHarry Wentland .wm_read_state = hubbub2_wm_read_state, 636bbeb64d0SHarry Wentland .get_dchub_ref_freq = hubbub2_get_dchub_ref_freq, 6377f7652eeSMartin Leung .program_watermarks = hubbub2_program_watermarks, 63887f24027SMartin Leung .is_allow_self_refresh_enabled = hubbub1_is_allow_self_refresh_enabled, 63987f24027SMartin Leung .allow_self_refresh_control = hubbub1_allow_self_refresh_control, 640*98e95e4fSJosip Pavic .hubbub_read_state = hubbub2_read_state, 641bbeb64d0SHarry Wentland }; 642bbeb64d0SHarry Wentland 643bbeb64d0SHarry Wentland void hubbub2_construct(struct dcn20_hubbub *hubbub, 644bbeb64d0SHarry Wentland struct dc_context *ctx, 645bbeb64d0SHarry Wentland const struct dcn_hubbub_registers *hubbub_regs, 646bbeb64d0SHarry Wentland const struct dcn_hubbub_shift *hubbub_shift, 647bbeb64d0SHarry Wentland const struct dcn_hubbub_mask *hubbub_mask) 648bbeb64d0SHarry Wentland { 649bbeb64d0SHarry Wentland hubbub->base.ctx = ctx; 650bbeb64d0SHarry Wentland 651bbeb64d0SHarry Wentland hubbub->base.funcs = &hubbub2_funcs; 652bbeb64d0SHarry Wentland 653bbeb64d0SHarry Wentland hubbub->regs = hubbub_regs; 654bbeb64d0SHarry Wentland hubbub->shifts = hubbub_shift; 655bbeb64d0SHarry Wentland hubbub->masks = hubbub_mask; 656bbeb64d0SHarry Wentland 657bbeb64d0SHarry Wentland hubbub->debug_test_index_pstate = 0xB; 658ec4388a2SDmytro Laktyushkin hubbub->detile_buf_size = 164 * 1024; /* 164KB for DCN2.0 */ 659bbeb64d0SHarry Wentland } 660