linux/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hubbub.h
<<
>>
Prefs
   1/*
   2 * Copyright 2016 Advanced Micro Devices, Inc.
   3 *
   4 * Permission is hereby granted, free of charge, to any person obtaining a
   5 * copy of this software and associated documentation files (the "Software"),
   6 * to deal in the Software without restriction, including without limitation
   7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
   8 * and/or sell copies of the Software, and to permit persons to whom the
   9 * Software is furnished to do so, subject to the following conditions:
  10 *
  11 * The above copyright notice and this permission notice shall be included in
  12 * all copies or substantial portions of the Software.
  13 *
  14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
  17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
  18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  20 * OTHER DEALINGS IN THE SOFTWARE.
  21 *
  22 * Authors: AMD
  23 *
  24 */
  25
  26#ifndef __DC_HUBBUB_DCN10_H__
  27#define __DC_HUBBUB_DCN10_H__
  28
  29#include "core_types.h"
  30#include "dchubbub.h"
  31
  32#define HUBHUB_REG_LIST_DCN()\
  33        SR(DCHUBBUB_ARB_DATA_URGENCY_WATERMARK_A),\
  34        SR(DCHUBBUB_ARB_PTE_META_URGENCY_WATERMARK_A),\
  35        SR(DCHUBBUB_ARB_ALLOW_DRAM_CLK_CHANGE_WATERMARK_A),\
  36        SR(DCHUBBUB_ARB_DATA_URGENCY_WATERMARK_B),\
  37        SR(DCHUBBUB_ARB_PTE_META_URGENCY_WATERMARK_B),\
  38        SR(DCHUBBUB_ARB_ALLOW_DRAM_CLK_CHANGE_WATERMARK_B),\
  39        SR(DCHUBBUB_ARB_DATA_URGENCY_WATERMARK_C),\
  40        SR(DCHUBBUB_ARB_PTE_META_URGENCY_WATERMARK_C),\
  41        SR(DCHUBBUB_ARB_ALLOW_DRAM_CLK_CHANGE_WATERMARK_C),\
  42        SR(DCHUBBUB_ARB_DATA_URGENCY_WATERMARK_D),\
  43        SR(DCHUBBUB_ARB_PTE_META_URGENCY_WATERMARK_D),\
  44        SR(DCHUBBUB_ARB_ALLOW_DRAM_CLK_CHANGE_WATERMARK_D),\
  45        SR(DCHUBBUB_ARB_WATERMARK_CHANGE_CNTL),\
  46        SR(DCHUBBUB_ARB_DRAM_STATE_CNTL),\
  47        SR(DCHUBBUB_ARB_SAT_LEVEL),\
  48        SR(DCHUBBUB_ARB_DF_REQ_OUTSTAND),\
  49        SR(DCHUBBUB_GLOBAL_TIMER_CNTL), \
  50        SR(DCHUBBUB_TEST_DEBUG_INDEX), \
  51        SR(DCHUBBUB_TEST_DEBUG_DATA),\
  52        SR(DCHUBBUB_SOFT_RESET)
  53
  54#define HUBBUB_SR_WATERMARK_REG_LIST()\
  55        SR(DCHUBBUB_ARB_ALLOW_SR_ENTER_WATERMARK_A),\
  56        SR(DCHUBBUB_ARB_ALLOW_SR_EXIT_WATERMARK_A),\
  57        SR(DCHUBBUB_ARB_ALLOW_SR_ENTER_WATERMARK_B),\
  58        SR(DCHUBBUB_ARB_ALLOW_SR_EXIT_WATERMARK_B),\
  59        SR(DCHUBBUB_ARB_ALLOW_SR_ENTER_WATERMARK_C),\
  60        SR(DCHUBBUB_ARB_ALLOW_SR_EXIT_WATERMARK_C),\
  61        SR(DCHUBBUB_ARB_ALLOW_SR_ENTER_WATERMARK_D),\
  62        SR(DCHUBBUB_ARB_ALLOW_SR_EXIT_WATERMARK_D)
  63
  64#define HUBBUB_REG_LIST_DCN10(id)\
  65        HUBHUB_REG_LIST_DCN(), \
  66        HUBBUB_SR_WATERMARK_REG_LIST(), \
  67        SR(DCHUBBUB_SDPIF_FB_TOP),\
  68        SR(DCHUBBUB_SDPIF_FB_BASE),\
  69        SR(DCHUBBUB_SDPIF_FB_OFFSET),\
  70        SR(DCHUBBUB_SDPIF_AGP_BASE),\
  71        SR(DCHUBBUB_SDPIF_AGP_BOT),\
  72        SR(DCHUBBUB_SDPIF_AGP_TOP)
  73
  74struct dcn_hubbub_registers {
  75        uint32_t DCHUBBUB_ARB_DATA_URGENCY_WATERMARK_A;
  76        uint32_t DCHUBBUB_ARB_PTE_META_URGENCY_WATERMARK_A;
  77        uint32_t DCHUBBUB_ARB_ALLOW_SR_ENTER_WATERMARK_A;
  78        uint32_t DCHUBBUB_ARB_ALLOW_SR_EXIT_WATERMARK_A;
  79        uint32_t DCHUBBUB_ARB_ALLOW_DRAM_CLK_CHANGE_WATERMARK_A;
  80        uint32_t DCHUBBUB_ARB_DATA_URGENCY_WATERMARK_B;
  81        uint32_t DCHUBBUB_ARB_PTE_META_URGENCY_WATERMARK_B;
  82        uint32_t DCHUBBUB_ARB_ALLOW_SR_ENTER_WATERMARK_B;
  83        uint32_t DCHUBBUB_ARB_ALLOW_SR_EXIT_WATERMARK_B;
  84        uint32_t DCHUBBUB_ARB_ALLOW_DRAM_CLK_CHANGE_WATERMARK_B;
  85        uint32_t DCHUBBUB_ARB_DATA_URGENCY_WATERMARK_C;
  86        uint32_t DCHUBBUB_ARB_PTE_META_URGENCY_WATERMARK_C;
  87        uint32_t DCHUBBUB_ARB_ALLOW_SR_ENTER_WATERMARK_C;
  88        uint32_t DCHUBBUB_ARB_ALLOW_SR_EXIT_WATERMARK_C;
  89        uint32_t DCHUBBUB_ARB_ALLOW_DRAM_CLK_CHANGE_WATERMARK_C;
  90        uint32_t DCHUBBUB_ARB_DATA_URGENCY_WATERMARK_D;
  91        uint32_t DCHUBBUB_ARB_PTE_META_URGENCY_WATERMARK_D;
  92        uint32_t DCHUBBUB_ARB_ALLOW_SR_ENTER_WATERMARK_D;
  93        uint32_t DCHUBBUB_ARB_ALLOW_SR_EXIT_WATERMARK_D;
  94        uint32_t DCHUBBUB_ARB_ALLOW_DRAM_CLK_CHANGE_WATERMARK_D;
  95        uint32_t DCHUBBUB_ARB_WATERMARK_CHANGE_CNTL;
  96        uint32_t DCHUBBUB_ARB_SAT_LEVEL;
  97        uint32_t DCHUBBUB_ARB_DF_REQ_OUTSTAND;
  98        uint32_t DCHUBBUB_GLOBAL_TIMER_CNTL;
  99        uint32_t DCHUBBUB_ARB_DRAM_STATE_CNTL;
 100        uint32_t DCHUBBUB_TEST_DEBUG_INDEX;
 101        uint32_t DCHUBBUB_TEST_DEBUG_DATA;
 102        uint32_t DCHUBBUB_SDPIF_FB_TOP;
 103        uint32_t DCHUBBUB_SDPIF_FB_BASE;
 104        uint32_t DCHUBBUB_SDPIF_FB_OFFSET;
 105        uint32_t DCHUBBUB_SDPIF_AGP_BASE;
 106        uint32_t DCHUBBUB_SDPIF_AGP_BOT;
 107        uint32_t DCHUBBUB_SDPIF_AGP_TOP;
 108        uint32_t DCHUBBUB_CRC_CTRL;
 109        uint32_t DCHUBBUB_SOFT_RESET;
 110};
 111
 112/* set field name */
 113#define HUBBUB_SF(reg_name, field_name, post_fix)\
 114        .field_name = reg_name ## __ ## field_name ## post_fix
 115
 116
 117#define HUBBUB_MASK_SH_LIST_DCN(mask_sh)\
 118                HUBBUB_SF(DCHUBBUB_GLOBAL_TIMER_CNTL, DCHUBBUB_GLOBAL_TIMER_ENABLE, mask_sh), \
 119                HUBBUB_SF(DCHUBBUB_SOFT_RESET, DCHUBBUB_GLOBAL_SOFT_RESET, mask_sh), \
 120                HUBBUB_SF(DCHUBBUB_ARB_WATERMARK_CHANGE_CNTL, DCHUBBUB_ARB_WATERMARK_CHANGE_REQUEST, mask_sh), \
 121                HUBBUB_SF(DCHUBBUB_ARB_WATERMARK_CHANGE_CNTL, DCHUBBUB_ARB_WATERMARK_CHANGE_DONE_INTERRUPT_DISABLE, mask_sh), \
 122                HUBBUB_SF(DCHUBBUB_ARB_DRAM_STATE_CNTL, DCHUBBUB_ARB_ALLOW_SELF_REFRESH_FORCE_VALUE, mask_sh), \
 123                HUBBUB_SF(DCHUBBUB_ARB_DRAM_STATE_CNTL, DCHUBBUB_ARB_ALLOW_SELF_REFRESH_FORCE_ENABLE, mask_sh), \
 124                HUBBUB_SF(DCHUBBUB_ARB_DRAM_STATE_CNTL, DCHUBBUB_ARB_ALLOW_PSTATE_CHANGE_FORCE_VALUE, mask_sh), \
 125                HUBBUB_SF(DCHUBBUB_ARB_DRAM_STATE_CNTL, DCHUBBUB_ARB_ALLOW_PSTATE_CHANGE_FORCE_ENABLE, mask_sh), \
 126                HUBBUB_SF(DCHUBBUB_ARB_SAT_LEVEL, DCHUBBUB_ARB_SAT_LEVEL, mask_sh), \
 127                HUBBUB_SF(DCHUBBUB_ARB_DF_REQ_OUTSTAND, DCHUBBUB_ARB_MIN_REQ_OUTSTAND, mask_sh)
 128
 129#define HUBBUB_MASK_SH_LIST_DCN10(mask_sh)\
 130                HUBBUB_MASK_SH_LIST_DCN(mask_sh), \
 131                HUBBUB_SF(DCHUBBUB_SDPIF_FB_TOP, SDPIF_FB_TOP, mask_sh), \
 132                HUBBUB_SF(DCHUBBUB_SDPIF_FB_BASE, SDPIF_FB_BASE, mask_sh), \
 133                HUBBUB_SF(DCHUBBUB_SDPIF_FB_OFFSET, SDPIF_FB_OFFSET, mask_sh), \
 134                HUBBUB_SF(DCHUBBUB_SDPIF_AGP_BASE, SDPIF_AGP_BASE, mask_sh), \
 135                HUBBUB_SF(DCHUBBUB_SDPIF_AGP_BOT, SDPIF_AGP_BOT, mask_sh), \
 136                HUBBUB_SF(DCHUBBUB_SDPIF_AGP_TOP, SDPIF_AGP_TOP, mask_sh)
 137
 138#define DCN_HUBBUB_REG_FIELD_LIST(type) \
 139                type DCHUBBUB_GLOBAL_TIMER_ENABLE; \
 140                type DCHUBBUB_ARB_WATERMARK_CHANGE_REQUEST;\
 141                type DCHUBBUB_ARB_WATERMARK_CHANGE_DONE_INTERRUPT_DISABLE;\
 142                type DCHUBBUB_ARB_ALLOW_SELF_REFRESH_FORCE_VALUE;\
 143                type DCHUBBUB_ARB_ALLOW_SELF_REFRESH_FORCE_ENABLE;\
 144                type DCHUBBUB_ARB_ALLOW_PSTATE_CHANGE_FORCE_VALUE;\
 145                type DCHUBBUB_ARB_ALLOW_PSTATE_CHANGE_FORCE_ENABLE;\
 146                type DCHUBBUB_ARB_SAT_LEVEL;\
 147                type DCHUBBUB_ARB_MIN_REQ_OUTSTAND;\
 148                type DCHUBBUB_GLOBAL_TIMER_REFDIV;\
 149                type DCHUBBUB_GLOBAL_SOFT_RESET; \
 150                type SDPIF_FB_TOP;\
 151                type SDPIF_FB_BASE;\
 152                type SDPIF_FB_OFFSET;\
 153                type SDPIF_AGP_BASE;\
 154                type SDPIF_AGP_BOT;\
 155                type SDPIF_AGP_TOP
 156
 157
 158struct dcn_hubbub_shift {
 159        DCN_HUBBUB_REG_FIELD_LIST(uint8_t);
 160};
 161
 162struct dcn_hubbub_mask {
 163        DCN_HUBBUB_REG_FIELD_LIST(uint32_t);
 164};
 165
 166struct dc;
 167
 168struct dcn_hubbub_wm_set {
 169        uint32_t wm_set;
 170        uint32_t data_urgent;
 171        uint32_t pte_meta_urgent;
 172        uint32_t sr_enter;
 173        uint32_t sr_exit;
 174        uint32_t dram_clk_chanage;
 175};
 176
 177struct dcn_hubbub_wm {
 178        struct dcn_hubbub_wm_set sets[4];
 179};
 180
 181struct hubbub {
 182        const struct hubbub_funcs *funcs;
 183        struct dc_context *ctx;
 184        const struct dcn_hubbub_registers *regs;
 185        const struct dcn_hubbub_shift *shifts;
 186        const struct dcn_hubbub_mask *masks;
 187        unsigned int debug_test_index_pstate;
 188        struct dcn_watermark_set watermarks;
 189};
 190
 191void hubbub1_update_dchub(
 192        struct hubbub *hubbub,
 193        struct dchub_init_data *dh_data);
 194
 195bool hubbub1_verify_allow_pstate_change_high(
 196        struct hubbub *hubbub);
 197
 198void hubbub1_wm_change_req_wa(struct hubbub *hubbub);
 199
 200void hubbub1_program_watermarks(
 201                struct hubbub *hubbub,
 202                struct dcn_watermark_set *watermarks,
 203                unsigned int refclk_mhz,
 204                bool safe_to_lower);
 205
 206void hubbub1_disable_allow_self_refresh(struct hubbub *hubbub);
 207
 208bool hububu1_is_allow_self_refresh_enabled(struct hubbub *hubub);
 209
 210void hubbub1_toggle_watermark_change_req(
 211                struct hubbub *hubbub);
 212
 213void hubbub1_wm_read_state(struct hubbub *hubbub,
 214                struct dcn_hubbub_wm *wm);
 215
 216void hubbub1_soft_reset(struct hubbub *hubbub, bool reset);
 217void hubbub1_construct(struct hubbub *hubbub,
 218        struct dc_context *ctx,
 219        const struct dcn_hubbub_registers *hubbub_regs,
 220        const struct dcn_hubbub_shift *hubbub_shift,
 221        const struct dcn_hubbub_mask *hubbub_mask);
 222
 223#endif
 224