| .. | .. |
|---|
| 20 | 20 | struct intel_qgv_info { |
|---|
| 21 | 21 | struct intel_qgv_point points[I915_NUM_QGV_POINTS]; |
|---|
| 22 | 22 | u8 num_points; |
|---|
| 23 | | - u8 num_channels; |
|---|
| 24 | 23 | u8 t_bl; |
|---|
| 25 | | - enum intel_dram_type dram_type; |
|---|
| 26 | 24 | }; |
|---|
| 27 | | - |
|---|
| 28 | | -static int icl_pcode_read_mem_global_info(struct drm_i915_private *dev_priv, |
|---|
| 29 | | - struct intel_qgv_info *qi) |
|---|
| 30 | | -{ |
|---|
| 31 | | - u32 val = 0; |
|---|
| 32 | | - int ret; |
|---|
| 33 | | - |
|---|
| 34 | | - ret = sandybridge_pcode_read(dev_priv, |
|---|
| 35 | | - ICL_PCODE_MEM_SUBSYSYSTEM_INFO | |
|---|
| 36 | | - ICL_PCODE_MEM_SS_READ_GLOBAL_INFO, |
|---|
| 37 | | - &val, NULL); |
|---|
| 38 | | - if (ret) |
|---|
| 39 | | - return ret; |
|---|
| 40 | | - |
|---|
| 41 | | - if (IS_GEN(dev_priv, 12)) { |
|---|
| 42 | | - switch (val & 0xf) { |
|---|
| 43 | | - case 0: |
|---|
| 44 | | - qi->dram_type = INTEL_DRAM_DDR4; |
|---|
| 45 | | - break; |
|---|
| 46 | | - case 3: |
|---|
| 47 | | - qi->dram_type = INTEL_DRAM_LPDDR4; |
|---|
| 48 | | - break; |
|---|
| 49 | | - case 4: |
|---|
| 50 | | - qi->dram_type = INTEL_DRAM_DDR3; |
|---|
| 51 | | - break; |
|---|
| 52 | | - case 5: |
|---|
| 53 | | - qi->dram_type = INTEL_DRAM_LPDDR3; |
|---|
| 54 | | - break; |
|---|
| 55 | | - default: |
|---|
| 56 | | - MISSING_CASE(val & 0xf); |
|---|
| 57 | | - break; |
|---|
| 58 | | - } |
|---|
| 59 | | - } else if (IS_GEN(dev_priv, 11)) { |
|---|
| 60 | | - switch (val & 0xf) { |
|---|
| 61 | | - case 0: |
|---|
| 62 | | - qi->dram_type = INTEL_DRAM_DDR4; |
|---|
| 63 | | - break; |
|---|
| 64 | | - case 1: |
|---|
| 65 | | - qi->dram_type = INTEL_DRAM_DDR3; |
|---|
| 66 | | - break; |
|---|
| 67 | | - case 2: |
|---|
| 68 | | - qi->dram_type = INTEL_DRAM_LPDDR3; |
|---|
| 69 | | - break; |
|---|
| 70 | | - case 3: |
|---|
| 71 | | - qi->dram_type = INTEL_DRAM_LPDDR4; |
|---|
| 72 | | - break; |
|---|
| 73 | | - default: |
|---|
| 74 | | - MISSING_CASE(val & 0xf); |
|---|
| 75 | | - break; |
|---|
| 76 | | - } |
|---|
| 77 | | - } else { |
|---|
| 78 | | - MISSING_CASE(INTEL_GEN(dev_priv)); |
|---|
| 79 | | - qi->dram_type = INTEL_DRAM_LPDDR3; /* Conservative default */ |
|---|
| 80 | | - } |
|---|
| 81 | | - |
|---|
| 82 | | - qi->num_channels = (val & 0xf0) >> 4; |
|---|
| 83 | | - qi->num_points = (val & 0xf00) >> 8; |
|---|
| 84 | | - |
|---|
| 85 | | - if (IS_GEN(dev_priv, 12)) |
|---|
| 86 | | - qi->t_bl = qi->dram_type == INTEL_DRAM_DDR4 ? 4 : 16; |
|---|
| 87 | | - else if (IS_GEN(dev_priv, 11)) |
|---|
| 88 | | - qi->t_bl = qi->dram_type == INTEL_DRAM_DDR4 ? 4 : 8; |
|---|
| 89 | | - |
|---|
| 90 | | - return 0; |
|---|
| 91 | | -} |
|---|
| 92 | 25 | |
|---|
| 93 | 26 | static int icl_pcode_read_qgv_point_info(struct drm_i915_private *dev_priv, |
|---|
| 94 | 27 | struct intel_qgv_point *sp, |
|---|
| .. | .. |
|---|
| 139 | 72 | static int icl_get_qgv_points(struct drm_i915_private *dev_priv, |
|---|
| 140 | 73 | struct intel_qgv_info *qi) |
|---|
| 141 | 74 | { |
|---|
| 75 | + const struct dram_info *dram_info = &dev_priv->dram_info; |
|---|
| 142 | 76 | int i, ret; |
|---|
| 143 | 77 | |
|---|
| 144 | | - ret = icl_pcode_read_mem_global_info(dev_priv, qi); |
|---|
| 145 | | - if (ret) |
|---|
| 146 | | - return ret; |
|---|
| 78 | + qi->num_points = dram_info->num_qgv_points; |
|---|
| 79 | + |
|---|
| 80 | + if (IS_GEN(dev_priv, 12)) |
|---|
| 81 | + qi->t_bl = dev_priv->dram_info.type == INTEL_DRAM_DDR4 ? 4 : 16; |
|---|
| 82 | + else if (IS_GEN(dev_priv, 11)) |
|---|
| 83 | + qi->t_bl = dev_priv->dram_info.type == INTEL_DRAM_DDR4 ? 4 : 8; |
|---|
| 147 | 84 | |
|---|
| 148 | 85 | if (drm_WARN_ON(&dev_priv->drm, |
|---|
| 149 | 86 | qi->num_points > ARRAY_SIZE(qi->points))) |
|---|
| .. | .. |
|---|
| 209 | 146 | { |
|---|
| 210 | 147 | struct intel_qgv_info qi = {}; |
|---|
| 211 | 148 | bool is_y_tile = true; /* assume y tile may be used */ |
|---|
| 212 | | - int num_channels; |
|---|
| 149 | + int num_channels = dev_priv->dram_info.num_channels; |
|---|
| 213 | 150 | int deinterleave; |
|---|
| 214 | 151 | int ipqdepth, ipqdepthpch; |
|---|
| 215 | 152 | int dclk_max; |
|---|
| .. | .. |
|---|
| 222 | 159 | "Failed to get memory subsystem information, ignoring bandwidth limits"); |
|---|
| 223 | 160 | return ret; |
|---|
| 224 | 161 | } |
|---|
| 225 | | - num_channels = qi.num_channels; |
|---|
| 226 | 162 | |
|---|
| 227 | 163 | deinterleave = DIV_ROUND_UP(num_channels, is_y_tile ? 4 : 2); |
|---|
| 228 | 164 | dclk_max = icl_sagv_max_dclk(&qi); |
|---|