1 1.9 mrg /* $NetBSD: radeon_si_dpm.c,v 1.9 2023/09/30 10:46:45 mrg Exp $ */ 2 1.1 riastrad 3 1.1 riastrad /* 4 1.1 riastrad * Copyright 2013 Advanced Micro Devices, Inc. 5 1.1 riastrad * 6 1.1 riastrad * Permission is hereby granted, free of charge, to any person obtaining a 7 1.1 riastrad * copy of this software and associated documentation files (the "Software"), 8 1.1 riastrad * to deal in the Software without restriction, including without limitation 9 1.1 riastrad * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 1.1 riastrad * and/or sell copies of the Software, and to permit persons to whom the 11 1.1 riastrad * Software is furnished to do so, subject to the following conditions: 12 1.1 riastrad * 13 1.1 riastrad * The above copyright notice and this permission notice shall be included in 14 1.1 riastrad * all copies or substantial portions of the Software. 15 1.1 riastrad * 16 1.1 riastrad * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 1.1 riastrad * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 1.1 riastrad * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19 1.1 riastrad * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 1.1 riastrad * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 1.1 riastrad * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 1.1 riastrad * OTHER DEALINGS IN THE SOFTWARE. 23 1.1 riastrad * 24 1.1 riastrad */ 25 1.1 riastrad 26 1.1 riastrad #include <sys/cdefs.h> 27 1.9 mrg __KERNEL_RCSID(0, "$NetBSD: radeon_si_dpm.c,v 1.9 2023/09/30 10:46:45 mrg Exp $"); 28 1.1 riastrad 29 1.5 riastrad #include <linux/math64.h> 30 1.5 riastrad #include <linux/pci.h> 31 1.5 riastrad #include <linux/seq_file.h> 32 1.5 riastrad 33 1.5 riastrad #include "atom.h" 34 1.5 riastrad #include "r600_dpm.h" 35 1.1 riastrad #include "radeon.h" 36 1.1 riastrad #include "radeon_asic.h" 37 1.5 riastrad #include "si_dpm.h" 38 1.1 riastrad #include "sid.h" 39 1.1 riastrad 40 1.1 riastrad #define MC_CG_ARB_FREQ_F0 0x0a 41 1.1 riastrad #define MC_CG_ARB_FREQ_F1 0x0b 42 1.1 riastrad #define MC_CG_ARB_FREQ_F2 0x0c 43 1.1 riastrad #define MC_CG_ARB_FREQ_F3 0x0d 44 1.1 riastrad 45 1.1 riastrad #define SMC_RAM_END 0x20000 46 1.1 riastrad 47 1.1 riastrad #define SCLK_MIN_DEEPSLEEP_FREQ 1350 48 1.1 riastrad 49 1.1 riastrad static const struct si_cac_config_reg cac_weights_tahiti[] = 50 1.1 riastrad { 51 1.1 riastrad { 0x0, 0x0000ffff, 0, 0xc, SISLANDS_CACCONFIG_CGIND }, 52 1.1 riastrad { 0x0, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 53 1.1 riastrad { 0x1, 0x0000ffff, 0, 0x101, SISLANDS_CACCONFIG_CGIND }, 54 1.1 riastrad { 0x1, 0xffff0000, 16, 0xc, SISLANDS_CACCONFIG_CGIND }, 55 1.1 riastrad { 0x2, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 56 1.1 riastrad { 0x3, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 57 1.1 riastrad { 0x3, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 58 1.1 riastrad { 0x4, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 59 1.1 riastrad { 0x4, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 60 1.1 riastrad { 0x5, 0x0000ffff, 0, 0x8fc, SISLANDS_CACCONFIG_CGIND }, 61 1.1 riastrad { 0x5, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 62 1.1 riastrad { 0x6, 0x0000ffff, 0, 0x95, SISLANDS_CACCONFIG_CGIND }, 63 1.1 riastrad { 0x6, 0xffff0000, 16, 0x34e, SISLANDS_CACCONFIG_CGIND }, 64 1.1 riastrad { 0x18f, 0x0000ffff, 0, 0x1a1, SISLANDS_CACCONFIG_CGIND }, 65 1.1 riastrad { 0x7, 0x0000ffff, 0, 0xda, SISLANDS_CACCONFIG_CGIND }, 66 1.1 riastrad { 0x7, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 67 1.1 riastrad { 0x8, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 68 1.1 riastrad { 0x8, 0xffff0000, 16, 0x46, SISLANDS_CACCONFIG_CGIND }, 69 1.1 riastrad { 0x9, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 70 1.1 riastrad { 0xa, 0x0000ffff, 0, 0x208, SISLANDS_CACCONFIG_CGIND }, 71 1.1 riastrad { 0xb, 0x0000ffff, 0, 0xe7, SISLANDS_CACCONFIG_CGIND }, 72 1.1 riastrad { 0xb, 0xffff0000, 16, 0x948, SISLANDS_CACCONFIG_CGIND }, 73 1.1 riastrad { 0xc, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 74 1.1 riastrad { 0xd, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 75 1.1 riastrad { 0xd, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 76 1.1 riastrad { 0xe, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 77 1.1 riastrad { 0xf, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 78 1.1 riastrad { 0xf, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 79 1.1 riastrad { 0x10, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 80 1.1 riastrad { 0x10, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 81 1.1 riastrad { 0x11, 0x0000ffff, 0, 0x167, SISLANDS_CACCONFIG_CGIND }, 82 1.1 riastrad { 0x11, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 83 1.1 riastrad { 0x12, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 84 1.1 riastrad { 0x13, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 85 1.1 riastrad { 0x13, 0xffff0000, 16, 0x35, SISLANDS_CACCONFIG_CGIND }, 86 1.1 riastrad { 0x14, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 87 1.1 riastrad { 0x15, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 88 1.1 riastrad { 0x15, 0xffff0000, 16, 0x2, SISLANDS_CACCONFIG_CGIND }, 89 1.1 riastrad { 0x4e, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 90 1.1 riastrad { 0x16, 0x0000ffff, 0, 0x31, SISLANDS_CACCONFIG_CGIND }, 91 1.1 riastrad { 0x16, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 92 1.1 riastrad { 0x17, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 93 1.1 riastrad { 0x18, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 94 1.1 riastrad { 0x18, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 95 1.1 riastrad { 0x19, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 96 1.1 riastrad { 0x19, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 97 1.1 riastrad { 0x1a, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 98 1.1 riastrad { 0x1a, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 99 1.1 riastrad { 0x1b, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 100 1.1 riastrad { 0x1b, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 101 1.1 riastrad { 0x1c, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 102 1.1 riastrad { 0x1c, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 103 1.1 riastrad { 0x1d, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 104 1.1 riastrad { 0x1d, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 105 1.1 riastrad { 0x1e, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 106 1.1 riastrad { 0x1e, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 107 1.1 riastrad { 0x1f, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 108 1.1 riastrad { 0x1f, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 109 1.1 riastrad { 0x20, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 110 1.1 riastrad { 0x6d, 0x0000ffff, 0, 0x18e, SISLANDS_CACCONFIG_CGIND }, 111 1.1 riastrad { 0xFFFFFFFF } 112 1.1 riastrad }; 113 1.1 riastrad 114 1.1 riastrad static const struct si_cac_config_reg lcac_tahiti[] = 115 1.1 riastrad { 116 1.1 riastrad { 0x143, 0x0001fffe, 1, 0x3, SISLANDS_CACCONFIG_CGIND }, 117 1.1 riastrad { 0x143, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 118 1.1 riastrad { 0x146, 0x0001fffe, 1, 0x3, SISLANDS_CACCONFIG_CGIND }, 119 1.1 riastrad { 0x146, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 120 1.1 riastrad { 0x149, 0x0001fffe, 1, 0x3, SISLANDS_CACCONFIG_CGIND }, 121 1.1 riastrad { 0x149, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 122 1.1 riastrad { 0x14c, 0x0001fffe, 1, 0x3, SISLANDS_CACCONFIG_CGIND }, 123 1.1 riastrad { 0x14c, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 124 1.1 riastrad { 0x98, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 125 1.1 riastrad { 0x98, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 126 1.1 riastrad { 0x9b, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 127 1.1 riastrad { 0x9b, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 128 1.1 riastrad { 0x9e, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 129 1.1 riastrad { 0x9e, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 130 1.1 riastrad { 0x101, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 131 1.1 riastrad { 0x101, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 132 1.1 riastrad { 0x104, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 133 1.1 riastrad { 0x104, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 134 1.1 riastrad { 0x107, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 135 1.1 riastrad { 0x107, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 136 1.1 riastrad { 0x10a, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 137 1.1 riastrad { 0x10a, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 138 1.1 riastrad { 0x10d, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 139 1.1 riastrad { 0x10d, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 140 1.1 riastrad { 0x8c, 0x0001fffe, 1, 0x8, SISLANDS_CACCONFIG_CGIND }, 141 1.1 riastrad { 0x8c, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 142 1.1 riastrad { 0x8f, 0x0001fffe, 1, 0x8, SISLANDS_CACCONFIG_CGIND }, 143 1.1 riastrad { 0x8f, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 144 1.1 riastrad { 0x92, 0x0001fffe, 1, 0x8, SISLANDS_CACCONFIG_CGIND }, 145 1.1 riastrad { 0x92, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 146 1.1 riastrad { 0x95, 0x0001fffe, 1, 0x8, SISLANDS_CACCONFIG_CGIND }, 147 1.1 riastrad { 0x95, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 148 1.1 riastrad { 0x14f, 0x0001fffe, 1, 0x8, SISLANDS_CACCONFIG_CGIND }, 149 1.1 riastrad { 0x14f, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 150 1.1 riastrad { 0x152, 0x0001fffe, 1, 0x8, SISLANDS_CACCONFIG_CGIND }, 151 1.1 riastrad { 0x152, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 152 1.1 riastrad { 0x155, 0x0001fffe, 1, 0x8, SISLANDS_CACCONFIG_CGIND }, 153 1.1 riastrad { 0x155, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 154 1.1 riastrad { 0x158, 0x0001fffe, 1, 0x8, SISLANDS_CACCONFIG_CGIND }, 155 1.1 riastrad { 0x158, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 156 1.1 riastrad { 0x110, 0x0001fffe, 1, 0x8, SISLANDS_CACCONFIG_CGIND }, 157 1.1 riastrad { 0x110, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 158 1.1 riastrad { 0x113, 0x0001fffe, 1, 0x8, SISLANDS_CACCONFIG_CGIND }, 159 1.1 riastrad { 0x113, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 160 1.1 riastrad { 0x116, 0x0001fffe, 1, 0x8, SISLANDS_CACCONFIG_CGIND }, 161 1.1 riastrad { 0x116, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 162 1.1 riastrad { 0x119, 0x0001fffe, 1, 0x8, SISLANDS_CACCONFIG_CGIND }, 163 1.1 riastrad { 0x119, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 164 1.1 riastrad { 0x11c, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 165 1.1 riastrad { 0x11c, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 166 1.1 riastrad { 0x11f, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 167 1.1 riastrad { 0x11f, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 168 1.1 riastrad { 0x122, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 169 1.1 riastrad { 0x122, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 170 1.1 riastrad { 0x125, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 171 1.1 riastrad { 0x125, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 172 1.1 riastrad { 0x128, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 173 1.1 riastrad { 0x128, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 174 1.1 riastrad { 0x12b, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 175 1.1 riastrad { 0x12b, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 176 1.1 riastrad { 0x15b, 0x0001fffe, 1, 0x4, SISLANDS_CACCONFIG_CGIND }, 177 1.1 riastrad { 0x15b, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 178 1.1 riastrad { 0x15e, 0x0001fffe, 1, 0x4, SISLANDS_CACCONFIG_CGIND }, 179 1.1 riastrad { 0x15e, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 180 1.1 riastrad { 0x161, 0x0001fffe, 1, 0x4, SISLANDS_CACCONFIG_CGIND }, 181 1.1 riastrad { 0x161, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 182 1.1 riastrad { 0x164, 0x0001fffe, 1, 0x4, SISLANDS_CACCONFIG_CGIND }, 183 1.1 riastrad { 0x164, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 184 1.1 riastrad { 0x167, 0x0001fffe, 1, 0x4, SISLANDS_CACCONFIG_CGIND }, 185 1.1 riastrad { 0x167, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 186 1.1 riastrad { 0x16a, 0x0001fffe, 1, 0x4, SISLANDS_CACCONFIG_CGIND }, 187 1.1 riastrad { 0x16a, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 188 1.1 riastrad { 0x16d, 0x0001fffe, 1, 0x6, SISLANDS_CACCONFIG_CGIND }, 189 1.1 riastrad { 0x16d, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 190 1.1 riastrad { 0x170, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 191 1.1 riastrad { 0x170, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 192 1.1 riastrad { 0x173, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 193 1.1 riastrad { 0x173, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 194 1.1 riastrad { 0x176, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 195 1.1 riastrad { 0x176, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 196 1.1 riastrad { 0x179, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 197 1.1 riastrad { 0x179, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 198 1.1 riastrad { 0x17c, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 199 1.1 riastrad { 0x17c, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 200 1.1 riastrad { 0x17f, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 201 1.1 riastrad { 0x17f, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 202 1.1 riastrad { 0xFFFFFFFF } 203 1.1 riastrad 204 1.1 riastrad }; 205 1.1 riastrad 206 1.1 riastrad static const struct si_cac_config_reg cac_override_tahiti[] = 207 1.1 riastrad { 208 1.1 riastrad { 0xFFFFFFFF } 209 1.1 riastrad }; 210 1.1 riastrad 211 1.1 riastrad static const struct si_powertune_data powertune_data_tahiti = 212 1.1 riastrad { 213 1.1 riastrad ((1 << 16) | 27027), 214 1.1 riastrad 6, 215 1.1 riastrad 0, 216 1.1 riastrad 4, 217 1.1 riastrad 95, 218 1.1 riastrad { 219 1.1 riastrad 0UL, 220 1.1 riastrad 0UL, 221 1.1 riastrad 4521550UL, 222 1.1 riastrad 309631529UL, 223 1.1 riastrad -1270850L, 224 1.1 riastrad 4513710L, 225 1.1 riastrad 40 226 1.1 riastrad }, 227 1.1 riastrad 595000000UL, 228 1.1 riastrad 12, 229 1.1 riastrad { 230 1.1 riastrad 0, 231 1.1 riastrad 0, 232 1.1 riastrad 0, 233 1.1 riastrad 0, 234 1.1 riastrad 0, 235 1.1 riastrad 0, 236 1.1 riastrad 0, 237 1.1 riastrad 0 238 1.1 riastrad }, 239 1.1 riastrad true 240 1.1 riastrad }; 241 1.1 riastrad 242 1.1 riastrad static const struct si_dte_data dte_data_tahiti = 243 1.1 riastrad { 244 1.1 riastrad { 1159409, 0, 0, 0, 0 }, 245 1.1 riastrad { 777, 0, 0, 0, 0 }, 246 1.1 riastrad 2, 247 1.1 riastrad 54000, 248 1.1 riastrad 127000, 249 1.1 riastrad 25, 250 1.1 riastrad 2, 251 1.1 riastrad 10, 252 1.1 riastrad 13, 253 1.1 riastrad { 27, 31, 35, 39, 43, 47, 54, 61, 67, 74, 81, 88, 95, 0, 0, 0 }, 254 1.1 riastrad { 240888759, 221057860, 235370597, 162287531, 158510299, 131423027, 116673180, 103067515, 87941937, 76209048, 68209175, 64090048, 58301890, 0, 0, 0 }, 255 1.1 riastrad { 12024, 11189, 11451, 8411, 7939, 6666, 5681, 4905, 4241, 3720, 3354, 3122, 2890, 0, 0, 0 }, 256 1.1 riastrad 85, 257 1.1 riastrad false 258 1.1 riastrad }; 259 1.1 riastrad 260 1.1 riastrad static const struct si_dte_data dte_data_tahiti_le = 261 1.1 riastrad { 262 1.1 riastrad { 0x1E8480, 0x7A1200, 0x2160EC0, 0x3938700, 0 }, 263 1.1 riastrad { 0x7D, 0x7D, 0x4E4, 0xB00, 0 }, 264 1.1 riastrad 0x5, 265 1.1 riastrad 0xAFC8, 266 1.1 riastrad 0x64, 267 1.1 riastrad 0x32, 268 1.1 riastrad 1, 269 1.1 riastrad 0, 270 1.1 riastrad 0x10, 271 1.1 riastrad { 0x78, 0x7C, 0x82, 0x88, 0x8E, 0x94, 0x9A, 0xA0, 0xA6, 0xAC, 0xB0, 0xB4, 0xB8, 0xBC, 0xC0, 0xC4 }, 272 1.1 riastrad { 0x3938700, 0x3938700, 0x3938700, 0x3938700, 0x3938700, 0x3938700, 0x3938700, 0x3938700, 0x3938700, 0x3938700, 0x3938700, 0x3938700, 0x3938700, 0x3938700, 0x3938700, 0x3938700 }, 273 1.1 riastrad { 0x2AF8, 0x2AF8, 0x29BB, 0x27F9, 0x2637, 0x2475, 0x22B3, 0x20F1, 0x1F2F, 0x1D6D, 0x1734, 0x1414, 0x10F4, 0xDD4, 0xAB4, 0x794 }, 274 1.1 riastrad 85, 275 1.1 riastrad true 276 1.1 riastrad }; 277 1.1 riastrad 278 1.1 riastrad static const struct si_dte_data dte_data_tahiti_pro = 279 1.1 riastrad { 280 1.1 riastrad { 0x1E8480, 0x3D0900, 0x989680, 0x2625A00, 0x0 }, 281 1.1 riastrad { 0x0, 0x0, 0x0, 0x0, 0x0 }, 282 1.1 riastrad 5, 283 1.1 riastrad 45000, 284 1.1 riastrad 100, 285 1.1 riastrad 0xA, 286 1.1 riastrad 1, 287 1.1 riastrad 0, 288 1.1 riastrad 0x10, 289 1.1 riastrad { 0x96, 0xB4, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, 290 1.1 riastrad { 0x895440, 0x3D0900, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680 }, 291 1.1 riastrad { 0x7D0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, 292 1.1 riastrad 90, 293 1.1 riastrad true 294 1.1 riastrad }; 295 1.1 riastrad 296 1.1 riastrad static const struct si_dte_data dte_data_new_zealand = 297 1.1 riastrad { 298 1.1 riastrad { 0x1E8480, 0x3D0900, 0x989680, 0x2625A00, 0 }, 299 1.1 riastrad { 0x29B, 0x3E9, 0x537, 0x7D2, 0 }, 300 1.1 riastrad 0x5, 301 1.1 riastrad 0xAFC8, 302 1.1 riastrad 0x69, 303 1.1 riastrad 0x32, 304 1.1 riastrad 1, 305 1.1 riastrad 0, 306 1.1 riastrad 0x10, 307 1.1 riastrad { 0x82, 0xA0, 0xB4, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE }, 308 1.1 riastrad { 0x895440, 0x3D0900, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680 }, 309 1.1 riastrad { 0xDAC, 0x1388, 0x685, 0x685, 0x685, 0x685, 0x685, 0x685, 0x685, 0x685, 0x685, 0x685, 0x685, 0x685, 0x685, 0x685 }, 310 1.1 riastrad 85, 311 1.1 riastrad true 312 1.1 riastrad }; 313 1.1 riastrad 314 1.1 riastrad static const struct si_dte_data dte_data_aruba_pro = 315 1.1 riastrad { 316 1.1 riastrad { 0x1E8480, 0x3D0900, 0x989680, 0x2625A00, 0x0 }, 317 1.1 riastrad { 0x0, 0x0, 0x0, 0x0, 0x0 }, 318 1.1 riastrad 5, 319 1.1 riastrad 45000, 320 1.1 riastrad 100, 321 1.1 riastrad 0xA, 322 1.1 riastrad 1, 323 1.1 riastrad 0, 324 1.1 riastrad 0x10, 325 1.1 riastrad { 0x96, 0xB4, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, 326 1.1 riastrad { 0x895440, 0x3D0900, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680 }, 327 1.1 riastrad { 0x1000, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, 328 1.1 riastrad 90, 329 1.1 riastrad true 330 1.1 riastrad }; 331 1.1 riastrad 332 1.1 riastrad static const struct si_dte_data dte_data_malta = 333 1.1 riastrad { 334 1.1 riastrad { 0x1E8480, 0x3D0900, 0x989680, 0x2625A00, 0x0 }, 335 1.1 riastrad { 0x0, 0x0, 0x0, 0x0, 0x0 }, 336 1.1 riastrad 5, 337 1.1 riastrad 45000, 338 1.1 riastrad 100, 339 1.1 riastrad 0xA, 340 1.1 riastrad 1, 341 1.1 riastrad 0, 342 1.1 riastrad 0x10, 343 1.1 riastrad { 0x96, 0xB4, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, 344 1.1 riastrad { 0x895440, 0x3D0900, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680 }, 345 1.1 riastrad { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, 346 1.1 riastrad 90, 347 1.1 riastrad true 348 1.1 riastrad }; 349 1.1 riastrad 350 1.1 riastrad struct si_cac_config_reg cac_weights_pitcairn[] = 351 1.1 riastrad { 352 1.1 riastrad { 0x0, 0x0000ffff, 0, 0x8a, SISLANDS_CACCONFIG_CGIND }, 353 1.1 riastrad { 0x0, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 354 1.1 riastrad { 0x1, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 355 1.1 riastrad { 0x1, 0xffff0000, 16, 0x24d, SISLANDS_CACCONFIG_CGIND }, 356 1.1 riastrad { 0x2, 0x0000ffff, 0, 0x19, SISLANDS_CACCONFIG_CGIND }, 357 1.1 riastrad { 0x3, 0x0000ffff, 0, 0x118, SISLANDS_CACCONFIG_CGIND }, 358 1.1 riastrad { 0x3, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 359 1.1 riastrad { 0x4, 0x0000ffff, 0, 0x76, SISLANDS_CACCONFIG_CGIND }, 360 1.1 riastrad { 0x4, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 361 1.1 riastrad { 0x5, 0x0000ffff, 0, 0xc11, SISLANDS_CACCONFIG_CGIND }, 362 1.1 riastrad { 0x5, 0xffff0000, 16, 0x7f3, SISLANDS_CACCONFIG_CGIND }, 363 1.1 riastrad { 0x6, 0x0000ffff, 0, 0x403, SISLANDS_CACCONFIG_CGIND }, 364 1.1 riastrad { 0x6, 0xffff0000, 16, 0x367, SISLANDS_CACCONFIG_CGIND }, 365 1.1 riastrad { 0x18f, 0x0000ffff, 0, 0x4c9, SISLANDS_CACCONFIG_CGIND }, 366 1.1 riastrad { 0x7, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 367 1.1 riastrad { 0x7, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 368 1.1 riastrad { 0x8, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 369 1.1 riastrad { 0x8, 0xffff0000, 16, 0x45d, SISLANDS_CACCONFIG_CGIND }, 370 1.1 riastrad { 0x9, 0x0000ffff, 0, 0x36d, SISLANDS_CACCONFIG_CGIND }, 371 1.1 riastrad { 0xa, 0x0000ffff, 0, 0x534, SISLANDS_CACCONFIG_CGIND }, 372 1.1 riastrad { 0xb, 0x0000ffff, 0, 0x5da, SISLANDS_CACCONFIG_CGIND }, 373 1.1 riastrad { 0xb, 0xffff0000, 16, 0x880, SISLANDS_CACCONFIG_CGIND }, 374 1.1 riastrad { 0xc, 0x0000ffff, 0, 0x201, SISLANDS_CACCONFIG_CGIND }, 375 1.1 riastrad { 0xd, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 376 1.1 riastrad { 0xd, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 377 1.1 riastrad { 0xe, 0x0000ffff, 0, 0x9f, SISLANDS_CACCONFIG_CGIND }, 378 1.1 riastrad { 0xf, 0x0000ffff, 0, 0x1f, SISLANDS_CACCONFIG_CGIND }, 379 1.1 riastrad { 0xf, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 380 1.1 riastrad { 0x10, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 381 1.1 riastrad { 0x10, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 382 1.1 riastrad { 0x11, 0x0000ffff, 0, 0x5de, SISLANDS_CACCONFIG_CGIND }, 383 1.1 riastrad { 0x11, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 384 1.1 riastrad { 0x12, 0x0000ffff, 0, 0x7b, SISLANDS_CACCONFIG_CGIND }, 385 1.1 riastrad { 0x13, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 386 1.1 riastrad { 0x13, 0xffff0000, 16, 0x13, SISLANDS_CACCONFIG_CGIND }, 387 1.1 riastrad { 0x14, 0x0000ffff, 0, 0xf9, SISLANDS_CACCONFIG_CGIND }, 388 1.1 riastrad { 0x15, 0x0000ffff, 0, 0x66, SISLANDS_CACCONFIG_CGIND }, 389 1.1 riastrad { 0x15, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 390 1.1 riastrad { 0x4e, 0x0000ffff, 0, 0x13, SISLANDS_CACCONFIG_CGIND }, 391 1.1 riastrad { 0x16, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 392 1.1 riastrad { 0x16, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 393 1.1 riastrad { 0x17, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 394 1.1 riastrad { 0x18, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 395 1.1 riastrad { 0x18, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 396 1.1 riastrad { 0x19, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 397 1.1 riastrad { 0x19, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 398 1.1 riastrad { 0x1a, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 399 1.1 riastrad { 0x1a, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 400 1.1 riastrad { 0x1b, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 401 1.1 riastrad { 0x1b, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 402 1.1 riastrad { 0x1c, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 403 1.1 riastrad { 0x1c, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 404 1.1 riastrad { 0x1d, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 405 1.1 riastrad { 0x1d, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 406 1.1 riastrad { 0x1e, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 407 1.1 riastrad { 0x1e, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 408 1.1 riastrad { 0x1f, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 409 1.1 riastrad { 0x1f, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 410 1.1 riastrad { 0x20, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 411 1.1 riastrad { 0x6d, 0x0000ffff, 0, 0x186, SISLANDS_CACCONFIG_CGIND }, 412 1.1 riastrad { 0xFFFFFFFF } 413 1.1 riastrad }; 414 1.1 riastrad 415 1.1 riastrad static const struct si_cac_config_reg lcac_pitcairn[] = 416 1.1 riastrad { 417 1.1 riastrad { 0x98, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 418 1.1 riastrad { 0x98, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 419 1.1 riastrad { 0x104, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 420 1.1 riastrad { 0x104, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 421 1.1 riastrad { 0x110, 0x0001fffe, 1, 0x5, SISLANDS_CACCONFIG_CGIND }, 422 1.1 riastrad { 0x110, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 423 1.1 riastrad { 0x14f, 0x0001fffe, 1, 0x5, SISLANDS_CACCONFIG_CGIND }, 424 1.1 riastrad { 0x14f, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 425 1.1 riastrad { 0x8c, 0x0001fffe, 1, 0x5, SISLANDS_CACCONFIG_CGIND }, 426 1.1 riastrad { 0x8c, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 427 1.1 riastrad { 0x143, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 428 1.1 riastrad { 0x143, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 429 1.1 riastrad { 0x9b, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 430 1.1 riastrad { 0x9b, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 431 1.1 riastrad { 0x107, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 432 1.1 riastrad { 0x107, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 433 1.1 riastrad { 0x113, 0x0001fffe, 1, 0x5, SISLANDS_CACCONFIG_CGIND }, 434 1.1 riastrad { 0x113, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 435 1.1 riastrad { 0x152, 0x0001fffe, 1, 0x5, SISLANDS_CACCONFIG_CGIND }, 436 1.1 riastrad { 0x152, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 437 1.1 riastrad { 0x8f, 0x0001fffe, 1, 0x5, SISLANDS_CACCONFIG_CGIND }, 438 1.1 riastrad { 0x8f, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 439 1.1 riastrad { 0x146, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 440 1.1 riastrad { 0x146, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 441 1.1 riastrad { 0x9e, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 442 1.1 riastrad { 0x9e, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 443 1.1 riastrad { 0x10a, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 444 1.1 riastrad { 0x10a, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 445 1.1 riastrad { 0x116, 0x0001fffe, 1, 0x5, SISLANDS_CACCONFIG_CGIND }, 446 1.1 riastrad { 0x116, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 447 1.1 riastrad { 0x155, 0x0001fffe, 1, 0x5, SISLANDS_CACCONFIG_CGIND }, 448 1.1 riastrad { 0x155, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 449 1.1 riastrad { 0x92, 0x0001fffe, 1, 0x5, SISLANDS_CACCONFIG_CGIND }, 450 1.1 riastrad { 0x92, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 451 1.1 riastrad { 0x149, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 452 1.1 riastrad { 0x149, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 453 1.1 riastrad { 0x101, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 454 1.1 riastrad { 0x101, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 455 1.1 riastrad { 0x10d, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 456 1.1 riastrad { 0x10d, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 457 1.1 riastrad { 0x119, 0x0001fffe, 1, 0x5, SISLANDS_CACCONFIG_CGIND }, 458 1.1 riastrad { 0x119, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 459 1.1 riastrad { 0x158, 0x0001fffe, 1, 0x5, SISLANDS_CACCONFIG_CGIND }, 460 1.1 riastrad { 0x158, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 461 1.1 riastrad { 0x95, 0x0001fffe, 1, 0x5, SISLANDS_CACCONFIG_CGIND }, 462 1.1 riastrad { 0x95, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 463 1.1 riastrad { 0x14c, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 464 1.1 riastrad { 0x14c, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 465 1.1 riastrad { 0x11c, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 466 1.1 riastrad { 0x11c, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 467 1.1 riastrad { 0x11f, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 468 1.1 riastrad { 0x11f, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 469 1.1 riastrad { 0x122, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 470 1.1 riastrad { 0x122, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 471 1.1 riastrad { 0x125, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 472 1.1 riastrad { 0x125, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 473 1.1 riastrad { 0x128, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 474 1.1 riastrad { 0x128, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 475 1.1 riastrad { 0x12b, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 476 1.1 riastrad { 0x12b, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 477 1.1 riastrad { 0x164, 0x0001fffe, 1, 0x4, SISLANDS_CACCONFIG_CGIND }, 478 1.1 riastrad { 0x164, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 479 1.1 riastrad { 0x167, 0x0001fffe, 1, 0x4, SISLANDS_CACCONFIG_CGIND }, 480 1.1 riastrad { 0x167, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 481 1.1 riastrad { 0x16a, 0x0001fffe, 1, 0x4, SISLANDS_CACCONFIG_CGIND }, 482 1.1 riastrad { 0x16a, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 483 1.1 riastrad { 0x15e, 0x0001fffe, 1, 0x4, SISLANDS_CACCONFIG_CGIND }, 484 1.1 riastrad { 0x15e, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 485 1.1 riastrad { 0x161, 0x0001fffe, 1, 0x4, SISLANDS_CACCONFIG_CGIND }, 486 1.1 riastrad { 0x161, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 487 1.1 riastrad { 0x15b, 0x0001fffe, 1, 0x4, SISLANDS_CACCONFIG_CGIND }, 488 1.1 riastrad { 0x15b, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 489 1.1 riastrad { 0x16d, 0x0001fffe, 1, 0x4, SISLANDS_CACCONFIG_CGIND }, 490 1.1 riastrad { 0x16d, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 491 1.1 riastrad { 0x170, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 492 1.1 riastrad { 0x170, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 493 1.1 riastrad { 0x173, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 494 1.1 riastrad { 0x173, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 495 1.1 riastrad { 0x176, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 496 1.1 riastrad { 0x176, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 497 1.1 riastrad { 0x179, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 498 1.1 riastrad { 0x179, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 499 1.1 riastrad { 0x17c, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 500 1.1 riastrad { 0x17c, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 501 1.1 riastrad { 0x17f, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 502 1.1 riastrad { 0x17f, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 503 1.1 riastrad { 0xFFFFFFFF } 504 1.1 riastrad }; 505 1.1 riastrad 506 1.1 riastrad static const struct si_cac_config_reg cac_override_pitcairn[] = 507 1.1 riastrad { 508 1.5 riastrad { 0xFFFFFFFF } 509 1.1 riastrad }; 510 1.1 riastrad 511 1.1 riastrad static const struct si_powertune_data powertune_data_pitcairn = 512 1.1 riastrad { 513 1.1 riastrad ((1 << 16) | 27027), 514 1.1 riastrad 5, 515 1.1 riastrad 0, 516 1.1 riastrad 6, 517 1.1 riastrad 100, 518 1.1 riastrad { 519 1.1 riastrad 51600000UL, 520 1.1 riastrad 1800000UL, 521 1.1 riastrad 7194395UL, 522 1.1 riastrad 309631529UL, 523 1.1 riastrad -1270850L, 524 1.1 riastrad 4513710L, 525 1.1 riastrad 100 526 1.1 riastrad }, 527 1.1 riastrad 117830498UL, 528 1.1 riastrad 12, 529 1.1 riastrad { 530 1.1 riastrad 0, 531 1.1 riastrad 0, 532 1.1 riastrad 0, 533 1.1 riastrad 0, 534 1.1 riastrad 0, 535 1.1 riastrad 0, 536 1.1 riastrad 0, 537 1.1 riastrad 0 538 1.1 riastrad }, 539 1.1 riastrad true 540 1.1 riastrad }; 541 1.1 riastrad 542 1.1 riastrad static const struct si_dte_data dte_data_pitcairn = 543 1.1 riastrad { 544 1.1 riastrad { 0, 0, 0, 0, 0 }, 545 1.1 riastrad { 0, 0, 0, 0, 0 }, 546 1.1 riastrad 0, 547 1.1 riastrad 0, 548 1.1 riastrad 0, 549 1.1 riastrad 0, 550 1.1 riastrad 0, 551 1.1 riastrad 0, 552 1.1 riastrad 0, 553 1.1 riastrad { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 554 1.1 riastrad { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 555 1.1 riastrad { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 556 1.1 riastrad 0, 557 1.1 riastrad false 558 1.1 riastrad }; 559 1.1 riastrad 560 1.1 riastrad static const struct si_dte_data dte_data_curacao_xt = 561 1.1 riastrad { 562 1.1 riastrad { 0x1E8480, 0x3D0900, 0x989680, 0x2625A00, 0x0 }, 563 1.1 riastrad { 0x0, 0x0, 0x0, 0x0, 0x0 }, 564 1.1 riastrad 5, 565 1.1 riastrad 45000, 566 1.1 riastrad 100, 567 1.1 riastrad 0xA, 568 1.1 riastrad 1, 569 1.1 riastrad 0, 570 1.1 riastrad 0x10, 571 1.1 riastrad { 0x96, 0xB4, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, 572 1.1 riastrad { 0x895440, 0x3D0900, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680 }, 573 1.1 riastrad { 0x1D17, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, 574 1.1 riastrad 90, 575 1.1 riastrad true 576 1.1 riastrad }; 577 1.1 riastrad 578 1.1 riastrad static const struct si_dte_data dte_data_curacao_pro = 579 1.1 riastrad { 580 1.1 riastrad { 0x1E8480, 0x3D0900, 0x989680, 0x2625A00, 0x0 }, 581 1.1 riastrad { 0x0, 0x0, 0x0, 0x0, 0x0 }, 582 1.1 riastrad 5, 583 1.1 riastrad 45000, 584 1.1 riastrad 100, 585 1.1 riastrad 0xA, 586 1.1 riastrad 1, 587 1.1 riastrad 0, 588 1.1 riastrad 0x10, 589 1.1 riastrad { 0x96, 0xB4, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, 590 1.1 riastrad { 0x895440, 0x3D0900, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680 }, 591 1.1 riastrad { 0x1D17, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, 592 1.1 riastrad 90, 593 1.1 riastrad true 594 1.1 riastrad }; 595 1.1 riastrad 596 1.1 riastrad static const struct si_dte_data dte_data_neptune_xt = 597 1.1 riastrad { 598 1.1 riastrad { 0x1E8480, 0x3D0900, 0x989680, 0x2625A00, 0x0 }, 599 1.1 riastrad { 0x0, 0x0, 0x0, 0x0, 0x0 }, 600 1.1 riastrad 5, 601 1.1 riastrad 45000, 602 1.1 riastrad 100, 603 1.1 riastrad 0xA, 604 1.1 riastrad 1, 605 1.1 riastrad 0, 606 1.1 riastrad 0x10, 607 1.1 riastrad { 0x96, 0xB4, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, 608 1.1 riastrad { 0x895440, 0x3D0900, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680 }, 609 1.1 riastrad { 0x3A2F, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, 610 1.1 riastrad 90, 611 1.1 riastrad true 612 1.1 riastrad }; 613 1.1 riastrad 614 1.1 riastrad static const struct si_cac_config_reg cac_weights_chelsea_pro[] = 615 1.1 riastrad { 616 1.1 riastrad { 0x0, 0x0000ffff, 0, 0x82, SISLANDS_CACCONFIG_CGIND }, 617 1.1 riastrad { 0x0, 0xffff0000, 16, 0x4F, SISLANDS_CACCONFIG_CGIND }, 618 1.1 riastrad { 0x1, 0x0000ffff, 0, 0x153, SISLANDS_CACCONFIG_CGIND }, 619 1.1 riastrad { 0x1, 0xffff0000, 16, 0x52, SISLANDS_CACCONFIG_CGIND }, 620 1.1 riastrad { 0x2, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 621 1.1 riastrad { 0x3, 0x0000ffff, 0, 0x135, SISLANDS_CACCONFIG_CGIND }, 622 1.1 riastrad { 0x3, 0xffff0000, 16, 0x4F, SISLANDS_CACCONFIG_CGIND }, 623 1.1 riastrad { 0x4, 0x0000ffff, 0, 0x135, SISLANDS_CACCONFIG_CGIND }, 624 1.1 riastrad { 0x4, 0xffff0000, 16, 0xAC, SISLANDS_CACCONFIG_CGIND }, 625 1.1 riastrad { 0x5, 0x0000ffff, 0, 0x118, SISLANDS_CACCONFIG_CGIND }, 626 1.1 riastrad { 0x5, 0xffff0000, 16, 0xBE, SISLANDS_CACCONFIG_CGIND }, 627 1.1 riastrad { 0x6, 0x0000ffff, 0, 0x110, SISLANDS_CACCONFIG_CGIND }, 628 1.1 riastrad { 0x6, 0xffff0000, 16, 0x4CD, SISLANDS_CACCONFIG_CGIND }, 629 1.1 riastrad { 0x18f, 0x0000ffff, 0, 0x30, SISLANDS_CACCONFIG_CGIND }, 630 1.1 riastrad { 0x7, 0x0000ffff, 0, 0x37, SISLANDS_CACCONFIG_CGIND }, 631 1.1 riastrad { 0x7, 0xffff0000, 16, 0x27, SISLANDS_CACCONFIG_CGIND }, 632 1.1 riastrad { 0x8, 0x0000ffff, 0, 0xC3, SISLANDS_CACCONFIG_CGIND }, 633 1.1 riastrad { 0x8, 0xffff0000, 16, 0x35, SISLANDS_CACCONFIG_CGIND }, 634 1.1 riastrad { 0x9, 0x0000ffff, 0, 0x28, SISLANDS_CACCONFIG_CGIND }, 635 1.1 riastrad { 0xa, 0x0000ffff, 0, 0x26C, SISLANDS_CACCONFIG_CGIND }, 636 1.1 riastrad { 0xb, 0x0000ffff, 0, 0x3B2, SISLANDS_CACCONFIG_CGIND }, 637 1.1 riastrad { 0xb, 0xffff0000, 16, 0x99D, SISLANDS_CACCONFIG_CGIND }, 638 1.1 riastrad { 0xc, 0x0000ffff, 0, 0xA3F, SISLANDS_CACCONFIG_CGIND }, 639 1.1 riastrad { 0xd, 0x0000ffff, 0, 0xA, SISLANDS_CACCONFIG_CGIND }, 640 1.1 riastrad { 0xd, 0xffff0000, 16, 0xA, SISLANDS_CACCONFIG_CGIND }, 641 1.1 riastrad { 0xe, 0x0000ffff, 0, 0x5, SISLANDS_CACCONFIG_CGIND }, 642 1.1 riastrad { 0xf, 0x0000ffff, 0, 0x3, SISLANDS_CACCONFIG_CGIND }, 643 1.1 riastrad { 0xf, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 644 1.1 riastrad { 0x10, 0x0000ffff, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 645 1.1 riastrad { 0x10, 0xffff0000, 16, 0x1, SISLANDS_CACCONFIG_CGIND }, 646 1.1 riastrad { 0x11, 0x0000ffff, 0, 0x5, SISLANDS_CACCONFIG_CGIND }, 647 1.1 riastrad { 0x11, 0xffff0000, 16, 0x15, SISLANDS_CACCONFIG_CGIND }, 648 1.1 riastrad { 0x12, 0x0000ffff, 0, 0x34, SISLANDS_CACCONFIG_CGIND }, 649 1.1 riastrad { 0x13, 0x0000ffff, 0, 0x4, SISLANDS_CACCONFIG_CGIND }, 650 1.1 riastrad { 0x13, 0xffff0000, 16, 0x4, SISLANDS_CACCONFIG_CGIND }, 651 1.1 riastrad { 0x14, 0x0000ffff, 0, 0x2BD, SISLANDS_CACCONFIG_CGIND }, 652 1.1 riastrad { 0x15, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 653 1.1 riastrad { 0x15, 0xffff0000, 16, 0x6, SISLANDS_CACCONFIG_CGIND }, 654 1.1 riastrad { 0x4e, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 655 1.1 riastrad { 0x16, 0x0000ffff, 0, 0x30, SISLANDS_CACCONFIG_CGIND }, 656 1.1 riastrad { 0x16, 0xffff0000, 16, 0x7A, SISLANDS_CACCONFIG_CGIND }, 657 1.1 riastrad { 0x17, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 658 1.1 riastrad { 0x18, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 659 1.1 riastrad { 0x18, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 660 1.1 riastrad { 0x19, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 661 1.1 riastrad { 0x19, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 662 1.1 riastrad { 0x1a, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 663 1.1 riastrad { 0x1a, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND }, 664 1.1 riastrad { 0x1b, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 665 1.1 riastrad { 0x1b, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND }, 666 1.1 riastrad { 0x1c, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 667 1.1 riastrad { 0x1c, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND }, 668 1.1 riastrad { 0x1d, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 669 1.1 riastrad { 0x1d, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND }, 670 1.1 riastrad { 0x1e, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 671 1.1 riastrad { 0x1e, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND }, 672 1.1 riastrad { 0x1f, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 673 1.1 riastrad { 0x1f, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND }, 674 1.1 riastrad { 0x20, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 675 1.1 riastrad { 0x6d, 0x0000ffff, 0, 0x100, SISLANDS_CACCONFIG_CGIND }, 676 1.1 riastrad { 0xFFFFFFFF } 677 1.1 riastrad }; 678 1.1 riastrad 679 1.1 riastrad static const struct si_cac_config_reg cac_weights_chelsea_xt[] = 680 1.1 riastrad { 681 1.1 riastrad { 0x0, 0x0000ffff, 0, 0x82, SISLANDS_CACCONFIG_CGIND }, 682 1.1 riastrad { 0x0, 0xffff0000, 16, 0x4F, SISLANDS_CACCONFIG_CGIND }, 683 1.1 riastrad { 0x1, 0x0000ffff, 0, 0x153, SISLANDS_CACCONFIG_CGIND }, 684 1.1 riastrad { 0x1, 0xffff0000, 16, 0x52, SISLANDS_CACCONFIG_CGIND }, 685 1.1 riastrad { 0x2, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 686 1.1 riastrad { 0x3, 0x0000ffff, 0, 0x135, SISLANDS_CACCONFIG_CGIND }, 687 1.1 riastrad { 0x3, 0xffff0000, 16, 0x4F, SISLANDS_CACCONFIG_CGIND }, 688 1.1 riastrad { 0x4, 0x0000ffff, 0, 0x135, SISLANDS_CACCONFIG_CGIND }, 689 1.1 riastrad { 0x4, 0xffff0000, 16, 0xAC, SISLANDS_CACCONFIG_CGIND }, 690 1.1 riastrad { 0x5, 0x0000ffff, 0, 0x118, SISLANDS_CACCONFIG_CGIND }, 691 1.1 riastrad { 0x5, 0xffff0000, 16, 0xBE, SISLANDS_CACCONFIG_CGIND }, 692 1.1 riastrad { 0x6, 0x0000ffff, 0, 0x110, SISLANDS_CACCONFIG_CGIND }, 693 1.1 riastrad { 0x6, 0xffff0000, 16, 0x4CD, SISLANDS_CACCONFIG_CGIND }, 694 1.1 riastrad { 0x18f, 0x0000ffff, 0, 0x30, SISLANDS_CACCONFIG_CGIND }, 695 1.1 riastrad { 0x7, 0x0000ffff, 0, 0x37, SISLANDS_CACCONFIG_CGIND }, 696 1.1 riastrad { 0x7, 0xffff0000, 16, 0x27, SISLANDS_CACCONFIG_CGIND }, 697 1.1 riastrad { 0x8, 0x0000ffff, 0, 0xC3, SISLANDS_CACCONFIG_CGIND }, 698 1.1 riastrad { 0x8, 0xffff0000, 16, 0x35, SISLANDS_CACCONFIG_CGIND }, 699 1.1 riastrad { 0x9, 0x0000ffff, 0, 0x28, SISLANDS_CACCONFIG_CGIND }, 700 1.1 riastrad { 0xa, 0x0000ffff, 0, 0x26C, SISLANDS_CACCONFIG_CGIND }, 701 1.1 riastrad { 0xb, 0x0000ffff, 0, 0x3B2, SISLANDS_CACCONFIG_CGIND }, 702 1.1 riastrad { 0xb, 0xffff0000, 16, 0x99D, SISLANDS_CACCONFIG_CGIND }, 703 1.1 riastrad { 0xc, 0x0000ffff, 0, 0xA3F, SISLANDS_CACCONFIG_CGIND }, 704 1.1 riastrad { 0xd, 0x0000ffff, 0, 0xA, SISLANDS_CACCONFIG_CGIND }, 705 1.1 riastrad { 0xd, 0xffff0000, 16, 0xA, SISLANDS_CACCONFIG_CGIND }, 706 1.1 riastrad { 0xe, 0x0000ffff, 0, 0x5, SISLANDS_CACCONFIG_CGIND }, 707 1.1 riastrad { 0xf, 0x0000ffff, 0, 0x3, SISLANDS_CACCONFIG_CGIND }, 708 1.1 riastrad { 0xf, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 709 1.1 riastrad { 0x10, 0x0000ffff, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 710 1.1 riastrad { 0x10, 0xffff0000, 16, 0x1, SISLANDS_CACCONFIG_CGIND }, 711 1.1 riastrad { 0x11, 0x0000ffff, 0, 0x5, SISLANDS_CACCONFIG_CGIND }, 712 1.1 riastrad { 0x11, 0xffff0000, 16, 0x15, SISLANDS_CACCONFIG_CGIND }, 713 1.1 riastrad { 0x12, 0x0000ffff, 0, 0x34, SISLANDS_CACCONFIG_CGIND }, 714 1.1 riastrad { 0x13, 0x0000ffff, 0, 0x4, SISLANDS_CACCONFIG_CGIND }, 715 1.1 riastrad { 0x13, 0xffff0000, 16, 0x4, SISLANDS_CACCONFIG_CGIND }, 716 1.1 riastrad { 0x14, 0x0000ffff, 0, 0x30A, SISLANDS_CACCONFIG_CGIND }, 717 1.1 riastrad { 0x15, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 718 1.1 riastrad { 0x15, 0xffff0000, 16, 0x6, SISLANDS_CACCONFIG_CGIND }, 719 1.1 riastrad { 0x4e, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 720 1.1 riastrad { 0x16, 0x0000ffff, 0, 0x30, SISLANDS_CACCONFIG_CGIND }, 721 1.1 riastrad { 0x16, 0xffff0000, 16, 0x7A, SISLANDS_CACCONFIG_CGIND }, 722 1.1 riastrad { 0x17, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 723 1.1 riastrad { 0x18, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 724 1.1 riastrad { 0x18, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 725 1.1 riastrad { 0x19, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 726 1.1 riastrad { 0x19, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 727 1.1 riastrad { 0x1a, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 728 1.1 riastrad { 0x1a, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND }, 729 1.1 riastrad { 0x1b, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 730 1.1 riastrad { 0x1b, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND }, 731 1.1 riastrad { 0x1c, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 732 1.1 riastrad { 0x1c, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND }, 733 1.1 riastrad { 0x1d, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 734 1.1 riastrad { 0x1d, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND }, 735 1.1 riastrad { 0x1e, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 736 1.1 riastrad { 0x1e, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND }, 737 1.1 riastrad { 0x1f, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 738 1.1 riastrad { 0x1f, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND }, 739 1.1 riastrad { 0x20, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 740 1.1 riastrad { 0x6d, 0x0000ffff, 0, 0x100, SISLANDS_CACCONFIG_CGIND }, 741 1.1 riastrad { 0xFFFFFFFF } 742 1.1 riastrad }; 743 1.1 riastrad 744 1.1 riastrad static const struct si_cac_config_reg cac_weights_heathrow[] = 745 1.1 riastrad { 746 1.1 riastrad { 0x0, 0x0000ffff, 0, 0x82, SISLANDS_CACCONFIG_CGIND }, 747 1.1 riastrad { 0x0, 0xffff0000, 16, 0x4F, SISLANDS_CACCONFIG_CGIND }, 748 1.1 riastrad { 0x1, 0x0000ffff, 0, 0x153, SISLANDS_CACCONFIG_CGIND }, 749 1.1 riastrad { 0x1, 0xffff0000, 16, 0x52, SISLANDS_CACCONFIG_CGIND }, 750 1.1 riastrad { 0x2, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 751 1.1 riastrad { 0x3, 0x0000ffff, 0, 0x135, SISLANDS_CACCONFIG_CGIND }, 752 1.1 riastrad { 0x3, 0xffff0000, 16, 0x4F, SISLANDS_CACCONFIG_CGIND }, 753 1.1 riastrad { 0x4, 0x0000ffff, 0, 0x135, SISLANDS_CACCONFIG_CGIND }, 754 1.1 riastrad { 0x4, 0xffff0000, 16, 0xAC, SISLANDS_CACCONFIG_CGIND }, 755 1.1 riastrad { 0x5, 0x0000ffff, 0, 0x118, SISLANDS_CACCONFIG_CGIND }, 756 1.1 riastrad { 0x5, 0xffff0000, 16, 0xBE, SISLANDS_CACCONFIG_CGIND }, 757 1.1 riastrad { 0x6, 0x0000ffff, 0, 0x110, SISLANDS_CACCONFIG_CGIND }, 758 1.1 riastrad { 0x6, 0xffff0000, 16, 0x4CD, SISLANDS_CACCONFIG_CGIND }, 759 1.1 riastrad { 0x18f, 0x0000ffff, 0, 0x30, SISLANDS_CACCONFIG_CGIND }, 760 1.1 riastrad { 0x7, 0x0000ffff, 0, 0x37, SISLANDS_CACCONFIG_CGIND }, 761 1.1 riastrad { 0x7, 0xffff0000, 16, 0x27, SISLANDS_CACCONFIG_CGIND }, 762 1.1 riastrad { 0x8, 0x0000ffff, 0, 0xC3, SISLANDS_CACCONFIG_CGIND }, 763 1.1 riastrad { 0x8, 0xffff0000, 16, 0x35, SISLANDS_CACCONFIG_CGIND }, 764 1.1 riastrad { 0x9, 0x0000ffff, 0, 0x28, SISLANDS_CACCONFIG_CGIND }, 765 1.1 riastrad { 0xa, 0x0000ffff, 0, 0x26C, SISLANDS_CACCONFIG_CGIND }, 766 1.1 riastrad { 0xb, 0x0000ffff, 0, 0x3B2, SISLANDS_CACCONFIG_CGIND }, 767 1.1 riastrad { 0xb, 0xffff0000, 16, 0x99D, SISLANDS_CACCONFIG_CGIND }, 768 1.1 riastrad { 0xc, 0x0000ffff, 0, 0xA3F, SISLANDS_CACCONFIG_CGIND }, 769 1.1 riastrad { 0xd, 0x0000ffff, 0, 0xA, SISLANDS_CACCONFIG_CGIND }, 770 1.1 riastrad { 0xd, 0xffff0000, 16, 0xA, SISLANDS_CACCONFIG_CGIND }, 771 1.1 riastrad { 0xe, 0x0000ffff, 0, 0x5, SISLANDS_CACCONFIG_CGIND }, 772 1.1 riastrad { 0xf, 0x0000ffff, 0, 0x3, SISLANDS_CACCONFIG_CGIND }, 773 1.1 riastrad { 0xf, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 774 1.1 riastrad { 0x10, 0x0000ffff, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 775 1.1 riastrad { 0x10, 0xffff0000, 16, 0x1, SISLANDS_CACCONFIG_CGIND }, 776 1.1 riastrad { 0x11, 0x0000ffff, 0, 0x5, SISLANDS_CACCONFIG_CGIND }, 777 1.1 riastrad { 0x11, 0xffff0000, 16, 0x15, SISLANDS_CACCONFIG_CGIND }, 778 1.1 riastrad { 0x12, 0x0000ffff, 0, 0x34, SISLANDS_CACCONFIG_CGIND }, 779 1.1 riastrad { 0x13, 0x0000ffff, 0, 0x4, SISLANDS_CACCONFIG_CGIND }, 780 1.1 riastrad { 0x13, 0xffff0000, 16, 0x4, SISLANDS_CACCONFIG_CGIND }, 781 1.1 riastrad { 0x14, 0x0000ffff, 0, 0x362, SISLANDS_CACCONFIG_CGIND }, 782 1.1 riastrad { 0x15, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 783 1.1 riastrad { 0x15, 0xffff0000, 16, 0x6, SISLANDS_CACCONFIG_CGIND }, 784 1.1 riastrad { 0x4e, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 785 1.1 riastrad { 0x16, 0x0000ffff, 0, 0x30, SISLANDS_CACCONFIG_CGIND }, 786 1.1 riastrad { 0x16, 0xffff0000, 16, 0x7A, SISLANDS_CACCONFIG_CGIND }, 787 1.1 riastrad { 0x17, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 788 1.1 riastrad { 0x18, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 789 1.1 riastrad { 0x18, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 790 1.1 riastrad { 0x19, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 791 1.1 riastrad { 0x19, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 792 1.1 riastrad { 0x1a, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 793 1.1 riastrad { 0x1a, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND }, 794 1.1 riastrad { 0x1b, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 795 1.1 riastrad { 0x1b, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND }, 796 1.1 riastrad { 0x1c, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 797 1.1 riastrad { 0x1c, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND }, 798 1.1 riastrad { 0x1d, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 799 1.1 riastrad { 0x1d, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND }, 800 1.1 riastrad { 0x1e, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 801 1.1 riastrad { 0x1e, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND }, 802 1.1 riastrad { 0x1f, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 803 1.1 riastrad { 0x1f, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND }, 804 1.1 riastrad { 0x20, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 805 1.1 riastrad { 0x6d, 0x0000ffff, 0, 0x100, SISLANDS_CACCONFIG_CGIND }, 806 1.1 riastrad { 0xFFFFFFFF } 807 1.1 riastrad }; 808 1.1 riastrad 809 1.1 riastrad static const struct si_cac_config_reg cac_weights_cape_verde_pro[] = 810 1.1 riastrad { 811 1.1 riastrad { 0x0, 0x0000ffff, 0, 0x82, SISLANDS_CACCONFIG_CGIND }, 812 1.1 riastrad { 0x0, 0xffff0000, 16, 0x4F, SISLANDS_CACCONFIG_CGIND }, 813 1.1 riastrad { 0x1, 0x0000ffff, 0, 0x153, SISLANDS_CACCONFIG_CGIND }, 814 1.1 riastrad { 0x1, 0xffff0000, 16, 0x52, SISLANDS_CACCONFIG_CGIND }, 815 1.1 riastrad { 0x2, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 816 1.1 riastrad { 0x3, 0x0000ffff, 0, 0x135, SISLANDS_CACCONFIG_CGIND }, 817 1.1 riastrad { 0x3, 0xffff0000, 16, 0x4F, SISLANDS_CACCONFIG_CGIND }, 818 1.1 riastrad { 0x4, 0x0000ffff, 0, 0x135, SISLANDS_CACCONFIG_CGIND }, 819 1.1 riastrad { 0x4, 0xffff0000, 16, 0xAC, SISLANDS_CACCONFIG_CGIND }, 820 1.1 riastrad { 0x5, 0x0000ffff, 0, 0x118, SISLANDS_CACCONFIG_CGIND }, 821 1.1 riastrad { 0x5, 0xffff0000, 16, 0xBE, SISLANDS_CACCONFIG_CGIND }, 822 1.1 riastrad { 0x6, 0x0000ffff, 0, 0x110, SISLANDS_CACCONFIG_CGIND }, 823 1.1 riastrad { 0x6, 0xffff0000, 16, 0x4CD, SISLANDS_CACCONFIG_CGIND }, 824 1.1 riastrad { 0x18f, 0x0000ffff, 0, 0x30, SISLANDS_CACCONFIG_CGIND }, 825 1.1 riastrad { 0x7, 0x0000ffff, 0, 0x37, SISLANDS_CACCONFIG_CGIND }, 826 1.1 riastrad { 0x7, 0xffff0000, 16, 0x27, SISLANDS_CACCONFIG_CGIND }, 827 1.1 riastrad { 0x8, 0x0000ffff, 0, 0xC3, SISLANDS_CACCONFIG_CGIND }, 828 1.1 riastrad { 0x8, 0xffff0000, 16, 0x35, SISLANDS_CACCONFIG_CGIND }, 829 1.1 riastrad { 0x9, 0x0000ffff, 0, 0x28, SISLANDS_CACCONFIG_CGIND }, 830 1.1 riastrad { 0xa, 0x0000ffff, 0, 0x26C, SISLANDS_CACCONFIG_CGIND }, 831 1.1 riastrad { 0xb, 0x0000ffff, 0, 0x3B2, SISLANDS_CACCONFIG_CGIND }, 832 1.1 riastrad { 0xb, 0xffff0000, 16, 0x99D, SISLANDS_CACCONFIG_CGIND }, 833 1.1 riastrad { 0xc, 0x0000ffff, 0, 0xA3F, SISLANDS_CACCONFIG_CGIND }, 834 1.1 riastrad { 0xd, 0x0000ffff, 0, 0xA, SISLANDS_CACCONFIG_CGIND }, 835 1.1 riastrad { 0xd, 0xffff0000, 16, 0xA, SISLANDS_CACCONFIG_CGIND }, 836 1.1 riastrad { 0xe, 0x0000ffff, 0, 0x5, SISLANDS_CACCONFIG_CGIND }, 837 1.1 riastrad { 0xf, 0x0000ffff, 0, 0x3, SISLANDS_CACCONFIG_CGIND }, 838 1.1 riastrad { 0xf, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 839 1.1 riastrad { 0x10, 0x0000ffff, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 840 1.1 riastrad { 0x10, 0xffff0000, 16, 0x1, SISLANDS_CACCONFIG_CGIND }, 841 1.1 riastrad { 0x11, 0x0000ffff, 0, 0x5, SISLANDS_CACCONFIG_CGIND }, 842 1.1 riastrad { 0x11, 0xffff0000, 16, 0x15, SISLANDS_CACCONFIG_CGIND }, 843 1.1 riastrad { 0x12, 0x0000ffff, 0, 0x34, SISLANDS_CACCONFIG_CGIND }, 844 1.1 riastrad { 0x13, 0x0000ffff, 0, 0x4, SISLANDS_CACCONFIG_CGIND }, 845 1.1 riastrad { 0x13, 0xffff0000, 16, 0x4, SISLANDS_CACCONFIG_CGIND }, 846 1.1 riastrad { 0x14, 0x0000ffff, 0, 0x315, SISLANDS_CACCONFIG_CGIND }, 847 1.1 riastrad { 0x15, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 848 1.1 riastrad { 0x15, 0xffff0000, 16, 0x6, SISLANDS_CACCONFIG_CGIND }, 849 1.1 riastrad { 0x4e, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 850 1.1 riastrad { 0x16, 0x0000ffff, 0, 0x30, SISLANDS_CACCONFIG_CGIND }, 851 1.1 riastrad { 0x16, 0xffff0000, 16, 0x7A, SISLANDS_CACCONFIG_CGIND }, 852 1.1 riastrad { 0x17, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 853 1.1 riastrad { 0x18, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 854 1.1 riastrad { 0x18, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 855 1.1 riastrad { 0x19, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 856 1.1 riastrad { 0x19, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 857 1.1 riastrad { 0x1a, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 858 1.1 riastrad { 0x1a, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND }, 859 1.1 riastrad { 0x1b, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 860 1.1 riastrad { 0x1b, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND }, 861 1.1 riastrad { 0x1c, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 862 1.1 riastrad { 0x1c, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND }, 863 1.1 riastrad { 0x1d, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 864 1.1 riastrad { 0x1d, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND }, 865 1.1 riastrad { 0x1e, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 866 1.1 riastrad { 0x1e, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND }, 867 1.1 riastrad { 0x1f, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 868 1.1 riastrad { 0x1f, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND }, 869 1.1 riastrad { 0x20, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 870 1.1 riastrad { 0x6d, 0x0000ffff, 0, 0x100, SISLANDS_CACCONFIG_CGIND }, 871 1.1 riastrad { 0xFFFFFFFF } 872 1.1 riastrad }; 873 1.1 riastrad 874 1.1 riastrad static const struct si_cac_config_reg cac_weights_cape_verde[] = 875 1.1 riastrad { 876 1.1 riastrad { 0x0, 0x0000ffff, 0, 0x82, SISLANDS_CACCONFIG_CGIND }, 877 1.1 riastrad { 0x0, 0xffff0000, 16, 0x4F, SISLANDS_CACCONFIG_CGIND }, 878 1.1 riastrad { 0x1, 0x0000ffff, 0, 0x153, SISLANDS_CACCONFIG_CGIND }, 879 1.1 riastrad { 0x1, 0xffff0000, 16, 0x52, SISLANDS_CACCONFIG_CGIND }, 880 1.1 riastrad { 0x2, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 881 1.1 riastrad { 0x3, 0x0000ffff, 0, 0x135, SISLANDS_CACCONFIG_CGIND }, 882 1.1 riastrad { 0x3, 0xffff0000, 16, 0x4F, SISLANDS_CACCONFIG_CGIND }, 883 1.1 riastrad { 0x4, 0x0000ffff, 0, 0x135, SISLANDS_CACCONFIG_CGIND }, 884 1.1 riastrad { 0x4, 0xffff0000, 16, 0xAC, SISLANDS_CACCONFIG_CGIND }, 885 1.1 riastrad { 0x5, 0x0000ffff, 0, 0x118, SISLANDS_CACCONFIG_CGIND }, 886 1.1 riastrad { 0x5, 0xffff0000, 16, 0xBE, SISLANDS_CACCONFIG_CGIND }, 887 1.1 riastrad { 0x6, 0x0000ffff, 0, 0x110, SISLANDS_CACCONFIG_CGIND }, 888 1.1 riastrad { 0x6, 0xffff0000, 16, 0x4CD, SISLANDS_CACCONFIG_CGIND }, 889 1.1 riastrad { 0x18f, 0x0000ffff, 0, 0x30, SISLANDS_CACCONFIG_CGIND }, 890 1.1 riastrad { 0x7, 0x0000ffff, 0, 0x37, SISLANDS_CACCONFIG_CGIND }, 891 1.1 riastrad { 0x7, 0xffff0000, 16, 0x27, SISLANDS_CACCONFIG_CGIND }, 892 1.1 riastrad { 0x8, 0x0000ffff, 0, 0xC3, SISLANDS_CACCONFIG_CGIND }, 893 1.1 riastrad { 0x8, 0xffff0000, 16, 0x35, SISLANDS_CACCONFIG_CGIND }, 894 1.1 riastrad { 0x9, 0x0000ffff, 0, 0x28, SISLANDS_CACCONFIG_CGIND }, 895 1.1 riastrad { 0xa, 0x0000ffff, 0, 0x26C, SISLANDS_CACCONFIG_CGIND }, 896 1.1 riastrad { 0xb, 0x0000ffff, 0, 0x3B2, SISLANDS_CACCONFIG_CGIND }, 897 1.1 riastrad { 0xb, 0xffff0000, 16, 0x99D, SISLANDS_CACCONFIG_CGIND }, 898 1.1 riastrad { 0xc, 0x0000ffff, 0, 0xA3F, SISLANDS_CACCONFIG_CGIND }, 899 1.1 riastrad { 0xd, 0x0000ffff, 0, 0xA, SISLANDS_CACCONFIG_CGIND }, 900 1.1 riastrad { 0xd, 0xffff0000, 16, 0xA, SISLANDS_CACCONFIG_CGIND }, 901 1.1 riastrad { 0xe, 0x0000ffff, 0, 0x5, SISLANDS_CACCONFIG_CGIND }, 902 1.1 riastrad { 0xf, 0x0000ffff, 0, 0x3, SISLANDS_CACCONFIG_CGIND }, 903 1.1 riastrad { 0xf, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 904 1.1 riastrad { 0x10, 0x0000ffff, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 905 1.1 riastrad { 0x10, 0xffff0000, 16, 0x1, SISLANDS_CACCONFIG_CGIND }, 906 1.1 riastrad { 0x11, 0x0000ffff, 0, 0x5, SISLANDS_CACCONFIG_CGIND }, 907 1.1 riastrad { 0x11, 0xffff0000, 16, 0x15, SISLANDS_CACCONFIG_CGIND }, 908 1.1 riastrad { 0x12, 0x0000ffff, 0, 0x34, SISLANDS_CACCONFIG_CGIND }, 909 1.1 riastrad { 0x13, 0x0000ffff, 0, 0x4, SISLANDS_CACCONFIG_CGIND }, 910 1.1 riastrad { 0x13, 0xffff0000, 16, 0x4, SISLANDS_CACCONFIG_CGIND }, 911 1.1 riastrad { 0x14, 0x0000ffff, 0, 0x3BA, SISLANDS_CACCONFIG_CGIND }, 912 1.1 riastrad { 0x15, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 913 1.1 riastrad { 0x15, 0xffff0000, 16, 0x6, SISLANDS_CACCONFIG_CGIND }, 914 1.1 riastrad { 0x4e, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 915 1.1 riastrad { 0x16, 0x0000ffff, 0, 0x30, SISLANDS_CACCONFIG_CGIND }, 916 1.1 riastrad { 0x16, 0xffff0000, 16, 0x7A, SISLANDS_CACCONFIG_CGIND }, 917 1.1 riastrad { 0x17, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 918 1.1 riastrad { 0x18, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 919 1.1 riastrad { 0x18, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 920 1.1 riastrad { 0x19, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 921 1.1 riastrad { 0x19, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 922 1.1 riastrad { 0x1a, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 923 1.1 riastrad { 0x1a, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND }, 924 1.1 riastrad { 0x1b, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 925 1.1 riastrad { 0x1b, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND }, 926 1.1 riastrad { 0x1c, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 927 1.1 riastrad { 0x1c, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND }, 928 1.1 riastrad { 0x1d, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 929 1.1 riastrad { 0x1d, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND }, 930 1.1 riastrad { 0x1e, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 931 1.1 riastrad { 0x1e, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND }, 932 1.1 riastrad { 0x1f, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 933 1.1 riastrad { 0x1f, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND }, 934 1.1 riastrad { 0x20, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 935 1.1 riastrad { 0x6d, 0x0000ffff, 0, 0x100, SISLANDS_CACCONFIG_CGIND }, 936 1.1 riastrad { 0xFFFFFFFF } 937 1.1 riastrad }; 938 1.1 riastrad 939 1.1 riastrad static const struct si_cac_config_reg lcac_cape_verde[] = 940 1.1 riastrad { 941 1.1 riastrad { 0x98, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 942 1.1 riastrad { 0x98, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 943 1.1 riastrad { 0x104, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 944 1.1 riastrad { 0x104, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 945 1.1 riastrad { 0x110, 0x0001fffe, 1, 0x5, SISLANDS_CACCONFIG_CGIND }, 946 1.1 riastrad { 0x110, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 947 1.1 riastrad { 0x14f, 0x0001fffe, 1, 0x5, SISLANDS_CACCONFIG_CGIND }, 948 1.1 riastrad { 0x14f, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 949 1.1 riastrad { 0x8c, 0x0001fffe, 1, 0x5, SISLANDS_CACCONFIG_CGIND }, 950 1.1 riastrad { 0x8c, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 951 1.1 riastrad { 0x143, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND }, 952 1.1 riastrad { 0x143, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 953 1.1 riastrad { 0x9b, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 954 1.1 riastrad { 0x9b, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 955 1.1 riastrad { 0x107, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 956 1.1 riastrad { 0x107, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 957 1.1 riastrad { 0x113, 0x0001fffe, 1, 0x5, SISLANDS_CACCONFIG_CGIND }, 958 1.1 riastrad { 0x113, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 959 1.1 riastrad { 0x152, 0x0001fffe, 1, 0x5, SISLANDS_CACCONFIG_CGIND }, 960 1.1 riastrad { 0x152, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 961 1.1 riastrad { 0x8f, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND }, 962 1.1 riastrad { 0x8f, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 963 1.1 riastrad { 0x146, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND }, 964 1.1 riastrad { 0x146, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 965 1.1 riastrad { 0x11c, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 966 1.1 riastrad { 0x11c, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 967 1.1 riastrad { 0x11f, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 968 1.1 riastrad { 0x11f, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 969 1.1 riastrad { 0x164, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 970 1.1 riastrad { 0x164, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 971 1.1 riastrad { 0x167, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 972 1.1 riastrad { 0x167, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 973 1.1 riastrad { 0x16a, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 974 1.1 riastrad { 0x16a, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 975 1.1 riastrad { 0x15e, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 976 1.1 riastrad { 0x15e, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 977 1.1 riastrad { 0x161, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 978 1.1 riastrad { 0x161, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 979 1.1 riastrad { 0x15b, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 980 1.1 riastrad { 0x15b, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 981 1.1 riastrad { 0x16d, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 982 1.1 riastrad { 0x16d, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 983 1.1 riastrad { 0x170, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND }, 984 1.1 riastrad { 0x170, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 985 1.1 riastrad { 0x173, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 986 1.1 riastrad { 0x173, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 987 1.1 riastrad { 0x176, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND }, 988 1.1 riastrad { 0x176, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 989 1.1 riastrad { 0x179, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND }, 990 1.1 riastrad { 0x179, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 991 1.1 riastrad { 0x17c, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND }, 992 1.1 riastrad { 0x17c, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 993 1.1 riastrad { 0x17f, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND }, 994 1.1 riastrad { 0x17f, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 995 1.1 riastrad { 0xFFFFFFFF } 996 1.1 riastrad }; 997 1.1 riastrad 998 1.1 riastrad static const struct si_cac_config_reg cac_override_cape_verde[] = 999 1.1 riastrad { 1000 1.5 riastrad { 0xFFFFFFFF } 1001 1.1 riastrad }; 1002 1.1 riastrad 1003 1.1 riastrad static const struct si_powertune_data powertune_data_cape_verde = 1004 1.1 riastrad { 1005 1.1 riastrad ((1 << 16) | 0x6993), 1006 1.1 riastrad 5, 1007 1.1 riastrad 0, 1008 1.1 riastrad 7, 1009 1.1 riastrad 105, 1010 1.1 riastrad { 1011 1.1 riastrad 0UL, 1012 1.1 riastrad 0UL, 1013 1.1 riastrad 7194395UL, 1014 1.1 riastrad 309631529UL, 1015 1.1 riastrad -1270850L, 1016 1.1 riastrad 4513710L, 1017 1.1 riastrad 100 1018 1.1 riastrad }, 1019 1.1 riastrad 117830498UL, 1020 1.1 riastrad 12, 1021 1.1 riastrad { 1022 1.1 riastrad 0, 1023 1.1 riastrad 0, 1024 1.1 riastrad 0, 1025 1.1 riastrad 0, 1026 1.1 riastrad 0, 1027 1.1 riastrad 0, 1028 1.1 riastrad 0, 1029 1.1 riastrad 0 1030 1.1 riastrad }, 1031 1.1 riastrad true 1032 1.1 riastrad }; 1033 1.1 riastrad 1034 1.1 riastrad static const struct si_dte_data dte_data_cape_verde = 1035 1.1 riastrad { 1036 1.1 riastrad { 0, 0, 0, 0, 0 }, 1037 1.1 riastrad { 0, 0, 0, 0, 0 }, 1038 1.1 riastrad 0, 1039 1.1 riastrad 0, 1040 1.1 riastrad 0, 1041 1.1 riastrad 0, 1042 1.1 riastrad 0, 1043 1.1 riastrad 0, 1044 1.1 riastrad 0, 1045 1.1 riastrad { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 1046 1.1 riastrad { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 1047 1.1 riastrad { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 1048 1.1 riastrad 0, 1049 1.1 riastrad false 1050 1.1 riastrad }; 1051 1.1 riastrad 1052 1.1 riastrad static const struct si_dte_data dte_data_venus_xtx = 1053 1.1 riastrad { 1054 1.1 riastrad { 0x1E8480, 0x3D0900, 0x989680, 0x2625A00, 0x0 }, 1055 1.1 riastrad { 0x71C, 0xAAB, 0xE39, 0x11C7, 0x0 }, 1056 1.1 riastrad 5, 1057 1.1 riastrad 55000, 1058 1.1 riastrad 0x69, 1059 1.1 riastrad 0xA, 1060 1.1 riastrad 1, 1061 1.1 riastrad 0, 1062 1.1 riastrad 0x3, 1063 1.1 riastrad { 0x96, 0xB4, 0xFF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, 1064 1.1 riastrad { 0x895440, 0x3D0900, 0x989680, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, 1065 1.1 riastrad { 0xD6D8, 0x88B8, 0x1555, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, 1066 1.1 riastrad 90, 1067 1.1 riastrad true 1068 1.1 riastrad }; 1069 1.1 riastrad 1070 1.1 riastrad static const struct si_dte_data dte_data_venus_xt = 1071 1.1 riastrad { 1072 1.1 riastrad { 0x1E8480, 0x3D0900, 0x989680, 0x2625A00, 0x0 }, 1073 1.1 riastrad { 0xBDA, 0x11C7, 0x17B4, 0x1DA1, 0x0 }, 1074 1.1 riastrad 5, 1075 1.1 riastrad 55000, 1076 1.1 riastrad 0x69, 1077 1.1 riastrad 0xA, 1078 1.1 riastrad 1, 1079 1.1 riastrad 0, 1080 1.1 riastrad 0x3, 1081 1.1 riastrad { 0x96, 0xB4, 0xFF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, 1082 1.1 riastrad { 0x895440, 0x3D0900, 0x989680, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, 1083 1.1 riastrad { 0xAFC8, 0x88B8, 0x238E, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, 1084 1.1 riastrad 90, 1085 1.1 riastrad true 1086 1.1 riastrad }; 1087 1.1 riastrad 1088 1.1 riastrad static const struct si_dte_data dte_data_venus_pro = 1089 1.1 riastrad { 1090 1.1 riastrad { 0x1E8480, 0x3D0900, 0x989680, 0x2625A00, 0x0 }, 1091 1.1 riastrad { 0x11C7, 0x1AAB, 0x238E, 0x2C72, 0x0 }, 1092 1.1 riastrad 5, 1093 1.1 riastrad 55000, 1094 1.1 riastrad 0x69, 1095 1.1 riastrad 0xA, 1096 1.1 riastrad 1, 1097 1.1 riastrad 0, 1098 1.1 riastrad 0x3, 1099 1.1 riastrad { 0x96, 0xB4, 0xFF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, 1100 1.1 riastrad { 0x895440, 0x3D0900, 0x989680, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, 1101 1.1 riastrad { 0x88B8, 0x88B8, 0x3555, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, 1102 1.1 riastrad 90, 1103 1.1 riastrad true 1104 1.1 riastrad }; 1105 1.1 riastrad 1106 1.1 riastrad struct si_cac_config_reg cac_weights_oland[] = 1107 1.1 riastrad { 1108 1.1 riastrad { 0x0, 0x0000ffff, 0, 0x82, SISLANDS_CACCONFIG_CGIND }, 1109 1.1 riastrad { 0x0, 0xffff0000, 16, 0x4F, SISLANDS_CACCONFIG_CGIND }, 1110 1.1 riastrad { 0x1, 0x0000ffff, 0, 0x153, SISLANDS_CACCONFIG_CGIND }, 1111 1.1 riastrad { 0x1, 0xffff0000, 16, 0x52, SISLANDS_CACCONFIG_CGIND }, 1112 1.1 riastrad { 0x2, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 1113 1.1 riastrad { 0x3, 0x0000ffff, 0, 0x135, SISLANDS_CACCONFIG_CGIND }, 1114 1.1 riastrad { 0x3, 0xffff0000, 16, 0x4F, SISLANDS_CACCONFIG_CGIND }, 1115 1.1 riastrad { 0x4, 0x0000ffff, 0, 0x135, SISLANDS_CACCONFIG_CGIND }, 1116 1.1 riastrad { 0x4, 0xffff0000, 16, 0xAC, SISLANDS_CACCONFIG_CGIND }, 1117 1.1 riastrad { 0x5, 0x0000ffff, 0, 0x118, SISLANDS_CACCONFIG_CGIND }, 1118 1.1 riastrad { 0x5, 0xffff0000, 16, 0xBE, SISLANDS_CACCONFIG_CGIND }, 1119 1.1 riastrad { 0x6, 0x0000ffff, 0, 0x110, SISLANDS_CACCONFIG_CGIND }, 1120 1.1 riastrad { 0x6, 0xffff0000, 16, 0x4CD, SISLANDS_CACCONFIG_CGIND }, 1121 1.1 riastrad { 0x18f, 0x0000ffff, 0, 0x30, SISLANDS_CACCONFIG_CGIND }, 1122 1.1 riastrad { 0x7, 0x0000ffff, 0, 0x37, SISLANDS_CACCONFIG_CGIND }, 1123 1.1 riastrad { 0x7, 0xffff0000, 16, 0x27, SISLANDS_CACCONFIG_CGIND }, 1124 1.1 riastrad { 0x8, 0x0000ffff, 0, 0xC3, SISLANDS_CACCONFIG_CGIND }, 1125 1.1 riastrad { 0x8, 0xffff0000, 16, 0x35, SISLANDS_CACCONFIG_CGIND }, 1126 1.1 riastrad { 0x9, 0x0000ffff, 0, 0x28, SISLANDS_CACCONFIG_CGIND }, 1127 1.1 riastrad { 0xa, 0x0000ffff, 0, 0x26C, SISLANDS_CACCONFIG_CGIND }, 1128 1.1 riastrad { 0xb, 0x0000ffff, 0, 0x3B2, SISLANDS_CACCONFIG_CGIND }, 1129 1.1 riastrad { 0xb, 0xffff0000, 16, 0x99D, SISLANDS_CACCONFIG_CGIND }, 1130 1.1 riastrad { 0xc, 0x0000ffff, 0, 0xA3F, SISLANDS_CACCONFIG_CGIND }, 1131 1.1 riastrad { 0xd, 0x0000ffff, 0, 0xA, SISLANDS_CACCONFIG_CGIND }, 1132 1.1 riastrad { 0xd, 0xffff0000, 16, 0xA, SISLANDS_CACCONFIG_CGIND }, 1133 1.1 riastrad { 0xe, 0x0000ffff, 0, 0x5, SISLANDS_CACCONFIG_CGIND }, 1134 1.1 riastrad { 0xf, 0x0000ffff, 0, 0x3, SISLANDS_CACCONFIG_CGIND }, 1135 1.1 riastrad { 0xf, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 1136 1.1 riastrad { 0x10, 0x0000ffff, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 1137 1.1 riastrad { 0x10, 0xffff0000, 16, 0x1, SISLANDS_CACCONFIG_CGIND }, 1138 1.1 riastrad { 0x11, 0x0000ffff, 0, 0x5, SISLANDS_CACCONFIG_CGIND }, 1139 1.1 riastrad { 0x11, 0xffff0000, 16, 0x15, SISLANDS_CACCONFIG_CGIND }, 1140 1.1 riastrad { 0x12, 0x0000ffff, 0, 0x34, SISLANDS_CACCONFIG_CGIND }, 1141 1.1 riastrad { 0x13, 0x0000ffff, 0, 0x4, SISLANDS_CACCONFIG_CGIND }, 1142 1.1 riastrad { 0x13, 0xffff0000, 16, 0x4, SISLANDS_CACCONFIG_CGIND }, 1143 1.1 riastrad { 0x14, 0x0000ffff, 0, 0x3BA, SISLANDS_CACCONFIG_CGIND }, 1144 1.1 riastrad { 0x15, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 1145 1.1 riastrad { 0x15, 0xffff0000, 16, 0x6, SISLANDS_CACCONFIG_CGIND }, 1146 1.1 riastrad { 0x4e, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 1147 1.1 riastrad { 0x16, 0x0000ffff, 0, 0x30, SISLANDS_CACCONFIG_CGIND }, 1148 1.1 riastrad { 0x16, 0xffff0000, 16, 0x7A, SISLANDS_CACCONFIG_CGIND }, 1149 1.1 riastrad { 0x17, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 1150 1.1 riastrad { 0x18, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 1151 1.1 riastrad { 0x18, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 1152 1.1 riastrad { 0x19, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 1153 1.1 riastrad { 0x19, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 1154 1.1 riastrad { 0x1a, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 1155 1.1 riastrad { 0x1a, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND }, 1156 1.1 riastrad { 0x1b, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 1157 1.1 riastrad { 0x1b, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND }, 1158 1.1 riastrad { 0x1c, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 1159 1.1 riastrad { 0x1c, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND }, 1160 1.1 riastrad { 0x1d, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 1161 1.1 riastrad { 0x1d, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND }, 1162 1.1 riastrad { 0x1e, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 1163 1.1 riastrad { 0x1e, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND }, 1164 1.1 riastrad { 0x1f, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 1165 1.1 riastrad { 0x1f, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND }, 1166 1.1 riastrad { 0x20, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 1167 1.1 riastrad { 0x6d, 0x0000ffff, 0, 0x100, SISLANDS_CACCONFIG_CGIND }, 1168 1.1 riastrad { 0xFFFFFFFF } 1169 1.1 riastrad }; 1170 1.1 riastrad 1171 1.1 riastrad static const struct si_cac_config_reg cac_weights_mars_pro[] = 1172 1.1 riastrad { 1173 1.1 riastrad { 0x0, 0x0000ffff, 0, 0x43, SISLANDS_CACCONFIG_CGIND }, 1174 1.1 riastrad { 0x0, 0xffff0000, 16, 0x29, SISLANDS_CACCONFIG_CGIND }, 1175 1.1 riastrad { 0x1, 0x0000ffff, 0, 0xAF, SISLANDS_CACCONFIG_CGIND }, 1176 1.1 riastrad { 0x1, 0xffff0000, 16, 0x2A, SISLANDS_CACCONFIG_CGIND }, 1177 1.1 riastrad { 0x2, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 1178 1.1 riastrad { 0x3, 0x0000ffff, 0, 0xA0, SISLANDS_CACCONFIG_CGIND }, 1179 1.1 riastrad { 0x3, 0xffff0000, 16, 0x29, SISLANDS_CACCONFIG_CGIND }, 1180 1.1 riastrad { 0x4, 0x0000ffff, 0, 0xA0, SISLANDS_CACCONFIG_CGIND }, 1181 1.1 riastrad { 0x4, 0xffff0000, 16, 0x59, SISLANDS_CACCONFIG_CGIND }, 1182 1.1 riastrad { 0x5, 0x0000ffff, 0, 0x1A5, SISLANDS_CACCONFIG_CGIND }, 1183 1.1 riastrad { 0x5, 0xffff0000, 16, 0x1D6, SISLANDS_CACCONFIG_CGIND }, 1184 1.1 riastrad { 0x6, 0x0000ffff, 0, 0x2A3, SISLANDS_CACCONFIG_CGIND }, 1185 1.1 riastrad { 0x6, 0xffff0000, 16, 0x8FD, SISLANDS_CACCONFIG_CGIND }, 1186 1.1 riastrad { 0x18f, 0x0000ffff, 0, 0x76, SISLANDS_CACCONFIG_CGIND }, 1187 1.1 riastrad { 0x7, 0x0000ffff, 0, 0x8A, SISLANDS_CACCONFIG_CGIND }, 1188 1.1 riastrad { 0x7, 0xffff0000, 16, 0xA3, SISLANDS_CACCONFIG_CGIND }, 1189 1.1 riastrad { 0x8, 0x0000ffff, 0, 0x71, SISLANDS_CACCONFIG_CGIND }, 1190 1.1 riastrad { 0x8, 0xffff0000, 16, 0x36, SISLANDS_CACCONFIG_CGIND }, 1191 1.1 riastrad { 0x9, 0x0000ffff, 0, 0xA6, SISLANDS_CACCONFIG_CGIND }, 1192 1.1 riastrad { 0xa, 0x0000ffff, 0, 0x81, SISLANDS_CACCONFIG_CGIND }, 1193 1.1 riastrad { 0xb, 0x0000ffff, 0, 0x3D2, SISLANDS_CACCONFIG_CGIND }, 1194 1.1 riastrad { 0xb, 0xffff0000, 16, 0x27C, SISLANDS_CACCONFIG_CGIND }, 1195 1.1 riastrad { 0xc, 0x0000ffff, 0, 0xA96, SISLANDS_CACCONFIG_CGIND }, 1196 1.1 riastrad { 0xd, 0x0000ffff, 0, 0x5, SISLANDS_CACCONFIG_CGIND }, 1197 1.1 riastrad { 0xd, 0xffff0000, 16, 0x5, SISLANDS_CACCONFIG_CGIND }, 1198 1.1 riastrad { 0xe, 0x0000ffff, 0, 0xB, SISLANDS_CACCONFIG_CGIND }, 1199 1.1 riastrad { 0xf, 0x0000ffff, 0, 0x3, SISLANDS_CACCONFIG_CGIND }, 1200 1.1 riastrad { 0xf, 0xffff0000, 16, 0x2, SISLANDS_CACCONFIG_CGIND }, 1201 1.1 riastrad { 0x10, 0x0000ffff, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 1202 1.1 riastrad { 0x10, 0xffff0000, 16, 0x4, SISLANDS_CACCONFIG_CGIND }, 1203 1.1 riastrad { 0x11, 0x0000ffff, 0, 0x15, SISLANDS_CACCONFIG_CGIND }, 1204 1.1 riastrad { 0x11, 0xffff0000, 16, 0x7, SISLANDS_CACCONFIG_CGIND }, 1205 1.1 riastrad { 0x12, 0x0000ffff, 0, 0x36, SISLANDS_CACCONFIG_CGIND }, 1206 1.1 riastrad { 0x13, 0x0000ffff, 0, 0x10, SISLANDS_CACCONFIG_CGIND }, 1207 1.1 riastrad { 0x13, 0xffff0000, 16, 0x10, SISLANDS_CACCONFIG_CGIND }, 1208 1.1 riastrad { 0x14, 0x0000ffff, 0, 0x2, SISLANDS_CACCONFIG_CGIND }, 1209 1.1 riastrad { 0x15, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 1210 1.1 riastrad { 0x15, 0xffff0000, 16, 0x6, SISLANDS_CACCONFIG_CGIND }, 1211 1.1 riastrad { 0x4e, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 1212 1.1 riastrad { 0x16, 0x0000ffff, 0, 0x32, SISLANDS_CACCONFIG_CGIND }, 1213 1.1 riastrad { 0x16, 0xffff0000, 16, 0x7E, SISLANDS_CACCONFIG_CGIND }, 1214 1.1 riastrad { 0x17, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 1215 1.1 riastrad { 0x18, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 1216 1.1 riastrad { 0x18, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 1217 1.1 riastrad { 0x19, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 1218 1.1 riastrad { 0x19, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 1219 1.1 riastrad { 0x1a, 0x0000ffff, 0, 0x280, SISLANDS_CACCONFIG_CGIND }, 1220 1.1 riastrad { 0x1a, 0xffff0000, 16, 0x7, SISLANDS_CACCONFIG_CGIND }, 1221 1.1 riastrad { 0x1b, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 1222 1.1 riastrad { 0x1b, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 1223 1.1 riastrad { 0x1c, 0x0000ffff, 0, 0x3C, SISLANDS_CACCONFIG_CGIND }, 1224 1.1 riastrad { 0x1c, 0xffff0000, 16, 0x203, SISLANDS_CACCONFIG_CGIND }, 1225 1.1 riastrad { 0x1d, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 1226 1.1 riastrad { 0x1d, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 1227 1.1 riastrad { 0x1e, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 1228 1.1 riastrad { 0x1e, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND }, 1229 1.1 riastrad { 0x1f, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 1230 1.1 riastrad { 0x1f, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND }, 1231 1.1 riastrad { 0x20, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 1232 1.1 riastrad { 0x6d, 0x0000ffff, 0, 0xB4, SISLANDS_CACCONFIG_CGIND }, 1233 1.1 riastrad { 0xFFFFFFFF } 1234 1.1 riastrad }; 1235 1.1 riastrad 1236 1.1 riastrad static const struct si_cac_config_reg cac_weights_mars_xt[] = 1237 1.1 riastrad { 1238 1.1 riastrad { 0x0, 0x0000ffff, 0, 0x43, SISLANDS_CACCONFIG_CGIND }, 1239 1.1 riastrad { 0x0, 0xffff0000, 16, 0x29, SISLANDS_CACCONFIG_CGIND }, 1240 1.1 riastrad { 0x1, 0x0000ffff, 0, 0xAF, SISLANDS_CACCONFIG_CGIND }, 1241 1.1 riastrad { 0x1, 0xffff0000, 16, 0x2A, SISLANDS_CACCONFIG_CGIND }, 1242 1.1 riastrad { 0x2, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 1243 1.1 riastrad { 0x3, 0x0000ffff, 0, 0xA0, SISLANDS_CACCONFIG_CGIND }, 1244 1.1 riastrad { 0x3, 0xffff0000, 16, 0x29, SISLANDS_CACCONFIG_CGIND }, 1245 1.1 riastrad { 0x4, 0x0000ffff, 0, 0xA0, SISLANDS_CACCONFIG_CGIND }, 1246 1.1 riastrad { 0x4, 0xffff0000, 16, 0x59, SISLANDS_CACCONFIG_CGIND }, 1247 1.1 riastrad { 0x5, 0x0000ffff, 0, 0x1A5, SISLANDS_CACCONFIG_CGIND }, 1248 1.1 riastrad { 0x5, 0xffff0000, 16, 0x1D6, SISLANDS_CACCONFIG_CGIND }, 1249 1.1 riastrad { 0x6, 0x0000ffff, 0, 0x2A3, SISLANDS_CACCONFIG_CGIND }, 1250 1.1 riastrad { 0x6, 0xffff0000, 16, 0x8FD, SISLANDS_CACCONFIG_CGIND }, 1251 1.1 riastrad { 0x18f, 0x0000ffff, 0, 0x76, SISLANDS_CACCONFIG_CGIND }, 1252 1.1 riastrad { 0x7, 0x0000ffff, 0, 0x8A, SISLANDS_CACCONFIG_CGIND }, 1253 1.1 riastrad { 0x7, 0xffff0000, 16, 0xA3, SISLANDS_CACCONFIG_CGIND }, 1254 1.1 riastrad { 0x8, 0x0000ffff, 0, 0x71, SISLANDS_CACCONFIG_CGIND }, 1255 1.1 riastrad { 0x8, 0xffff0000, 16, 0x36, SISLANDS_CACCONFIG_CGIND }, 1256 1.1 riastrad { 0x9, 0x0000ffff, 0, 0xA6, SISLANDS_CACCONFIG_CGIND }, 1257 1.1 riastrad { 0xa, 0x0000ffff, 0, 0x81, SISLANDS_CACCONFIG_CGIND }, 1258 1.1 riastrad { 0xb, 0x0000ffff, 0, 0x3D2, SISLANDS_CACCONFIG_CGIND }, 1259 1.1 riastrad { 0xb, 0xffff0000, 16, 0x27C, SISLANDS_CACCONFIG_CGIND }, 1260 1.1 riastrad { 0xc, 0x0000ffff, 0, 0xA96, SISLANDS_CACCONFIG_CGIND }, 1261 1.1 riastrad { 0xd, 0x0000ffff, 0, 0x5, SISLANDS_CACCONFIG_CGIND }, 1262 1.1 riastrad { 0xd, 0xffff0000, 16, 0x5, SISLANDS_CACCONFIG_CGIND }, 1263 1.1 riastrad { 0xe, 0x0000ffff, 0, 0xB, SISLANDS_CACCONFIG_CGIND }, 1264 1.1 riastrad { 0xf, 0x0000ffff, 0, 0x3, SISLANDS_CACCONFIG_CGIND }, 1265 1.1 riastrad { 0xf, 0xffff0000, 16, 0x2, SISLANDS_CACCONFIG_CGIND }, 1266 1.1 riastrad { 0x10, 0x0000ffff, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 1267 1.1 riastrad { 0x10, 0xffff0000, 16, 0x4, SISLANDS_CACCONFIG_CGIND }, 1268 1.1 riastrad { 0x11, 0x0000ffff, 0, 0x15, SISLANDS_CACCONFIG_CGIND }, 1269 1.1 riastrad { 0x11, 0xffff0000, 16, 0x7, SISLANDS_CACCONFIG_CGIND }, 1270 1.1 riastrad { 0x12, 0x0000ffff, 0, 0x36, SISLANDS_CACCONFIG_CGIND }, 1271 1.1 riastrad { 0x13, 0x0000ffff, 0, 0x10, SISLANDS_CACCONFIG_CGIND }, 1272 1.1 riastrad { 0x13, 0xffff0000, 16, 0x10, SISLANDS_CACCONFIG_CGIND }, 1273 1.1 riastrad { 0x14, 0x0000ffff, 0, 0x60, SISLANDS_CACCONFIG_CGIND }, 1274 1.1 riastrad { 0x15, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 1275 1.1 riastrad { 0x15, 0xffff0000, 16, 0x6, SISLANDS_CACCONFIG_CGIND }, 1276 1.1 riastrad { 0x4e, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 1277 1.1 riastrad { 0x16, 0x0000ffff, 0, 0x32, SISLANDS_CACCONFIG_CGIND }, 1278 1.1 riastrad { 0x16, 0xffff0000, 16, 0x7E, SISLANDS_CACCONFIG_CGIND }, 1279 1.1 riastrad { 0x17, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 1280 1.1 riastrad { 0x18, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 1281 1.1 riastrad { 0x18, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 1282 1.1 riastrad { 0x19, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 1283 1.1 riastrad { 0x19, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 1284 1.1 riastrad { 0x1a, 0x0000ffff, 0, 0x280, SISLANDS_CACCONFIG_CGIND }, 1285 1.1 riastrad { 0x1a, 0xffff0000, 16, 0x7, SISLANDS_CACCONFIG_CGIND }, 1286 1.1 riastrad { 0x1b, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 1287 1.1 riastrad { 0x1b, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 1288 1.1 riastrad { 0x1c, 0x0000ffff, 0, 0x3C, SISLANDS_CACCONFIG_CGIND }, 1289 1.1 riastrad { 0x1c, 0xffff0000, 16, 0x203, SISLANDS_CACCONFIG_CGIND }, 1290 1.1 riastrad { 0x1d, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 1291 1.1 riastrad { 0x1d, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 1292 1.1 riastrad { 0x1e, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 1293 1.1 riastrad { 0x1e, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND }, 1294 1.1 riastrad { 0x1f, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 1295 1.1 riastrad { 0x1f, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND }, 1296 1.1 riastrad { 0x20, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 1297 1.1 riastrad { 0x6d, 0x0000ffff, 0, 0xB4, SISLANDS_CACCONFIG_CGIND }, 1298 1.1 riastrad { 0xFFFFFFFF } 1299 1.1 riastrad }; 1300 1.1 riastrad 1301 1.1 riastrad static const struct si_cac_config_reg cac_weights_oland_pro[] = 1302 1.1 riastrad { 1303 1.1 riastrad { 0x0, 0x0000ffff, 0, 0x43, SISLANDS_CACCONFIG_CGIND }, 1304 1.1 riastrad { 0x0, 0xffff0000, 16, 0x29, SISLANDS_CACCONFIG_CGIND }, 1305 1.1 riastrad { 0x1, 0x0000ffff, 0, 0xAF, SISLANDS_CACCONFIG_CGIND }, 1306 1.1 riastrad { 0x1, 0xffff0000, 16, 0x2A, SISLANDS_CACCONFIG_CGIND }, 1307 1.1 riastrad { 0x2, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 1308 1.1 riastrad { 0x3, 0x0000ffff, 0, 0xA0, SISLANDS_CACCONFIG_CGIND }, 1309 1.1 riastrad { 0x3, 0xffff0000, 16, 0x29, SISLANDS_CACCONFIG_CGIND }, 1310 1.1 riastrad { 0x4, 0x0000ffff, 0, 0xA0, SISLANDS_CACCONFIG_CGIND }, 1311 1.1 riastrad { 0x4, 0xffff0000, 16, 0x59, SISLANDS_CACCONFIG_CGIND }, 1312 1.1 riastrad { 0x5, 0x0000ffff, 0, 0x1A5, SISLANDS_CACCONFIG_CGIND }, 1313 1.1 riastrad { 0x5, 0xffff0000, 16, 0x1D6, SISLANDS_CACCONFIG_CGIND }, 1314 1.1 riastrad { 0x6, 0x0000ffff, 0, 0x2A3, SISLANDS_CACCONFIG_CGIND }, 1315 1.1 riastrad { 0x6, 0xffff0000, 16, 0x8FD, SISLANDS_CACCONFIG_CGIND }, 1316 1.1 riastrad { 0x18f, 0x0000ffff, 0, 0x76, SISLANDS_CACCONFIG_CGIND }, 1317 1.1 riastrad { 0x7, 0x0000ffff, 0, 0x8A, SISLANDS_CACCONFIG_CGIND }, 1318 1.1 riastrad { 0x7, 0xffff0000, 16, 0xA3, SISLANDS_CACCONFIG_CGIND }, 1319 1.1 riastrad { 0x8, 0x0000ffff, 0, 0x71, SISLANDS_CACCONFIG_CGIND }, 1320 1.1 riastrad { 0x8, 0xffff0000, 16, 0x36, SISLANDS_CACCONFIG_CGIND }, 1321 1.1 riastrad { 0x9, 0x0000ffff, 0, 0xA6, SISLANDS_CACCONFIG_CGIND }, 1322 1.1 riastrad { 0xa, 0x0000ffff, 0, 0x81, SISLANDS_CACCONFIG_CGIND }, 1323 1.1 riastrad { 0xb, 0x0000ffff, 0, 0x3D2, SISLANDS_CACCONFIG_CGIND }, 1324 1.1 riastrad { 0xb, 0xffff0000, 16, 0x27C, SISLANDS_CACCONFIG_CGIND }, 1325 1.1 riastrad { 0xc, 0x0000ffff, 0, 0xA96, SISLANDS_CACCONFIG_CGIND }, 1326 1.1 riastrad { 0xd, 0x0000ffff, 0, 0x5, SISLANDS_CACCONFIG_CGIND }, 1327 1.1 riastrad { 0xd, 0xffff0000, 16, 0x5, SISLANDS_CACCONFIG_CGIND }, 1328 1.1 riastrad { 0xe, 0x0000ffff, 0, 0xB, SISLANDS_CACCONFIG_CGIND }, 1329 1.1 riastrad { 0xf, 0x0000ffff, 0, 0x3, SISLANDS_CACCONFIG_CGIND }, 1330 1.1 riastrad { 0xf, 0xffff0000, 16, 0x2, SISLANDS_CACCONFIG_CGIND }, 1331 1.1 riastrad { 0x10, 0x0000ffff, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 1332 1.1 riastrad { 0x10, 0xffff0000, 16, 0x4, SISLANDS_CACCONFIG_CGIND }, 1333 1.1 riastrad { 0x11, 0x0000ffff, 0, 0x15, SISLANDS_CACCONFIG_CGIND }, 1334 1.1 riastrad { 0x11, 0xffff0000, 16, 0x7, SISLANDS_CACCONFIG_CGIND }, 1335 1.1 riastrad { 0x12, 0x0000ffff, 0, 0x36, SISLANDS_CACCONFIG_CGIND }, 1336 1.1 riastrad { 0x13, 0x0000ffff, 0, 0x10, SISLANDS_CACCONFIG_CGIND }, 1337 1.1 riastrad { 0x13, 0xffff0000, 16, 0x10, SISLANDS_CACCONFIG_CGIND }, 1338 1.1 riastrad { 0x14, 0x0000ffff, 0, 0x90, SISLANDS_CACCONFIG_CGIND }, 1339 1.1 riastrad { 0x15, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 1340 1.1 riastrad { 0x15, 0xffff0000, 16, 0x6, SISLANDS_CACCONFIG_CGIND }, 1341 1.1 riastrad { 0x4e, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 1342 1.1 riastrad { 0x16, 0x0000ffff, 0, 0x32, SISLANDS_CACCONFIG_CGIND }, 1343 1.1 riastrad { 0x16, 0xffff0000, 16, 0x7E, SISLANDS_CACCONFIG_CGIND }, 1344 1.1 riastrad { 0x17, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 1345 1.1 riastrad { 0x18, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 1346 1.1 riastrad { 0x18, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 1347 1.1 riastrad { 0x19, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 1348 1.1 riastrad { 0x19, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 1349 1.1 riastrad { 0x1a, 0x0000ffff, 0, 0x280, SISLANDS_CACCONFIG_CGIND }, 1350 1.1 riastrad { 0x1a, 0xffff0000, 16, 0x7, SISLANDS_CACCONFIG_CGIND }, 1351 1.1 riastrad { 0x1b, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 1352 1.1 riastrad { 0x1b, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 1353 1.1 riastrad { 0x1c, 0x0000ffff, 0, 0x3C, SISLANDS_CACCONFIG_CGIND }, 1354 1.1 riastrad { 0x1c, 0xffff0000, 16, 0x203, SISLANDS_CACCONFIG_CGIND }, 1355 1.1 riastrad { 0x1d, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 1356 1.1 riastrad { 0x1d, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 1357 1.1 riastrad { 0x1e, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 1358 1.1 riastrad { 0x1e, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND }, 1359 1.1 riastrad { 0x1f, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 1360 1.1 riastrad { 0x1f, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND }, 1361 1.1 riastrad { 0x20, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 1362 1.1 riastrad { 0x6d, 0x0000ffff, 0, 0xB4, SISLANDS_CACCONFIG_CGIND }, 1363 1.1 riastrad { 0xFFFFFFFF } 1364 1.1 riastrad }; 1365 1.1 riastrad 1366 1.1 riastrad static const struct si_cac_config_reg cac_weights_oland_xt[] = 1367 1.1 riastrad { 1368 1.1 riastrad { 0x0, 0x0000ffff, 0, 0x43, SISLANDS_CACCONFIG_CGIND }, 1369 1.1 riastrad { 0x0, 0xffff0000, 16, 0x29, SISLANDS_CACCONFIG_CGIND }, 1370 1.1 riastrad { 0x1, 0x0000ffff, 0, 0xAF, SISLANDS_CACCONFIG_CGIND }, 1371 1.1 riastrad { 0x1, 0xffff0000, 16, 0x2A, SISLANDS_CACCONFIG_CGIND }, 1372 1.1 riastrad { 0x2, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 1373 1.1 riastrad { 0x3, 0x0000ffff, 0, 0xA0, SISLANDS_CACCONFIG_CGIND }, 1374 1.1 riastrad { 0x3, 0xffff0000, 16, 0x29, SISLANDS_CACCONFIG_CGIND }, 1375 1.1 riastrad { 0x4, 0x0000ffff, 0, 0xA0, SISLANDS_CACCONFIG_CGIND }, 1376 1.1 riastrad { 0x4, 0xffff0000, 16, 0x59, SISLANDS_CACCONFIG_CGIND }, 1377 1.1 riastrad { 0x5, 0x0000ffff, 0, 0x1A5, SISLANDS_CACCONFIG_CGIND }, 1378 1.1 riastrad { 0x5, 0xffff0000, 16, 0x1D6, SISLANDS_CACCONFIG_CGIND }, 1379 1.1 riastrad { 0x6, 0x0000ffff, 0, 0x2A3, SISLANDS_CACCONFIG_CGIND }, 1380 1.1 riastrad { 0x6, 0xffff0000, 16, 0x8FD, SISLANDS_CACCONFIG_CGIND }, 1381 1.1 riastrad { 0x18f, 0x0000ffff, 0, 0x76, SISLANDS_CACCONFIG_CGIND }, 1382 1.1 riastrad { 0x7, 0x0000ffff, 0, 0x8A, SISLANDS_CACCONFIG_CGIND }, 1383 1.1 riastrad { 0x7, 0xffff0000, 16, 0xA3, SISLANDS_CACCONFIG_CGIND }, 1384 1.1 riastrad { 0x8, 0x0000ffff, 0, 0x71, SISLANDS_CACCONFIG_CGIND }, 1385 1.1 riastrad { 0x8, 0xffff0000, 16, 0x36, SISLANDS_CACCONFIG_CGIND }, 1386 1.1 riastrad { 0x9, 0x0000ffff, 0, 0xA6, SISLANDS_CACCONFIG_CGIND }, 1387 1.1 riastrad { 0xa, 0x0000ffff, 0, 0x81, SISLANDS_CACCONFIG_CGIND }, 1388 1.1 riastrad { 0xb, 0x0000ffff, 0, 0x3D2, SISLANDS_CACCONFIG_CGIND }, 1389 1.1 riastrad { 0xb, 0xffff0000, 16, 0x27C, SISLANDS_CACCONFIG_CGIND }, 1390 1.1 riastrad { 0xc, 0x0000ffff, 0, 0xA96, SISLANDS_CACCONFIG_CGIND }, 1391 1.1 riastrad { 0xd, 0x0000ffff, 0, 0x5, SISLANDS_CACCONFIG_CGIND }, 1392 1.1 riastrad { 0xd, 0xffff0000, 16, 0x5, SISLANDS_CACCONFIG_CGIND }, 1393 1.1 riastrad { 0xe, 0x0000ffff, 0, 0xB, SISLANDS_CACCONFIG_CGIND }, 1394 1.1 riastrad { 0xf, 0x0000ffff, 0, 0x3, SISLANDS_CACCONFIG_CGIND }, 1395 1.1 riastrad { 0xf, 0xffff0000, 16, 0x2, SISLANDS_CACCONFIG_CGIND }, 1396 1.1 riastrad { 0x10, 0x0000ffff, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 1397 1.1 riastrad { 0x10, 0xffff0000, 16, 0x4, SISLANDS_CACCONFIG_CGIND }, 1398 1.1 riastrad { 0x11, 0x0000ffff, 0, 0x15, SISLANDS_CACCONFIG_CGIND }, 1399 1.1 riastrad { 0x11, 0xffff0000, 16, 0x7, SISLANDS_CACCONFIG_CGIND }, 1400 1.1 riastrad { 0x12, 0x0000ffff, 0, 0x36, SISLANDS_CACCONFIG_CGIND }, 1401 1.1 riastrad { 0x13, 0x0000ffff, 0, 0x10, SISLANDS_CACCONFIG_CGIND }, 1402 1.1 riastrad { 0x13, 0xffff0000, 16, 0x10, SISLANDS_CACCONFIG_CGIND }, 1403 1.1 riastrad { 0x14, 0x0000ffff, 0, 0x120, SISLANDS_CACCONFIG_CGIND }, 1404 1.1 riastrad { 0x15, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 1405 1.1 riastrad { 0x15, 0xffff0000, 16, 0x6, SISLANDS_CACCONFIG_CGIND }, 1406 1.1 riastrad { 0x4e, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 1407 1.1 riastrad { 0x16, 0x0000ffff, 0, 0x32, SISLANDS_CACCONFIG_CGIND }, 1408 1.1 riastrad { 0x16, 0xffff0000, 16, 0x7E, SISLANDS_CACCONFIG_CGIND }, 1409 1.1 riastrad { 0x17, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 1410 1.1 riastrad { 0x18, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 1411 1.1 riastrad { 0x18, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 1412 1.1 riastrad { 0x19, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 1413 1.1 riastrad { 0x19, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 1414 1.1 riastrad { 0x1a, 0x0000ffff, 0, 0x280, SISLANDS_CACCONFIG_CGIND }, 1415 1.1 riastrad { 0x1a, 0xffff0000, 16, 0x7, SISLANDS_CACCONFIG_CGIND }, 1416 1.1 riastrad { 0x1b, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 1417 1.1 riastrad { 0x1b, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 1418 1.1 riastrad { 0x1c, 0x0000ffff, 0, 0x3C, SISLANDS_CACCONFIG_CGIND }, 1419 1.1 riastrad { 0x1c, 0xffff0000, 16, 0x203, SISLANDS_CACCONFIG_CGIND }, 1420 1.1 riastrad { 0x1d, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 1421 1.1 riastrad { 0x1d, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 1422 1.1 riastrad { 0x1e, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 1423 1.1 riastrad { 0x1e, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND }, 1424 1.1 riastrad { 0x1f, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 1425 1.1 riastrad { 0x1f, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND }, 1426 1.1 riastrad { 0x20, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 1427 1.1 riastrad { 0x6d, 0x0000ffff, 0, 0xB4, SISLANDS_CACCONFIG_CGIND }, 1428 1.1 riastrad { 0xFFFFFFFF } 1429 1.1 riastrad }; 1430 1.1 riastrad 1431 1.1 riastrad static const struct si_cac_config_reg lcac_oland[] = 1432 1.1 riastrad { 1433 1.1 riastrad { 0x98, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 1434 1.1 riastrad { 0x98, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 1435 1.1 riastrad { 0x104, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 1436 1.1 riastrad { 0x104, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 1437 1.1 riastrad { 0x110, 0x0001fffe, 1, 0x6, SISLANDS_CACCONFIG_CGIND }, 1438 1.1 riastrad { 0x110, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 1439 1.1 riastrad { 0x14f, 0x0001fffe, 1, 0x6, SISLANDS_CACCONFIG_CGIND }, 1440 1.1 riastrad { 0x14f, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 1441 1.1 riastrad { 0x8c, 0x0001fffe, 1, 0x6, SISLANDS_CACCONFIG_CGIND }, 1442 1.1 riastrad { 0x8c, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 1443 1.1 riastrad { 0x143, 0x0001fffe, 1, 0x4, SISLANDS_CACCONFIG_CGIND }, 1444 1.1 riastrad { 0x143, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 1445 1.1 riastrad { 0x11c, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 1446 1.1 riastrad { 0x11c, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 1447 1.1 riastrad { 0x11f, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 1448 1.1 riastrad { 0x11f, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 1449 1.1 riastrad { 0x164, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND }, 1450 1.1 riastrad { 0x164, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 1451 1.1 riastrad { 0x167, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND }, 1452 1.1 riastrad { 0x167, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 1453 1.1 riastrad { 0x16a, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND }, 1454 1.1 riastrad { 0x16a, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 1455 1.1 riastrad { 0x15e, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND }, 1456 1.1 riastrad { 0x15e, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 1457 1.1 riastrad { 0x161, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND }, 1458 1.1 riastrad { 0x161, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 1459 1.1 riastrad { 0x15b, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND }, 1460 1.1 riastrad { 0x15b, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 1461 1.1 riastrad { 0x16d, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 1462 1.1 riastrad { 0x16d, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 1463 1.1 riastrad { 0x170, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND }, 1464 1.1 riastrad { 0x170, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 1465 1.1 riastrad { 0x173, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND }, 1466 1.1 riastrad { 0x173, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 1467 1.1 riastrad { 0x176, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND }, 1468 1.1 riastrad { 0x176, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 1469 1.1 riastrad { 0x179, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND }, 1470 1.1 riastrad { 0x179, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 1471 1.1 riastrad { 0x17c, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND }, 1472 1.1 riastrad { 0x17c, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 1473 1.1 riastrad { 0x17f, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND }, 1474 1.1 riastrad { 0x17f, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 1475 1.1 riastrad { 0xFFFFFFFF } 1476 1.1 riastrad }; 1477 1.1 riastrad 1478 1.1 riastrad static const struct si_cac_config_reg lcac_mars_pro[] = 1479 1.1 riastrad { 1480 1.1 riastrad { 0x98, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 1481 1.1 riastrad { 0x98, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 1482 1.1 riastrad { 0x104, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 1483 1.1 riastrad { 0x104, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 1484 1.1 riastrad { 0x110, 0x0001fffe, 1, 0x6, SISLANDS_CACCONFIG_CGIND }, 1485 1.1 riastrad { 0x110, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 1486 1.1 riastrad { 0x14f, 0x0001fffe, 1, 0x6, SISLANDS_CACCONFIG_CGIND }, 1487 1.1 riastrad { 0x14f, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 1488 1.1 riastrad { 0x8c, 0x0001fffe, 1, 0x6, SISLANDS_CACCONFIG_CGIND }, 1489 1.1 riastrad { 0x8c, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 1490 1.1 riastrad { 0x143, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 1491 1.1 riastrad { 0x143, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 1492 1.1 riastrad { 0x11c, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 1493 1.1 riastrad { 0x11c, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 1494 1.1 riastrad { 0x11f, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 1495 1.1 riastrad { 0x11f, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 1496 1.1 riastrad { 0x164, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND }, 1497 1.1 riastrad { 0x164, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 1498 1.1 riastrad { 0x167, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND }, 1499 1.1 riastrad { 0x167, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 1500 1.1 riastrad { 0x16a, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND }, 1501 1.1 riastrad { 0x16a, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 1502 1.1 riastrad { 0x15e, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND }, 1503 1.1 riastrad { 0x15e, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 1504 1.1 riastrad { 0x161, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND }, 1505 1.1 riastrad { 0x161, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 1506 1.1 riastrad { 0x15b, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND }, 1507 1.1 riastrad { 0x15b, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 1508 1.1 riastrad { 0x16d, 0x0001fffe, 1, 0x2, SISLANDS_CACCONFIG_CGIND }, 1509 1.1 riastrad { 0x16d, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 1510 1.1 riastrad { 0x170, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND }, 1511 1.1 riastrad { 0x170, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 1512 1.1 riastrad { 0x173, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND }, 1513 1.1 riastrad { 0x173, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 1514 1.1 riastrad { 0x176, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND }, 1515 1.1 riastrad { 0x176, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 1516 1.1 riastrad { 0x179, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND }, 1517 1.1 riastrad { 0x179, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 1518 1.1 riastrad { 0x17c, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND }, 1519 1.1 riastrad { 0x17c, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 1520 1.1 riastrad { 0x17f, 0x0001fffe, 1, 0x1, SISLANDS_CACCONFIG_CGIND }, 1521 1.1 riastrad { 0x17f, 0x00000001, 0, 0x1, SISLANDS_CACCONFIG_CGIND }, 1522 1.1 riastrad { 0xFFFFFFFF } 1523 1.1 riastrad }; 1524 1.1 riastrad 1525 1.1 riastrad static const struct si_cac_config_reg cac_override_oland[] = 1526 1.1 riastrad { 1527 1.1 riastrad { 0xFFFFFFFF } 1528 1.1 riastrad }; 1529 1.1 riastrad 1530 1.1 riastrad static const struct si_powertune_data powertune_data_oland = 1531 1.1 riastrad { 1532 1.1 riastrad ((1 << 16) | 0x6993), 1533 1.1 riastrad 5, 1534 1.1 riastrad 0, 1535 1.1 riastrad 7, 1536 1.1 riastrad 105, 1537 1.1 riastrad { 1538 1.1 riastrad 0UL, 1539 1.1 riastrad 0UL, 1540 1.1 riastrad 7194395UL, 1541 1.1 riastrad 309631529UL, 1542 1.1 riastrad -1270850L, 1543 1.1 riastrad 4513710L, 1544 1.1 riastrad 100 1545 1.1 riastrad }, 1546 1.1 riastrad 117830498UL, 1547 1.1 riastrad 12, 1548 1.1 riastrad { 1549 1.1 riastrad 0, 1550 1.1 riastrad 0, 1551 1.1 riastrad 0, 1552 1.1 riastrad 0, 1553 1.1 riastrad 0, 1554 1.1 riastrad 0, 1555 1.1 riastrad 0, 1556 1.1 riastrad 0 1557 1.1 riastrad }, 1558 1.1 riastrad true 1559 1.1 riastrad }; 1560 1.1 riastrad 1561 1.1 riastrad static const struct si_powertune_data powertune_data_mars_pro = 1562 1.1 riastrad { 1563 1.1 riastrad ((1 << 16) | 0x6993), 1564 1.1 riastrad 5, 1565 1.1 riastrad 0, 1566 1.1 riastrad 7, 1567 1.1 riastrad 105, 1568 1.1 riastrad { 1569 1.1 riastrad 0UL, 1570 1.1 riastrad 0UL, 1571 1.1 riastrad 7194395UL, 1572 1.1 riastrad 309631529UL, 1573 1.1 riastrad -1270850L, 1574 1.1 riastrad 4513710L, 1575 1.1 riastrad 100 1576 1.1 riastrad }, 1577 1.1 riastrad 117830498UL, 1578 1.1 riastrad 12, 1579 1.1 riastrad { 1580 1.1 riastrad 0, 1581 1.1 riastrad 0, 1582 1.1 riastrad 0, 1583 1.1 riastrad 0, 1584 1.1 riastrad 0, 1585 1.1 riastrad 0, 1586 1.1 riastrad 0, 1587 1.1 riastrad 0 1588 1.1 riastrad }, 1589 1.1 riastrad true 1590 1.1 riastrad }; 1591 1.1 riastrad 1592 1.1 riastrad static const struct si_dte_data dte_data_oland = 1593 1.1 riastrad { 1594 1.1 riastrad { 0, 0, 0, 0, 0 }, 1595 1.1 riastrad { 0, 0, 0, 0, 0 }, 1596 1.1 riastrad 0, 1597 1.1 riastrad 0, 1598 1.1 riastrad 0, 1599 1.1 riastrad 0, 1600 1.1 riastrad 0, 1601 1.1 riastrad 0, 1602 1.1 riastrad 0, 1603 1.1 riastrad { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 1604 1.1 riastrad { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 1605 1.1 riastrad { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 1606 1.1 riastrad 0, 1607 1.1 riastrad false 1608 1.1 riastrad }; 1609 1.1 riastrad 1610 1.1 riastrad static const struct si_dte_data dte_data_mars_pro = 1611 1.1 riastrad { 1612 1.1 riastrad { 0x1E8480, 0x3D0900, 0x989680, 0x2625A00, 0x0 }, 1613 1.1 riastrad { 0x0, 0x0, 0x0, 0x0, 0x0 }, 1614 1.1 riastrad 5, 1615 1.1 riastrad 55000, 1616 1.1 riastrad 105, 1617 1.1 riastrad 0xA, 1618 1.1 riastrad 1, 1619 1.1 riastrad 0, 1620 1.1 riastrad 0x10, 1621 1.1 riastrad { 0x96, 0xB4, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, 1622 1.1 riastrad { 0x895440, 0x3D0900, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680 }, 1623 1.1 riastrad { 0xF627, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, 1624 1.1 riastrad 90, 1625 1.1 riastrad true 1626 1.1 riastrad }; 1627 1.1 riastrad 1628 1.1 riastrad static const struct si_dte_data dte_data_sun_xt = 1629 1.1 riastrad { 1630 1.1 riastrad { 0x1E8480, 0x3D0900, 0x989680, 0x2625A00, 0x0 }, 1631 1.1 riastrad { 0x0, 0x0, 0x0, 0x0, 0x0 }, 1632 1.1 riastrad 5, 1633 1.1 riastrad 55000, 1634 1.1 riastrad 105, 1635 1.1 riastrad 0xA, 1636 1.1 riastrad 1, 1637 1.1 riastrad 0, 1638 1.1 riastrad 0x10, 1639 1.1 riastrad { 0x96, 0xB4, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, 1640 1.1 riastrad { 0x895440, 0x3D0900, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680, 0x989680 }, 1641 1.1 riastrad { 0xD555, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }, 1642 1.1 riastrad 90, 1643 1.1 riastrad true 1644 1.1 riastrad }; 1645 1.1 riastrad 1646 1.1 riastrad 1647 1.1 riastrad static const struct si_cac_config_reg cac_weights_hainan[] = 1648 1.1 riastrad { 1649 1.1 riastrad { 0x0, 0x0000ffff, 0, 0x2d9, SISLANDS_CACCONFIG_CGIND }, 1650 1.1 riastrad { 0x0, 0xffff0000, 16, 0x22b, SISLANDS_CACCONFIG_CGIND }, 1651 1.1 riastrad { 0x1, 0x0000ffff, 0, 0x21c, SISLANDS_CACCONFIG_CGIND }, 1652 1.1 riastrad { 0x1, 0xffff0000, 16, 0x1dc, SISLANDS_CACCONFIG_CGIND }, 1653 1.1 riastrad { 0x2, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 1654 1.1 riastrad { 0x3, 0x0000ffff, 0, 0x24e, SISLANDS_CACCONFIG_CGIND }, 1655 1.1 riastrad { 0x3, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 1656 1.1 riastrad { 0x4, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 1657 1.1 riastrad { 0x4, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 1658 1.1 riastrad { 0x5, 0x0000ffff, 0, 0x35e, SISLANDS_CACCONFIG_CGIND }, 1659 1.1 riastrad { 0x5, 0xffff0000, 16, 0x1143, SISLANDS_CACCONFIG_CGIND }, 1660 1.1 riastrad { 0x6, 0x0000ffff, 0, 0xe17, SISLANDS_CACCONFIG_CGIND }, 1661 1.1 riastrad { 0x6, 0xffff0000, 16, 0x441, SISLANDS_CACCONFIG_CGIND }, 1662 1.1 riastrad { 0x18f, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 1663 1.1 riastrad { 0x7, 0x0000ffff, 0, 0x28b, SISLANDS_CACCONFIG_CGIND }, 1664 1.1 riastrad { 0x7, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 1665 1.1 riastrad { 0x8, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 1666 1.1 riastrad { 0x8, 0xffff0000, 16, 0xabe, SISLANDS_CACCONFIG_CGIND }, 1667 1.1 riastrad { 0x9, 0x0000ffff, 0, 0xf11, SISLANDS_CACCONFIG_CGIND }, 1668 1.1 riastrad { 0xa, 0x0000ffff, 0, 0x907, SISLANDS_CACCONFIG_CGIND }, 1669 1.1 riastrad { 0xb, 0x0000ffff, 0, 0xb45, SISLANDS_CACCONFIG_CGIND }, 1670 1.1 riastrad { 0xb, 0xffff0000, 16, 0xd1e, SISLANDS_CACCONFIG_CGIND }, 1671 1.1 riastrad { 0xc, 0x0000ffff, 0, 0xa2c, SISLANDS_CACCONFIG_CGIND }, 1672 1.1 riastrad { 0xd, 0x0000ffff, 0, 0x62, SISLANDS_CACCONFIG_CGIND }, 1673 1.1 riastrad { 0xd, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 1674 1.1 riastrad { 0xe, 0x0000ffff, 0, 0x1f3, SISLANDS_CACCONFIG_CGIND }, 1675 1.1 riastrad { 0xf, 0x0000ffff, 0, 0x42, SISLANDS_CACCONFIG_CGIND }, 1676 1.1 riastrad { 0xf, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 1677 1.1 riastrad { 0x10, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 1678 1.1 riastrad { 0x10, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 1679 1.1 riastrad { 0x11, 0x0000ffff, 0, 0x709, SISLANDS_CACCONFIG_CGIND }, 1680 1.1 riastrad { 0x11, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 1681 1.1 riastrad { 0x12, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 1682 1.1 riastrad { 0x13, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 1683 1.1 riastrad { 0x13, 0xffff0000, 16, 0x3a, SISLANDS_CACCONFIG_CGIND }, 1684 1.1 riastrad { 0x14, 0x0000ffff, 0, 0x357, SISLANDS_CACCONFIG_CGIND }, 1685 1.1 riastrad { 0x15, 0x0000ffff, 0, 0x9f, SISLANDS_CACCONFIG_CGIND }, 1686 1.1 riastrad { 0x15, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 1687 1.1 riastrad { 0x4e, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 1688 1.1 riastrad { 0x16, 0x0000ffff, 0, 0x314, SISLANDS_CACCONFIG_CGIND }, 1689 1.1 riastrad { 0x16, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 1690 1.1 riastrad { 0x17, 0x0000ffff, 0, 0x6d, SISLANDS_CACCONFIG_CGIND }, 1691 1.1 riastrad { 0x18, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 1692 1.1 riastrad { 0x18, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 1693 1.1 riastrad { 0x19, 0x0000ffff, 0, 0x0, SISLANDS_CACCONFIG_CGIND }, 1694 1.1 riastrad { 0x19, 0xffff0000, 16, 0x0, SISLANDS_CACCONFIG_CGIND }, 1695 1.1 riastrad { 0x1a, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 1696 1.1 riastrad { 0x1a, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND }, 1697 1.1 riastrad { 0x1b, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 1698 1.1 riastrad { 0x1b, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND }, 1699 1.1 riastrad { 0x1c, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 1700 1.1 riastrad { 0x1c, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND }, 1701 1.1 riastrad { 0x1d, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 1702 1.1 riastrad { 0x1d, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND }, 1703 1.1 riastrad { 0x1e, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 1704 1.1 riastrad { 0x1e, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND }, 1705 1.1 riastrad { 0x1f, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 1706 1.1 riastrad { 0x1f, 0xffff0000, 16, 0, SISLANDS_CACCONFIG_CGIND }, 1707 1.1 riastrad { 0x20, 0x0000ffff, 0, 0, SISLANDS_CACCONFIG_CGIND }, 1708 1.1 riastrad { 0x6d, 0x0000ffff, 0, 0x1b9, SISLANDS_CACCONFIG_CGIND }, 1709 1.1 riastrad { 0xFFFFFFFF } 1710 1.1 riastrad }; 1711 1.1 riastrad 1712 1.1 riastrad static const struct si_powertune_data powertune_data_hainan = 1713 1.1 riastrad { 1714 1.1 riastrad ((1 << 16) | 0x6993), 1715 1.1 riastrad 5, 1716 1.1 riastrad 0, 1717 1.1 riastrad 9, 1718 1.1 riastrad 105, 1719 1.1 riastrad { 1720 1.1 riastrad 0UL, 1721 1.1 riastrad 0UL, 1722 1.1 riastrad 7194395UL, 1723 1.1 riastrad 309631529UL, 1724 1.1 riastrad -1270850L, 1725 1.1 riastrad 4513710L, 1726 1.1 riastrad 100 1727 1.1 riastrad }, 1728 1.1 riastrad 117830498UL, 1729 1.1 riastrad 12, 1730 1.1 riastrad { 1731 1.1 riastrad 0, 1732 1.1 riastrad 0, 1733 1.1 riastrad 0, 1734 1.1 riastrad 0, 1735 1.1 riastrad 0, 1736 1.1 riastrad 0, 1737 1.1 riastrad 0, 1738 1.1 riastrad 0 1739 1.1 riastrad }, 1740 1.1 riastrad true 1741 1.1 riastrad }; 1742 1.1 riastrad 1743 1.1 riastrad struct rv7xx_power_info *rv770_get_pi(struct radeon_device *rdev); 1744 1.1 riastrad struct evergreen_power_info *evergreen_get_pi(struct radeon_device *rdev); 1745 1.1 riastrad struct ni_power_info *ni_get_pi(struct radeon_device *rdev); 1746 1.1 riastrad struct ni_ps *ni_get_ps(struct radeon_ps *rps); 1747 1.1 riastrad 1748 1.1 riastrad extern int si_mc_load_microcode(struct radeon_device *rdev); 1749 1.1 riastrad extern void vce_v1_0_enable_mgcg(struct radeon_device *rdev, bool enable); 1750 1.1 riastrad 1751 1.1 riastrad static int si_populate_voltage_value(struct radeon_device *rdev, 1752 1.1 riastrad const struct atom_voltage_table *table, 1753 1.1 riastrad u16 value, SISLANDS_SMC_VOLTAGE_VALUE *voltage); 1754 1.1 riastrad static int si_get_std_voltage_value(struct radeon_device *rdev, 1755 1.1 riastrad SISLANDS_SMC_VOLTAGE_VALUE *voltage, 1756 1.1 riastrad u16 *std_voltage); 1757 1.1 riastrad static int si_write_smc_soft_register(struct radeon_device *rdev, 1758 1.1 riastrad u16 reg_offset, u32 value); 1759 1.1 riastrad static int si_convert_power_level_to_smc(struct radeon_device *rdev, 1760 1.1 riastrad struct rv7xx_pl *pl, 1761 1.1 riastrad SISLANDS_SMC_HW_PERFORMANCE_LEVEL *level); 1762 1.1 riastrad static int si_calculate_sclk_params(struct radeon_device *rdev, 1763 1.1 riastrad u32 engine_clock, 1764 1.1 riastrad SISLANDS_SMC_SCLK_VALUE *sclk); 1765 1.1 riastrad 1766 1.1 riastrad static void si_thermal_start_smc_fan_control(struct radeon_device *rdev); 1767 1.1 riastrad static void si_fan_ctrl_set_default_mode(struct radeon_device *rdev); 1768 1.1 riastrad 1769 1.1 riastrad static struct si_power_info *si_get_pi(struct radeon_device *rdev) 1770 1.1 riastrad { 1771 1.5 riastrad struct si_power_info *pi = rdev->pm.dpm.priv; 1772 1.1 riastrad 1773 1.5 riastrad return pi; 1774 1.1 riastrad } 1775 1.1 riastrad 1776 1.1 riastrad static void si_calculate_leakage_for_v_and_t_formula(const struct ni_leakage_coeffients *coeff, 1777 1.1 riastrad u16 v, s32 t, u32 ileakage, u32 *leakage) 1778 1.1 riastrad { 1779 1.1 riastrad s64 kt, kv, leakage_w, i_leakage, vddc; 1780 1.1 riastrad s64 temperature, t_slope, t_intercept, av, bv, t_ref; 1781 1.1 riastrad s64 tmp; 1782 1.1 riastrad 1783 1.1 riastrad i_leakage = div64_s64(drm_int2fixp(ileakage), 100); 1784 1.1 riastrad vddc = div64_s64(drm_int2fixp(v), 1000); 1785 1.1 riastrad temperature = div64_s64(drm_int2fixp(t), 1000); 1786 1.1 riastrad 1787 1.1 riastrad t_slope = div64_s64(drm_int2fixp(coeff->t_slope), 100000000); 1788 1.1 riastrad t_intercept = div64_s64(drm_int2fixp(coeff->t_intercept), 100000000); 1789 1.1 riastrad av = div64_s64(drm_int2fixp(coeff->av), 100000000); 1790 1.1 riastrad bv = div64_s64(drm_int2fixp(coeff->bv), 100000000); 1791 1.1 riastrad t_ref = drm_int2fixp(coeff->t_ref); 1792 1.1 riastrad 1793 1.1 riastrad tmp = drm_fixp_mul(t_slope, vddc) + t_intercept; 1794 1.1 riastrad kt = drm_fixp_exp(drm_fixp_mul(tmp, temperature)); 1795 1.1 riastrad kt = drm_fixp_div(kt, drm_fixp_exp(drm_fixp_mul(tmp, t_ref))); 1796 1.1 riastrad kv = drm_fixp_mul(av, drm_fixp_exp(drm_fixp_mul(bv, vddc))); 1797 1.1 riastrad 1798 1.1 riastrad leakage_w = drm_fixp_mul(drm_fixp_mul(drm_fixp_mul(i_leakage, kt), kv), vddc); 1799 1.1 riastrad 1800 1.1 riastrad *leakage = drm_fixp2int(leakage_w * 1000); 1801 1.1 riastrad } 1802 1.1 riastrad 1803 1.1 riastrad static void si_calculate_leakage_for_v_and_t(struct radeon_device *rdev, 1804 1.1 riastrad const struct ni_leakage_coeffients *coeff, 1805 1.1 riastrad u16 v, 1806 1.1 riastrad s32 t, 1807 1.1 riastrad u32 i_leakage, 1808 1.1 riastrad u32 *leakage) 1809 1.1 riastrad { 1810 1.1 riastrad si_calculate_leakage_for_v_and_t_formula(coeff, v, t, i_leakage, leakage); 1811 1.1 riastrad } 1812 1.1 riastrad 1813 1.1 riastrad static void si_calculate_leakage_for_v_formula(const struct ni_leakage_coeffients *coeff, 1814 1.1 riastrad const u32 fixed_kt, u16 v, 1815 1.1 riastrad u32 ileakage, u32 *leakage) 1816 1.1 riastrad { 1817 1.1 riastrad s64 kt, kv, leakage_w, i_leakage, vddc; 1818 1.1 riastrad 1819 1.1 riastrad i_leakage = div64_s64(drm_int2fixp(ileakage), 100); 1820 1.1 riastrad vddc = div64_s64(drm_int2fixp(v), 1000); 1821 1.1 riastrad 1822 1.1 riastrad kt = div64_s64(drm_int2fixp(fixed_kt), 100000000); 1823 1.1 riastrad kv = drm_fixp_mul(div64_s64(drm_int2fixp(coeff->av), 100000000), 1824 1.1 riastrad drm_fixp_exp(drm_fixp_mul(div64_s64(drm_int2fixp(coeff->bv), 100000000), vddc))); 1825 1.1 riastrad 1826 1.1 riastrad leakage_w = drm_fixp_mul(drm_fixp_mul(drm_fixp_mul(i_leakage, kt), kv), vddc); 1827 1.1 riastrad 1828 1.1 riastrad *leakage = drm_fixp2int(leakage_w * 1000); 1829 1.1 riastrad } 1830 1.1 riastrad 1831 1.1 riastrad static void si_calculate_leakage_for_v(struct radeon_device *rdev, 1832 1.1 riastrad const struct ni_leakage_coeffients *coeff, 1833 1.1 riastrad const u32 fixed_kt, 1834 1.1 riastrad u16 v, 1835 1.1 riastrad u32 i_leakage, 1836 1.1 riastrad u32 *leakage) 1837 1.1 riastrad { 1838 1.1 riastrad si_calculate_leakage_for_v_formula(coeff, fixed_kt, v, i_leakage, leakage); 1839 1.1 riastrad } 1840 1.1 riastrad 1841 1.1 riastrad 1842 1.1 riastrad static void si_update_dte_from_pl2(struct radeon_device *rdev, 1843 1.1 riastrad struct si_dte_data *dte_data) 1844 1.1 riastrad { 1845 1.1 riastrad u32 p_limit1 = rdev->pm.dpm.tdp_limit; 1846 1.1 riastrad u32 p_limit2 = rdev->pm.dpm.near_tdp_limit; 1847 1.1 riastrad u32 k = dte_data->k; 1848 1.1 riastrad u32 t_max = dte_data->max_t; 1849 1.1 riastrad u32 t_split[5] = { 10, 15, 20, 25, 30 }; 1850 1.1 riastrad u32 t_0 = dte_data->t0; 1851 1.1 riastrad u32 i; 1852 1.1 riastrad 1853 1.1 riastrad if (p_limit2 != 0 && p_limit2 <= p_limit1) { 1854 1.1 riastrad dte_data->tdep_count = 3; 1855 1.1 riastrad 1856 1.1 riastrad for (i = 0; i < k; i++) { 1857 1.1 riastrad dte_data->r[i] = 1858 1.1 riastrad (t_split[i] * (t_max - t_0/(u32)1000) * (1 << 14)) / 1859 1.1 riastrad (p_limit2 * (u32)100); 1860 1.1 riastrad } 1861 1.1 riastrad 1862 1.1 riastrad dte_data->tdep_r[1] = dte_data->r[4] * 2; 1863 1.1 riastrad 1864 1.1 riastrad for (i = 2; i < SMC_SISLANDS_DTE_MAX_TEMPERATURE_DEPENDENT_ARRAY_SIZE; i++) { 1865 1.1 riastrad dte_data->tdep_r[i] = dte_data->r[4]; 1866 1.1 riastrad } 1867 1.1 riastrad } else { 1868 1.1 riastrad DRM_ERROR("Invalid PL2! DTE will not be updated.\n"); 1869 1.1 riastrad } 1870 1.1 riastrad } 1871 1.1 riastrad 1872 1.1 riastrad static void si_initialize_powertune_defaults(struct radeon_device *rdev) 1873 1.1 riastrad { 1874 1.1 riastrad struct ni_power_info *ni_pi = ni_get_pi(rdev); 1875 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 1876 1.1 riastrad bool update_dte_from_pl2 = false; 1877 1.1 riastrad 1878 1.1 riastrad if (rdev->family == CHIP_TAHITI) { 1879 1.1 riastrad si_pi->cac_weights = cac_weights_tahiti; 1880 1.1 riastrad si_pi->lcac_config = lcac_tahiti; 1881 1.1 riastrad si_pi->cac_override = cac_override_tahiti; 1882 1.1 riastrad si_pi->powertune_data = &powertune_data_tahiti; 1883 1.1 riastrad si_pi->dte_data = dte_data_tahiti; 1884 1.1 riastrad 1885 1.1 riastrad switch (rdev->pdev->device) { 1886 1.1 riastrad case 0x6798: 1887 1.1 riastrad si_pi->dte_data.enable_dte_by_default = true; 1888 1.1 riastrad break; 1889 1.1 riastrad case 0x6799: 1890 1.1 riastrad si_pi->dte_data = dte_data_new_zealand; 1891 1.1 riastrad break; 1892 1.1 riastrad case 0x6790: 1893 1.1 riastrad case 0x6791: 1894 1.1 riastrad case 0x6792: 1895 1.1 riastrad case 0x679E: 1896 1.1 riastrad si_pi->dte_data = dte_data_aruba_pro; 1897 1.1 riastrad update_dte_from_pl2 = true; 1898 1.1 riastrad break; 1899 1.1 riastrad case 0x679B: 1900 1.1 riastrad si_pi->dte_data = dte_data_malta; 1901 1.1 riastrad update_dte_from_pl2 = true; 1902 1.1 riastrad break; 1903 1.1 riastrad case 0x679A: 1904 1.1 riastrad si_pi->dte_data = dte_data_tahiti_pro; 1905 1.1 riastrad update_dte_from_pl2 = true; 1906 1.1 riastrad break; 1907 1.1 riastrad default: 1908 1.1 riastrad if (si_pi->dte_data.enable_dte_by_default == true) 1909 1.1 riastrad DRM_ERROR("DTE is not enabled!\n"); 1910 1.1 riastrad break; 1911 1.1 riastrad } 1912 1.1 riastrad } else if (rdev->family == CHIP_PITCAIRN) { 1913 1.1 riastrad switch (rdev->pdev->device) { 1914 1.1 riastrad case 0x6810: 1915 1.1 riastrad case 0x6818: 1916 1.1 riastrad si_pi->cac_weights = cac_weights_pitcairn; 1917 1.1 riastrad si_pi->lcac_config = lcac_pitcairn; 1918 1.1 riastrad si_pi->cac_override = cac_override_pitcairn; 1919 1.1 riastrad si_pi->powertune_data = &powertune_data_pitcairn; 1920 1.1 riastrad si_pi->dte_data = dte_data_curacao_xt; 1921 1.1 riastrad update_dte_from_pl2 = true; 1922 1.1 riastrad break; 1923 1.1 riastrad case 0x6819: 1924 1.1 riastrad case 0x6811: 1925 1.1 riastrad si_pi->cac_weights = cac_weights_pitcairn; 1926 1.1 riastrad si_pi->lcac_config = lcac_pitcairn; 1927 1.1 riastrad si_pi->cac_override = cac_override_pitcairn; 1928 1.1 riastrad si_pi->powertune_data = &powertune_data_pitcairn; 1929 1.1 riastrad si_pi->dte_data = dte_data_curacao_pro; 1930 1.1 riastrad update_dte_from_pl2 = true; 1931 1.1 riastrad break; 1932 1.1 riastrad case 0x6800: 1933 1.1 riastrad case 0x6806: 1934 1.1 riastrad si_pi->cac_weights = cac_weights_pitcairn; 1935 1.1 riastrad si_pi->lcac_config = lcac_pitcairn; 1936 1.1 riastrad si_pi->cac_override = cac_override_pitcairn; 1937 1.1 riastrad si_pi->powertune_data = &powertune_data_pitcairn; 1938 1.1 riastrad si_pi->dte_data = dte_data_neptune_xt; 1939 1.1 riastrad update_dte_from_pl2 = true; 1940 1.1 riastrad break; 1941 1.1 riastrad default: 1942 1.1 riastrad si_pi->cac_weights = cac_weights_pitcairn; 1943 1.1 riastrad si_pi->lcac_config = lcac_pitcairn; 1944 1.1 riastrad si_pi->cac_override = cac_override_pitcairn; 1945 1.1 riastrad si_pi->powertune_data = &powertune_data_pitcairn; 1946 1.1 riastrad si_pi->dte_data = dte_data_pitcairn; 1947 1.1 riastrad break; 1948 1.1 riastrad } 1949 1.1 riastrad } else if (rdev->family == CHIP_VERDE) { 1950 1.1 riastrad si_pi->lcac_config = lcac_cape_verde; 1951 1.1 riastrad si_pi->cac_override = cac_override_cape_verde; 1952 1.1 riastrad si_pi->powertune_data = &powertune_data_cape_verde; 1953 1.1 riastrad 1954 1.1 riastrad switch (rdev->pdev->device) { 1955 1.1 riastrad case 0x683B: 1956 1.1 riastrad case 0x683F: 1957 1.1 riastrad case 0x6829: 1958 1.1 riastrad case 0x6835: 1959 1.1 riastrad si_pi->cac_weights = cac_weights_cape_verde_pro; 1960 1.1 riastrad si_pi->dte_data = dte_data_cape_verde; 1961 1.1 riastrad break; 1962 1.1 riastrad case 0x682C: 1963 1.1 riastrad si_pi->cac_weights = cac_weights_cape_verde_pro; 1964 1.1 riastrad si_pi->dte_data = dte_data_sun_xt; 1965 1.5 riastrad update_dte_from_pl2 = true; 1966 1.1 riastrad break; 1967 1.1 riastrad case 0x6825: 1968 1.1 riastrad case 0x6827: 1969 1.1 riastrad si_pi->cac_weights = cac_weights_heathrow; 1970 1.1 riastrad si_pi->dte_data = dte_data_cape_verde; 1971 1.1 riastrad break; 1972 1.1 riastrad case 0x6824: 1973 1.1 riastrad case 0x682D: 1974 1.1 riastrad si_pi->cac_weights = cac_weights_chelsea_xt; 1975 1.1 riastrad si_pi->dte_data = dte_data_cape_verde; 1976 1.1 riastrad break; 1977 1.1 riastrad case 0x682F: 1978 1.1 riastrad si_pi->cac_weights = cac_weights_chelsea_pro; 1979 1.1 riastrad si_pi->dte_data = dte_data_cape_verde; 1980 1.1 riastrad break; 1981 1.1 riastrad case 0x6820: 1982 1.1 riastrad si_pi->cac_weights = cac_weights_heathrow; 1983 1.1 riastrad si_pi->dte_data = dte_data_venus_xtx; 1984 1.1 riastrad break; 1985 1.1 riastrad case 0x6821: 1986 1.1 riastrad si_pi->cac_weights = cac_weights_heathrow; 1987 1.1 riastrad si_pi->dte_data = dte_data_venus_xt; 1988 1.1 riastrad break; 1989 1.1 riastrad case 0x6823: 1990 1.1 riastrad case 0x682B: 1991 1.1 riastrad case 0x6822: 1992 1.1 riastrad case 0x682A: 1993 1.1 riastrad si_pi->cac_weights = cac_weights_chelsea_pro; 1994 1.1 riastrad si_pi->dte_data = dte_data_venus_pro; 1995 1.1 riastrad break; 1996 1.1 riastrad default: 1997 1.1 riastrad si_pi->cac_weights = cac_weights_cape_verde; 1998 1.1 riastrad si_pi->dte_data = dte_data_cape_verde; 1999 1.1 riastrad break; 2000 1.1 riastrad } 2001 1.1 riastrad } else if (rdev->family == CHIP_OLAND) { 2002 1.1 riastrad switch (rdev->pdev->device) { 2003 1.1 riastrad case 0x6601: 2004 1.1 riastrad case 0x6621: 2005 1.1 riastrad case 0x6603: 2006 1.1 riastrad case 0x6605: 2007 1.1 riastrad si_pi->cac_weights = cac_weights_mars_pro; 2008 1.1 riastrad si_pi->lcac_config = lcac_mars_pro; 2009 1.1 riastrad si_pi->cac_override = cac_override_oland; 2010 1.1 riastrad si_pi->powertune_data = &powertune_data_mars_pro; 2011 1.1 riastrad si_pi->dte_data = dte_data_mars_pro; 2012 1.1 riastrad update_dte_from_pl2 = true; 2013 1.1 riastrad break; 2014 1.1 riastrad case 0x6600: 2015 1.1 riastrad case 0x6606: 2016 1.1 riastrad case 0x6620: 2017 1.1 riastrad case 0x6604: 2018 1.1 riastrad si_pi->cac_weights = cac_weights_mars_xt; 2019 1.1 riastrad si_pi->lcac_config = lcac_mars_pro; 2020 1.1 riastrad si_pi->cac_override = cac_override_oland; 2021 1.1 riastrad si_pi->powertune_data = &powertune_data_mars_pro; 2022 1.1 riastrad si_pi->dte_data = dte_data_mars_pro; 2023 1.1 riastrad update_dte_from_pl2 = true; 2024 1.1 riastrad break; 2025 1.1 riastrad case 0x6611: 2026 1.1 riastrad case 0x6613: 2027 1.1 riastrad case 0x6608: 2028 1.1 riastrad si_pi->cac_weights = cac_weights_oland_pro; 2029 1.1 riastrad si_pi->lcac_config = lcac_mars_pro; 2030 1.1 riastrad si_pi->cac_override = cac_override_oland; 2031 1.1 riastrad si_pi->powertune_data = &powertune_data_mars_pro; 2032 1.1 riastrad si_pi->dte_data = dte_data_mars_pro; 2033 1.1 riastrad update_dte_from_pl2 = true; 2034 1.1 riastrad break; 2035 1.1 riastrad case 0x6610: 2036 1.1 riastrad si_pi->cac_weights = cac_weights_oland_xt; 2037 1.1 riastrad si_pi->lcac_config = lcac_mars_pro; 2038 1.1 riastrad si_pi->cac_override = cac_override_oland; 2039 1.1 riastrad si_pi->powertune_data = &powertune_data_mars_pro; 2040 1.1 riastrad si_pi->dte_data = dte_data_mars_pro; 2041 1.1 riastrad update_dte_from_pl2 = true; 2042 1.1 riastrad break; 2043 1.1 riastrad default: 2044 1.1 riastrad si_pi->cac_weights = cac_weights_oland; 2045 1.1 riastrad si_pi->lcac_config = lcac_oland; 2046 1.1 riastrad si_pi->cac_override = cac_override_oland; 2047 1.1 riastrad si_pi->powertune_data = &powertune_data_oland; 2048 1.1 riastrad si_pi->dte_data = dte_data_oland; 2049 1.1 riastrad break; 2050 1.1 riastrad } 2051 1.1 riastrad } else if (rdev->family == CHIP_HAINAN) { 2052 1.1 riastrad si_pi->cac_weights = cac_weights_hainan; 2053 1.1 riastrad si_pi->lcac_config = lcac_oland; 2054 1.1 riastrad si_pi->cac_override = cac_override_oland; 2055 1.1 riastrad si_pi->powertune_data = &powertune_data_hainan; 2056 1.1 riastrad si_pi->dte_data = dte_data_sun_xt; 2057 1.1 riastrad update_dte_from_pl2 = true; 2058 1.1 riastrad } else { 2059 1.1 riastrad DRM_ERROR("Unknown SI asic revision, failed to initialize PowerTune!\n"); 2060 1.1 riastrad return; 2061 1.1 riastrad } 2062 1.1 riastrad 2063 1.1 riastrad ni_pi->enable_power_containment = false; 2064 1.1 riastrad ni_pi->enable_cac = false; 2065 1.1 riastrad ni_pi->enable_sq_ramping = false; 2066 1.1 riastrad si_pi->enable_dte = false; 2067 1.1 riastrad 2068 1.1 riastrad if (si_pi->powertune_data->enable_powertune_by_default) { 2069 1.1 riastrad ni_pi->enable_power_containment= true; 2070 1.1 riastrad ni_pi->enable_cac = true; 2071 1.1 riastrad if (si_pi->dte_data.enable_dte_by_default) { 2072 1.1 riastrad si_pi->enable_dte = true; 2073 1.1 riastrad if (update_dte_from_pl2) 2074 1.1 riastrad si_update_dte_from_pl2(rdev, &si_pi->dte_data); 2075 1.1 riastrad 2076 1.1 riastrad } 2077 1.1 riastrad ni_pi->enable_sq_ramping = true; 2078 1.1 riastrad } 2079 1.1 riastrad 2080 1.1 riastrad ni_pi->driver_calculate_cac_leakage = true; 2081 1.1 riastrad ni_pi->cac_configuration_required = true; 2082 1.1 riastrad 2083 1.1 riastrad if (ni_pi->cac_configuration_required) { 2084 1.1 riastrad ni_pi->support_cac_long_term_average = true; 2085 1.1 riastrad si_pi->dyn_powertune_data.l2_lta_window_size = 2086 1.1 riastrad si_pi->powertune_data->l2_lta_window_size_default; 2087 1.1 riastrad si_pi->dyn_powertune_data.lts_truncate = 2088 1.1 riastrad si_pi->powertune_data->lts_truncate_default; 2089 1.1 riastrad } else { 2090 1.1 riastrad ni_pi->support_cac_long_term_average = false; 2091 1.1 riastrad si_pi->dyn_powertune_data.l2_lta_window_size = 0; 2092 1.1 riastrad si_pi->dyn_powertune_data.lts_truncate = 0; 2093 1.1 riastrad } 2094 1.1 riastrad 2095 1.1 riastrad si_pi->dyn_powertune_data.disable_uvd_powertune = false; 2096 1.1 riastrad } 2097 1.1 riastrad 2098 1.1 riastrad static u32 si_get_smc_power_scaling_factor(struct radeon_device *rdev) 2099 1.1 riastrad { 2100 1.1 riastrad return 1; 2101 1.1 riastrad } 2102 1.1 riastrad 2103 1.1 riastrad static u32 si_calculate_cac_wintime(struct radeon_device *rdev) 2104 1.1 riastrad { 2105 1.1 riastrad u32 xclk; 2106 1.1 riastrad u32 wintime; 2107 1.1 riastrad u32 cac_window; 2108 1.1 riastrad u32 cac_window_size; 2109 1.1 riastrad 2110 1.1 riastrad xclk = radeon_get_xclk(rdev); 2111 1.1 riastrad 2112 1.1 riastrad if (xclk == 0) 2113 1.1 riastrad return 0; 2114 1.1 riastrad 2115 1.1 riastrad cac_window = RREG32(CG_CAC_CTRL) & CAC_WINDOW_MASK; 2116 1.1 riastrad cac_window_size = ((cac_window & 0xFFFF0000) >> 16) * (cac_window & 0x0000FFFF); 2117 1.1 riastrad 2118 1.1 riastrad wintime = (cac_window_size * 100) / xclk; 2119 1.1 riastrad 2120 1.1 riastrad return wintime; 2121 1.1 riastrad } 2122 1.1 riastrad 2123 1.1 riastrad static u32 si_scale_power_for_smc(u32 power_in_watts, u32 scaling_factor) 2124 1.1 riastrad { 2125 1.1 riastrad return power_in_watts; 2126 1.1 riastrad } 2127 1.1 riastrad 2128 1.1 riastrad static int si_calculate_adjusted_tdp_limits(struct radeon_device *rdev, 2129 1.1 riastrad bool adjust_polarity, 2130 1.1 riastrad u32 tdp_adjustment, 2131 1.1 riastrad u32 *tdp_limit, 2132 1.1 riastrad u32 *near_tdp_limit) 2133 1.1 riastrad { 2134 1.1 riastrad u32 adjustment_delta, max_tdp_limit; 2135 1.1 riastrad 2136 1.1 riastrad if (tdp_adjustment > (u32)rdev->pm.dpm.tdp_od_limit) 2137 1.1 riastrad return -EINVAL; 2138 1.1 riastrad 2139 1.1 riastrad max_tdp_limit = ((100 + 100) * rdev->pm.dpm.tdp_limit) / 100; 2140 1.1 riastrad 2141 1.1 riastrad if (adjust_polarity) { 2142 1.1 riastrad *tdp_limit = ((100 + tdp_adjustment) * rdev->pm.dpm.tdp_limit) / 100; 2143 1.1 riastrad *near_tdp_limit = rdev->pm.dpm.near_tdp_limit_adjusted + (*tdp_limit - rdev->pm.dpm.tdp_limit); 2144 1.1 riastrad } else { 2145 1.1 riastrad *tdp_limit = ((100 - tdp_adjustment) * rdev->pm.dpm.tdp_limit) / 100; 2146 1.1 riastrad adjustment_delta = rdev->pm.dpm.tdp_limit - *tdp_limit; 2147 1.1 riastrad if (adjustment_delta < rdev->pm.dpm.near_tdp_limit_adjusted) 2148 1.1 riastrad *near_tdp_limit = rdev->pm.dpm.near_tdp_limit_adjusted - adjustment_delta; 2149 1.1 riastrad else 2150 1.1 riastrad *near_tdp_limit = 0; 2151 1.1 riastrad } 2152 1.1 riastrad 2153 1.1 riastrad if ((*tdp_limit <= 0) || (*tdp_limit > max_tdp_limit)) 2154 1.1 riastrad return -EINVAL; 2155 1.1 riastrad if ((*near_tdp_limit <= 0) || (*near_tdp_limit > *tdp_limit)) 2156 1.1 riastrad return -EINVAL; 2157 1.1 riastrad 2158 1.1 riastrad return 0; 2159 1.1 riastrad } 2160 1.1 riastrad 2161 1.1 riastrad static int si_populate_smc_tdp_limits(struct radeon_device *rdev, 2162 1.1 riastrad struct radeon_ps *radeon_state) 2163 1.1 riastrad { 2164 1.1 riastrad struct ni_power_info *ni_pi = ni_get_pi(rdev); 2165 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 2166 1.1 riastrad 2167 1.1 riastrad if (ni_pi->enable_power_containment) { 2168 1.1 riastrad SISLANDS_SMC_STATETABLE *smc_table = &si_pi->smc_statetable; 2169 1.1 riastrad PP_SIslands_PAPMParameters *papm_parm; 2170 1.1 riastrad struct radeon_ppm_table *ppm = rdev->pm.dpm.dyn_state.ppm_table; 2171 1.1 riastrad u32 scaling_factor = si_get_smc_power_scaling_factor(rdev); 2172 1.1 riastrad u32 tdp_limit; 2173 1.1 riastrad u32 near_tdp_limit; 2174 1.1 riastrad int ret; 2175 1.1 riastrad 2176 1.1 riastrad if (scaling_factor == 0) 2177 1.1 riastrad return -EINVAL; 2178 1.1 riastrad 2179 1.1 riastrad memset(smc_table, 0, sizeof(SISLANDS_SMC_STATETABLE)); 2180 1.1 riastrad 2181 1.1 riastrad ret = si_calculate_adjusted_tdp_limits(rdev, 2182 1.1 riastrad false, /* ??? */ 2183 1.1 riastrad rdev->pm.dpm.tdp_adjustment, 2184 1.1 riastrad &tdp_limit, 2185 1.1 riastrad &near_tdp_limit); 2186 1.1 riastrad if (ret) 2187 1.1 riastrad return ret; 2188 1.1 riastrad 2189 1.1 riastrad smc_table->dpm2Params.TDPLimit = 2190 1.1 riastrad cpu_to_be32(si_scale_power_for_smc(tdp_limit, scaling_factor) * 1000); 2191 1.1 riastrad smc_table->dpm2Params.NearTDPLimit = 2192 1.1 riastrad cpu_to_be32(si_scale_power_for_smc(near_tdp_limit, scaling_factor) * 1000); 2193 1.1 riastrad smc_table->dpm2Params.SafePowerLimit = 2194 1.1 riastrad cpu_to_be32(si_scale_power_for_smc((near_tdp_limit * SISLANDS_DPM2_TDP_SAFE_LIMIT_PERCENT) / 100, scaling_factor) * 1000); 2195 1.1 riastrad 2196 1.1 riastrad ret = si_copy_bytes_to_smc(rdev, 2197 1.1 riastrad (si_pi->state_table_start + offsetof(SISLANDS_SMC_STATETABLE, dpm2Params) + 2198 1.1 riastrad offsetof(PP_SIslands_DPM2Parameters, TDPLimit)), 2199 1.1 riastrad (u8 *)(&(smc_table->dpm2Params.TDPLimit)), 2200 1.1 riastrad sizeof(u32) * 3, 2201 1.1 riastrad si_pi->sram_end); 2202 1.1 riastrad if (ret) 2203 1.1 riastrad return ret; 2204 1.1 riastrad 2205 1.1 riastrad if (si_pi->enable_ppm) { 2206 1.1 riastrad papm_parm = &si_pi->papm_parm; 2207 1.1 riastrad memset(papm_parm, 0, sizeof(PP_SIslands_PAPMParameters)); 2208 1.1 riastrad papm_parm->NearTDPLimitTherm = cpu_to_be32(ppm->dgpu_tdp); 2209 1.1 riastrad papm_parm->dGPU_T_Limit = cpu_to_be32(ppm->tj_max); 2210 1.1 riastrad papm_parm->dGPU_T_Warning = cpu_to_be32(95); 2211 1.1 riastrad papm_parm->dGPU_T_Hysteresis = cpu_to_be32(5); 2212 1.1 riastrad papm_parm->PlatformPowerLimit = 0xffffffff; 2213 1.1 riastrad papm_parm->NearTDPLimitPAPM = 0xffffffff; 2214 1.1 riastrad 2215 1.1 riastrad ret = si_copy_bytes_to_smc(rdev, si_pi->papm_cfg_table_start, 2216 1.1 riastrad (u8 *)papm_parm, 2217 1.1 riastrad sizeof(PP_SIslands_PAPMParameters), 2218 1.1 riastrad si_pi->sram_end); 2219 1.1 riastrad if (ret) 2220 1.1 riastrad return ret; 2221 1.1 riastrad } 2222 1.1 riastrad } 2223 1.1 riastrad return 0; 2224 1.1 riastrad } 2225 1.1 riastrad 2226 1.1 riastrad static int si_populate_smc_tdp_limits_2(struct radeon_device *rdev, 2227 1.1 riastrad struct radeon_ps *radeon_state) 2228 1.1 riastrad { 2229 1.1 riastrad struct ni_power_info *ni_pi = ni_get_pi(rdev); 2230 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 2231 1.1 riastrad 2232 1.1 riastrad if (ni_pi->enable_power_containment) { 2233 1.1 riastrad SISLANDS_SMC_STATETABLE *smc_table = &si_pi->smc_statetable; 2234 1.1 riastrad u32 scaling_factor = si_get_smc_power_scaling_factor(rdev); 2235 1.1 riastrad int ret; 2236 1.1 riastrad 2237 1.1 riastrad memset(smc_table, 0, sizeof(SISLANDS_SMC_STATETABLE)); 2238 1.1 riastrad 2239 1.1 riastrad smc_table->dpm2Params.NearTDPLimit = 2240 1.1 riastrad cpu_to_be32(si_scale_power_for_smc(rdev->pm.dpm.near_tdp_limit_adjusted, scaling_factor) * 1000); 2241 1.1 riastrad smc_table->dpm2Params.SafePowerLimit = 2242 1.1 riastrad cpu_to_be32(si_scale_power_for_smc((rdev->pm.dpm.near_tdp_limit_adjusted * SISLANDS_DPM2_TDP_SAFE_LIMIT_PERCENT) / 100, scaling_factor) * 1000); 2243 1.1 riastrad 2244 1.1 riastrad ret = si_copy_bytes_to_smc(rdev, 2245 1.1 riastrad (si_pi->state_table_start + 2246 1.1 riastrad offsetof(SISLANDS_SMC_STATETABLE, dpm2Params) + 2247 1.1 riastrad offsetof(PP_SIslands_DPM2Parameters, NearTDPLimit)), 2248 1.1 riastrad (u8 *)(&(smc_table->dpm2Params.NearTDPLimit)), 2249 1.1 riastrad sizeof(u32) * 2, 2250 1.1 riastrad si_pi->sram_end); 2251 1.1 riastrad if (ret) 2252 1.1 riastrad return ret; 2253 1.1 riastrad } 2254 1.1 riastrad 2255 1.1 riastrad return 0; 2256 1.1 riastrad } 2257 1.1 riastrad 2258 1.1 riastrad static u16 si_calculate_power_efficiency_ratio(struct radeon_device *rdev, 2259 1.1 riastrad const u16 prev_std_vddc, 2260 1.1 riastrad const u16 curr_std_vddc) 2261 1.1 riastrad { 2262 1.1 riastrad u64 margin = (u64)SISLANDS_DPM2_PWREFFICIENCYRATIO_MARGIN; 2263 1.1 riastrad u64 prev_vddc = (u64)prev_std_vddc; 2264 1.1 riastrad u64 curr_vddc = (u64)curr_std_vddc; 2265 1.1 riastrad u64 pwr_efficiency_ratio, n, d; 2266 1.1 riastrad 2267 1.1 riastrad if ((prev_vddc == 0) || (curr_vddc == 0)) 2268 1.1 riastrad return 0; 2269 1.1 riastrad 2270 1.1 riastrad n = div64_u64((u64)1024 * curr_vddc * curr_vddc * ((u64)1000 + margin), (u64)1000); 2271 1.1 riastrad d = prev_vddc * prev_vddc; 2272 1.1 riastrad pwr_efficiency_ratio = div64_u64(n, d); 2273 1.1 riastrad 2274 1.1 riastrad if (pwr_efficiency_ratio > (u64)0xFFFF) 2275 1.1 riastrad return 0; 2276 1.1 riastrad 2277 1.1 riastrad return (u16)pwr_efficiency_ratio; 2278 1.1 riastrad } 2279 1.1 riastrad 2280 1.1 riastrad static bool si_should_disable_uvd_powertune(struct radeon_device *rdev, 2281 1.1 riastrad struct radeon_ps *radeon_state) 2282 1.1 riastrad { 2283 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 2284 1.1 riastrad 2285 1.1 riastrad if (si_pi->dyn_powertune_data.disable_uvd_powertune && 2286 1.1 riastrad radeon_state->vclk && radeon_state->dclk) 2287 1.1 riastrad return true; 2288 1.1 riastrad 2289 1.1 riastrad return false; 2290 1.1 riastrad } 2291 1.1 riastrad 2292 1.1 riastrad static int si_populate_power_containment_values(struct radeon_device *rdev, 2293 1.1 riastrad struct radeon_ps *radeon_state, 2294 1.1 riastrad SISLANDS_SMC_SWSTATE *smc_state) 2295 1.1 riastrad { 2296 1.1 riastrad struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); 2297 1.1 riastrad struct ni_power_info *ni_pi = ni_get_pi(rdev); 2298 1.1 riastrad struct ni_ps *state = ni_get_ps(radeon_state); 2299 1.1 riastrad SISLANDS_SMC_VOLTAGE_VALUE vddc; 2300 1.1 riastrad u32 prev_sclk; 2301 1.1 riastrad u32 max_sclk; 2302 1.1 riastrad u32 min_sclk; 2303 1.1 riastrad u16 prev_std_vddc; 2304 1.1 riastrad u16 curr_std_vddc; 2305 1.1 riastrad int i; 2306 1.1 riastrad u16 pwr_efficiency_ratio; 2307 1.1 riastrad u8 max_ps_percent; 2308 1.1 riastrad bool disable_uvd_power_tune; 2309 1.1 riastrad int ret; 2310 1.1 riastrad 2311 1.1 riastrad if (ni_pi->enable_power_containment == false) 2312 1.1 riastrad return 0; 2313 1.1 riastrad 2314 1.1 riastrad if (state->performance_level_count == 0) 2315 1.1 riastrad return -EINVAL; 2316 1.1 riastrad 2317 1.1 riastrad if (smc_state->levelCount != state->performance_level_count) 2318 1.1 riastrad return -EINVAL; 2319 1.1 riastrad 2320 1.1 riastrad disable_uvd_power_tune = si_should_disable_uvd_powertune(rdev, radeon_state); 2321 1.1 riastrad 2322 1.1 riastrad smc_state->levels[0].dpm2.MaxPS = 0; 2323 1.1 riastrad smc_state->levels[0].dpm2.NearTDPDec = 0; 2324 1.1 riastrad smc_state->levels[0].dpm2.AboveSafeInc = 0; 2325 1.1 riastrad smc_state->levels[0].dpm2.BelowSafeInc = 0; 2326 1.1 riastrad smc_state->levels[0].dpm2.PwrEfficiencyRatio = 0; 2327 1.1 riastrad 2328 1.1 riastrad for (i = 1; i < state->performance_level_count; i++) { 2329 1.1 riastrad prev_sclk = state->performance_levels[i-1].sclk; 2330 1.1 riastrad max_sclk = state->performance_levels[i].sclk; 2331 1.1 riastrad if (i == 1) 2332 1.1 riastrad max_ps_percent = SISLANDS_DPM2_MAXPS_PERCENT_M; 2333 1.1 riastrad else 2334 1.1 riastrad max_ps_percent = SISLANDS_DPM2_MAXPS_PERCENT_H; 2335 1.1 riastrad 2336 1.1 riastrad if (prev_sclk > max_sclk) 2337 1.1 riastrad return -EINVAL; 2338 1.1 riastrad 2339 1.1 riastrad if ((max_ps_percent == 0) || 2340 1.1 riastrad (prev_sclk == max_sclk) || 2341 1.1 riastrad disable_uvd_power_tune) { 2342 1.1 riastrad min_sclk = max_sclk; 2343 1.1 riastrad } else if (i == 1) { 2344 1.1 riastrad min_sclk = prev_sclk; 2345 1.1 riastrad } else { 2346 1.1 riastrad min_sclk = (prev_sclk * (u32)max_ps_percent) / 100; 2347 1.1 riastrad } 2348 1.1 riastrad 2349 1.1 riastrad if (min_sclk < state->performance_levels[0].sclk) 2350 1.1 riastrad min_sclk = state->performance_levels[0].sclk; 2351 1.1 riastrad 2352 1.1 riastrad if (min_sclk == 0) 2353 1.1 riastrad return -EINVAL; 2354 1.1 riastrad 2355 1.1 riastrad ret = si_populate_voltage_value(rdev, &eg_pi->vddc_voltage_table, 2356 1.1 riastrad state->performance_levels[i-1].vddc, &vddc); 2357 1.1 riastrad if (ret) 2358 1.1 riastrad return ret; 2359 1.1 riastrad 2360 1.1 riastrad ret = si_get_std_voltage_value(rdev, &vddc, &prev_std_vddc); 2361 1.1 riastrad if (ret) 2362 1.1 riastrad return ret; 2363 1.1 riastrad 2364 1.1 riastrad ret = si_populate_voltage_value(rdev, &eg_pi->vddc_voltage_table, 2365 1.1 riastrad state->performance_levels[i].vddc, &vddc); 2366 1.1 riastrad if (ret) 2367 1.1 riastrad return ret; 2368 1.1 riastrad 2369 1.1 riastrad ret = si_get_std_voltage_value(rdev, &vddc, &curr_std_vddc); 2370 1.1 riastrad if (ret) 2371 1.1 riastrad return ret; 2372 1.1 riastrad 2373 1.1 riastrad pwr_efficiency_ratio = si_calculate_power_efficiency_ratio(rdev, 2374 1.1 riastrad prev_std_vddc, curr_std_vddc); 2375 1.1 riastrad 2376 1.1 riastrad smc_state->levels[i].dpm2.MaxPS = (u8)((SISLANDS_DPM2_MAX_PULSE_SKIP * (max_sclk - min_sclk)) / max_sclk); 2377 1.1 riastrad smc_state->levels[i].dpm2.NearTDPDec = SISLANDS_DPM2_NEAR_TDP_DEC; 2378 1.1 riastrad smc_state->levels[i].dpm2.AboveSafeInc = SISLANDS_DPM2_ABOVE_SAFE_INC; 2379 1.1 riastrad smc_state->levels[i].dpm2.BelowSafeInc = SISLANDS_DPM2_BELOW_SAFE_INC; 2380 1.1 riastrad smc_state->levels[i].dpm2.PwrEfficiencyRatio = cpu_to_be16(pwr_efficiency_ratio); 2381 1.1 riastrad } 2382 1.1 riastrad 2383 1.1 riastrad return 0; 2384 1.1 riastrad } 2385 1.1 riastrad 2386 1.1 riastrad static int si_populate_sq_ramping_values(struct radeon_device *rdev, 2387 1.1 riastrad struct radeon_ps *radeon_state, 2388 1.1 riastrad SISLANDS_SMC_SWSTATE *smc_state) 2389 1.1 riastrad { 2390 1.1 riastrad struct ni_power_info *ni_pi = ni_get_pi(rdev); 2391 1.1 riastrad struct ni_ps *state = ni_get_ps(radeon_state); 2392 1.1 riastrad u32 sq_power_throttle, sq_power_throttle2; 2393 1.1 riastrad bool enable_sq_ramping = ni_pi->enable_sq_ramping; 2394 1.1 riastrad int i; 2395 1.1 riastrad 2396 1.1 riastrad if (state->performance_level_count == 0) 2397 1.1 riastrad return -EINVAL; 2398 1.1 riastrad 2399 1.1 riastrad if (smc_state->levelCount != state->performance_level_count) 2400 1.1 riastrad return -EINVAL; 2401 1.1 riastrad 2402 1.1 riastrad if (rdev->pm.dpm.sq_ramping_threshold == 0) 2403 1.1 riastrad return -EINVAL; 2404 1.1 riastrad 2405 1.1 riastrad if (SISLANDS_DPM2_SQ_RAMP_MAX_POWER > (MAX_POWER_MASK >> MAX_POWER_SHIFT)) 2406 1.1 riastrad enable_sq_ramping = false; 2407 1.1 riastrad 2408 1.1 riastrad if (SISLANDS_DPM2_SQ_RAMP_MIN_POWER > (MIN_POWER_MASK >> MIN_POWER_SHIFT)) 2409 1.1 riastrad enable_sq_ramping = false; 2410 1.1 riastrad 2411 1.1 riastrad if (SISLANDS_DPM2_SQ_RAMP_MAX_POWER_DELTA > (MAX_POWER_DELTA_MASK >> MAX_POWER_DELTA_SHIFT)) 2412 1.1 riastrad enable_sq_ramping = false; 2413 1.1 riastrad 2414 1.1 riastrad if (SISLANDS_DPM2_SQ_RAMP_STI_SIZE > (STI_SIZE_MASK >> STI_SIZE_SHIFT)) 2415 1.1 riastrad enable_sq_ramping = false; 2416 1.1 riastrad 2417 1.1 riastrad if (SISLANDS_DPM2_SQ_RAMP_LTI_RATIO > (LTI_RATIO_MASK >> LTI_RATIO_SHIFT)) 2418 1.1 riastrad enable_sq_ramping = false; 2419 1.1 riastrad 2420 1.1 riastrad for (i = 0; i < state->performance_level_count; i++) { 2421 1.1 riastrad sq_power_throttle = 0; 2422 1.1 riastrad sq_power_throttle2 = 0; 2423 1.1 riastrad 2424 1.1 riastrad if ((state->performance_levels[i].sclk >= rdev->pm.dpm.sq_ramping_threshold) && 2425 1.1 riastrad enable_sq_ramping) { 2426 1.1 riastrad sq_power_throttle |= MAX_POWER(SISLANDS_DPM2_SQ_RAMP_MAX_POWER); 2427 1.1 riastrad sq_power_throttle |= MIN_POWER(SISLANDS_DPM2_SQ_RAMP_MIN_POWER); 2428 1.1 riastrad sq_power_throttle2 |= MAX_POWER_DELTA(SISLANDS_DPM2_SQ_RAMP_MAX_POWER_DELTA); 2429 1.1 riastrad sq_power_throttle2 |= STI_SIZE(SISLANDS_DPM2_SQ_RAMP_STI_SIZE); 2430 1.1 riastrad sq_power_throttle2 |= LTI_RATIO(SISLANDS_DPM2_SQ_RAMP_LTI_RATIO); 2431 1.1 riastrad } else { 2432 1.1 riastrad sq_power_throttle |= MAX_POWER_MASK | MIN_POWER_MASK; 2433 1.1 riastrad sq_power_throttle2 |= MAX_POWER_DELTA_MASK | STI_SIZE_MASK | LTI_RATIO_MASK; 2434 1.1 riastrad } 2435 1.1 riastrad 2436 1.1 riastrad smc_state->levels[i].SQPowerThrottle = cpu_to_be32(sq_power_throttle); 2437 1.1 riastrad smc_state->levels[i].SQPowerThrottle_2 = cpu_to_be32(sq_power_throttle2); 2438 1.1 riastrad } 2439 1.1 riastrad 2440 1.1 riastrad return 0; 2441 1.1 riastrad } 2442 1.1 riastrad 2443 1.1 riastrad static int si_enable_power_containment(struct radeon_device *rdev, 2444 1.1 riastrad struct radeon_ps *radeon_new_state, 2445 1.1 riastrad bool enable) 2446 1.1 riastrad { 2447 1.1 riastrad struct ni_power_info *ni_pi = ni_get_pi(rdev); 2448 1.1 riastrad PPSMC_Result smc_result; 2449 1.1 riastrad int ret = 0; 2450 1.1 riastrad 2451 1.1 riastrad if (ni_pi->enable_power_containment) { 2452 1.1 riastrad if (enable) { 2453 1.1 riastrad if (!si_should_disable_uvd_powertune(rdev, radeon_new_state)) { 2454 1.1 riastrad smc_result = si_send_msg_to_smc(rdev, PPSMC_TDPClampingActive); 2455 1.1 riastrad if (smc_result != PPSMC_Result_OK) { 2456 1.1 riastrad ret = -EINVAL; 2457 1.1 riastrad ni_pi->pc_enabled = false; 2458 1.1 riastrad } else { 2459 1.1 riastrad ni_pi->pc_enabled = true; 2460 1.1 riastrad } 2461 1.1 riastrad } 2462 1.1 riastrad } else { 2463 1.1 riastrad smc_result = si_send_msg_to_smc(rdev, PPSMC_TDPClampingInactive); 2464 1.1 riastrad if (smc_result != PPSMC_Result_OK) 2465 1.1 riastrad ret = -EINVAL; 2466 1.1 riastrad ni_pi->pc_enabled = false; 2467 1.1 riastrad } 2468 1.1 riastrad } 2469 1.1 riastrad 2470 1.1 riastrad return ret; 2471 1.1 riastrad } 2472 1.1 riastrad 2473 1.1 riastrad static int si_initialize_smc_dte_tables(struct radeon_device *rdev) 2474 1.1 riastrad { 2475 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 2476 1.1 riastrad int ret = 0; 2477 1.1 riastrad struct si_dte_data *dte_data = &si_pi->dte_data; 2478 1.1 riastrad Smc_SIslands_DTE_Configuration *dte_tables = NULL; 2479 1.1 riastrad u32 table_size; 2480 1.1 riastrad u8 tdep_count; 2481 1.1 riastrad u32 i; 2482 1.1 riastrad 2483 1.1 riastrad if (dte_data == NULL) 2484 1.1 riastrad si_pi->enable_dte = false; 2485 1.1 riastrad 2486 1.1 riastrad if (si_pi->enable_dte == false) 2487 1.1 riastrad return 0; 2488 1.1 riastrad 2489 1.1 riastrad if (dte_data->k <= 0) 2490 1.1 riastrad return -EINVAL; 2491 1.1 riastrad 2492 1.1 riastrad dte_tables = kzalloc(sizeof(Smc_SIslands_DTE_Configuration), GFP_KERNEL); 2493 1.1 riastrad if (dte_tables == NULL) { 2494 1.1 riastrad si_pi->enable_dte = false; 2495 1.1 riastrad return -ENOMEM; 2496 1.1 riastrad } 2497 1.1 riastrad 2498 1.1 riastrad table_size = dte_data->k; 2499 1.1 riastrad 2500 1.1 riastrad if (table_size > SMC_SISLANDS_DTE_MAX_FILTER_STAGES) 2501 1.1 riastrad table_size = SMC_SISLANDS_DTE_MAX_FILTER_STAGES; 2502 1.1 riastrad 2503 1.1 riastrad tdep_count = dte_data->tdep_count; 2504 1.1 riastrad if (tdep_count > SMC_SISLANDS_DTE_MAX_TEMPERATURE_DEPENDENT_ARRAY_SIZE) 2505 1.1 riastrad tdep_count = SMC_SISLANDS_DTE_MAX_TEMPERATURE_DEPENDENT_ARRAY_SIZE; 2506 1.1 riastrad 2507 1.1 riastrad dte_tables->K = cpu_to_be32(table_size); 2508 1.1 riastrad dte_tables->T0 = cpu_to_be32(dte_data->t0); 2509 1.1 riastrad dte_tables->MaxT = cpu_to_be32(dte_data->max_t); 2510 1.1 riastrad dte_tables->WindowSize = dte_data->window_size; 2511 1.1 riastrad dte_tables->temp_select = dte_data->temp_select; 2512 1.1 riastrad dte_tables->DTE_mode = dte_data->dte_mode; 2513 1.1 riastrad dte_tables->Tthreshold = cpu_to_be32(dte_data->t_threshold); 2514 1.1 riastrad 2515 1.1 riastrad if (tdep_count > 0) 2516 1.1 riastrad table_size--; 2517 1.1 riastrad 2518 1.1 riastrad for (i = 0; i < table_size; i++) { 2519 1.1 riastrad dte_tables->tau[i] = cpu_to_be32(dte_data->tau[i]); 2520 1.1 riastrad dte_tables->R[i] = cpu_to_be32(dte_data->r[i]); 2521 1.1 riastrad } 2522 1.1 riastrad 2523 1.1 riastrad dte_tables->Tdep_count = tdep_count; 2524 1.1 riastrad 2525 1.1 riastrad for (i = 0; i < (u32)tdep_count; i++) { 2526 1.1 riastrad dte_tables->T_limits[i] = dte_data->t_limits[i]; 2527 1.1 riastrad dte_tables->Tdep_tau[i] = cpu_to_be32(dte_data->tdep_tau[i]); 2528 1.1 riastrad dte_tables->Tdep_R[i] = cpu_to_be32(dte_data->tdep_r[i]); 2529 1.1 riastrad } 2530 1.1 riastrad 2531 1.1 riastrad ret = si_copy_bytes_to_smc(rdev, si_pi->dte_table_start, (u8 *)dte_tables, 2532 1.1 riastrad sizeof(Smc_SIslands_DTE_Configuration), si_pi->sram_end); 2533 1.1 riastrad kfree(dte_tables); 2534 1.1 riastrad 2535 1.1 riastrad return ret; 2536 1.1 riastrad } 2537 1.1 riastrad 2538 1.1 riastrad static int si_get_cac_std_voltage_max_min(struct radeon_device *rdev, 2539 1.3 riastrad u16 *max, u16 *min) 2540 1.1 riastrad { 2541 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 2542 1.1 riastrad struct radeon_cac_leakage_table *table = 2543 1.1 riastrad &rdev->pm.dpm.dyn_state.cac_leakage_table; 2544 1.1 riastrad u32 i; 2545 1.1 riastrad u32 v0_loadline; 2546 1.1 riastrad 2547 1.1 riastrad 2548 1.1 riastrad if (table == NULL) 2549 1.1 riastrad return -EINVAL; 2550 1.1 riastrad 2551 1.3 riastrad *max = 0; 2552 1.3 riastrad *min = 0xFFFF; 2553 1.1 riastrad 2554 1.1 riastrad for (i = 0; i < table->count; i++) { 2555 1.3 riastrad if (table->entries[i].vddc > *max) 2556 1.3 riastrad *max = table->entries[i].vddc; 2557 1.3 riastrad if (table->entries[i].vddc < *min) 2558 1.3 riastrad *min = table->entries[i].vddc; 2559 1.1 riastrad } 2560 1.1 riastrad 2561 1.1 riastrad if (si_pi->powertune_data->lkge_lut_v0_percent > 100) 2562 1.1 riastrad return -EINVAL; 2563 1.1 riastrad 2564 1.3 riastrad v0_loadline = (*min) * (100 - si_pi->powertune_data->lkge_lut_v0_percent) / 100; 2565 1.1 riastrad 2566 1.1 riastrad if (v0_loadline > 0xFFFFUL) 2567 1.1 riastrad return -EINVAL; 2568 1.1 riastrad 2569 1.3 riastrad *min = (u16)v0_loadline; 2570 1.1 riastrad 2571 1.3 riastrad if ((*min > *max) || (*max == 0) || (*min == 0)) 2572 1.1 riastrad return -EINVAL; 2573 1.1 riastrad 2574 1.1 riastrad return 0; 2575 1.1 riastrad } 2576 1.1 riastrad 2577 1.3 riastrad static u16 si_get_cac_std_voltage_step(u16 max, u16 min) 2578 1.1 riastrad { 2579 1.3 riastrad return ((max - min) + (SMC_SISLANDS_LKGE_LUT_NUM_OF_VOLT_ENTRIES - 1)) / 2580 1.1 riastrad SMC_SISLANDS_LKGE_LUT_NUM_OF_VOLT_ENTRIES; 2581 1.1 riastrad } 2582 1.1 riastrad 2583 1.1 riastrad static int si_init_dte_leakage_table(struct radeon_device *rdev, 2584 1.1 riastrad PP_SIslands_CacConfig *cac_tables, 2585 1.1 riastrad u16 vddc_max, u16 vddc_min, u16 vddc_step, 2586 1.1 riastrad u16 t0, u16 t_step) 2587 1.1 riastrad { 2588 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 2589 1.1 riastrad u32 leakage; 2590 1.1 riastrad unsigned int i, j; 2591 1.1 riastrad s32 t; 2592 1.1 riastrad u32 smc_leakage; 2593 1.1 riastrad u32 scaling_factor; 2594 1.1 riastrad u16 voltage; 2595 1.1 riastrad 2596 1.1 riastrad scaling_factor = si_get_smc_power_scaling_factor(rdev); 2597 1.1 riastrad 2598 1.1 riastrad for (i = 0; i < SMC_SISLANDS_LKGE_LUT_NUM_OF_TEMP_ENTRIES ; i++) { 2599 1.1 riastrad t = (1000 * (i * t_step + t0)); 2600 1.1 riastrad 2601 1.1 riastrad for (j = 0; j < SMC_SISLANDS_LKGE_LUT_NUM_OF_VOLT_ENTRIES; j++) { 2602 1.1 riastrad voltage = vddc_max - (vddc_step * j); 2603 1.1 riastrad 2604 1.1 riastrad si_calculate_leakage_for_v_and_t(rdev, 2605 1.1 riastrad &si_pi->powertune_data->leakage_coefficients, 2606 1.1 riastrad voltage, 2607 1.1 riastrad t, 2608 1.1 riastrad si_pi->dyn_powertune_data.cac_leakage, 2609 1.1 riastrad &leakage); 2610 1.1 riastrad 2611 1.1 riastrad smc_leakage = si_scale_power_for_smc(leakage, scaling_factor) / 4; 2612 1.1 riastrad 2613 1.1 riastrad if (smc_leakage > 0xFFFF) 2614 1.1 riastrad smc_leakage = 0xFFFF; 2615 1.1 riastrad 2616 1.1 riastrad cac_tables->cac_lkge_lut[i][SMC_SISLANDS_LKGE_LUT_NUM_OF_VOLT_ENTRIES-1-j] = 2617 1.1 riastrad cpu_to_be16((u16)smc_leakage); 2618 1.1 riastrad } 2619 1.1 riastrad } 2620 1.1 riastrad return 0; 2621 1.1 riastrad } 2622 1.1 riastrad 2623 1.1 riastrad static int si_init_simplified_leakage_table(struct radeon_device *rdev, 2624 1.1 riastrad PP_SIslands_CacConfig *cac_tables, 2625 1.1 riastrad u16 vddc_max, u16 vddc_min, u16 vddc_step) 2626 1.1 riastrad { 2627 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 2628 1.1 riastrad u32 leakage; 2629 1.1 riastrad unsigned int i, j; 2630 1.1 riastrad u32 smc_leakage; 2631 1.1 riastrad u32 scaling_factor; 2632 1.1 riastrad u16 voltage; 2633 1.1 riastrad 2634 1.1 riastrad scaling_factor = si_get_smc_power_scaling_factor(rdev); 2635 1.1 riastrad 2636 1.1 riastrad for (j = 0; j < SMC_SISLANDS_LKGE_LUT_NUM_OF_VOLT_ENTRIES; j++) { 2637 1.1 riastrad voltage = vddc_max - (vddc_step * j); 2638 1.1 riastrad 2639 1.1 riastrad si_calculate_leakage_for_v(rdev, 2640 1.1 riastrad &si_pi->powertune_data->leakage_coefficients, 2641 1.1 riastrad si_pi->powertune_data->fixed_kt, 2642 1.1 riastrad voltage, 2643 1.1 riastrad si_pi->dyn_powertune_data.cac_leakage, 2644 1.1 riastrad &leakage); 2645 1.1 riastrad 2646 1.1 riastrad smc_leakage = si_scale_power_for_smc(leakage, scaling_factor) / 4; 2647 1.1 riastrad 2648 1.1 riastrad if (smc_leakage > 0xFFFF) 2649 1.1 riastrad smc_leakage = 0xFFFF; 2650 1.1 riastrad 2651 1.1 riastrad for (i = 0; i < SMC_SISLANDS_LKGE_LUT_NUM_OF_TEMP_ENTRIES ; i++) 2652 1.1 riastrad cac_tables->cac_lkge_lut[i][SMC_SISLANDS_LKGE_LUT_NUM_OF_VOLT_ENTRIES-1-j] = 2653 1.1 riastrad cpu_to_be16((u16)smc_leakage); 2654 1.1 riastrad } 2655 1.1 riastrad return 0; 2656 1.1 riastrad } 2657 1.1 riastrad 2658 1.1 riastrad static int si_initialize_smc_cac_tables(struct radeon_device *rdev) 2659 1.1 riastrad { 2660 1.1 riastrad struct ni_power_info *ni_pi = ni_get_pi(rdev); 2661 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 2662 1.1 riastrad PP_SIslands_CacConfig *cac_tables = NULL; 2663 1.1 riastrad u16 vddc_max, vddc_min, vddc_step; 2664 1.1 riastrad u16 t0, t_step; 2665 1.1 riastrad u32 load_line_slope, reg; 2666 1.1 riastrad int ret = 0; 2667 1.1 riastrad u32 ticks_per_us = radeon_get_xclk(rdev) / 100; 2668 1.1 riastrad 2669 1.1 riastrad if (ni_pi->enable_cac == false) 2670 1.1 riastrad return 0; 2671 1.1 riastrad 2672 1.1 riastrad cac_tables = kzalloc(sizeof(PP_SIslands_CacConfig), GFP_KERNEL); 2673 1.1 riastrad if (!cac_tables) 2674 1.1 riastrad return -ENOMEM; 2675 1.1 riastrad 2676 1.1 riastrad reg = RREG32(CG_CAC_CTRL) & ~CAC_WINDOW_MASK; 2677 1.1 riastrad reg |= CAC_WINDOW(si_pi->powertune_data->cac_window); 2678 1.1 riastrad WREG32(CG_CAC_CTRL, reg); 2679 1.1 riastrad 2680 1.1 riastrad si_pi->dyn_powertune_data.cac_leakage = rdev->pm.dpm.cac_leakage; 2681 1.1 riastrad si_pi->dyn_powertune_data.dc_pwr_value = 2682 1.1 riastrad si_pi->powertune_data->dc_cac[NISLANDS_DCCAC_LEVEL_0]; 2683 1.1 riastrad si_pi->dyn_powertune_data.wintime = si_calculate_cac_wintime(rdev); 2684 1.1 riastrad si_pi->dyn_powertune_data.shift_n = si_pi->powertune_data->shift_n_default; 2685 1.1 riastrad 2686 1.1 riastrad si_pi->dyn_powertune_data.leakage_minimum_temperature = 80 * 1000; 2687 1.1 riastrad 2688 1.1 riastrad ret = si_get_cac_std_voltage_max_min(rdev, &vddc_max, &vddc_min); 2689 1.1 riastrad if (ret) 2690 1.1 riastrad goto done_free; 2691 1.1 riastrad 2692 1.1 riastrad vddc_step = si_get_cac_std_voltage_step(vddc_max, vddc_min); 2693 1.1 riastrad vddc_min = vddc_max - (vddc_step * (SMC_SISLANDS_LKGE_LUT_NUM_OF_VOLT_ENTRIES - 1)); 2694 1.1 riastrad t_step = 4; 2695 1.1 riastrad t0 = 60; 2696 1.1 riastrad 2697 1.1 riastrad if (si_pi->enable_dte || ni_pi->driver_calculate_cac_leakage) 2698 1.1 riastrad ret = si_init_dte_leakage_table(rdev, cac_tables, 2699 1.1 riastrad vddc_max, vddc_min, vddc_step, 2700 1.1 riastrad t0, t_step); 2701 1.1 riastrad else 2702 1.1 riastrad ret = si_init_simplified_leakage_table(rdev, cac_tables, 2703 1.1 riastrad vddc_max, vddc_min, vddc_step); 2704 1.1 riastrad if (ret) 2705 1.1 riastrad goto done_free; 2706 1.1 riastrad 2707 1.1 riastrad load_line_slope = ((u32)rdev->pm.dpm.load_line_slope << SMC_SISLANDS_SCALE_R) / 100; 2708 1.1 riastrad 2709 1.1 riastrad cac_tables->l2numWin_TDP = cpu_to_be32(si_pi->dyn_powertune_data.l2_lta_window_size); 2710 1.1 riastrad cac_tables->lts_truncate_n = si_pi->dyn_powertune_data.lts_truncate; 2711 1.1 riastrad cac_tables->SHIFT_N = si_pi->dyn_powertune_data.shift_n; 2712 1.1 riastrad cac_tables->lkge_lut_V0 = cpu_to_be32((u32)vddc_min); 2713 1.1 riastrad cac_tables->lkge_lut_Vstep = cpu_to_be32((u32)vddc_step); 2714 1.1 riastrad cac_tables->R_LL = cpu_to_be32(load_line_slope); 2715 1.1 riastrad cac_tables->WinTime = cpu_to_be32(si_pi->dyn_powertune_data.wintime); 2716 1.1 riastrad cac_tables->calculation_repeats = cpu_to_be32(2); 2717 1.1 riastrad cac_tables->dc_cac = cpu_to_be32(0); 2718 1.1 riastrad cac_tables->log2_PG_LKG_SCALE = 12; 2719 1.1 riastrad cac_tables->cac_temp = si_pi->powertune_data->operating_temp; 2720 1.1 riastrad cac_tables->lkge_lut_T0 = cpu_to_be32((u32)t0); 2721 1.1 riastrad cac_tables->lkge_lut_Tstep = cpu_to_be32((u32)t_step); 2722 1.1 riastrad 2723 1.1 riastrad ret = si_copy_bytes_to_smc(rdev, si_pi->cac_table_start, (u8 *)cac_tables, 2724 1.1 riastrad sizeof(PP_SIslands_CacConfig), si_pi->sram_end); 2725 1.1 riastrad 2726 1.1 riastrad if (ret) 2727 1.1 riastrad goto done_free; 2728 1.1 riastrad 2729 1.1 riastrad ret = si_write_smc_soft_register(rdev, SI_SMC_SOFT_REGISTER_ticks_per_us, ticks_per_us); 2730 1.1 riastrad 2731 1.1 riastrad done_free: 2732 1.1 riastrad if (ret) { 2733 1.1 riastrad ni_pi->enable_cac = false; 2734 1.1 riastrad ni_pi->enable_power_containment = false; 2735 1.1 riastrad } 2736 1.1 riastrad 2737 1.1 riastrad kfree(cac_tables); 2738 1.1 riastrad 2739 1.1 riastrad return 0; 2740 1.1 riastrad } 2741 1.1 riastrad 2742 1.1 riastrad static int si_program_cac_config_registers(struct radeon_device *rdev, 2743 1.1 riastrad const struct si_cac_config_reg *cac_config_regs) 2744 1.1 riastrad { 2745 1.1 riastrad const struct si_cac_config_reg *config_regs = cac_config_regs; 2746 1.1 riastrad u32 data = 0, offset; 2747 1.1 riastrad 2748 1.1 riastrad if (!config_regs) 2749 1.1 riastrad return -EINVAL; 2750 1.1 riastrad 2751 1.1 riastrad while (config_regs->offset != 0xFFFFFFFF) { 2752 1.1 riastrad switch (config_regs->type) { 2753 1.1 riastrad case SISLANDS_CACCONFIG_CGIND: 2754 1.1 riastrad offset = SMC_CG_IND_START + config_regs->offset; 2755 1.1 riastrad if (offset < SMC_CG_IND_END) 2756 1.1 riastrad data = RREG32_SMC(offset); 2757 1.1 riastrad break; 2758 1.1 riastrad default: 2759 1.1 riastrad data = RREG32(config_regs->offset << 2); 2760 1.1 riastrad break; 2761 1.1 riastrad } 2762 1.1 riastrad 2763 1.1 riastrad data &= ~config_regs->mask; 2764 1.1 riastrad data |= ((config_regs->value << config_regs->shift) & config_regs->mask); 2765 1.1 riastrad 2766 1.1 riastrad switch (config_regs->type) { 2767 1.1 riastrad case SISLANDS_CACCONFIG_CGIND: 2768 1.1 riastrad offset = SMC_CG_IND_START + config_regs->offset; 2769 1.1 riastrad if (offset < SMC_CG_IND_END) 2770 1.1 riastrad WREG32_SMC(offset, data); 2771 1.1 riastrad break; 2772 1.1 riastrad default: 2773 1.1 riastrad WREG32(config_regs->offset << 2, data); 2774 1.1 riastrad break; 2775 1.1 riastrad } 2776 1.1 riastrad config_regs++; 2777 1.1 riastrad } 2778 1.1 riastrad return 0; 2779 1.1 riastrad } 2780 1.1 riastrad 2781 1.1 riastrad static int si_initialize_hardware_cac_manager(struct radeon_device *rdev) 2782 1.1 riastrad { 2783 1.1 riastrad struct ni_power_info *ni_pi = ni_get_pi(rdev); 2784 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 2785 1.1 riastrad int ret; 2786 1.1 riastrad 2787 1.1 riastrad if ((ni_pi->enable_cac == false) || 2788 1.1 riastrad (ni_pi->cac_configuration_required == false)) 2789 1.1 riastrad return 0; 2790 1.1 riastrad 2791 1.1 riastrad ret = si_program_cac_config_registers(rdev, si_pi->lcac_config); 2792 1.1 riastrad if (ret) 2793 1.1 riastrad return ret; 2794 1.1 riastrad ret = si_program_cac_config_registers(rdev, si_pi->cac_override); 2795 1.1 riastrad if (ret) 2796 1.1 riastrad return ret; 2797 1.1 riastrad ret = si_program_cac_config_registers(rdev, si_pi->cac_weights); 2798 1.1 riastrad if (ret) 2799 1.1 riastrad return ret; 2800 1.1 riastrad 2801 1.1 riastrad return 0; 2802 1.1 riastrad } 2803 1.1 riastrad 2804 1.1 riastrad static int si_enable_smc_cac(struct radeon_device *rdev, 2805 1.1 riastrad struct radeon_ps *radeon_new_state, 2806 1.1 riastrad bool enable) 2807 1.1 riastrad { 2808 1.1 riastrad struct ni_power_info *ni_pi = ni_get_pi(rdev); 2809 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 2810 1.1 riastrad PPSMC_Result smc_result; 2811 1.1 riastrad int ret = 0; 2812 1.1 riastrad 2813 1.1 riastrad if (ni_pi->enable_cac) { 2814 1.1 riastrad if (enable) { 2815 1.1 riastrad if (!si_should_disable_uvd_powertune(rdev, radeon_new_state)) { 2816 1.1 riastrad if (ni_pi->support_cac_long_term_average) { 2817 1.1 riastrad smc_result = si_send_msg_to_smc(rdev, PPSMC_CACLongTermAvgEnable); 2818 1.1 riastrad if (smc_result != PPSMC_Result_OK) 2819 1.1 riastrad ni_pi->support_cac_long_term_average = false; 2820 1.1 riastrad } 2821 1.1 riastrad 2822 1.1 riastrad smc_result = si_send_msg_to_smc(rdev, PPSMC_MSG_EnableCac); 2823 1.1 riastrad if (smc_result != PPSMC_Result_OK) { 2824 1.1 riastrad ret = -EINVAL; 2825 1.1 riastrad ni_pi->cac_enabled = false; 2826 1.1 riastrad } else { 2827 1.1 riastrad ni_pi->cac_enabled = true; 2828 1.1 riastrad } 2829 1.1 riastrad 2830 1.1 riastrad if (si_pi->enable_dte) { 2831 1.1 riastrad smc_result = si_send_msg_to_smc(rdev, PPSMC_MSG_EnableDTE); 2832 1.1 riastrad if (smc_result != PPSMC_Result_OK) 2833 1.1 riastrad ret = -EINVAL; 2834 1.1 riastrad } 2835 1.1 riastrad } 2836 1.1 riastrad } else if (ni_pi->cac_enabled) { 2837 1.1 riastrad if (si_pi->enable_dte) 2838 1.1 riastrad smc_result = si_send_msg_to_smc(rdev, PPSMC_MSG_DisableDTE); 2839 1.1 riastrad 2840 1.1 riastrad smc_result = si_send_msg_to_smc(rdev, PPSMC_MSG_DisableCac); 2841 1.1 riastrad 2842 1.1 riastrad ni_pi->cac_enabled = false; 2843 1.1 riastrad 2844 1.1 riastrad if (ni_pi->support_cac_long_term_average) 2845 1.1 riastrad smc_result = si_send_msg_to_smc(rdev, PPSMC_CACLongTermAvgDisable); 2846 1.1 riastrad } 2847 1.1 riastrad } 2848 1.1 riastrad return ret; 2849 1.1 riastrad } 2850 1.1 riastrad 2851 1.1 riastrad static int si_init_smc_spll_table(struct radeon_device *rdev) 2852 1.1 riastrad { 2853 1.1 riastrad struct ni_power_info *ni_pi = ni_get_pi(rdev); 2854 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 2855 1.1 riastrad SMC_SISLANDS_SPLL_DIV_TABLE *spll_table; 2856 1.1 riastrad SISLANDS_SMC_SCLK_VALUE sclk_params; 2857 1.1 riastrad u32 fb_div, p_div; 2858 1.1 riastrad u32 clk_s, clk_v; 2859 1.1 riastrad u32 sclk = 0; 2860 1.1 riastrad int ret = 0; 2861 1.1 riastrad u32 tmp; 2862 1.1 riastrad int i; 2863 1.1 riastrad 2864 1.1 riastrad if (si_pi->spll_table_start == 0) 2865 1.1 riastrad return -EINVAL; 2866 1.1 riastrad 2867 1.1 riastrad spll_table = kzalloc(sizeof(SMC_SISLANDS_SPLL_DIV_TABLE), GFP_KERNEL); 2868 1.1 riastrad if (spll_table == NULL) 2869 1.1 riastrad return -ENOMEM; 2870 1.1 riastrad 2871 1.1 riastrad for (i = 0; i < 256; i++) { 2872 1.1 riastrad ret = si_calculate_sclk_params(rdev, sclk, &sclk_params); 2873 1.1 riastrad if (ret) 2874 1.1 riastrad break; 2875 1.1 riastrad 2876 1.1 riastrad p_div = (sclk_params.vCG_SPLL_FUNC_CNTL & SPLL_PDIV_A_MASK) >> SPLL_PDIV_A_SHIFT; 2877 1.1 riastrad fb_div = (sclk_params.vCG_SPLL_FUNC_CNTL_3 & SPLL_FB_DIV_MASK) >> SPLL_FB_DIV_SHIFT; 2878 1.1 riastrad clk_s = (sclk_params.vCG_SPLL_SPREAD_SPECTRUM & CLK_S_MASK) >> CLK_S_SHIFT; 2879 1.1 riastrad clk_v = (sclk_params.vCG_SPLL_SPREAD_SPECTRUM_2 & CLK_V_MASK) >> CLK_V_SHIFT; 2880 1.1 riastrad 2881 1.1 riastrad fb_div &= ~0x00001FFF; 2882 1.1 riastrad fb_div >>= 1; 2883 1.1 riastrad clk_v >>= 6; 2884 1.1 riastrad 2885 1.1 riastrad if (p_div & ~(SMC_SISLANDS_SPLL_DIV_TABLE_PDIV_MASK >> SMC_SISLANDS_SPLL_DIV_TABLE_PDIV_SHIFT)) 2886 1.1 riastrad ret = -EINVAL; 2887 1.1 riastrad if (fb_div & ~(SMC_SISLANDS_SPLL_DIV_TABLE_FBDIV_MASK >> SMC_SISLANDS_SPLL_DIV_TABLE_FBDIV_SHIFT)) 2888 1.1 riastrad ret = -EINVAL; 2889 1.1 riastrad if (clk_s & ~(SMC_SISLANDS_SPLL_DIV_TABLE_CLKS_MASK >> SMC_SISLANDS_SPLL_DIV_TABLE_CLKS_SHIFT)) 2890 1.1 riastrad ret = -EINVAL; 2891 1.1 riastrad if (clk_v & ~(SMC_SISLANDS_SPLL_DIV_TABLE_CLKV_MASK >> SMC_SISLANDS_SPLL_DIV_TABLE_CLKV_SHIFT)) 2892 1.1 riastrad ret = -EINVAL; 2893 1.1 riastrad 2894 1.1 riastrad if (ret) 2895 1.1 riastrad break; 2896 1.1 riastrad 2897 1.1 riastrad tmp = ((fb_div << SMC_SISLANDS_SPLL_DIV_TABLE_FBDIV_SHIFT) & SMC_SISLANDS_SPLL_DIV_TABLE_FBDIV_MASK) | 2898 1.1 riastrad ((p_div << SMC_SISLANDS_SPLL_DIV_TABLE_PDIV_SHIFT) & SMC_SISLANDS_SPLL_DIV_TABLE_PDIV_MASK); 2899 1.1 riastrad spll_table->freq[i] = cpu_to_be32(tmp); 2900 1.1 riastrad 2901 1.1 riastrad tmp = ((clk_v << SMC_SISLANDS_SPLL_DIV_TABLE_CLKV_SHIFT) & SMC_SISLANDS_SPLL_DIV_TABLE_CLKV_MASK) | 2902 1.1 riastrad ((clk_s << SMC_SISLANDS_SPLL_DIV_TABLE_CLKS_SHIFT) & SMC_SISLANDS_SPLL_DIV_TABLE_CLKS_MASK); 2903 1.1 riastrad spll_table->ss[i] = cpu_to_be32(tmp); 2904 1.1 riastrad 2905 1.1 riastrad sclk += 512; 2906 1.1 riastrad } 2907 1.1 riastrad 2908 1.1 riastrad 2909 1.1 riastrad if (!ret) 2910 1.1 riastrad ret = si_copy_bytes_to_smc(rdev, si_pi->spll_table_start, 2911 1.1 riastrad (u8 *)spll_table, sizeof(SMC_SISLANDS_SPLL_DIV_TABLE), 2912 1.1 riastrad si_pi->sram_end); 2913 1.1 riastrad 2914 1.1 riastrad if (ret) 2915 1.1 riastrad ni_pi->enable_power_containment = false; 2916 1.1 riastrad 2917 1.1 riastrad kfree(spll_table); 2918 1.1 riastrad 2919 1.1 riastrad return ret; 2920 1.1 riastrad } 2921 1.1 riastrad 2922 1.1 riastrad static u16 si_get_lower_of_leakage_and_vce_voltage(struct radeon_device *rdev, 2923 1.1 riastrad u16 vce_voltage) 2924 1.1 riastrad { 2925 1.1 riastrad u16 highest_leakage = 0; 2926 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 2927 1.1 riastrad int i; 2928 1.1 riastrad 2929 1.1 riastrad for (i = 0; i < si_pi->leakage_voltage.count; i++){ 2930 1.1 riastrad if (highest_leakage < si_pi->leakage_voltage.entries[i].voltage) 2931 1.1 riastrad highest_leakage = si_pi->leakage_voltage.entries[i].voltage; 2932 1.1 riastrad } 2933 1.1 riastrad 2934 1.1 riastrad if (si_pi->leakage_voltage.count && (highest_leakage < vce_voltage)) 2935 1.1 riastrad return highest_leakage; 2936 1.1 riastrad 2937 1.1 riastrad return vce_voltage; 2938 1.1 riastrad } 2939 1.1 riastrad 2940 1.1 riastrad static int si_get_vce_clock_voltage(struct radeon_device *rdev, 2941 1.1 riastrad u32 evclk, u32 ecclk, u16 *voltage) 2942 1.1 riastrad { 2943 1.1 riastrad u32 i; 2944 1.1 riastrad int ret = -EINVAL; 2945 1.1 riastrad struct radeon_vce_clock_voltage_dependency_table *table = 2946 1.1 riastrad &rdev->pm.dpm.dyn_state.vce_clock_voltage_dependency_table; 2947 1.1 riastrad 2948 1.1 riastrad if (((evclk == 0) && (ecclk == 0)) || 2949 1.1 riastrad (table && (table->count == 0))) { 2950 1.1 riastrad *voltage = 0; 2951 1.1 riastrad return 0; 2952 1.1 riastrad } 2953 1.1 riastrad 2954 1.1 riastrad for (i = 0; i < table->count; i++) { 2955 1.1 riastrad if ((evclk <= table->entries[i].evclk) && 2956 1.1 riastrad (ecclk <= table->entries[i].ecclk)) { 2957 1.1 riastrad *voltage = table->entries[i].v; 2958 1.1 riastrad ret = 0; 2959 1.1 riastrad break; 2960 1.1 riastrad } 2961 1.1 riastrad } 2962 1.1 riastrad 2963 1.1 riastrad /* if no match return the highest voltage */ 2964 1.1 riastrad if (ret) 2965 1.1 riastrad *voltage = table->entries[table->count - 1].v; 2966 1.1 riastrad 2967 1.1 riastrad *voltage = si_get_lower_of_leakage_and_vce_voltage(rdev, *voltage); 2968 1.1 riastrad 2969 1.1 riastrad return ret; 2970 1.1 riastrad } 2971 1.1 riastrad 2972 1.1 riastrad static void si_apply_state_adjust_rules(struct radeon_device *rdev, 2973 1.1 riastrad struct radeon_ps *rps) 2974 1.1 riastrad { 2975 1.1 riastrad struct ni_ps *ps = ni_get_ps(rps); 2976 1.1 riastrad struct radeon_clock_and_voltage_limits *max_limits; 2977 1.1 riastrad bool disable_mclk_switching = false; 2978 1.1 riastrad bool disable_sclk_switching = false; 2979 1.1 riastrad u32 mclk, sclk; 2980 1.1 riastrad u16 vddc, vddci, min_vce_voltage = 0; 2981 1.1 riastrad u32 max_sclk_vddc, max_mclk_vddci, max_mclk_vddc; 2982 1.1 riastrad u32 max_sclk = 0, max_mclk = 0; 2983 1.1 riastrad int i; 2984 1.1 riastrad 2985 1.5 riastrad if (rdev->family == CHIP_HAINAN) { 2986 1.1 riastrad if ((rdev->pdev->revision == 0x81) || 2987 1.1 riastrad (rdev->pdev->revision == 0x83) || 2988 1.1 riastrad (rdev->pdev->revision == 0xC3) || 2989 1.1 riastrad (rdev->pdev->device == 0x6664) || 2990 1.1 riastrad (rdev->pdev->device == 0x6665) || 2991 1.1 riastrad (rdev->pdev->device == 0x6667)) { 2992 1.1 riastrad max_sclk = 75000; 2993 1.5 riastrad } 2994 1.5 riastrad if ((rdev->pdev->revision == 0xC3) || 2995 1.5 riastrad (rdev->pdev->device == 0x6665)) { 2996 1.5 riastrad max_sclk = 60000; 2997 1.1 riastrad max_mclk = 80000; 2998 1.1 riastrad } 2999 1.1 riastrad } else if (rdev->family == CHIP_OLAND) { 3000 1.1 riastrad if ((rdev->pdev->revision == 0xC7) || 3001 1.1 riastrad (rdev->pdev->revision == 0x80) || 3002 1.1 riastrad (rdev->pdev->revision == 0x81) || 3003 1.1 riastrad (rdev->pdev->revision == 0x83) || 3004 1.1 riastrad (rdev->pdev->revision == 0x87) || 3005 1.1 riastrad (rdev->pdev->device == 0x6604) || 3006 1.1 riastrad (rdev->pdev->device == 0x6605)) { 3007 1.1 riastrad max_sclk = 75000; 3008 1.1 riastrad } 3009 1.1 riastrad } 3010 1.1 riastrad 3011 1.1 riastrad if (rps->vce_active) { 3012 1.1 riastrad rps->evclk = rdev->pm.dpm.vce_states[rdev->pm.dpm.vce_level].evclk; 3013 1.1 riastrad rps->ecclk = rdev->pm.dpm.vce_states[rdev->pm.dpm.vce_level].ecclk; 3014 1.1 riastrad si_get_vce_clock_voltage(rdev, rps->evclk, rps->ecclk, 3015 1.1 riastrad &min_vce_voltage); 3016 1.1 riastrad } else { 3017 1.1 riastrad rps->evclk = 0; 3018 1.1 riastrad rps->ecclk = 0; 3019 1.1 riastrad } 3020 1.1 riastrad 3021 1.1 riastrad if ((rdev->pm.dpm.new_active_crtc_count > 1) || 3022 1.1 riastrad ni_dpm_vblank_too_short(rdev)) 3023 1.1 riastrad disable_mclk_switching = true; 3024 1.1 riastrad 3025 1.1 riastrad if (rps->vclk || rps->dclk) { 3026 1.1 riastrad disable_mclk_switching = true; 3027 1.1 riastrad disable_sclk_switching = true; 3028 1.1 riastrad } 3029 1.1 riastrad 3030 1.1 riastrad if (rdev->pm.dpm.ac_power) 3031 1.1 riastrad max_limits = &rdev->pm.dpm.dyn_state.max_clock_voltage_on_ac; 3032 1.1 riastrad else 3033 1.1 riastrad max_limits = &rdev->pm.dpm.dyn_state.max_clock_voltage_on_dc; 3034 1.1 riastrad 3035 1.1 riastrad for (i = ps->performance_level_count - 2; i >= 0; i--) { 3036 1.1 riastrad if (ps->performance_levels[i].vddc > ps->performance_levels[i+1].vddc) 3037 1.1 riastrad ps->performance_levels[i].vddc = ps->performance_levels[i+1].vddc; 3038 1.1 riastrad } 3039 1.1 riastrad if (rdev->pm.dpm.ac_power == false) { 3040 1.1 riastrad for (i = 0; i < ps->performance_level_count; i++) { 3041 1.1 riastrad if (ps->performance_levels[i].mclk > max_limits->mclk) 3042 1.1 riastrad ps->performance_levels[i].mclk = max_limits->mclk; 3043 1.1 riastrad if (ps->performance_levels[i].sclk > max_limits->sclk) 3044 1.1 riastrad ps->performance_levels[i].sclk = max_limits->sclk; 3045 1.1 riastrad if (ps->performance_levels[i].vddc > max_limits->vddc) 3046 1.1 riastrad ps->performance_levels[i].vddc = max_limits->vddc; 3047 1.1 riastrad if (ps->performance_levels[i].vddci > max_limits->vddci) 3048 1.1 riastrad ps->performance_levels[i].vddci = max_limits->vddci; 3049 1.1 riastrad } 3050 1.1 riastrad } 3051 1.1 riastrad 3052 1.1 riastrad /* limit clocks to max supported clocks based on voltage dependency tables */ 3053 1.1 riastrad btc_get_max_clock_from_voltage_dependency_table(&rdev->pm.dpm.dyn_state.vddc_dependency_on_sclk, 3054 1.1 riastrad &max_sclk_vddc); 3055 1.1 riastrad btc_get_max_clock_from_voltage_dependency_table(&rdev->pm.dpm.dyn_state.vddci_dependency_on_mclk, 3056 1.1 riastrad &max_mclk_vddci); 3057 1.1 riastrad btc_get_max_clock_from_voltage_dependency_table(&rdev->pm.dpm.dyn_state.vddc_dependency_on_mclk, 3058 1.1 riastrad &max_mclk_vddc); 3059 1.1 riastrad 3060 1.1 riastrad for (i = 0; i < ps->performance_level_count; i++) { 3061 1.1 riastrad if (max_sclk_vddc) { 3062 1.1 riastrad if (ps->performance_levels[i].sclk > max_sclk_vddc) 3063 1.1 riastrad ps->performance_levels[i].sclk = max_sclk_vddc; 3064 1.1 riastrad } 3065 1.1 riastrad if (max_mclk_vddci) { 3066 1.1 riastrad if (ps->performance_levels[i].mclk > max_mclk_vddci) 3067 1.1 riastrad ps->performance_levels[i].mclk = max_mclk_vddci; 3068 1.1 riastrad } 3069 1.1 riastrad if (max_mclk_vddc) { 3070 1.1 riastrad if (ps->performance_levels[i].mclk > max_mclk_vddc) 3071 1.1 riastrad ps->performance_levels[i].mclk = max_mclk_vddc; 3072 1.1 riastrad } 3073 1.1 riastrad if (max_mclk) { 3074 1.1 riastrad if (ps->performance_levels[i].mclk > max_mclk) 3075 1.1 riastrad ps->performance_levels[i].mclk = max_mclk; 3076 1.1 riastrad } 3077 1.1 riastrad if (max_sclk) { 3078 1.1 riastrad if (ps->performance_levels[i].sclk > max_sclk) 3079 1.1 riastrad ps->performance_levels[i].sclk = max_sclk; 3080 1.1 riastrad } 3081 1.1 riastrad } 3082 1.1 riastrad 3083 1.1 riastrad /* XXX validate the min clocks required for display */ 3084 1.1 riastrad 3085 1.1 riastrad if (disable_mclk_switching) { 3086 1.1 riastrad mclk = ps->performance_levels[ps->performance_level_count - 1].mclk; 3087 1.1 riastrad vddci = ps->performance_levels[ps->performance_level_count - 1].vddci; 3088 1.1 riastrad } else { 3089 1.1 riastrad mclk = ps->performance_levels[0].mclk; 3090 1.1 riastrad vddci = ps->performance_levels[0].vddci; 3091 1.1 riastrad } 3092 1.1 riastrad 3093 1.1 riastrad if (disable_sclk_switching) { 3094 1.1 riastrad sclk = ps->performance_levels[ps->performance_level_count - 1].sclk; 3095 1.1 riastrad vddc = ps->performance_levels[ps->performance_level_count - 1].vddc; 3096 1.1 riastrad } else { 3097 1.1 riastrad sclk = ps->performance_levels[0].sclk; 3098 1.1 riastrad vddc = ps->performance_levels[0].vddc; 3099 1.1 riastrad } 3100 1.1 riastrad 3101 1.1 riastrad if (rps->vce_active) { 3102 1.1 riastrad if (sclk < rdev->pm.dpm.vce_states[rdev->pm.dpm.vce_level].sclk) 3103 1.1 riastrad sclk = rdev->pm.dpm.vce_states[rdev->pm.dpm.vce_level].sclk; 3104 1.1 riastrad if (mclk < rdev->pm.dpm.vce_states[rdev->pm.dpm.vce_level].mclk) 3105 1.1 riastrad mclk = rdev->pm.dpm.vce_states[rdev->pm.dpm.vce_level].mclk; 3106 1.1 riastrad } 3107 1.1 riastrad 3108 1.1 riastrad /* adjusted low state */ 3109 1.1 riastrad ps->performance_levels[0].sclk = sclk; 3110 1.1 riastrad ps->performance_levels[0].mclk = mclk; 3111 1.1 riastrad ps->performance_levels[0].vddc = vddc; 3112 1.1 riastrad ps->performance_levels[0].vddci = vddci; 3113 1.1 riastrad 3114 1.1 riastrad if (disable_sclk_switching) { 3115 1.1 riastrad sclk = ps->performance_levels[0].sclk; 3116 1.1 riastrad for (i = 1; i < ps->performance_level_count; i++) { 3117 1.1 riastrad if (sclk < ps->performance_levels[i].sclk) 3118 1.1 riastrad sclk = ps->performance_levels[i].sclk; 3119 1.1 riastrad } 3120 1.1 riastrad for (i = 0; i < ps->performance_level_count; i++) { 3121 1.1 riastrad ps->performance_levels[i].sclk = sclk; 3122 1.1 riastrad ps->performance_levels[i].vddc = vddc; 3123 1.1 riastrad } 3124 1.1 riastrad } else { 3125 1.1 riastrad for (i = 1; i < ps->performance_level_count; i++) { 3126 1.1 riastrad if (ps->performance_levels[i].sclk < ps->performance_levels[i - 1].sclk) 3127 1.1 riastrad ps->performance_levels[i].sclk = ps->performance_levels[i - 1].sclk; 3128 1.1 riastrad if (ps->performance_levels[i].vddc < ps->performance_levels[i - 1].vddc) 3129 1.1 riastrad ps->performance_levels[i].vddc = ps->performance_levels[i - 1].vddc; 3130 1.1 riastrad } 3131 1.1 riastrad } 3132 1.1 riastrad 3133 1.1 riastrad if (disable_mclk_switching) { 3134 1.1 riastrad mclk = ps->performance_levels[0].mclk; 3135 1.1 riastrad for (i = 1; i < ps->performance_level_count; i++) { 3136 1.1 riastrad if (mclk < ps->performance_levels[i].mclk) 3137 1.1 riastrad mclk = ps->performance_levels[i].mclk; 3138 1.1 riastrad } 3139 1.1 riastrad for (i = 0; i < ps->performance_level_count; i++) { 3140 1.1 riastrad ps->performance_levels[i].mclk = mclk; 3141 1.1 riastrad ps->performance_levels[i].vddci = vddci; 3142 1.1 riastrad } 3143 1.1 riastrad } else { 3144 1.1 riastrad for (i = 1; i < ps->performance_level_count; i++) { 3145 1.1 riastrad if (ps->performance_levels[i].mclk < ps->performance_levels[i - 1].mclk) 3146 1.1 riastrad ps->performance_levels[i].mclk = ps->performance_levels[i - 1].mclk; 3147 1.1 riastrad if (ps->performance_levels[i].vddci < ps->performance_levels[i - 1].vddci) 3148 1.1 riastrad ps->performance_levels[i].vddci = ps->performance_levels[i - 1].vddci; 3149 1.1 riastrad } 3150 1.1 riastrad } 3151 1.1 riastrad 3152 1.5 riastrad for (i = 0; i < ps->performance_level_count; i++) 3153 1.5 riastrad btc_adjust_clock_combinations(rdev, max_limits, 3154 1.5 riastrad &ps->performance_levels[i]); 3155 1.1 riastrad 3156 1.1 riastrad for (i = 0; i < ps->performance_level_count; i++) { 3157 1.1 riastrad if (ps->performance_levels[i].vddc < min_vce_voltage) 3158 1.1 riastrad ps->performance_levels[i].vddc = min_vce_voltage; 3159 1.1 riastrad btc_apply_voltage_dependency_rules(&rdev->pm.dpm.dyn_state.vddc_dependency_on_sclk, 3160 1.1 riastrad ps->performance_levels[i].sclk, 3161 1.1 riastrad max_limits->vddc, &ps->performance_levels[i].vddc); 3162 1.1 riastrad btc_apply_voltage_dependency_rules(&rdev->pm.dpm.dyn_state.vddci_dependency_on_mclk, 3163 1.1 riastrad ps->performance_levels[i].mclk, 3164 1.1 riastrad max_limits->vddci, &ps->performance_levels[i].vddci); 3165 1.1 riastrad btc_apply_voltage_dependency_rules(&rdev->pm.dpm.dyn_state.vddc_dependency_on_mclk, 3166 1.1 riastrad ps->performance_levels[i].mclk, 3167 1.1 riastrad max_limits->vddc, &ps->performance_levels[i].vddc); 3168 1.1 riastrad btc_apply_voltage_dependency_rules(&rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk, 3169 1.1 riastrad rdev->clock.current_dispclk, 3170 1.1 riastrad max_limits->vddc, &ps->performance_levels[i].vddc); 3171 1.1 riastrad } 3172 1.1 riastrad 3173 1.1 riastrad for (i = 0; i < ps->performance_level_count; i++) { 3174 1.1 riastrad btc_apply_voltage_delta_rules(rdev, 3175 1.1 riastrad max_limits->vddc, max_limits->vddci, 3176 1.1 riastrad &ps->performance_levels[i].vddc, 3177 1.1 riastrad &ps->performance_levels[i].vddci); 3178 1.1 riastrad } 3179 1.1 riastrad 3180 1.1 riastrad ps->dc_compatible = true; 3181 1.1 riastrad for (i = 0; i < ps->performance_level_count; i++) { 3182 1.1 riastrad if (ps->performance_levels[i].vddc > rdev->pm.dpm.dyn_state.max_clock_voltage_on_dc.vddc) 3183 1.1 riastrad ps->dc_compatible = false; 3184 1.1 riastrad } 3185 1.1 riastrad } 3186 1.1 riastrad 3187 1.1 riastrad #if 0 3188 1.1 riastrad static int si_read_smc_soft_register(struct radeon_device *rdev, 3189 1.1 riastrad u16 reg_offset, u32 *value) 3190 1.1 riastrad { 3191 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 3192 1.1 riastrad 3193 1.1 riastrad return si_read_smc_sram_dword(rdev, 3194 1.1 riastrad si_pi->soft_regs_start + reg_offset, value, 3195 1.1 riastrad si_pi->sram_end); 3196 1.1 riastrad } 3197 1.1 riastrad #endif 3198 1.1 riastrad 3199 1.1 riastrad static int si_write_smc_soft_register(struct radeon_device *rdev, 3200 1.1 riastrad u16 reg_offset, u32 value) 3201 1.1 riastrad { 3202 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 3203 1.1 riastrad 3204 1.1 riastrad return si_write_smc_sram_dword(rdev, 3205 1.1 riastrad si_pi->soft_regs_start + reg_offset, 3206 1.1 riastrad value, si_pi->sram_end); 3207 1.1 riastrad } 3208 1.1 riastrad 3209 1.1 riastrad static bool si_is_special_1gb_platform(struct radeon_device *rdev) 3210 1.1 riastrad { 3211 1.1 riastrad bool ret = false; 3212 1.1 riastrad u32 tmp, width, row, column, bank, density; 3213 1.1 riastrad bool is_memory_gddr5, is_special; 3214 1.1 riastrad 3215 1.1 riastrad tmp = RREG32(MC_SEQ_MISC0); 3216 1.1 riastrad is_memory_gddr5 = (MC_SEQ_MISC0_GDDR5_VALUE == ((tmp & MC_SEQ_MISC0_GDDR5_MASK) >> MC_SEQ_MISC0_GDDR5_SHIFT)); 3217 1.1 riastrad is_special = (MC_SEQ_MISC0_REV_ID_VALUE == ((tmp & MC_SEQ_MISC0_REV_ID_MASK) >> MC_SEQ_MISC0_REV_ID_SHIFT)) 3218 1.1 riastrad & (MC_SEQ_MISC0_VEN_ID_VALUE == ((tmp & MC_SEQ_MISC0_VEN_ID_MASK) >> MC_SEQ_MISC0_VEN_ID_SHIFT)); 3219 1.1 riastrad 3220 1.1 riastrad WREG32(MC_SEQ_IO_DEBUG_INDEX, 0xb); 3221 1.1 riastrad width = ((RREG32(MC_SEQ_IO_DEBUG_DATA) >> 1) & 1) ? 16 : 32; 3222 1.1 riastrad 3223 1.1 riastrad tmp = RREG32(MC_ARB_RAMCFG); 3224 1.1 riastrad row = ((tmp & NOOFROWS_MASK) >> NOOFROWS_SHIFT) + 10; 3225 1.1 riastrad column = ((tmp & NOOFCOLS_MASK) >> NOOFCOLS_SHIFT) + 8; 3226 1.1 riastrad bank = ((tmp & NOOFBANK_MASK) >> NOOFBANK_SHIFT) + 2; 3227 1.1 riastrad 3228 1.1 riastrad density = (1 << (row + column - 20 + bank)) * width; 3229 1.1 riastrad 3230 1.1 riastrad if ((rdev->pdev->device == 0x6819) && 3231 1.1 riastrad is_memory_gddr5 && is_special && (density == 0x400)) 3232 1.1 riastrad ret = true; 3233 1.1 riastrad 3234 1.1 riastrad return ret; 3235 1.1 riastrad } 3236 1.1 riastrad 3237 1.1 riastrad static void si_get_leakage_vddc(struct radeon_device *rdev) 3238 1.1 riastrad { 3239 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 3240 1.1 riastrad u16 vddc, count = 0; 3241 1.1 riastrad int i, ret; 3242 1.1 riastrad 3243 1.1 riastrad for (i = 0; i < SISLANDS_MAX_LEAKAGE_COUNT; i++) { 3244 1.1 riastrad ret = radeon_atom_get_leakage_vddc_based_on_leakage_idx(rdev, &vddc, SISLANDS_LEAKAGE_INDEX0 + i); 3245 1.1 riastrad 3246 1.1 riastrad if (!ret && (vddc > 0) && (vddc != (SISLANDS_LEAKAGE_INDEX0 + i))) { 3247 1.1 riastrad si_pi->leakage_voltage.entries[count].voltage = vddc; 3248 1.1 riastrad si_pi->leakage_voltage.entries[count].leakage_index = 3249 1.1 riastrad SISLANDS_LEAKAGE_INDEX0 + i; 3250 1.1 riastrad count++; 3251 1.1 riastrad } 3252 1.1 riastrad } 3253 1.1 riastrad si_pi->leakage_voltage.count = count; 3254 1.1 riastrad } 3255 1.1 riastrad 3256 1.1 riastrad static int si_get_leakage_voltage_from_leakage_index(struct radeon_device *rdev, 3257 1.1 riastrad u32 index, u16 *leakage_voltage) 3258 1.1 riastrad { 3259 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 3260 1.1 riastrad int i; 3261 1.1 riastrad 3262 1.1 riastrad if (leakage_voltage == NULL) 3263 1.1 riastrad return -EINVAL; 3264 1.1 riastrad 3265 1.1 riastrad if ((index & 0xff00) != 0xff00) 3266 1.1 riastrad return -EINVAL; 3267 1.1 riastrad 3268 1.1 riastrad if ((index & 0xff) > SISLANDS_MAX_LEAKAGE_COUNT + 1) 3269 1.1 riastrad return -EINVAL; 3270 1.1 riastrad 3271 1.1 riastrad if (index < SISLANDS_LEAKAGE_INDEX0) 3272 1.1 riastrad return -EINVAL; 3273 1.1 riastrad 3274 1.1 riastrad for (i = 0; i < si_pi->leakage_voltage.count; i++) { 3275 1.1 riastrad if (si_pi->leakage_voltage.entries[i].leakage_index == index) { 3276 1.1 riastrad *leakage_voltage = si_pi->leakage_voltage.entries[i].voltage; 3277 1.1 riastrad return 0; 3278 1.1 riastrad } 3279 1.1 riastrad } 3280 1.1 riastrad return -EAGAIN; 3281 1.1 riastrad } 3282 1.1 riastrad 3283 1.1 riastrad static void si_set_dpm_event_sources(struct radeon_device *rdev, u32 sources) 3284 1.1 riastrad { 3285 1.1 riastrad struct rv7xx_power_info *pi = rv770_get_pi(rdev); 3286 1.1 riastrad bool want_thermal_protection; 3287 1.1 riastrad enum radeon_dpm_event_src dpm_event_src; 3288 1.1 riastrad 3289 1.1 riastrad switch (sources) { 3290 1.1 riastrad case 0: 3291 1.1 riastrad default: 3292 1.1 riastrad want_thermal_protection = false; 3293 1.5 riastrad break; 3294 1.1 riastrad case (1 << RADEON_DPM_AUTO_THROTTLE_SRC_THERMAL): 3295 1.1 riastrad want_thermal_protection = true; 3296 1.1 riastrad dpm_event_src = RADEON_DPM_EVENT_SRC_DIGITAL; 3297 1.1 riastrad break; 3298 1.1 riastrad case (1 << RADEON_DPM_AUTO_THROTTLE_SRC_EXTERNAL): 3299 1.1 riastrad want_thermal_protection = true; 3300 1.1 riastrad dpm_event_src = RADEON_DPM_EVENT_SRC_EXTERNAL; 3301 1.1 riastrad break; 3302 1.1 riastrad case ((1 << RADEON_DPM_AUTO_THROTTLE_SRC_EXTERNAL) | 3303 1.1 riastrad (1 << RADEON_DPM_AUTO_THROTTLE_SRC_THERMAL)): 3304 1.1 riastrad want_thermal_protection = true; 3305 1.1 riastrad dpm_event_src = RADEON_DPM_EVENT_SRC_DIGIAL_OR_EXTERNAL; 3306 1.1 riastrad break; 3307 1.1 riastrad } 3308 1.1 riastrad 3309 1.1 riastrad if (want_thermal_protection) { 3310 1.1 riastrad WREG32_P(CG_THERMAL_CTRL, DPM_EVENT_SRC(dpm_event_src), ~DPM_EVENT_SRC_MASK); 3311 1.1 riastrad if (pi->thermal_protection) 3312 1.1 riastrad WREG32_P(GENERAL_PWRMGT, 0, ~THERMAL_PROTECTION_DIS); 3313 1.1 riastrad } else { 3314 1.1 riastrad WREG32_P(GENERAL_PWRMGT, THERMAL_PROTECTION_DIS, ~THERMAL_PROTECTION_DIS); 3315 1.1 riastrad } 3316 1.1 riastrad } 3317 1.1 riastrad 3318 1.1 riastrad static void si_enable_auto_throttle_source(struct radeon_device *rdev, 3319 1.1 riastrad enum radeon_dpm_auto_throttle_src source, 3320 1.1 riastrad bool enable) 3321 1.1 riastrad { 3322 1.1 riastrad struct rv7xx_power_info *pi = rv770_get_pi(rdev); 3323 1.1 riastrad 3324 1.1 riastrad if (enable) { 3325 1.1 riastrad if (!(pi->active_auto_throttle_sources & (1 << source))) { 3326 1.1 riastrad pi->active_auto_throttle_sources |= 1 << source; 3327 1.1 riastrad si_set_dpm_event_sources(rdev, pi->active_auto_throttle_sources); 3328 1.1 riastrad } 3329 1.1 riastrad } else { 3330 1.1 riastrad if (pi->active_auto_throttle_sources & (1 << source)) { 3331 1.1 riastrad pi->active_auto_throttle_sources &= ~(1 << source); 3332 1.1 riastrad si_set_dpm_event_sources(rdev, pi->active_auto_throttle_sources); 3333 1.1 riastrad } 3334 1.1 riastrad } 3335 1.1 riastrad } 3336 1.1 riastrad 3337 1.1 riastrad static void si_start_dpm(struct radeon_device *rdev) 3338 1.1 riastrad { 3339 1.1 riastrad WREG32_P(GENERAL_PWRMGT, GLOBAL_PWRMGT_EN, ~GLOBAL_PWRMGT_EN); 3340 1.1 riastrad } 3341 1.1 riastrad 3342 1.1 riastrad static void si_stop_dpm(struct radeon_device *rdev) 3343 1.1 riastrad { 3344 1.1 riastrad WREG32_P(GENERAL_PWRMGT, 0, ~GLOBAL_PWRMGT_EN); 3345 1.1 riastrad } 3346 1.1 riastrad 3347 1.1 riastrad static void si_enable_sclk_control(struct radeon_device *rdev, bool enable) 3348 1.1 riastrad { 3349 1.1 riastrad if (enable) 3350 1.1 riastrad WREG32_P(SCLK_PWRMGT_CNTL, 0, ~SCLK_PWRMGT_OFF); 3351 1.1 riastrad else 3352 1.1 riastrad WREG32_P(SCLK_PWRMGT_CNTL, SCLK_PWRMGT_OFF, ~SCLK_PWRMGT_OFF); 3353 1.1 riastrad 3354 1.1 riastrad } 3355 1.1 riastrad 3356 1.1 riastrad #if 0 3357 1.1 riastrad static int si_notify_hardware_of_thermal_state(struct radeon_device *rdev, 3358 1.1 riastrad u32 thermal_level) 3359 1.1 riastrad { 3360 1.1 riastrad PPSMC_Result ret; 3361 1.1 riastrad 3362 1.1 riastrad if (thermal_level == 0) { 3363 1.1 riastrad ret = si_send_msg_to_smc(rdev, PPSMC_MSG_EnableThermalInterrupt); 3364 1.1 riastrad if (ret == PPSMC_Result_OK) 3365 1.1 riastrad return 0; 3366 1.1 riastrad else 3367 1.1 riastrad return -EINVAL; 3368 1.1 riastrad } 3369 1.1 riastrad return 0; 3370 1.1 riastrad } 3371 1.1 riastrad 3372 1.1 riastrad static void si_notify_hardware_vpu_recovery_event(struct radeon_device *rdev) 3373 1.1 riastrad { 3374 1.1 riastrad si_write_smc_soft_register(rdev, SI_SMC_SOFT_REGISTER_tdr_is_about_to_happen, true); 3375 1.1 riastrad } 3376 1.1 riastrad #endif 3377 1.1 riastrad 3378 1.1 riastrad #if 0 3379 1.1 riastrad static int si_notify_hw_of_powersource(struct radeon_device *rdev, bool ac_power) 3380 1.1 riastrad { 3381 1.1 riastrad if (ac_power) 3382 1.1 riastrad return (si_send_msg_to_smc(rdev, PPSMC_MSG_RunningOnAC) == PPSMC_Result_OK) ? 3383 1.1 riastrad 0 : -EINVAL; 3384 1.1 riastrad 3385 1.1 riastrad return 0; 3386 1.1 riastrad } 3387 1.1 riastrad #endif 3388 1.1 riastrad 3389 1.1 riastrad static PPSMC_Result si_send_msg_to_smc_with_parameter(struct radeon_device *rdev, 3390 1.1 riastrad PPSMC_Msg msg, u32 parameter) 3391 1.1 riastrad { 3392 1.1 riastrad WREG32(SMC_SCRATCH0, parameter); 3393 1.1 riastrad return si_send_msg_to_smc(rdev, msg); 3394 1.1 riastrad } 3395 1.1 riastrad 3396 1.1 riastrad static int si_restrict_performance_levels_before_switch(struct radeon_device *rdev) 3397 1.1 riastrad { 3398 1.1 riastrad if (si_send_msg_to_smc(rdev, PPSMC_MSG_NoForcedLevel) != PPSMC_Result_OK) 3399 1.1 riastrad return -EINVAL; 3400 1.1 riastrad 3401 1.1 riastrad return (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetEnabledLevels, 1) == PPSMC_Result_OK) ? 3402 1.1 riastrad 0 : -EINVAL; 3403 1.1 riastrad } 3404 1.1 riastrad 3405 1.1 riastrad int si_dpm_force_performance_level(struct radeon_device *rdev, 3406 1.1 riastrad enum radeon_dpm_forced_level level) 3407 1.1 riastrad { 3408 1.1 riastrad struct radeon_ps *rps = rdev->pm.dpm.current_ps; 3409 1.1 riastrad struct ni_ps *ps = ni_get_ps(rps); 3410 1.1 riastrad u32 levels = ps->performance_level_count; 3411 1.1 riastrad 3412 1.1 riastrad if (level == RADEON_DPM_FORCED_LEVEL_HIGH) { 3413 1.1 riastrad if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetEnabledLevels, levels) != PPSMC_Result_OK) 3414 1.1 riastrad return -EINVAL; 3415 1.1 riastrad 3416 1.1 riastrad if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetForcedLevels, 1) != PPSMC_Result_OK) 3417 1.1 riastrad return -EINVAL; 3418 1.1 riastrad } else if (level == RADEON_DPM_FORCED_LEVEL_LOW) { 3419 1.1 riastrad if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetForcedLevels, 0) != PPSMC_Result_OK) 3420 1.1 riastrad return -EINVAL; 3421 1.1 riastrad 3422 1.1 riastrad if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetEnabledLevels, 1) != PPSMC_Result_OK) 3423 1.1 riastrad return -EINVAL; 3424 1.1 riastrad } else if (level == RADEON_DPM_FORCED_LEVEL_AUTO) { 3425 1.1 riastrad if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetForcedLevels, 0) != PPSMC_Result_OK) 3426 1.1 riastrad return -EINVAL; 3427 1.1 riastrad 3428 1.1 riastrad if (si_send_msg_to_smc_with_parameter(rdev, PPSMC_MSG_SetEnabledLevels, levels) != PPSMC_Result_OK) 3429 1.1 riastrad return -EINVAL; 3430 1.1 riastrad } 3431 1.1 riastrad 3432 1.1 riastrad rdev->pm.dpm.forced_level = level; 3433 1.1 riastrad 3434 1.1 riastrad return 0; 3435 1.1 riastrad } 3436 1.1 riastrad 3437 1.1 riastrad #if 0 3438 1.1 riastrad static int si_set_boot_state(struct radeon_device *rdev) 3439 1.1 riastrad { 3440 1.1 riastrad return (si_send_msg_to_smc(rdev, PPSMC_MSG_SwitchToInitialState) == PPSMC_Result_OK) ? 3441 1.1 riastrad 0 : -EINVAL; 3442 1.1 riastrad } 3443 1.1 riastrad #endif 3444 1.1 riastrad 3445 1.1 riastrad static int si_set_sw_state(struct radeon_device *rdev) 3446 1.1 riastrad { 3447 1.1 riastrad return (si_send_msg_to_smc(rdev, PPSMC_MSG_SwitchToSwState) == PPSMC_Result_OK) ? 3448 1.1 riastrad 0 : -EINVAL; 3449 1.1 riastrad } 3450 1.1 riastrad 3451 1.1 riastrad static int si_halt_smc(struct radeon_device *rdev) 3452 1.1 riastrad { 3453 1.1 riastrad if (si_send_msg_to_smc(rdev, PPSMC_MSG_Halt) != PPSMC_Result_OK) 3454 1.1 riastrad return -EINVAL; 3455 1.1 riastrad 3456 1.1 riastrad return (si_wait_for_smc_inactive(rdev) == PPSMC_Result_OK) ? 3457 1.1 riastrad 0 : -EINVAL; 3458 1.1 riastrad } 3459 1.1 riastrad 3460 1.1 riastrad static int si_resume_smc(struct radeon_device *rdev) 3461 1.1 riastrad { 3462 1.1 riastrad if (si_send_msg_to_smc(rdev, PPSMC_FlushDataCache) != PPSMC_Result_OK) 3463 1.1 riastrad return -EINVAL; 3464 1.1 riastrad 3465 1.1 riastrad return (si_send_msg_to_smc(rdev, PPSMC_MSG_Resume) == PPSMC_Result_OK) ? 3466 1.1 riastrad 0 : -EINVAL; 3467 1.1 riastrad } 3468 1.1 riastrad 3469 1.1 riastrad static void si_dpm_start_smc(struct radeon_device *rdev) 3470 1.1 riastrad { 3471 1.1 riastrad si_program_jump_on_start(rdev); 3472 1.1 riastrad si_start_smc(rdev); 3473 1.1 riastrad si_start_smc_clock(rdev); 3474 1.1 riastrad } 3475 1.1 riastrad 3476 1.1 riastrad static void si_dpm_stop_smc(struct radeon_device *rdev) 3477 1.1 riastrad { 3478 1.1 riastrad si_reset_smc(rdev); 3479 1.1 riastrad si_stop_smc_clock(rdev); 3480 1.1 riastrad } 3481 1.1 riastrad 3482 1.1 riastrad static int si_process_firmware_header(struct radeon_device *rdev) 3483 1.1 riastrad { 3484 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 3485 1.1 riastrad u32 tmp; 3486 1.1 riastrad int ret; 3487 1.1 riastrad 3488 1.1 riastrad ret = si_read_smc_sram_dword(rdev, 3489 1.1 riastrad SISLANDS_SMC_FIRMWARE_HEADER_LOCATION + 3490 1.1 riastrad SISLANDS_SMC_FIRMWARE_HEADER_stateTable, 3491 1.1 riastrad &tmp, si_pi->sram_end); 3492 1.1 riastrad if (ret) 3493 1.1 riastrad return ret; 3494 1.1 riastrad 3495 1.5 riastrad si_pi->state_table_start = tmp; 3496 1.1 riastrad 3497 1.1 riastrad ret = si_read_smc_sram_dword(rdev, 3498 1.1 riastrad SISLANDS_SMC_FIRMWARE_HEADER_LOCATION + 3499 1.1 riastrad SISLANDS_SMC_FIRMWARE_HEADER_softRegisters, 3500 1.1 riastrad &tmp, si_pi->sram_end); 3501 1.1 riastrad if (ret) 3502 1.1 riastrad return ret; 3503 1.1 riastrad 3504 1.1 riastrad si_pi->soft_regs_start = tmp; 3505 1.1 riastrad 3506 1.1 riastrad ret = si_read_smc_sram_dword(rdev, 3507 1.1 riastrad SISLANDS_SMC_FIRMWARE_HEADER_LOCATION + 3508 1.1 riastrad SISLANDS_SMC_FIRMWARE_HEADER_mcRegisterTable, 3509 1.1 riastrad &tmp, si_pi->sram_end); 3510 1.1 riastrad if (ret) 3511 1.1 riastrad return ret; 3512 1.1 riastrad 3513 1.1 riastrad si_pi->mc_reg_table_start = tmp; 3514 1.1 riastrad 3515 1.1 riastrad ret = si_read_smc_sram_dword(rdev, 3516 1.1 riastrad SISLANDS_SMC_FIRMWARE_HEADER_LOCATION + 3517 1.1 riastrad SISLANDS_SMC_FIRMWARE_HEADER_fanTable, 3518 1.1 riastrad &tmp, si_pi->sram_end); 3519 1.1 riastrad if (ret) 3520 1.1 riastrad return ret; 3521 1.1 riastrad 3522 1.1 riastrad si_pi->fan_table_start = tmp; 3523 1.1 riastrad 3524 1.1 riastrad ret = si_read_smc_sram_dword(rdev, 3525 1.1 riastrad SISLANDS_SMC_FIRMWARE_HEADER_LOCATION + 3526 1.1 riastrad SISLANDS_SMC_FIRMWARE_HEADER_mcArbDramAutoRefreshTable, 3527 1.1 riastrad &tmp, si_pi->sram_end); 3528 1.1 riastrad if (ret) 3529 1.1 riastrad return ret; 3530 1.1 riastrad 3531 1.1 riastrad si_pi->arb_table_start = tmp; 3532 1.1 riastrad 3533 1.1 riastrad ret = si_read_smc_sram_dword(rdev, 3534 1.1 riastrad SISLANDS_SMC_FIRMWARE_HEADER_LOCATION + 3535 1.1 riastrad SISLANDS_SMC_FIRMWARE_HEADER_CacConfigTable, 3536 1.1 riastrad &tmp, si_pi->sram_end); 3537 1.1 riastrad if (ret) 3538 1.1 riastrad return ret; 3539 1.1 riastrad 3540 1.1 riastrad si_pi->cac_table_start = tmp; 3541 1.1 riastrad 3542 1.1 riastrad ret = si_read_smc_sram_dword(rdev, 3543 1.1 riastrad SISLANDS_SMC_FIRMWARE_HEADER_LOCATION + 3544 1.1 riastrad SISLANDS_SMC_FIRMWARE_HEADER_DteConfiguration, 3545 1.1 riastrad &tmp, si_pi->sram_end); 3546 1.1 riastrad if (ret) 3547 1.1 riastrad return ret; 3548 1.1 riastrad 3549 1.1 riastrad si_pi->dte_table_start = tmp; 3550 1.1 riastrad 3551 1.1 riastrad ret = si_read_smc_sram_dword(rdev, 3552 1.1 riastrad SISLANDS_SMC_FIRMWARE_HEADER_LOCATION + 3553 1.1 riastrad SISLANDS_SMC_FIRMWARE_HEADER_spllTable, 3554 1.1 riastrad &tmp, si_pi->sram_end); 3555 1.1 riastrad if (ret) 3556 1.1 riastrad return ret; 3557 1.1 riastrad 3558 1.1 riastrad si_pi->spll_table_start = tmp; 3559 1.1 riastrad 3560 1.1 riastrad ret = si_read_smc_sram_dword(rdev, 3561 1.1 riastrad SISLANDS_SMC_FIRMWARE_HEADER_LOCATION + 3562 1.1 riastrad SISLANDS_SMC_FIRMWARE_HEADER_PAPMParameters, 3563 1.1 riastrad &tmp, si_pi->sram_end); 3564 1.1 riastrad if (ret) 3565 1.1 riastrad return ret; 3566 1.1 riastrad 3567 1.1 riastrad si_pi->papm_cfg_table_start = tmp; 3568 1.1 riastrad 3569 1.1 riastrad return ret; 3570 1.1 riastrad } 3571 1.1 riastrad 3572 1.1 riastrad static void si_read_clock_registers(struct radeon_device *rdev) 3573 1.1 riastrad { 3574 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 3575 1.1 riastrad 3576 1.1 riastrad si_pi->clock_registers.cg_spll_func_cntl = RREG32(CG_SPLL_FUNC_CNTL); 3577 1.1 riastrad si_pi->clock_registers.cg_spll_func_cntl_2 = RREG32(CG_SPLL_FUNC_CNTL_2); 3578 1.1 riastrad si_pi->clock_registers.cg_spll_func_cntl_3 = RREG32(CG_SPLL_FUNC_CNTL_3); 3579 1.1 riastrad si_pi->clock_registers.cg_spll_func_cntl_4 = RREG32(CG_SPLL_FUNC_CNTL_4); 3580 1.1 riastrad si_pi->clock_registers.cg_spll_spread_spectrum = RREG32(CG_SPLL_SPREAD_SPECTRUM); 3581 1.1 riastrad si_pi->clock_registers.cg_spll_spread_spectrum_2 = RREG32(CG_SPLL_SPREAD_SPECTRUM_2); 3582 1.1 riastrad si_pi->clock_registers.dll_cntl = RREG32(DLL_CNTL); 3583 1.1 riastrad si_pi->clock_registers.mclk_pwrmgt_cntl = RREG32(MCLK_PWRMGT_CNTL); 3584 1.1 riastrad si_pi->clock_registers.mpll_ad_func_cntl = RREG32(MPLL_AD_FUNC_CNTL); 3585 1.1 riastrad si_pi->clock_registers.mpll_dq_func_cntl = RREG32(MPLL_DQ_FUNC_CNTL); 3586 1.1 riastrad si_pi->clock_registers.mpll_func_cntl = RREG32(MPLL_FUNC_CNTL); 3587 1.1 riastrad si_pi->clock_registers.mpll_func_cntl_1 = RREG32(MPLL_FUNC_CNTL_1); 3588 1.1 riastrad si_pi->clock_registers.mpll_func_cntl_2 = RREG32(MPLL_FUNC_CNTL_2); 3589 1.1 riastrad si_pi->clock_registers.mpll_ss1 = RREG32(MPLL_SS1); 3590 1.1 riastrad si_pi->clock_registers.mpll_ss2 = RREG32(MPLL_SS2); 3591 1.1 riastrad } 3592 1.1 riastrad 3593 1.1 riastrad static void si_enable_thermal_protection(struct radeon_device *rdev, 3594 1.1 riastrad bool enable) 3595 1.1 riastrad { 3596 1.1 riastrad if (enable) 3597 1.1 riastrad WREG32_P(GENERAL_PWRMGT, 0, ~THERMAL_PROTECTION_DIS); 3598 1.1 riastrad else 3599 1.1 riastrad WREG32_P(GENERAL_PWRMGT, THERMAL_PROTECTION_DIS, ~THERMAL_PROTECTION_DIS); 3600 1.1 riastrad } 3601 1.1 riastrad 3602 1.1 riastrad static void si_enable_acpi_power_management(struct radeon_device *rdev) 3603 1.1 riastrad { 3604 1.1 riastrad WREG32_P(GENERAL_PWRMGT, STATIC_PM_EN, ~STATIC_PM_EN); 3605 1.1 riastrad } 3606 1.1 riastrad 3607 1.1 riastrad #if 0 3608 1.1 riastrad static int si_enter_ulp_state(struct radeon_device *rdev) 3609 1.1 riastrad { 3610 1.1 riastrad WREG32(SMC_MESSAGE_0, PPSMC_MSG_SwitchToMinimumPower); 3611 1.1 riastrad 3612 1.1 riastrad udelay(25000); 3613 1.1 riastrad 3614 1.1 riastrad return 0; 3615 1.1 riastrad } 3616 1.1 riastrad 3617 1.1 riastrad static int si_exit_ulp_state(struct radeon_device *rdev) 3618 1.1 riastrad { 3619 1.1 riastrad int i; 3620 1.1 riastrad 3621 1.1 riastrad WREG32(SMC_MESSAGE_0, PPSMC_MSG_ResumeFromMinimumPower); 3622 1.1 riastrad 3623 1.1 riastrad udelay(7000); 3624 1.1 riastrad 3625 1.1 riastrad for (i = 0; i < rdev->usec_timeout; i++) { 3626 1.1 riastrad if (RREG32(SMC_RESP_0) == 1) 3627 1.1 riastrad break; 3628 1.1 riastrad udelay(1000); 3629 1.1 riastrad } 3630 1.1 riastrad 3631 1.1 riastrad return 0; 3632 1.1 riastrad } 3633 1.1 riastrad #endif 3634 1.1 riastrad 3635 1.1 riastrad static int si_notify_smc_display_change(struct radeon_device *rdev, 3636 1.1 riastrad bool has_display) 3637 1.1 riastrad { 3638 1.1 riastrad PPSMC_Msg msg = has_display ? 3639 1.1 riastrad PPSMC_MSG_HasDisplay : PPSMC_MSG_NoDisplay; 3640 1.1 riastrad 3641 1.1 riastrad return (si_send_msg_to_smc(rdev, msg) == PPSMC_Result_OK) ? 3642 1.1 riastrad 0 : -EINVAL; 3643 1.1 riastrad } 3644 1.1 riastrad 3645 1.1 riastrad static void si_program_response_times(struct radeon_device *rdev) 3646 1.1 riastrad { 3647 1.5 riastrad u32 voltage_response_time, acpi_delay_time, vbi_time_out; 3648 1.1 riastrad u32 vddc_dly, acpi_dly, vbi_dly; 3649 1.1 riastrad u32 reference_clock; 3650 1.1 riastrad 3651 1.1 riastrad si_write_smc_soft_register(rdev, SI_SMC_SOFT_REGISTER_mvdd_chg_time, 1); 3652 1.1 riastrad 3653 1.1 riastrad voltage_response_time = (u32)rdev->pm.dpm.voltage_response_time; 3654 1.1 riastrad 3655 1.1 riastrad if (voltage_response_time == 0) 3656 1.1 riastrad voltage_response_time = 1000; 3657 1.1 riastrad 3658 1.1 riastrad acpi_delay_time = 15000; 3659 1.1 riastrad vbi_time_out = 100000; 3660 1.1 riastrad 3661 1.1 riastrad reference_clock = radeon_get_xclk(rdev); 3662 1.1 riastrad 3663 1.1 riastrad vddc_dly = (voltage_response_time * reference_clock) / 100; 3664 1.1 riastrad acpi_dly = (acpi_delay_time * reference_clock) / 100; 3665 1.1 riastrad vbi_dly = (vbi_time_out * reference_clock) / 100; 3666 1.1 riastrad 3667 1.1 riastrad si_write_smc_soft_register(rdev, SI_SMC_SOFT_REGISTER_delay_vreg, vddc_dly); 3668 1.1 riastrad si_write_smc_soft_register(rdev, SI_SMC_SOFT_REGISTER_delay_acpi, acpi_dly); 3669 1.1 riastrad si_write_smc_soft_register(rdev, SI_SMC_SOFT_REGISTER_mclk_chg_timeout, vbi_dly); 3670 1.1 riastrad si_write_smc_soft_register(rdev, SI_SMC_SOFT_REGISTER_mc_block_delay, 0xAA); 3671 1.1 riastrad } 3672 1.1 riastrad 3673 1.1 riastrad static void si_program_ds_registers(struct radeon_device *rdev) 3674 1.1 riastrad { 3675 1.1 riastrad struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); 3676 1.1 riastrad u32 tmp = 1; /* XXX: 0x10 on tahiti A0 */ 3677 1.1 riastrad 3678 1.1 riastrad if (eg_pi->sclk_deep_sleep) { 3679 1.1 riastrad WREG32_P(MISC_CLK_CNTL, DEEP_SLEEP_CLK_SEL(tmp), ~DEEP_SLEEP_CLK_SEL_MASK); 3680 1.1 riastrad WREG32_P(CG_SPLL_AUTOSCALE_CNTL, AUTOSCALE_ON_SS_CLEAR, 3681 1.1 riastrad ~AUTOSCALE_ON_SS_CLEAR); 3682 1.1 riastrad } 3683 1.1 riastrad } 3684 1.1 riastrad 3685 1.1 riastrad static void si_program_display_gap(struct radeon_device *rdev) 3686 1.1 riastrad { 3687 1.1 riastrad u32 tmp, pipe; 3688 1.1 riastrad int i; 3689 1.1 riastrad 3690 1.1 riastrad tmp = RREG32(CG_DISPLAY_GAP_CNTL) & ~(DISP1_GAP_MASK | DISP2_GAP_MASK); 3691 1.1 riastrad if (rdev->pm.dpm.new_active_crtc_count > 0) 3692 1.1 riastrad tmp |= DISP1_GAP(R600_PM_DISPLAY_GAP_VBLANK_OR_WM); 3693 1.1 riastrad else 3694 1.1 riastrad tmp |= DISP1_GAP(R600_PM_DISPLAY_GAP_IGNORE); 3695 1.1 riastrad 3696 1.1 riastrad if (rdev->pm.dpm.new_active_crtc_count > 1) 3697 1.1 riastrad tmp |= DISP2_GAP(R600_PM_DISPLAY_GAP_VBLANK_OR_WM); 3698 1.1 riastrad else 3699 1.1 riastrad tmp |= DISP2_GAP(R600_PM_DISPLAY_GAP_IGNORE); 3700 1.1 riastrad 3701 1.1 riastrad WREG32(CG_DISPLAY_GAP_CNTL, tmp); 3702 1.1 riastrad 3703 1.1 riastrad tmp = RREG32(DCCG_DISP_SLOW_SELECT_REG); 3704 1.1 riastrad pipe = (tmp & DCCG_DISP1_SLOW_SELECT_MASK) >> DCCG_DISP1_SLOW_SELECT_SHIFT; 3705 1.1 riastrad 3706 1.1 riastrad if ((rdev->pm.dpm.new_active_crtc_count > 0) && 3707 1.1 riastrad (!(rdev->pm.dpm.new_active_crtcs & (1 << pipe)))) { 3708 1.1 riastrad /* find the first active crtc */ 3709 1.1 riastrad for (i = 0; i < rdev->num_crtc; i++) { 3710 1.1 riastrad if (rdev->pm.dpm.new_active_crtcs & (1 << i)) 3711 1.1 riastrad break; 3712 1.1 riastrad } 3713 1.1 riastrad if (i == rdev->num_crtc) 3714 1.1 riastrad pipe = 0; 3715 1.1 riastrad else 3716 1.1 riastrad pipe = i; 3717 1.1 riastrad 3718 1.1 riastrad tmp &= ~DCCG_DISP1_SLOW_SELECT_MASK; 3719 1.1 riastrad tmp |= DCCG_DISP1_SLOW_SELECT(pipe); 3720 1.1 riastrad WREG32(DCCG_DISP_SLOW_SELECT_REG, tmp); 3721 1.1 riastrad } 3722 1.1 riastrad 3723 1.1 riastrad /* Setting this to false forces the performance state to low if the crtcs are disabled. 3724 1.1 riastrad * This can be a problem on PowerXpress systems or if you want to use the card 3725 1.1 riastrad * for offscreen rendering or compute if there are no crtcs enabled. 3726 1.1 riastrad */ 3727 1.1 riastrad si_notify_smc_display_change(rdev, rdev->pm.dpm.new_active_crtc_count > 0); 3728 1.1 riastrad } 3729 1.1 riastrad 3730 1.1 riastrad static void si_enable_spread_spectrum(struct radeon_device *rdev, bool enable) 3731 1.1 riastrad { 3732 1.1 riastrad struct rv7xx_power_info *pi = rv770_get_pi(rdev); 3733 1.1 riastrad 3734 1.1 riastrad if (enable) { 3735 1.1 riastrad if (pi->sclk_ss) 3736 1.1 riastrad WREG32_P(GENERAL_PWRMGT, DYN_SPREAD_SPECTRUM_EN, ~DYN_SPREAD_SPECTRUM_EN); 3737 1.1 riastrad } else { 3738 1.1 riastrad WREG32_P(CG_SPLL_SPREAD_SPECTRUM, 0, ~SSEN); 3739 1.1 riastrad WREG32_P(GENERAL_PWRMGT, 0, ~DYN_SPREAD_SPECTRUM_EN); 3740 1.1 riastrad } 3741 1.1 riastrad } 3742 1.1 riastrad 3743 1.1 riastrad static void si_setup_bsp(struct radeon_device *rdev) 3744 1.1 riastrad { 3745 1.1 riastrad struct rv7xx_power_info *pi = rv770_get_pi(rdev); 3746 1.1 riastrad u32 xclk = radeon_get_xclk(rdev); 3747 1.1 riastrad 3748 1.1 riastrad r600_calculate_u_and_p(pi->asi, 3749 1.1 riastrad xclk, 3750 1.1 riastrad 16, 3751 1.1 riastrad &pi->bsp, 3752 1.1 riastrad &pi->bsu); 3753 1.1 riastrad 3754 1.1 riastrad r600_calculate_u_and_p(pi->pasi, 3755 1.1 riastrad xclk, 3756 1.1 riastrad 16, 3757 1.1 riastrad &pi->pbsp, 3758 1.1 riastrad &pi->pbsu); 3759 1.1 riastrad 3760 1.1 riastrad 3761 1.5 riastrad pi->dsp = BSP(pi->bsp) | BSU(pi->bsu); 3762 1.1 riastrad pi->psp = BSP(pi->pbsp) | BSU(pi->pbsu); 3763 1.1 riastrad 3764 1.1 riastrad WREG32(CG_BSP, pi->dsp); 3765 1.1 riastrad } 3766 1.1 riastrad 3767 1.1 riastrad static void si_program_git(struct radeon_device *rdev) 3768 1.1 riastrad { 3769 1.1 riastrad WREG32_P(CG_GIT, CG_GICST(R600_GICST_DFLT), ~CG_GICST_MASK); 3770 1.1 riastrad } 3771 1.1 riastrad 3772 1.1 riastrad static void si_program_tp(struct radeon_device *rdev) 3773 1.1 riastrad { 3774 1.1 riastrad int i; 3775 1.1 riastrad enum r600_td td = R600_TD_DFLT; 3776 1.1 riastrad 3777 1.1 riastrad for (i = 0; i < R600_PM_NUMBER_OF_TC; i++) 3778 1.1 riastrad WREG32(CG_FFCT_0 + (i * 4), (UTC_0(r600_utc[i]) | DTC_0(r600_dtc[i]))); 3779 1.1 riastrad 3780 1.1 riastrad if (td == R600_TD_AUTO) 3781 1.1 riastrad WREG32_P(SCLK_PWRMGT_CNTL, 0, ~FIR_FORCE_TREND_SEL); 3782 1.1 riastrad else 3783 1.1 riastrad WREG32_P(SCLK_PWRMGT_CNTL, FIR_FORCE_TREND_SEL, ~FIR_FORCE_TREND_SEL); 3784 1.1 riastrad 3785 1.1 riastrad if (td == R600_TD_UP) 3786 1.1 riastrad WREG32_P(SCLK_PWRMGT_CNTL, 0, ~FIR_TREND_MODE); 3787 1.1 riastrad 3788 1.1 riastrad if (td == R600_TD_DOWN) 3789 1.1 riastrad WREG32_P(SCLK_PWRMGT_CNTL, FIR_TREND_MODE, ~FIR_TREND_MODE); 3790 1.1 riastrad } 3791 1.1 riastrad 3792 1.1 riastrad static void si_program_tpp(struct radeon_device *rdev) 3793 1.1 riastrad { 3794 1.1 riastrad WREG32(CG_TPC, R600_TPC_DFLT); 3795 1.1 riastrad } 3796 1.1 riastrad 3797 1.1 riastrad static void si_program_sstp(struct radeon_device *rdev) 3798 1.1 riastrad { 3799 1.1 riastrad WREG32(CG_SSP, (SSTU(R600_SSTU_DFLT) | SST(R600_SST_DFLT))); 3800 1.1 riastrad } 3801 1.1 riastrad 3802 1.1 riastrad static void si_enable_display_gap(struct radeon_device *rdev) 3803 1.1 riastrad { 3804 1.1 riastrad u32 tmp = RREG32(CG_DISPLAY_GAP_CNTL); 3805 1.1 riastrad 3806 1.1 riastrad tmp &= ~(DISP1_GAP_MASK | DISP2_GAP_MASK); 3807 1.1 riastrad tmp |= (DISP1_GAP(R600_PM_DISPLAY_GAP_IGNORE) | 3808 1.1 riastrad DISP2_GAP(R600_PM_DISPLAY_GAP_IGNORE)); 3809 1.1 riastrad 3810 1.1 riastrad tmp &= ~(DISP1_GAP_MCHG_MASK | DISP2_GAP_MCHG_MASK); 3811 1.1 riastrad tmp |= (DISP1_GAP_MCHG(R600_PM_DISPLAY_GAP_VBLANK) | 3812 1.1 riastrad DISP2_GAP_MCHG(R600_PM_DISPLAY_GAP_IGNORE)); 3813 1.1 riastrad WREG32(CG_DISPLAY_GAP_CNTL, tmp); 3814 1.1 riastrad } 3815 1.1 riastrad 3816 1.1 riastrad static void si_program_vc(struct radeon_device *rdev) 3817 1.1 riastrad { 3818 1.1 riastrad struct rv7xx_power_info *pi = rv770_get_pi(rdev); 3819 1.1 riastrad 3820 1.1 riastrad WREG32(CG_FTV, pi->vrc); 3821 1.1 riastrad } 3822 1.1 riastrad 3823 1.1 riastrad static void si_clear_vc(struct radeon_device *rdev) 3824 1.1 riastrad { 3825 1.1 riastrad WREG32(CG_FTV, 0); 3826 1.1 riastrad } 3827 1.1 riastrad 3828 1.1 riastrad u8 si_get_ddr3_mclk_frequency_ratio(u32 memory_clock) 3829 1.1 riastrad { 3830 1.1 riastrad u8 mc_para_index; 3831 1.1 riastrad 3832 1.1 riastrad if (memory_clock < 10000) 3833 1.1 riastrad mc_para_index = 0; 3834 1.1 riastrad else if (memory_clock >= 80000) 3835 1.1 riastrad mc_para_index = 0x0f; 3836 1.1 riastrad else 3837 1.1 riastrad mc_para_index = (u8)((memory_clock - 10000) / 5000 + 1); 3838 1.1 riastrad return mc_para_index; 3839 1.1 riastrad } 3840 1.1 riastrad 3841 1.1 riastrad u8 si_get_mclk_frequency_ratio(u32 memory_clock, bool strobe_mode) 3842 1.1 riastrad { 3843 1.1 riastrad u8 mc_para_index; 3844 1.1 riastrad 3845 1.1 riastrad if (strobe_mode) { 3846 1.1 riastrad if (memory_clock < 12500) 3847 1.1 riastrad mc_para_index = 0x00; 3848 1.1 riastrad else if (memory_clock > 47500) 3849 1.1 riastrad mc_para_index = 0x0f; 3850 1.1 riastrad else 3851 1.1 riastrad mc_para_index = (u8)((memory_clock - 10000) / 2500); 3852 1.1 riastrad } else { 3853 1.1 riastrad if (memory_clock < 65000) 3854 1.1 riastrad mc_para_index = 0x00; 3855 1.1 riastrad else if (memory_clock > 135000) 3856 1.1 riastrad mc_para_index = 0x0f; 3857 1.1 riastrad else 3858 1.1 riastrad mc_para_index = (u8)((memory_clock - 60000) / 5000); 3859 1.1 riastrad } 3860 1.1 riastrad return mc_para_index; 3861 1.1 riastrad } 3862 1.1 riastrad 3863 1.1 riastrad static u8 si_get_strobe_mode_settings(struct radeon_device *rdev, u32 mclk) 3864 1.1 riastrad { 3865 1.1 riastrad struct rv7xx_power_info *pi = rv770_get_pi(rdev); 3866 1.1 riastrad bool strobe_mode = false; 3867 1.1 riastrad u8 result = 0; 3868 1.1 riastrad 3869 1.1 riastrad if (mclk <= pi->mclk_strobe_mode_threshold) 3870 1.1 riastrad strobe_mode = true; 3871 1.1 riastrad 3872 1.1 riastrad if (pi->mem_gddr5) 3873 1.1 riastrad result = si_get_mclk_frequency_ratio(mclk, strobe_mode); 3874 1.1 riastrad else 3875 1.1 riastrad result = si_get_ddr3_mclk_frequency_ratio(mclk); 3876 1.1 riastrad 3877 1.1 riastrad if (strobe_mode) 3878 1.1 riastrad result |= SISLANDS_SMC_STROBE_ENABLE; 3879 1.1 riastrad 3880 1.1 riastrad return result; 3881 1.1 riastrad } 3882 1.1 riastrad 3883 1.1 riastrad static int si_upload_firmware(struct radeon_device *rdev) 3884 1.1 riastrad { 3885 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 3886 1.1 riastrad int ret; 3887 1.1 riastrad 3888 1.1 riastrad si_reset_smc(rdev); 3889 1.1 riastrad si_stop_smc_clock(rdev); 3890 1.1 riastrad 3891 1.1 riastrad ret = si_load_smc_ucode(rdev, si_pi->sram_end); 3892 1.1 riastrad 3893 1.1 riastrad return ret; 3894 1.1 riastrad } 3895 1.1 riastrad 3896 1.1 riastrad static bool si_validate_phase_shedding_tables(struct radeon_device *rdev, 3897 1.1 riastrad const struct atom_voltage_table *table, 3898 1.1 riastrad const struct radeon_phase_shedding_limits_table *limits) 3899 1.1 riastrad { 3900 1.1 riastrad u32 data, num_bits, num_levels; 3901 1.1 riastrad 3902 1.1 riastrad if ((table == NULL) || (limits == NULL)) 3903 1.1 riastrad return false; 3904 1.1 riastrad 3905 1.1 riastrad data = table->mask_low; 3906 1.1 riastrad 3907 1.1 riastrad num_bits = hweight32(data); 3908 1.1 riastrad 3909 1.1 riastrad if (num_bits == 0) 3910 1.1 riastrad return false; 3911 1.1 riastrad 3912 1.1 riastrad num_levels = (1 << num_bits); 3913 1.1 riastrad 3914 1.1 riastrad if (table->count != num_levels) 3915 1.1 riastrad return false; 3916 1.1 riastrad 3917 1.1 riastrad if (limits->count != (num_levels - 1)) 3918 1.1 riastrad return false; 3919 1.1 riastrad 3920 1.1 riastrad return true; 3921 1.1 riastrad } 3922 1.1 riastrad 3923 1.1 riastrad void si_trim_voltage_table_to_fit_state_table(struct radeon_device *rdev, 3924 1.1 riastrad u32 max_voltage_steps, 3925 1.1 riastrad struct atom_voltage_table *voltage_table) 3926 1.1 riastrad { 3927 1.1 riastrad unsigned int i, diff; 3928 1.1 riastrad 3929 1.1 riastrad if (voltage_table->count <= max_voltage_steps) 3930 1.1 riastrad return; 3931 1.1 riastrad 3932 1.1 riastrad diff = voltage_table->count - max_voltage_steps; 3933 1.1 riastrad 3934 1.1 riastrad for (i= 0; i < max_voltage_steps; i++) 3935 1.1 riastrad voltage_table->entries[i] = voltage_table->entries[i + diff]; 3936 1.1 riastrad 3937 1.1 riastrad voltage_table->count = max_voltage_steps; 3938 1.1 riastrad } 3939 1.1 riastrad 3940 1.1 riastrad static int si_get_svi2_voltage_table(struct radeon_device *rdev, 3941 1.1 riastrad struct radeon_clock_voltage_dependency_table *voltage_dependency_table, 3942 1.1 riastrad struct atom_voltage_table *voltage_table) 3943 1.1 riastrad { 3944 1.1 riastrad u32 i; 3945 1.1 riastrad 3946 1.1 riastrad if (voltage_dependency_table == NULL) 3947 1.1 riastrad return -EINVAL; 3948 1.1 riastrad 3949 1.1 riastrad voltage_table->mask_low = 0; 3950 1.1 riastrad voltage_table->phase_delay = 0; 3951 1.1 riastrad 3952 1.1 riastrad voltage_table->count = voltage_dependency_table->count; 3953 1.1 riastrad for (i = 0; i < voltage_table->count; i++) { 3954 1.1 riastrad voltage_table->entries[i].value = voltage_dependency_table->entries[i].v; 3955 1.1 riastrad voltage_table->entries[i].smio_low = 0; 3956 1.1 riastrad } 3957 1.1 riastrad 3958 1.1 riastrad return 0; 3959 1.1 riastrad } 3960 1.1 riastrad 3961 1.1 riastrad static int si_construct_voltage_tables(struct radeon_device *rdev) 3962 1.1 riastrad { 3963 1.1 riastrad struct rv7xx_power_info *pi = rv770_get_pi(rdev); 3964 1.1 riastrad struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); 3965 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 3966 1.1 riastrad int ret; 3967 1.1 riastrad 3968 1.1 riastrad if (pi->voltage_control) { 3969 1.1 riastrad ret = radeon_atom_get_voltage_table(rdev, VOLTAGE_TYPE_VDDC, 3970 1.1 riastrad VOLTAGE_OBJ_GPIO_LUT, &eg_pi->vddc_voltage_table); 3971 1.1 riastrad if (ret) 3972 1.1 riastrad return ret; 3973 1.1 riastrad 3974 1.1 riastrad if (eg_pi->vddc_voltage_table.count > SISLANDS_MAX_NO_VREG_STEPS) 3975 1.1 riastrad si_trim_voltage_table_to_fit_state_table(rdev, 3976 1.1 riastrad SISLANDS_MAX_NO_VREG_STEPS, 3977 1.1 riastrad &eg_pi->vddc_voltage_table); 3978 1.1 riastrad } else if (si_pi->voltage_control_svi2) { 3979 1.1 riastrad ret = si_get_svi2_voltage_table(rdev, 3980 1.1 riastrad &rdev->pm.dpm.dyn_state.vddc_dependency_on_mclk, 3981 1.1 riastrad &eg_pi->vddc_voltage_table); 3982 1.1 riastrad if (ret) 3983 1.1 riastrad return ret; 3984 1.1 riastrad } else { 3985 1.1 riastrad return -EINVAL; 3986 1.1 riastrad } 3987 1.1 riastrad 3988 1.1 riastrad if (eg_pi->vddci_control) { 3989 1.1 riastrad ret = radeon_atom_get_voltage_table(rdev, VOLTAGE_TYPE_VDDCI, 3990 1.1 riastrad VOLTAGE_OBJ_GPIO_LUT, &eg_pi->vddci_voltage_table); 3991 1.1 riastrad if (ret) 3992 1.1 riastrad return ret; 3993 1.1 riastrad 3994 1.1 riastrad if (eg_pi->vddci_voltage_table.count > SISLANDS_MAX_NO_VREG_STEPS) 3995 1.1 riastrad si_trim_voltage_table_to_fit_state_table(rdev, 3996 1.1 riastrad SISLANDS_MAX_NO_VREG_STEPS, 3997 1.1 riastrad &eg_pi->vddci_voltage_table); 3998 1.1 riastrad } 3999 1.1 riastrad if (si_pi->vddci_control_svi2) { 4000 1.1 riastrad ret = si_get_svi2_voltage_table(rdev, 4001 1.1 riastrad &rdev->pm.dpm.dyn_state.vddci_dependency_on_mclk, 4002 1.1 riastrad &eg_pi->vddci_voltage_table); 4003 1.1 riastrad if (ret) 4004 1.1 riastrad return ret; 4005 1.1 riastrad } 4006 1.1 riastrad 4007 1.1 riastrad if (pi->mvdd_control) { 4008 1.1 riastrad ret = radeon_atom_get_voltage_table(rdev, VOLTAGE_TYPE_MVDDC, 4009 1.1 riastrad VOLTAGE_OBJ_GPIO_LUT, &si_pi->mvdd_voltage_table); 4010 1.1 riastrad 4011 1.1 riastrad if (ret) { 4012 1.1 riastrad pi->mvdd_control = false; 4013 1.1 riastrad return ret; 4014 1.1 riastrad } 4015 1.1 riastrad 4016 1.1 riastrad if (si_pi->mvdd_voltage_table.count == 0) { 4017 1.1 riastrad pi->mvdd_control = false; 4018 1.1 riastrad return -EINVAL; 4019 1.1 riastrad } 4020 1.1 riastrad 4021 1.1 riastrad if (si_pi->mvdd_voltage_table.count > SISLANDS_MAX_NO_VREG_STEPS) 4022 1.1 riastrad si_trim_voltage_table_to_fit_state_table(rdev, 4023 1.1 riastrad SISLANDS_MAX_NO_VREG_STEPS, 4024 1.1 riastrad &si_pi->mvdd_voltage_table); 4025 1.1 riastrad } 4026 1.1 riastrad 4027 1.1 riastrad if (si_pi->vddc_phase_shed_control) { 4028 1.1 riastrad ret = radeon_atom_get_voltage_table(rdev, VOLTAGE_TYPE_VDDC, 4029 1.1 riastrad VOLTAGE_OBJ_PHASE_LUT, &si_pi->vddc_phase_shed_table); 4030 1.1 riastrad if (ret) 4031 1.1 riastrad si_pi->vddc_phase_shed_control = false; 4032 1.1 riastrad 4033 1.1 riastrad if ((si_pi->vddc_phase_shed_table.count == 0) || 4034 1.1 riastrad (si_pi->vddc_phase_shed_table.count > SISLANDS_MAX_NO_VREG_STEPS)) 4035 1.1 riastrad si_pi->vddc_phase_shed_control = false; 4036 1.1 riastrad } 4037 1.1 riastrad 4038 1.1 riastrad return 0; 4039 1.1 riastrad } 4040 1.1 riastrad 4041 1.1 riastrad static void si_populate_smc_voltage_table(struct radeon_device *rdev, 4042 1.1 riastrad const struct atom_voltage_table *voltage_table, 4043 1.1 riastrad SISLANDS_SMC_STATETABLE *table) 4044 1.1 riastrad { 4045 1.1 riastrad unsigned int i; 4046 1.1 riastrad 4047 1.1 riastrad for (i = 0; i < voltage_table->count; i++) 4048 1.1 riastrad table->lowSMIO[i] |= cpu_to_be32(voltage_table->entries[i].smio_low); 4049 1.1 riastrad } 4050 1.1 riastrad 4051 1.1 riastrad static int si_populate_smc_voltage_tables(struct radeon_device *rdev, 4052 1.1 riastrad SISLANDS_SMC_STATETABLE *table) 4053 1.1 riastrad { 4054 1.1 riastrad struct rv7xx_power_info *pi = rv770_get_pi(rdev); 4055 1.1 riastrad struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); 4056 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 4057 1.1 riastrad u8 i; 4058 1.1 riastrad 4059 1.1 riastrad if (si_pi->voltage_control_svi2) { 4060 1.1 riastrad si_write_smc_soft_register(rdev, SI_SMC_SOFT_REGISTER_svi_rework_gpio_id_svc, 4061 1.1 riastrad si_pi->svc_gpio_id); 4062 1.1 riastrad si_write_smc_soft_register(rdev, SI_SMC_SOFT_REGISTER_svi_rework_gpio_id_svd, 4063 1.1 riastrad si_pi->svd_gpio_id); 4064 1.1 riastrad si_write_smc_soft_register(rdev, SI_SMC_SOFT_REGISTER_svi_rework_plat_type, 4065 1.1 riastrad 2); 4066 1.1 riastrad } else { 4067 1.1 riastrad if (eg_pi->vddc_voltage_table.count) { 4068 1.1 riastrad si_populate_smc_voltage_table(rdev, &eg_pi->vddc_voltage_table, table); 4069 1.1 riastrad table->voltageMaskTable.lowMask[SISLANDS_SMC_VOLTAGEMASK_VDDC] = 4070 1.1 riastrad cpu_to_be32(eg_pi->vddc_voltage_table.mask_low); 4071 1.1 riastrad 4072 1.1 riastrad for (i = 0; i < eg_pi->vddc_voltage_table.count; i++) { 4073 1.1 riastrad if (pi->max_vddc_in_table <= eg_pi->vddc_voltage_table.entries[i].value) { 4074 1.1 riastrad table->maxVDDCIndexInPPTable = i; 4075 1.1 riastrad break; 4076 1.1 riastrad } 4077 1.1 riastrad } 4078 1.1 riastrad } 4079 1.1 riastrad 4080 1.1 riastrad if (eg_pi->vddci_voltage_table.count) { 4081 1.1 riastrad si_populate_smc_voltage_table(rdev, &eg_pi->vddci_voltage_table, table); 4082 1.1 riastrad 4083 1.1 riastrad table->voltageMaskTable.lowMask[SISLANDS_SMC_VOLTAGEMASK_VDDCI] = 4084 1.1 riastrad cpu_to_be32(eg_pi->vddci_voltage_table.mask_low); 4085 1.1 riastrad } 4086 1.1 riastrad 4087 1.1 riastrad 4088 1.1 riastrad if (si_pi->mvdd_voltage_table.count) { 4089 1.1 riastrad si_populate_smc_voltage_table(rdev, &si_pi->mvdd_voltage_table, table); 4090 1.1 riastrad 4091 1.1 riastrad table->voltageMaskTable.lowMask[SISLANDS_SMC_VOLTAGEMASK_MVDD] = 4092 1.1 riastrad cpu_to_be32(si_pi->mvdd_voltage_table.mask_low); 4093 1.1 riastrad } 4094 1.1 riastrad 4095 1.1 riastrad if (si_pi->vddc_phase_shed_control) { 4096 1.1 riastrad if (si_validate_phase_shedding_tables(rdev, &si_pi->vddc_phase_shed_table, 4097 1.1 riastrad &rdev->pm.dpm.dyn_state.phase_shedding_limits_table)) { 4098 1.1 riastrad si_populate_smc_voltage_table(rdev, &si_pi->vddc_phase_shed_table, table); 4099 1.1 riastrad 4100 1.1 riastrad table->phaseMaskTable.lowMask[SISLANDS_SMC_VOLTAGEMASK_VDDC_PHASE_SHEDDING] = 4101 1.1 riastrad cpu_to_be32(si_pi->vddc_phase_shed_table.mask_low); 4102 1.1 riastrad 4103 1.1 riastrad si_write_smc_soft_register(rdev, SI_SMC_SOFT_REGISTER_phase_shedding_delay, 4104 1.1 riastrad (u32)si_pi->vddc_phase_shed_table.phase_delay); 4105 1.1 riastrad } else { 4106 1.1 riastrad si_pi->vddc_phase_shed_control = false; 4107 1.1 riastrad } 4108 1.1 riastrad } 4109 1.1 riastrad } 4110 1.1 riastrad 4111 1.1 riastrad return 0; 4112 1.1 riastrad } 4113 1.1 riastrad 4114 1.1 riastrad static int si_populate_voltage_value(struct radeon_device *rdev, 4115 1.1 riastrad const struct atom_voltage_table *table, 4116 1.1 riastrad u16 value, SISLANDS_SMC_VOLTAGE_VALUE *voltage) 4117 1.1 riastrad { 4118 1.1 riastrad unsigned int i; 4119 1.1 riastrad 4120 1.1 riastrad for (i = 0; i < table->count; i++) { 4121 1.1 riastrad if (value <= table->entries[i].value) { 4122 1.1 riastrad voltage->index = (u8)i; 4123 1.1 riastrad voltage->value = cpu_to_be16(table->entries[i].value); 4124 1.1 riastrad break; 4125 1.1 riastrad } 4126 1.1 riastrad } 4127 1.1 riastrad 4128 1.1 riastrad if (i >= table->count) 4129 1.1 riastrad return -EINVAL; 4130 1.1 riastrad 4131 1.1 riastrad return 0; 4132 1.1 riastrad } 4133 1.1 riastrad 4134 1.1 riastrad static int si_populate_mvdd_value(struct radeon_device *rdev, u32 mclk, 4135 1.1 riastrad SISLANDS_SMC_VOLTAGE_VALUE *voltage) 4136 1.1 riastrad { 4137 1.1 riastrad struct rv7xx_power_info *pi = rv770_get_pi(rdev); 4138 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 4139 1.1 riastrad 4140 1.1 riastrad if (pi->mvdd_control) { 4141 1.1 riastrad if (mclk <= pi->mvdd_split_frequency) 4142 1.1 riastrad voltage->index = 0; 4143 1.1 riastrad else 4144 1.1 riastrad voltage->index = (u8)(si_pi->mvdd_voltage_table.count) - 1; 4145 1.1 riastrad 4146 1.1 riastrad voltage->value = cpu_to_be16(si_pi->mvdd_voltage_table.entries[voltage->index].value); 4147 1.1 riastrad } 4148 1.1 riastrad return 0; 4149 1.1 riastrad } 4150 1.1 riastrad 4151 1.1 riastrad static int si_get_std_voltage_value(struct radeon_device *rdev, 4152 1.1 riastrad SISLANDS_SMC_VOLTAGE_VALUE *voltage, 4153 1.1 riastrad u16 *std_voltage) 4154 1.1 riastrad { 4155 1.1 riastrad u16 v_index; 4156 1.1 riastrad bool voltage_found = false; 4157 1.1 riastrad *std_voltage = be16_to_cpu(voltage->value); 4158 1.1 riastrad 4159 1.1 riastrad if (rdev->pm.dpm.dyn_state.cac_leakage_table.entries) { 4160 1.1 riastrad if (rdev->pm.dpm.platform_caps & ATOM_PP_PLATFORM_CAP_NEW_CAC_VOLTAGE) { 4161 1.1 riastrad if (rdev->pm.dpm.dyn_state.vddc_dependency_on_sclk.entries == NULL) 4162 1.1 riastrad return -EINVAL; 4163 1.1 riastrad 4164 1.1 riastrad for (v_index = 0; (u32)v_index < rdev->pm.dpm.dyn_state.vddc_dependency_on_sclk.count; v_index++) { 4165 1.1 riastrad if (be16_to_cpu(voltage->value) == 4166 1.1 riastrad (u16)rdev->pm.dpm.dyn_state.vddc_dependency_on_sclk.entries[v_index].v) { 4167 1.1 riastrad voltage_found = true; 4168 1.1 riastrad if ((u32)v_index < rdev->pm.dpm.dyn_state.cac_leakage_table.count) 4169 1.1 riastrad *std_voltage = 4170 1.1 riastrad rdev->pm.dpm.dyn_state.cac_leakage_table.entries[v_index].vddc; 4171 1.1 riastrad else 4172 1.1 riastrad *std_voltage = 4173 1.1 riastrad rdev->pm.dpm.dyn_state.cac_leakage_table.entries[rdev->pm.dpm.dyn_state.cac_leakage_table.count-1].vddc; 4174 1.1 riastrad break; 4175 1.1 riastrad } 4176 1.1 riastrad } 4177 1.1 riastrad 4178 1.1 riastrad if (!voltage_found) { 4179 1.1 riastrad for (v_index = 0; (u32)v_index < rdev->pm.dpm.dyn_state.vddc_dependency_on_sclk.count; v_index++) { 4180 1.1 riastrad if (be16_to_cpu(voltage->value) <= 4181 1.1 riastrad (u16)rdev->pm.dpm.dyn_state.vddc_dependency_on_sclk.entries[v_index].v) { 4182 1.1 riastrad voltage_found = true; 4183 1.1 riastrad if ((u32)v_index < rdev->pm.dpm.dyn_state.cac_leakage_table.count) 4184 1.1 riastrad *std_voltage = 4185 1.1 riastrad rdev->pm.dpm.dyn_state.cac_leakage_table.entries[v_index].vddc; 4186 1.1 riastrad else 4187 1.1 riastrad *std_voltage = 4188 1.1 riastrad rdev->pm.dpm.dyn_state.cac_leakage_table.entries[rdev->pm.dpm.dyn_state.cac_leakage_table.count-1].vddc; 4189 1.1 riastrad break; 4190 1.1 riastrad } 4191 1.1 riastrad } 4192 1.1 riastrad } 4193 1.1 riastrad } else { 4194 1.1 riastrad if ((u32)voltage->index < rdev->pm.dpm.dyn_state.cac_leakage_table.count) 4195 1.1 riastrad *std_voltage = rdev->pm.dpm.dyn_state.cac_leakage_table.entries[voltage->index].vddc; 4196 1.1 riastrad } 4197 1.1 riastrad } 4198 1.1 riastrad 4199 1.1 riastrad return 0; 4200 1.1 riastrad } 4201 1.1 riastrad 4202 1.1 riastrad static int si_populate_std_voltage_value(struct radeon_device *rdev, 4203 1.1 riastrad u16 value, u8 index, 4204 1.1 riastrad SISLANDS_SMC_VOLTAGE_VALUE *voltage) 4205 1.1 riastrad { 4206 1.1 riastrad voltage->index = index; 4207 1.1 riastrad voltage->value = cpu_to_be16(value); 4208 1.1 riastrad 4209 1.1 riastrad return 0; 4210 1.1 riastrad } 4211 1.1 riastrad 4212 1.1 riastrad static int si_populate_phase_shedding_value(struct radeon_device *rdev, 4213 1.1 riastrad const struct radeon_phase_shedding_limits_table *limits, 4214 1.1 riastrad u16 voltage, u32 sclk, u32 mclk, 4215 1.1 riastrad SISLANDS_SMC_VOLTAGE_VALUE *smc_voltage) 4216 1.1 riastrad { 4217 1.1 riastrad unsigned int i; 4218 1.1 riastrad 4219 1.1 riastrad for (i = 0; i < limits->count; i++) { 4220 1.1 riastrad if ((voltage <= limits->entries[i].voltage) && 4221 1.1 riastrad (sclk <= limits->entries[i].sclk) && 4222 1.1 riastrad (mclk <= limits->entries[i].mclk)) 4223 1.1 riastrad break; 4224 1.1 riastrad } 4225 1.1 riastrad 4226 1.1 riastrad smc_voltage->phase_settings = (u8)i; 4227 1.1 riastrad 4228 1.1 riastrad return 0; 4229 1.1 riastrad } 4230 1.1 riastrad 4231 1.1 riastrad static int si_init_arb_table_index(struct radeon_device *rdev) 4232 1.1 riastrad { 4233 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 4234 1.1 riastrad u32 tmp; 4235 1.1 riastrad int ret; 4236 1.1 riastrad 4237 1.1 riastrad ret = si_read_smc_sram_dword(rdev, si_pi->arb_table_start, &tmp, si_pi->sram_end); 4238 1.1 riastrad if (ret) 4239 1.1 riastrad return ret; 4240 1.1 riastrad 4241 1.1 riastrad tmp &= 0x00FFFFFF; 4242 1.1 riastrad tmp |= MC_CG_ARB_FREQ_F1 << 24; 4243 1.1 riastrad 4244 1.1 riastrad return si_write_smc_sram_dword(rdev, si_pi->arb_table_start, tmp, si_pi->sram_end); 4245 1.1 riastrad } 4246 1.1 riastrad 4247 1.1 riastrad static int si_initial_switch_from_arb_f0_to_f1(struct radeon_device *rdev) 4248 1.1 riastrad { 4249 1.1 riastrad return ni_copy_and_switch_arb_sets(rdev, MC_CG_ARB_FREQ_F0, MC_CG_ARB_FREQ_F1); 4250 1.1 riastrad } 4251 1.1 riastrad 4252 1.1 riastrad static int si_reset_to_default(struct radeon_device *rdev) 4253 1.1 riastrad { 4254 1.1 riastrad return (si_send_msg_to_smc(rdev, PPSMC_MSG_ResetToDefaults) == PPSMC_Result_OK) ? 4255 1.1 riastrad 0 : -EINVAL; 4256 1.1 riastrad } 4257 1.1 riastrad 4258 1.1 riastrad static int si_force_switch_to_arb_f0(struct radeon_device *rdev) 4259 1.1 riastrad { 4260 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 4261 1.1 riastrad u32 tmp; 4262 1.1 riastrad int ret; 4263 1.1 riastrad 4264 1.1 riastrad ret = si_read_smc_sram_dword(rdev, si_pi->arb_table_start, 4265 1.1 riastrad &tmp, si_pi->sram_end); 4266 1.1 riastrad if (ret) 4267 1.1 riastrad return ret; 4268 1.1 riastrad 4269 1.1 riastrad tmp = (tmp >> 24) & 0xff; 4270 1.1 riastrad 4271 1.1 riastrad if (tmp == MC_CG_ARB_FREQ_F0) 4272 1.1 riastrad return 0; 4273 1.1 riastrad 4274 1.1 riastrad return ni_copy_and_switch_arb_sets(rdev, tmp, MC_CG_ARB_FREQ_F0); 4275 1.1 riastrad } 4276 1.1 riastrad 4277 1.1 riastrad static u32 si_calculate_memory_refresh_rate(struct radeon_device *rdev, 4278 1.1 riastrad u32 engine_clock) 4279 1.1 riastrad { 4280 1.1 riastrad u32 dram_rows; 4281 1.1 riastrad u32 dram_refresh_rate; 4282 1.1 riastrad u32 mc_arb_rfsh_rate; 4283 1.1 riastrad u32 tmp = (RREG32(MC_ARB_RAMCFG) & NOOFROWS_MASK) >> NOOFROWS_SHIFT; 4284 1.1 riastrad 4285 1.1 riastrad if (tmp >= 4) 4286 1.1 riastrad dram_rows = 16384; 4287 1.1 riastrad else 4288 1.1 riastrad dram_rows = 1 << (tmp + 10); 4289 1.1 riastrad 4290 1.1 riastrad dram_refresh_rate = 1 << ((RREG32(MC_SEQ_MISC0) & 0x3) + 3); 4291 1.1 riastrad mc_arb_rfsh_rate = ((engine_clock * 10) * dram_refresh_rate / dram_rows - 32) / 64; 4292 1.1 riastrad 4293 1.1 riastrad return mc_arb_rfsh_rate; 4294 1.1 riastrad } 4295 1.1 riastrad 4296 1.1 riastrad static int si_populate_memory_timing_parameters(struct radeon_device *rdev, 4297 1.1 riastrad struct rv7xx_pl *pl, 4298 1.1 riastrad SMC_SIslands_MCArbDramTimingRegisterSet *arb_regs) 4299 1.1 riastrad { 4300 1.1 riastrad u32 dram_timing; 4301 1.1 riastrad u32 dram_timing2; 4302 1.1 riastrad u32 burst_time; 4303 1.1 riastrad 4304 1.1 riastrad arb_regs->mc_arb_rfsh_rate = 4305 1.1 riastrad (u8)si_calculate_memory_refresh_rate(rdev, pl->sclk); 4306 1.1 riastrad 4307 1.1 riastrad radeon_atom_set_engine_dram_timings(rdev, 4308 1.1 riastrad pl->sclk, 4309 1.5 riastrad pl->mclk); 4310 1.1 riastrad 4311 1.1 riastrad dram_timing = RREG32(MC_ARB_DRAM_TIMING); 4312 1.1 riastrad dram_timing2 = RREG32(MC_ARB_DRAM_TIMING2); 4313 1.1 riastrad burst_time = RREG32(MC_ARB_BURST_TIME) & STATE0_MASK; 4314 1.1 riastrad 4315 1.1 riastrad arb_regs->mc_arb_dram_timing = cpu_to_be32(dram_timing); 4316 1.1 riastrad arb_regs->mc_arb_dram_timing2 = cpu_to_be32(dram_timing2); 4317 1.1 riastrad arb_regs->mc_arb_burst_time = (u8)burst_time; 4318 1.1 riastrad 4319 1.1 riastrad return 0; 4320 1.1 riastrad } 4321 1.1 riastrad 4322 1.1 riastrad static int si_do_program_memory_timing_parameters(struct radeon_device *rdev, 4323 1.1 riastrad struct radeon_ps *radeon_state, 4324 1.1 riastrad unsigned int first_arb_set) 4325 1.1 riastrad { 4326 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 4327 1.1 riastrad struct ni_ps *state = ni_get_ps(radeon_state); 4328 1.1 riastrad SMC_SIslands_MCArbDramTimingRegisterSet arb_regs = { 0 }; 4329 1.1 riastrad int i, ret = 0; 4330 1.1 riastrad 4331 1.1 riastrad for (i = 0; i < state->performance_level_count; i++) { 4332 1.1 riastrad ret = si_populate_memory_timing_parameters(rdev, &state->performance_levels[i], &arb_regs); 4333 1.1 riastrad if (ret) 4334 1.1 riastrad break; 4335 1.1 riastrad ret = si_copy_bytes_to_smc(rdev, 4336 1.1 riastrad si_pi->arb_table_start + 4337 1.1 riastrad offsetof(SMC_SIslands_MCArbDramTimingRegisters, data) + 4338 1.1 riastrad sizeof(SMC_SIslands_MCArbDramTimingRegisterSet) * (first_arb_set + i), 4339 1.1 riastrad (u8 *)&arb_regs, 4340 1.1 riastrad sizeof(SMC_SIslands_MCArbDramTimingRegisterSet), 4341 1.1 riastrad si_pi->sram_end); 4342 1.1 riastrad if (ret) 4343 1.1 riastrad break; 4344 1.5 riastrad } 4345 1.1 riastrad 4346 1.1 riastrad return ret; 4347 1.1 riastrad } 4348 1.1 riastrad 4349 1.1 riastrad static int si_program_memory_timing_parameters(struct radeon_device *rdev, 4350 1.1 riastrad struct radeon_ps *radeon_new_state) 4351 1.1 riastrad { 4352 1.1 riastrad return si_do_program_memory_timing_parameters(rdev, radeon_new_state, 4353 1.1 riastrad SISLANDS_DRIVER_STATE_ARB_INDEX); 4354 1.1 riastrad } 4355 1.1 riastrad 4356 1.1 riastrad static int si_populate_initial_mvdd_value(struct radeon_device *rdev, 4357 1.1 riastrad struct SISLANDS_SMC_VOLTAGE_VALUE *voltage) 4358 1.1 riastrad { 4359 1.1 riastrad struct rv7xx_power_info *pi = rv770_get_pi(rdev); 4360 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 4361 1.1 riastrad 4362 1.1 riastrad if (pi->mvdd_control) 4363 1.1 riastrad return si_populate_voltage_value(rdev, &si_pi->mvdd_voltage_table, 4364 1.1 riastrad si_pi->mvdd_bootup_value, voltage); 4365 1.1 riastrad 4366 1.1 riastrad return 0; 4367 1.1 riastrad } 4368 1.1 riastrad 4369 1.1 riastrad static int si_populate_smc_initial_state(struct radeon_device *rdev, 4370 1.1 riastrad struct radeon_ps *radeon_initial_state, 4371 1.1 riastrad SISLANDS_SMC_STATETABLE *table) 4372 1.1 riastrad { 4373 1.1 riastrad struct ni_ps *initial_state = ni_get_ps(radeon_initial_state); 4374 1.1 riastrad struct rv7xx_power_info *pi = rv770_get_pi(rdev); 4375 1.1 riastrad struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); 4376 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 4377 1.1 riastrad u32 reg; 4378 1.1 riastrad int ret; 4379 1.1 riastrad 4380 1.1 riastrad table->initialState.levels[0].mclk.vDLL_CNTL = 4381 1.1 riastrad cpu_to_be32(si_pi->clock_registers.dll_cntl); 4382 1.1 riastrad table->initialState.levels[0].mclk.vMCLK_PWRMGT_CNTL = 4383 1.1 riastrad cpu_to_be32(si_pi->clock_registers.mclk_pwrmgt_cntl); 4384 1.1 riastrad table->initialState.levels[0].mclk.vMPLL_AD_FUNC_CNTL = 4385 1.1 riastrad cpu_to_be32(si_pi->clock_registers.mpll_ad_func_cntl); 4386 1.1 riastrad table->initialState.levels[0].mclk.vMPLL_DQ_FUNC_CNTL = 4387 1.1 riastrad cpu_to_be32(si_pi->clock_registers.mpll_dq_func_cntl); 4388 1.1 riastrad table->initialState.levels[0].mclk.vMPLL_FUNC_CNTL = 4389 1.1 riastrad cpu_to_be32(si_pi->clock_registers.mpll_func_cntl); 4390 1.1 riastrad table->initialState.levels[0].mclk.vMPLL_FUNC_CNTL_1 = 4391 1.1 riastrad cpu_to_be32(si_pi->clock_registers.mpll_func_cntl_1); 4392 1.1 riastrad table->initialState.levels[0].mclk.vMPLL_FUNC_CNTL_2 = 4393 1.1 riastrad cpu_to_be32(si_pi->clock_registers.mpll_func_cntl_2); 4394 1.1 riastrad table->initialState.levels[0].mclk.vMPLL_SS = 4395 1.1 riastrad cpu_to_be32(si_pi->clock_registers.mpll_ss1); 4396 1.1 riastrad table->initialState.levels[0].mclk.vMPLL_SS2 = 4397 1.1 riastrad cpu_to_be32(si_pi->clock_registers.mpll_ss2); 4398 1.1 riastrad 4399 1.1 riastrad table->initialState.levels[0].mclk.mclk_value = 4400 1.1 riastrad cpu_to_be32(initial_state->performance_levels[0].mclk); 4401 1.1 riastrad 4402 1.1 riastrad table->initialState.levels[0].sclk.vCG_SPLL_FUNC_CNTL = 4403 1.1 riastrad cpu_to_be32(si_pi->clock_registers.cg_spll_func_cntl); 4404 1.1 riastrad table->initialState.levels[0].sclk.vCG_SPLL_FUNC_CNTL_2 = 4405 1.1 riastrad cpu_to_be32(si_pi->clock_registers.cg_spll_func_cntl_2); 4406 1.1 riastrad table->initialState.levels[0].sclk.vCG_SPLL_FUNC_CNTL_3 = 4407 1.1 riastrad cpu_to_be32(si_pi->clock_registers.cg_spll_func_cntl_3); 4408 1.1 riastrad table->initialState.levels[0].sclk.vCG_SPLL_FUNC_CNTL_4 = 4409 1.1 riastrad cpu_to_be32(si_pi->clock_registers.cg_spll_func_cntl_4); 4410 1.1 riastrad table->initialState.levels[0].sclk.vCG_SPLL_SPREAD_SPECTRUM = 4411 1.1 riastrad cpu_to_be32(si_pi->clock_registers.cg_spll_spread_spectrum); 4412 1.1 riastrad table->initialState.levels[0].sclk.vCG_SPLL_SPREAD_SPECTRUM_2 = 4413 1.1 riastrad cpu_to_be32(si_pi->clock_registers.cg_spll_spread_spectrum_2); 4414 1.1 riastrad 4415 1.1 riastrad table->initialState.levels[0].sclk.sclk_value = 4416 1.1 riastrad cpu_to_be32(initial_state->performance_levels[0].sclk); 4417 1.1 riastrad 4418 1.1 riastrad table->initialState.levels[0].arbRefreshState = 4419 1.1 riastrad SISLANDS_INITIAL_STATE_ARB_INDEX; 4420 1.1 riastrad 4421 1.1 riastrad table->initialState.levels[0].ACIndex = 0; 4422 1.1 riastrad 4423 1.1 riastrad ret = si_populate_voltage_value(rdev, &eg_pi->vddc_voltage_table, 4424 1.1 riastrad initial_state->performance_levels[0].vddc, 4425 1.1 riastrad &table->initialState.levels[0].vddc); 4426 1.1 riastrad 4427 1.1 riastrad if (!ret) { 4428 1.1 riastrad u16 std_vddc; 4429 1.1 riastrad 4430 1.1 riastrad ret = si_get_std_voltage_value(rdev, 4431 1.1 riastrad &table->initialState.levels[0].vddc, 4432 1.1 riastrad &std_vddc); 4433 1.1 riastrad if (!ret) 4434 1.1 riastrad si_populate_std_voltage_value(rdev, std_vddc, 4435 1.1 riastrad table->initialState.levels[0].vddc.index, 4436 1.1 riastrad &table->initialState.levels[0].std_vddc); 4437 1.1 riastrad } 4438 1.1 riastrad 4439 1.1 riastrad if (eg_pi->vddci_control) 4440 1.1 riastrad si_populate_voltage_value(rdev, 4441 1.1 riastrad &eg_pi->vddci_voltage_table, 4442 1.1 riastrad initial_state->performance_levels[0].vddci, 4443 1.1 riastrad &table->initialState.levels[0].vddci); 4444 1.1 riastrad 4445 1.1 riastrad if (si_pi->vddc_phase_shed_control) 4446 1.1 riastrad si_populate_phase_shedding_value(rdev, 4447 1.1 riastrad &rdev->pm.dpm.dyn_state.phase_shedding_limits_table, 4448 1.1 riastrad initial_state->performance_levels[0].vddc, 4449 1.1 riastrad initial_state->performance_levels[0].sclk, 4450 1.1 riastrad initial_state->performance_levels[0].mclk, 4451 1.1 riastrad &table->initialState.levels[0].vddc); 4452 1.1 riastrad 4453 1.1 riastrad si_populate_initial_mvdd_value(rdev, &table->initialState.levels[0].mvdd); 4454 1.1 riastrad 4455 1.1 riastrad reg = CG_R(0xffff) | CG_L(0); 4456 1.1 riastrad table->initialState.levels[0].aT = cpu_to_be32(reg); 4457 1.1 riastrad 4458 1.1 riastrad table->initialState.levels[0].bSP = cpu_to_be32(pi->dsp); 4459 1.1 riastrad 4460 1.1 riastrad table->initialState.levels[0].gen2PCIE = (u8)si_pi->boot_pcie_gen; 4461 1.1 riastrad 4462 1.1 riastrad if (pi->mem_gddr5) { 4463 1.1 riastrad table->initialState.levels[0].strobeMode = 4464 1.1 riastrad si_get_strobe_mode_settings(rdev, 4465 1.1 riastrad initial_state->performance_levels[0].mclk); 4466 1.1 riastrad 4467 1.1 riastrad if (initial_state->performance_levels[0].mclk > pi->mclk_edc_enable_threshold) 4468 1.1 riastrad table->initialState.levels[0].mcFlags = SISLANDS_SMC_MC_EDC_RD_FLAG | SISLANDS_SMC_MC_EDC_WR_FLAG; 4469 1.1 riastrad else 4470 1.1 riastrad table->initialState.levels[0].mcFlags = 0; 4471 1.1 riastrad } 4472 1.1 riastrad 4473 1.1 riastrad table->initialState.levelCount = 1; 4474 1.1 riastrad 4475 1.1 riastrad table->initialState.flags |= PPSMC_SWSTATE_FLAG_DC; 4476 1.1 riastrad 4477 1.1 riastrad table->initialState.levels[0].dpm2.MaxPS = 0; 4478 1.1 riastrad table->initialState.levels[0].dpm2.NearTDPDec = 0; 4479 1.1 riastrad table->initialState.levels[0].dpm2.AboveSafeInc = 0; 4480 1.1 riastrad table->initialState.levels[0].dpm2.BelowSafeInc = 0; 4481 1.1 riastrad table->initialState.levels[0].dpm2.PwrEfficiencyRatio = 0; 4482 1.1 riastrad 4483 1.1 riastrad reg = MIN_POWER_MASK | MAX_POWER_MASK; 4484 1.1 riastrad table->initialState.levels[0].SQPowerThrottle = cpu_to_be32(reg); 4485 1.1 riastrad 4486 1.1 riastrad reg = MAX_POWER_DELTA_MASK | STI_SIZE_MASK | LTI_RATIO_MASK; 4487 1.1 riastrad table->initialState.levels[0].SQPowerThrottle_2 = cpu_to_be32(reg); 4488 1.1 riastrad 4489 1.1 riastrad return 0; 4490 1.1 riastrad } 4491 1.1 riastrad 4492 1.1 riastrad static int si_populate_smc_acpi_state(struct radeon_device *rdev, 4493 1.1 riastrad SISLANDS_SMC_STATETABLE *table) 4494 1.1 riastrad { 4495 1.1 riastrad struct rv7xx_power_info *pi = rv770_get_pi(rdev); 4496 1.1 riastrad struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); 4497 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 4498 1.1 riastrad u32 spll_func_cntl = si_pi->clock_registers.cg_spll_func_cntl; 4499 1.1 riastrad u32 spll_func_cntl_2 = si_pi->clock_registers.cg_spll_func_cntl_2; 4500 1.1 riastrad u32 spll_func_cntl_3 = si_pi->clock_registers.cg_spll_func_cntl_3; 4501 1.1 riastrad u32 spll_func_cntl_4 = si_pi->clock_registers.cg_spll_func_cntl_4; 4502 1.1 riastrad u32 dll_cntl = si_pi->clock_registers.dll_cntl; 4503 1.1 riastrad u32 mclk_pwrmgt_cntl = si_pi->clock_registers.mclk_pwrmgt_cntl; 4504 1.1 riastrad u32 mpll_ad_func_cntl = si_pi->clock_registers.mpll_ad_func_cntl; 4505 1.1 riastrad u32 mpll_dq_func_cntl = si_pi->clock_registers.mpll_dq_func_cntl; 4506 1.1 riastrad u32 mpll_func_cntl = si_pi->clock_registers.mpll_func_cntl; 4507 1.1 riastrad u32 mpll_func_cntl_1 = si_pi->clock_registers.mpll_func_cntl_1; 4508 1.1 riastrad u32 mpll_func_cntl_2 = si_pi->clock_registers.mpll_func_cntl_2; 4509 1.1 riastrad u32 reg; 4510 1.1 riastrad int ret; 4511 1.1 riastrad 4512 1.1 riastrad table->ACPIState = table->initialState; 4513 1.1 riastrad 4514 1.1 riastrad table->ACPIState.flags &= ~PPSMC_SWSTATE_FLAG_DC; 4515 1.1 riastrad 4516 1.1 riastrad if (pi->acpi_vddc) { 4517 1.1 riastrad ret = si_populate_voltage_value(rdev, &eg_pi->vddc_voltage_table, 4518 1.1 riastrad pi->acpi_vddc, &table->ACPIState.levels[0].vddc); 4519 1.1 riastrad if (!ret) { 4520 1.1 riastrad u16 std_vddc; 4521 1.1 riastrad 4522 1.1 riastrad ret = si_get_std_voltage_value(rdev, 4523 1.1 riastrad &table->ACPIState.levels[0].vddc, &std_vddc); 4524 1.1 riastrad if (!ret) 4525 1.1 riastrad si_populate_std_voltage_value(rdev, std_vddc, 4526 1.1 riastrad table->ACPIState.levels[0].vddc.index, 4527 1.1 riastrad &table->ACPIState.levels[0].std_vddc); 4528 1.1 riastrad } 4529 1.1 riastrad table->ACPIState.levels[0].gen2PCIE = si_pi->acpi_pcie_gen; 4530 1.1 riastrad 4531 1.1 riastrad if (si_pi->vddc_phase_shed_control) { 4532 1.1 riastrad si_populate_phase_shedding_value(rdev, 4533 1.1 riastrad &rdev->pm.dpm.dyn_state.phase_shedding_limits_table, 4534 1.1 riastrad pi->acpi_vddc, 4535 1.1 riastrad 0, 4536 1.1 riastrad 0, 4537 1.1 riastrad &table->ACPIState.levels[0].vddc); 4538 1.1 riastrad } 4539 1.1 riastrad } else { 4540 1.1 riastrad ret = si_populate_voltage_value(rdev, &eg_pi->vddc_voltage_table, 4541 1.1 riastrad pi->min_vddc_in_table, &table->ACPIState.levels[0].vddc); 4542 1.1 riastrad if (!ret) { 4543 1.1 riastrad u16 std_vddc; 4544 1.1 riastrad 4545 1.1 riastrad ret = si_get_std_voltage_value(rdev, 4546 1.1 riastrad &table->ACPIState.levels[0].vddc, &std_vddc); 4547 1.1 riastrad 4548 1.1 riastrad if (!ret) 4549 1.1 riastrad si_populate_std_voltage_value(rdev, std_vddc, 4550 1.1 riastrad table->ACPIState.levels[0].vddc.index, 4551 1.1 riastrad &table->ACPIState.levels[0].std_vddc); 4552 1.1 riastrad } 4553 1.1 riastrad table->ACPIState.levels[0].gen2PCIE = (u8)r600_get_pcie_gen_support(rdev, 4554 1.1 riastrad si_pi->sys_pcie_mask, 4555 1.1 riastrad si_pi->boot_pcie_gen, 4556 1.1 riastrad RADEON_PCIE_GEN1); 4557 1.1 riastrad 4558 1.1 riastrad if (si_pi->vddc_phase_shed_control) 4559 1.1 riastrad si_populate_phase_shedding_value(rdev, 4560 1.1 riastrad &rdev->pm.dpm.dyn_state.phase_shedding_limits_table, 4561 1.1 riastrad pi->min_vddc_in_table, 4562 1.1 riastrad 0, 4563 1.1 riastrad 0, 4564 1.1 riastrad &table->ACPIState.levels[0].vddc); 4565 1.1 riastrad } 4566 1.1 riastrad 4567 1.1 riastrad if (pi->acpi_vddc) { 4568 1.1 riastrad if (eg_pi->acpi_vddci) 4569 1.1 riastrad si_populate_voltage_value(rdev, &eg_pi->vddci_voltage_table, 4570 1.1 riastrad eg_pi->acpi_vddci, 4571 1.1 riastrad &table->ACPIState.levels[0].vddci); 4572 1.1 riastrad } 4573 1.1 riastrad 4574 1.1 riastrad mclk_pwrmgt_cntl |= MRDCK0_RESET | MRDCK1_RESET; 4575 1.1 riastrad mclk_pwrmgt_cntl &= ~(MRDCK0_PDNB | MRDCK1_PDNB); 4576 1.1 riastrad 4577 1.1 riastrad dll_cntl &= ~(MRDCK0_BYPASS | MRDCK1_BYPASS); 4578 1.1 riastrad 4579 1.1 riastrad spll_func_cntl_2 &= ~SCLK_MUX_SEL_MASK; 4580 1.1 riastrad spll_func_cntl_2 |= SCLK_MUX_SEL(4); 4581 1.1 riastrad 4582 1.1 riastrad table->ACPIState.levels[0].mclk.vDLL_CNTL = 4583 1.1 riastrad cpu_to_be32(dll_cntl); 4584 1.1 riastrad table->ACPIState.levels[0].mclk.vMCLK_PWRMGT_CNTL = 4585 1.1 riastrad cpu_to_be32(mclk_pwrmgt_cntl); 4586 1.1 riastrad table->ACPIState.levels[0].mclk.vMPLL_AD_FUNC_CNTL = 4587 1.1 riastrad cpu_to_be32(mpll_ad_func_cntl); 4588 1.1 riastrad table->ACPIState.levels[0].mclk.vMPLL_DQ_FUNC_CNTL = 4589 1.1 riastrad cpu_to_be32(mpll_dq_func_cntl); 4590 1.1 riastrad table->ACPIState.levels[0].mclk.vMPLL_FUNC_CNTL = 4591 1.1 riastrad cpu_to_be32(mpll_func_cntl); 4592 1.1 riastrad table->ACPIState.levels[0].mclk.vMPLL_FUNC_CNTL_1 = 4593 1.1 riastrad cpu_to_be32(mpll_func_cntl_1); 4594 1.1 riastrad table->ACPIState.levels[0].mclk.vMPLL_FUNC_CNTL_2 = 4595 1.1 riastrad cpu_to_be32(mpll_func_cntl_2); 4596 1.1 riastrad table->ACPIState.levels[0].mclk.vMPLL_SS = 4597 1.1 riastrad cpu_to_be32(si_pi->clock_registers.mpll_ss1); 4598 1.1 riastrad table->ACPIState.levels[0].mclk.vMPLL_SS2 = 4599 1.1 riastrad cpu_to_be32(si_pi->clock_registers.mpll_ss2); 4600 1.1 riastrad 4601 1.1 riastrad table->ACPIState.levels[0].sclk.vCG_SPLL_FUNC_CNTL = 4602 1.1 riastrad cpu_to_be32(spll_func_cntl); 4603 1.1 riastrad table->ACPIState.levels[0].sclk.vCG_SPLL_FUNC_CNTL_2 = 4604 1.1 riastrad cpu_to_be32(spll_func_cntl_2); 4605 1.1 riastrad table->ACPIState.levels[0].sclk.vCG_SPLL_FUNC_CNTL_3 = 4606 1.1 riastrad cpu_to_be32(spll_func_cntl_3); 4607 1.1 riastrad table->ACPIState.levels[0].sclk.vCG_SPLL_FUNC_CNTL_4 = 4608 1.1 riastrad cpu_to_be32(spll_func_cntl_4); 4609 1.1 riastrad 4610 1.1 riastrad table->ACPIState.levels[0].mclk.mclk_value = 0; 4611 1.1 riastrad table->ACPIState.levels[0].sclk.sclk_value = 0; 4612 1.1 riastrad 4613 1.1 riastrad si_populate_mvdd_value(rdev, 0, &table->ACPIState.levels[0].mvdd); 4614 1.1 riastrad 4615 1.1 riastrad if (eg_pi->dynamic_ac_timing) 4616 1.1 riastrad table->ACPIState.levels[0].ACIndex = 0; 4617 1.1 riastrad 4618 1.1 riastrad table->ACPIState.levels[0].dpm2.MaxPS = 0; 4619 1.1 riastrad table->ACPIState.levels[0].dpm2.NearTDPDec = 0; 4620 1.1 riastrad table->ACPIState.levels[0].dpm2.AboveSafeInc = 0; 4621 1.1 riastrad table->ACPIState.levels[0].dpm2.BelowSafeInc = 0; 4622 1.1 riastrad table->ACPIState.levels[0].dpm2.PwrEfficiencyRatio = 0; 4623 1.1 riastrad 4624 1.1 riastrad reg = MIN_POWER_MASK | MAX_POWER_MASK; 4625 1.1 riastrad table->ACPIState.levels[0].SQPowerThrottle = cpu_to_be32(reg); 4626 1.1 riastrad 4627 1.1 riastrad reg = MAX_POWER_DELTA_MASK | STI_SIZE_MASK | LTI_RATIO_MASK; 4628 1.1 riastrad table->ACPIState.levels[0].SQPowerThrottle_2 = cpu_to_be32(reg); 4629 1.1 riastrad 4630 1.1 riastrad return 0; 4631 1.1 riastrad } 4632 1.1 riastrad 4633 1.1 riastrad static int si_populate_ulv_state(struct radeon_device *rdev, 4634 1.1 riastrad SISLANDS_SMC_SWSTATE *state) 4635 1.1 riastrad { 4636 1.1 riastrad struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); 4637 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 4638 1.1 riastrad struct si_ulv_param *ulv = &si_pi->ulv; 4639 1.1 riastrad u32 sclk_in_sr = 1350; /* ??? */ 4640 1.1 riastrad int ret; 4641 1.1 riastrad 4642 1.1 riastrad ret = si_convert_power_level_to_smc(rdev, &ulv->pl, 4643 1.1 riastrad &state->levels[0]); 4644 1.1 riastrad if (!ret) { 4645 1.1 riastrad if (eg_pi->sclk_deep_sleep) { 4646 1.1 riastrad if (sclk_in_sr <= SCLK_MIN_DEEPSLEEP_FREQ) 4647 1.1 riastrad state->levels[0].stateFlags |= PPSMC_STATEFLAG_DEEPSLEEP_BYPASS; 4648 1.1 riastrad else 4649 1.1 riastrad state->levels[0].stateFlags |= PPSMC_STATEFLAG_DEEPSLEEP_THROTTLE; 4650 1.1 riastrad } 4651 1.1 riastrad if (ulv->one_pcie_lane_in_ulv) 4652 1.1 riastrad state->flags |= PPSMC_SWSTATE_FLAG_PCIE_X1; 4653 1.1 riastrad state->levels[0].arbRefreshState = (u8)(SISLANDS_ULV_STATE_ARB_INDEX); 4654 1.1 riastrad state->levels[0].ACIndex = 1; 4655 1.1 riastrad state->levels[0].std_vddc = state->levels[0].vddc; 4656 1.1 riastrad state->levelCount = 1; 4657 1.1 riastrad 4658 1.1 riastrad state->flags |= PPSMC_SWSTATE_FLAG_DC; 4659 1.1 riastrad } 4660 1.1 riastrad 4661 1.1 riastrad return ret; 4662 1.1 riastrad } 4663 1.1 riastrad 4664 1.1 riastrad static int si_program_ulv_memory_timing_parameters(struct radeon_device *rdev) 4665 1.1 riastrad { 4666 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 4667 1.1 riastrad struct si_ulv_param *ulv = &si_pi->ulv; 4668 1.1 riastrad SMC_SIslands_MCArbDramTimingRegisterSet arb_regs = { 0 }; 4669 1.1 riastrad int ret; 4670 1.1 riastrad 4671 1.1 riastrad ret = si_populate_memory_timing_parameters(rdev, &ulv->pl, 4672 1.1 riastrad &arb_regs); 4673 1.1 riastrad if (ret) 4674 1.1 riastrad return ret; 4675 1.1 riastrad 4676 1.1 riastrad si_write_smc_soft_register(rdev, SI_SMC_SOFT_REGISTER_ulv_volt_change_delay, 4677 1.1 riastrad ulv->volt_change_delay); 4678 1.1 riastrad 4679 1.1 riastrad ret = si_copy_bytes_to_smc(rdev, 4680 1.1 riastrad si_pi->arb_table_start + 4681 1.1 riastrad offsetof(SMC_SIslands_MCArbDramTimingRegisters, data) + 4682 1.1 riastrad sizeof(SMC_SIslands_MCArbDramTimingRegisterSet) * SISLANDS_ULV_STATE_ARB_INDEX, 4683 1.1 riastrad (u8 *)&arb_regs, 4684 1.1 riastrad sizeof(SMC_SIslands_MCArbDramTimingRegisterSet), 4685 1.1 riastrad si_pi->sram_end); 4686 1.1 riastrad 4687 1.1 riastrad return ret; 4688 1.1 riastrad } 4689 1.1 riastrad 4690 1.1 riastrad static void si_get_mvdd_configuration(struct radeon_device *rdev) 4691 1.1 riastrad { 4692 1.1 riastrad struct rv7xx_power_info *pi = rv770_get_pi(rdev); 4693 1.1 riastrad 4694 1.1 riastrad pi->mvdd_split_frequency = 30000; 4695 1.1 riastrad } 4696 1.1 riastrad 4697 1.1 riastrad static int si_init_smc_table(struct radeon_device *rdev) 4698 1.1 riastrad { 4699 1.1 riastrad struct rv7xx_power_info *pi = rv770_get_pi(rdev); 4700 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 4701 1.1 riastrad struct radeon_ps *radeon_boot_state = rdev->pm.dpm.boot_ps; 4702 1.1 riastrad const struct si_ulv_param *ulv = &si_pi->ulv; 4703 1.1 riastrad SISLANDS_SMC_STATETABLE *table = &si_pi->smc_statetable; 4704 1.1 riastrad int ret; 4705 1.1 riastrad u32 lane_width; 4706 1.1 riastrad u32 vr_hot_gpio; 4707 1.1 riastrad 4708 1.1 riastrad si_populate_smc_voltage_tables(rdev, table); 4709 1.1 riastrad 4710 1.1 riastrad switch (rdev->pm.int_thermal_type) { 4711 1.1 riastrad case THERMAL_TYPE_SI: 4712 1.1 riastrad case THERMAL_TYPE_EMC2103_WITH_INTERNAL: 4713 1.1 riastrad table->thermalProtectType = PPSMC_THERMAL_PROTECT_TYPE_INTERNAL; 4714 1.1 riastrad break; 4715 1.1 riastrad case THERMAL_TYPE_NONE: 4716 1.1 riastrad table->thermalProtectType = PPSMC_THERMAL_PROTECT_TYPE_NONE; 4717 1.1 riastrad break; 4718 1.1 riastrad default: 4719 1.1 riastrad table->thermalProtectType = PPSMC_THERMAL_PROTECT_TYPE_EXTERNAL; 4720 1.1 riastrad break; 4721 1.1 riastrad } 4722 1.1 riastrad 4723 1.1 riastrad if (rdev->pm.dpm.platform_caps & ATOM_PP_PLATFORM_CAP_HARDWAREDC) 4724 1.1 riastrad table->systemFlags |= PPSMC_SYSTEMFLAG_GPIO_DC; 4725 1.1 riastrad 4726 1.1 riastrad if (rdev->pm.dpm.platform_caps & ATOM_PP_PLATFORM_CAP_REGULATOR_HOT) { 4727 1.1 riastrad if ((rdev->pdev->device != 0x6818) && (rdev->pdev->device != 0x6819)) 4728 1.1 riastrad table->systemFlags |= PPSMC_SYSTEMFLAG_REGULATOR_HOT; 4729 1.1 riastrad } 4730 1.1 riastrad 4731 1.1 riastrad if (rdev->pm.dpm.platform_caps & ATOM_PP_PLATFORM_CAP_STEPVDDC) 4732 1.1 riastrad table->systemFlags |= PPSMC_SYSTEMFLAG_STEPVDDC; 4733 1.1 riastrad 4734 1.1 riastrad if (pi->mem_gddr5) 4735 1.1 riastrad table->systemFlags |= PPSMC_SYSTEMFLAG_GDDR5; 4736 1.1 riastrad 4737 1.1 riastrad if (rdev->pm.dpm.platform_caps & ATOM_PP_PLATFORM_CAP_REVERT_GPIO5_POLARITY) 4738 1.1 riastrad table->extraFlags |= PPSMC_EXTRAFLAGS_AC2DC_GPIO5_POLARITY_HIGH; 4739 1.1 riastrad 4740 1.1 riastrad if (rdev->pm.dpm.platform_caps & ATOM_PP_PLATFORM_CAP_VRHOT_GPIO_CONFIGURABLE) { 4741 1.1 riastrad table->systemFlags |= PPSMC_SYSTEMFLAG_REGULATOR_HOT_PROG_GPIO; 4742 1.1 riastrad vr_hot_gpio = rdev->pm.dpm.backbias_response_time; 4743 1.1 riastrad si_write_smc_soft_register(rdev, SI_SMC_SOFT_REGISTER_vr_hot_gpio, 4744 1.1 riastrad vr_hot_gpio); 4745 1.1 riastrad } 4746 1.1 riastrad 4747 1.1 riastrad ret = si_populate_smc_initial_state(rdev, radeon_boot_state, table); 4748 1.1 riastrad if (ret) 4749 1.1 riastrad return ret; 4750 1.1 riastrad 4751 1.1 riastrad ret = si_populate_smc_acpi_state(rdev, table); 4752 1.1 riastrad if (ret) 4753 1.1 riastrad return ret; 4754 1.1 riastrad 4755 1.1 riastrad table->driverState = table->initialState; 4756 1.1 riastrad 4757 1.1 riastrad ret = si_do_program_memory_timing_parameters(rdev, radeon_boot_state, 4758 1.1 riastrad SISLANDS_INITIAL_STATE_ARB_INDEX); 4759 1.1 riastrad if (ret) 4760 1.1 riastrad return ret; 4761 1.1 riastrad 4762 1.1 riastrad if (ulv->supported && ulv->pl.vddc) { 4763 1.1 riastrad ret = si_populate_ulv_state(rdev, &table->ULVState); 4764 1.1 riastrad if (ret) 4765 1.1 riastrad return ret; 4766 1.1 riastrad 4767 1.1 riastrad ret = si_program_ulv_memory_timing_parameters(rdev); 4768 1.1 riastrad if (ret) 4769 1.1 riastrad return ret; 4770 1.1 riastrad 4771 1.1 riastrad WREG32(CG_ULV_CONTROL, ulv->cg_ulv_control); 4772 1.1 riastrad WREG32(CG_ULV_PARAMETER, ulv->cg_ulv_parameter); 4773 1.1 riastrad 4774 1.1 riastrad lane_width = radeon_get_pcie_lanes(rdev); 4775 1.1 riastrad si_write_smc_soft_register(rdev, SI_SMC_SOFT_REGISTER_non_ulv_pcie_link_width, lane_width); 4776 1.1 riastrad } else { 4777 1.1 riastrad table->ULVState = table->initialState; 4778 1.1 riastrad } 4779 1.1 riastrad 4780 1.1 riastrad return si_copy_bytes_to_smc(rdev, si_pi->state_table_start, 4781 1.1 riastrad (u8 *)table, sizeof(SISLANDS_SMC_STATETABLE), 4782 1.1 riastrad si_pi->sram_end); 4783 1.1 riastrad } 4784 1.1 riastrad 4785 1.1 riastrad static int si_calculate_sclk_params(struct radeon_device *rdev, 4786 1.1 riastrad u32 engine_clock, 4787 1.1 riastrad SISLANDS_SMC_SCLK_VALUE *sclk) 4788 1.1 riastrad { 4789 1.1 riastrad struct rv7xx_power_info *pi = rv770_get_pi(rdev); 4790 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 4791 1.1 riastrad struct atom_clock_dividers dividers; 4792 1.1 riastrad u32 spll_func_cntl = si_pi->clock_registers.cg_spll_func_cntl; 4793 1.1 riastrad u32 spll_func_cntl_2 = si_pi->clock_registers.cg_spll_func_cntl_2; 4794 1.1 riastrad u32 spll_func_cntl_3 = si_pi->clock_registers.cg_spll_func_cntl_3; 4795 1.1 riastrad u32 spll_func_cntl_4 = si_pi->clock_registers.cg_spll_func_cntl_4; 4796 1.1 riastrad u32 cg_spll_spread_spectrum = si_pi->clock_registers.cg_spll_spread_spectrum; 4797 1.1 riastrad u32 cg_spll_spread_spectrum_2 = si_pi->clock_registers.cg_spll_spread_spectrum_2; 4798 1.1 riastrad u64 tmp; 4799 1.1 riastrad u32 reference_clock = rdev->clock.spll.reference_freq; 4800 1.1 riastrad u32 reference_divider; 4801 1.1 riastrad u32 fbdiv; 4802 1.1 riastrad int ret; 4803 1.1 riastrad 4804 1.1 riastrad ret = radeon_atom_get_clock_dividers(rdev, COMPUTE_ENGINE_PLL_PARAM, 4805 1.1 riastrad engine_clock, false, ÷rs); 4806 1.1 riastrad if (ret) 4807 1.1 riastrad return ret; 4808 1.1 riastrad 4809 1.1 riastrad reference_divider = 1 + dividers.ref_div; 4810 1.1 riastrad 4811 1.1 riastrad tmp = (u64) engine_clock * reference_divider * dividers.post_div * 16384; 4812 1.1 riastrad do_div(tmp, reference_clock); 4813 1.1 riastrad fbdiv = (u32) tmp; 4814 1.1 riastrad 4815 1.1 riastrad spll_func_cntl &= ~(SPLL_PDIV_A_MASK | SPLL_REF_DIV_MASK); 4816 1.1 riastrad spll_func_cntl |= SPLL_REF_DIV(dividers.ref_div); 4817 1.1 riastrad spll_func_cntl |= SPLL_PDIV_A(dividers.post_div); 4818 1.1 riastrad 4819 1.1 riastrad spll_func_cntl_2 &= ~SCLK_MUX_SEL_MASK; 4820 1.1 riastrad spll_func_cntl_2 |= SCLK_MUX_SEL(2); 4821 1.1 riastrad 4822 1.5 riastrad spll_func_cntl_3 &= ~SPLL_FB_DIV_MASK; 4823 1.5 riastrad spll_func_cntl_3 |= SPLL_FB_DIV(fbdiv); 4824 1.5 riastrad spll_func_cntl_3 |= SPLL_DITHEN; 4825 1.1 riastrad 4826 1.1 riastrad if (pi->sclk_ss) { 4827 1.1 riastrad struct radeon_atom_ss ss; 4828 1.1 riastrad u32 vco_freq = engine_clock * dividers.post_div; 4829 1.1 riastrad 4830 1.1 riastrad if (radeon_atombios_get_asic_ss_info(rdev, &ss, 4831 1.1 riastrad ASIC_INTERNAL_ENGINE_SS, vco_freq)) { 4832 1.1 riastrad u32 clk_s = reference_clock * 5 / (reference_divider * ss.rate); 4833 1.1 riastrad u32 clk_v = 4 * ss.percentage * fbdiv / (clk_s * 10000); 4834 1.1 riastrad 4835 1.1 riastrad cg_spll_spread_spectrum &= ~CLK_S_MASK; 4836 1.1 riastrad cg_spll_spread_spectrum |= CLK_S(clk_s); 4837 1.1 riastrad cg_spll_spread_spectrum |= SSEN; 4838 1.1 riastrad 4839 1.1 riastrad cg_spll_spread_spectrum_2 &= ~CLK_V_MASK; 4840 1.1 riastrad cg_spll_spread_spectrum_2 |= CLK_V(clk_v); 4841 1.1 riastrad } 4842 1.1 riastrad } 4843 1.1 riastrad 4844 1.1 riastrad sclk->sclk_value = engine_clock; 4845 1.1 riastrad sclk->vCG_SPLL_FUNC_CNTL = spll_func_cntl; 4846 1.1 riastrad sclk->vCG_SPLL_FUNC_CNTL_2 = spll_func_cntl_2; 4847 1.1 riastrad sclk->vCG_SPLL_FUNC_CNTL_3 = spll_func_cntl_3; 4848 1.1 riastrad sclk->vCG_SPLL_FUNC_CNTL_4 = spll_func_cntl_4; 4849 1.1 riastrad sclk->vCG_SPLL_SPREAD_SPECTRUM = cg_spll_spread_spectrum; 4850 1.1 riastrad sclk->vCG_SPLL_SPREAD_SPECTRUM_2 = cg_spll_spread_spectrum_2; 4851 1.1 riastrad 4852 1.1 riastrad return 0; 4853 1.1 riastrad } 4854 1.1 riastrad 4855 1.1 riastrad static int si_populate_sclk_value(struct radeon_device *rdev, 4856 1.1 riastrad u32 engine_clock, 4857 1.1 riastrad SISLANDS_SMC_SCLK_VALUE *sclk) 4858 1.1 riastrad { 4859 1.1 riastrad SISLANDS_SMC_SCLK_VALUE sclk_tmp; 4860 1.1 riastrad int ret; 4861 1.1 riastrad 4862 1.1 riastrad ret = si_calculate_sclk_params(rdev, engine_clock, &sclk_tmp); 4863 1.1 riastrad if (!ret) { 4864 1.1 riastrad sclk->sclk_value = cpu_to_be32(sclk_tmp.sclk_value); 4865 1.1 riastrad sclk->vCG_SPLL_FUNC_CNTL = cpu_to_be32(sclk_tmp.vCG_SPLL_FUNC_CNTL); 4866 1.1 riastrad sclk->vCG_SPLL_FUNC_CNTL_2 = cpu_to_be32(sclk_tmp.vCG_SPLL_FUNC_CNTL_2); 4867 1.1 riastrad sclk->vCG_SPLL_FUNC_CNTL_3 = cpu_to_be32(sclk_tmp.vCG_SPLL_FUNC_CNTL_3); 4868 1.1 riastrad sclk->vCG_SPLL_FUNC_CNTL_4 = cpu_to_be32(sclk_tmp.vCG_SPLL_FUNC_CNTL_4); 4869 1.1 riastrad sclk->vCG_SPLL_SPREAD_SPECTRUM = cpu_to_be32(sclk_tmp.vCG_SPLL_SPREAD_SPECTRUM); 4870 1.1 riastrad sclk->vCG_SPLL_SPREAD_SPECTRUM_2 = cpu_to_be32(sclk_tmp.vCG_SPLL_SPREAD_SPECTRUM_2); 4871 1.1 riastrad } 4872 1.1 riastrad 4873 1.1 riastrad return ret; 4874 1.1 riastrad } 4875 1.1 riastrad 4876 1.1 riastrad static int si_populate_mclk_value(struct radeon_device *rdev, 4877 1.1 riastrad u32 engine_clock, 4878 1.1 riastrad u32 memory_clock, 4879 1.1 riastrad SISLANDS_SMC_MCLK_VALUE *mclk, 4880 1.1 riastrad bool strobe_mode, 4881 1.1 riastrad bool dll_state_on) 4882 1.1 riastrad { 4883 1.1 riastrad struct rv7xx_power_info *pi = rv770_get_pi(rdev); 4884 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 4885 1.1 riastrad u32 dll_cntl = si_pi->clock_registers.dll_cntl; 4886 1.1 riastrad u32 mclk_pwrmgt_cntl = si_pi->clock_registers.mclk_pwrmgt_cntl; 4887 1.1 riastrad u32 mpll_ad_func_cntl = si_pi->clock_registers.mpll_ad_func_cntl; 4888 1.1 riastrad u32 mpll_dq_func_cntl = si_pi->clock_registers.mpll_dq_func_cntl; 4889 1.1 riastrad u32 mpll_func_cntl = si_pi->clock_registers.mpll_func_cntl; 4890 1.1 riastrad u32 mpll_func_cntl_1 = si_pi->clock_registers.mpll_func_cntl_1; 4891 1.1 riastrad u32 mpll_func_cntl_2 = si_pi->clock_registers.mpll_func_cntl_2; 4892 1.1 riastrad u32 mpll_ss1 = si_pi->clock_registers.mpll_ss1; 4893 1.1 riastrad u32 mpll_ss2 = si_pi->clock_registers.mpll_ss2; 4894 1.1 riastrad struct atom_mpll_param mpll_param; 4895 1.1 riastrad int ret; 4896 1.1 riastrad 4897 1.1 riastrad ret = radeon_atom_get_memory_pll_dividers(rdev, memory_clock, strobe_mode, &mpll_param); 4898 1.1 riastrad if (ret) 4899 1.1 riastrad return ret; 4900 1.1 riastrad 4901 1.1 riastrad mpll_func_cntl &= ~BWCTRL_MASK; 4902 1.1 riastrad mpll_func_cntl |= BWCTRL(mpll_param.bwcntl); 4903 1.1 riastrad 4904 1.1 riastrad mpll_func_cntl_1 &= ~(CLKF_MASK | CLKFRAC_MASK | VCO_MODE_MASK); 4905 1.1 riastrad mpll_func_cntl_1 |= CLKF(mpll_param.clkf) | 4906 1.1 riastrad CLKFRAC(mpll_param.clkfrac) | VCO_MODE(mpll_param.vco_mode); 4907 1.1 riastrad 4908 1.1 riastrad mpll_ad_func_cntl &= ~YCLK_POST_DIV_MASK; 4909 1.1 riastrad mpll_ad_func_cntl |= YCLK_POST_DIV(mpll_param.post_div); 4910 1.1 riastrad 4911 1.1 riastrad if (pi->mem_gddr5) { 4912 1.1 riastrad mpll_dq_func_cntl &= ~(YCLK_SEL_MASK | YCLK_POST_DIV_MASK); 4913 1.1 riastrad mpll_dq_func_cntl |= YCLK_SEL(mpll_param.yclk_sel) | 4914 1.1 riastrad YCLK_POST_DIV(mpll_param.post_div); 4915 1.1 riastrad } 4916 1.1 riastrad 4917 1.1 riastrad if (pi->mclk_ss) { 4918 1.1 riastrad struct radeon_atom_ss ss; 4919 1.1 riastrad u32 freq_nom; 4920 1.1 riastrad u32 tmp; 4921 1.1 riastrad u32 reference_clock = rdev->clock.mpll.reference_freq; 4922 1.1 riastrad 4923 1.1 riastrad if (pi->mem_gddr5) 4924 1.1 riastrad freq_nom = memory_clock * 4; 4925 1.1 riastrad else 4926 1.1 riastrad freq_nom = memory_clock * 2; 4927 1.1 riastrad 4928 1.1 riastrad tmp = freq_nom / reference_clock; 4929 1.1 riastrad tmp = tmp * tmp; 4930 1.1 riastrad if (radeon_atombios_get_asic_ss_info(rdev, &ss, 4931 1.5 riastrad ASIC_INTERNAL_MEMORY_SS, freq_nom)) { 4932 1.1 riastrad u32 clks = reference_clock * 5 / ss.rate; 4933 1.1 riastrad u32 clkv = (u32)((((131 * ss.percentage * ss.rate) / 100) * tmp) / freq_nom); 4934 1.1 riastrad 4935 1.5 riastrad mpll_ss1 &= ~CLKV_MASK; 4936 1.5 riastrad mpll_ss1 |= CLKV(clkv); 4937 1.1 riastrad 4938 1.5 riastrad mpll_ss2 &= ~CLKS_MASK; 4939 1.5 riastrad mpll_ss2 |= CLKS(clks); 4940 1.1 riastrad } 4941 1.1 riastrad } 4942 1.1 riastrad 4943 1.1 riastrad mclk_pwrmgt_cntl &= ~DLL_SPEED_MASK; 4944 1.1 riastrad mclk_pwrmgt_cntl |= DLL_SPEED(mpll_param.dll_speed); 4945 1.1 riastrad 4946 1.1 riastrad if (dll_state_on) 4947 1.1 riastrad mclk_pwrmgt_cntl |= MRDCK0_PDNB | MRDCK1_PDNB; 4948 1.1 riastrad else 4949 1.1 riastrad mclk_pwrmgt_cntl &= ~(MRDCK0_PDNB | MRDCK1_PDNB); 4950 1.1 riastrad 4951 1.1 riastrad mclk->mclk_value = cpu_to_be32(memory_clock); 4952 1.1 riastrad mclk->vMPLL_FUNC_CNTL = cpu_to_be32(mpll_func_cntl); 4953 1.1 riastrad mclk->vMPLL_FUNC_CNTL_1 = cpu_to_be32(mpll_func_cntl_1); 4954 1.1 riastrad mclk->vMPLL_FUNC_CNTL_2 = cpu_to_be32(mpll_func_cntl_2); 4955 1.1 riastrad mclk->vMPLL_AD_FUNC_CNTL = cpu_to_be32(mpll_ad_func_cntl); 4956 1.1 riastrad mclk->vMPLL_DQ_FUNC_CNTL = cpu_to_be32(mpll_dq_func_cntl); 4957 1.1 riastrad mclk->vMCLK_PWRMGT_CNTL = cpu_to_be32(mclk_pwrmgt_cntl); 4958 1.1 riastrad mclk->vDLL_CNTL = cpu_to_be32(dll_cntl); 4959 1.1 riastrad mclk->vMPLL_SS = cpu_to_be32(mpll_ss1); 4960 1.1 riastrad mclk->vMPLL_SS2 = cpu_to_be32(mpll_ss2); 4961 1.1 riastrad 4962 1.1 riastrad return 0; 4963 1.1 riastrad } 4964 1.1 riastrad 4965 1.1 riastrad static void si_populate_smc_sp(struct radeon_device *rdev, 4966 1.1 riastrad struct radeon_ps *radeon_state, 4967 1.1 riastrad SISLANDS_SMC_SWSTATE *smc_state) 4968 1.1 riastrad { 4969 1.1 riastrad struct ni_ps *ps = ni_get_ps(radeon_state); 4970 1.1 riastrad struct rv7xx_power_info *pi = rv770_get_pi(rdev); 4971 1.1 riastrad int i; 4972 1.1 riastrad 4973 1.1 riastrad for (i = 0; i < ps->performance_level_count - 1; i++) 4974 1.1 riastrad smc_state->levels[i].bSP = cpu_to_be32(pi->dsp); 4975 1.1 riastrad 4976 1.1 riastrad smc_state->levels[ps->performance_level_count - 1].bSP = 4977 1.1 riastrad cpu_to_be32(pi->psp); 4978 1.1 riastrad } 4979 1.1 riastrad 4980 1.1 riastrad static int si_convert_power_level_to_smc(struct radeon_device *rdev, 4981 1.1 riastrad struct rv7xx_pl *pl, 4982 1.1 riastrad SISLANDS_SMC_HW_PERFORMANCE_LEVEL *level) 4983 1.1 riastrad { 4984 1.1 riastrad struct rv7xx_power_info *pi = rv770_get_pi(rdev); 4985 1.1 riastrad struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); 4986 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 4987 1.1 riastrad int ret; 4988 1.1 riastrad bool dll_state_on; 4989 1.1 riastrad u16 std_vddc; 4990 1.1 riastrad bool gmc_pg = false; 4991 1.1 riastrad 4992 1.1 riastrad if (eg_pi->pcie_performance_request && 4993 1.1 riastrad (si_pi->force_pcie_gen != RADEON_PCIE_GEN_INVALID)) 4994 1.1 riastrad level->gen2PCIE = (u8)si_pi->force_pcie_gen; 4995 1.1 riastrad else 4996 1.1 riastrad level->gen2PCIE = (u8)pl->pcie_gen; 4997 1.1 riastrad 4998 1.1 riastrad ret = si_populate_sclk_value(rdev, pl->sclk, &level->sclk); 4999 1.1 riastrad if (ret) 5000 1.1 riastrad return ret; 5001 1.1 riastrad 5002 1.1 riastrad level->mcFlags = 0; 5003 1.1 riastrad 5004 1.1 riastrad if (pi->mclk_stutter_mode_threshold && 5005 1.1 riastrad (pl->mclk <= pi->mclk_stutter_mode_threshold) && 5006 1.1 riastrad !eg_pi->uvd_enabled && 5007 1.1 riastrad (RREG32(DPG_PIPE_STUTTER_CONTROL) & STUTTER_ENABLE) && 5008 1.1 riastrad (rdev->pm.dpm.new_active_crtc_count <= 2)) { 5009 1.1 riastrad level->mcFlags |= SISLANDS_SMC_MC_STUTTER_EN; 5010 1.1 riastrad 5011 1.1 riastrad if (gmc_pg) 5012 1.1 riastrad level->mcFlags |= SISLANDS_SMC_MC_PG_EN; 5013 1.1 riastrad } 5014 1.1 riastrad 5015 1.1 riastrad if (pi->mem_gddr5) { 5016 1.1 riastrad if (pl->mclk > pi->mclk_edc_enable_threshold) 5017 1.1 riastrad level->mcFlags |= SISLANDS_SMC_MC_EDC_RD_FLAG; 5018 1.1 riastrad 5019 1.1 riastrad if (pl->mclk > eg_pi->mclk_edc_wr_enable_threshold) 5020 1.1 riastrad level->mcFlags |= SISLANDS_SMC_MC_EDC_WR_FLAG; 5021 1.1 riastrad 5022 1.1 riastrad level->strobeMode = si_get_strobe_mode_settings(rdev, pl->mclk); 5023 1.1 riastrad 5024 1.1 riastrad if (level->strobeMode & SISLANDS_SMC_STROBE_ENABLE) { 5025 1.1 riastrad if (si_get_mclk_frequency_ratio(pl->mclk, true) >= 5026 1.1 riastrad ((RREG32(MC_SEQ_MISC7) >> 16) & 0xf)) 5027 1.1 riastrad dll_state_on = ((RREG32(MC_SEQ_MISC5) >> 1) & 0x1) ? true : false; 5028 1.1 riastrad else 5029 1.1 riastrad dll_state_on = ((RREG32(MC_SEQ_MISC6) >> 1) & 0x1) ? true : false; 5030 1.1 riastrad } else { 5031 1.1 riastrad dll_state_on = false; 5032 1.1 riastrad } 5033 1.1 riastrad } else { 5034 1.1 riastrad level->strobeMode = si_get_strobe_mode_settings(rdev, 5035 1.1 riastrad pl->mclk); 5036 1.1 riastrad 5037 1.1 riastrad dll_state_on = ((RREG32(MC_SEQ_MISC5) >> 1) & 0x1) ? true : false; 5038 1.1 riastrad } 5039 1.1 riastrad 5040 1.1 riastrad ret = si_populate_mclk_value(rdev, 5041 1.1 riastrad pl->sclk, 5042 1.1 riastrad pl->mclk, 5043 1.1 riastrad &level->mclk, 5044 1.1 riastrad (level->strobeMode & SISLANDS_SMC_STROBE_ENABLE) != 0, dll_state_on); 5045 1.1 riastrad if (ret) 5046 1.1 riastrad return ret; 5047 1.1 riastrad 5048 1.1 riastrad ret = si_populate_voltage_value(rdev, 5049 1.1 riastrad &eg_pi->vddc_voltage_table, 5050 1.1 riastrad pl->vddc, &level->vddc); 5051 1.1 riastrad if (ret) 5052 1.1 riastrad return ret; 5053 1.1 riastrad 5054 1.1 riastrad 5055 1.1 riastrad ret = si_get_std_voltage_value(rdev, &level->vddc, &std_vddc); 5056 1.1 riastrad if (ret) 5057 1.1 riastrad return ret; 5058 1.1 riastrad 5059 1.1 riastrad ret = si_populate_std_voltage_value(rdev, std_vddc, 5060 1.1 riastrad level->vddc.index, &level->std_vddc); 5061 1.1 riastrad if (ret) 5062 1.1 riastrad return ret; 5063 1.1 riastrad 5064 1.1 riastrad if (eg_pi->vddci_control) { 5065 1.1 riastrad ret = si_populate_voltage_value(rdev, &eg_pi->vddci_voltage_table, 5066 1.1 riastrad pl->vddci, &level->vddci); 5067 1.1 riastrad if (ret) 5068 1.1 riastrad return ret; 5069 1.1 riastrad } 5070 1.1 riastrad 5071 1.1 riastrad if (si_pi->vddc_phase_shed_control) { 5072 1.1 riastrad ret = si_populate_phase_shedding_value(rdev, 5073 1.1 riastrad &rdev->pm.dpm.dyn_state.phase_shedding_limits_table, 5074 1.1 riastrad pl->vddc, 5075 1.1 riastrad pl->sclk, 5076 1.1 riastrad pl->mclk, 5077 1.1 riastrad &level->vddc); 5078 1.1 riastrad if (ret) 5079 1.1 riastrad return ret; 5080 1.1 riastrad } 5081 1.1 riastrad 5082 1.1 riastrad level->MaxPoweredUpCU = si_pi->max_cu; 5083 1.1 riastrad 5084 1.1 riastrad ret = si_populate_mvdd_value(rdev, pl->mclk, &level->mvdd); 5085 1.1 riastrad 5086 1.1 riastrad return ret; 5087 1.1 riastrad } 5088 1.1 riastrad 5089 1.1 riastrad static int si_populate_smc_t(struct radeon_device *rdev, 5090 1.1 riastrad struct radeon_ps *radeon_state, 5091 1.1 riastrad SISLANDS_SMC_SWSTATE *smc_state) 5092 1.1 riastrad { 5093 1.1 riastrad struct rv7xx_power_info *pi = rv770_get_pi(rdev); 5094 1.1 riastrad struct ni_ps *state = ni_get_ps(radeon_state); 5095 1.1 riastrad u32 a_t; 5096 1.1 riastrad u32 t_l, t_h; 5097 1.1 riastrad u32 high_bsp; 5098 1.1 riastrad int i, ret; 5099 1.1 riastrad 5100 1.1 riastrad if (state->performance_level_count >= 9) 5101 1.1 riastrad return -EINVAL; 5102 1.1 riastrad 5103 1.1 riastrad if (state->performance_level_count < 2) { 5104 1.1 riastrad a_t = CG_R(0xffff) | CG_L(0); 5105 1.1 riastrad smc_state->levels[0].aT = cpu_to_be32(a_t); 5106 1.1 riastrad return 0; 5107 1.1 riastrad } 5108 1.1 riastrad 5109 1.1 riastrad smc_state->levels[0].aT = cpu_to_be32(0); 5110 1.1 riastrad 5111 1.1 riastrad for (i = 0; i <= state->performance_level_count - 2; i++) { 5112 1.1 riastrad ret = r600_calculate_at( 5113 1.1 riastrad (50 / SISLANDS_MAX_HARDWARE_POWERLEVELS) * 100 * (i + 1), 5114 1.1 riastrad 100 * R600_AH_DFLT, 5115 1.1 riastrad state->performance_levels[i + 1].sclk, 5116 1.1 riastrad state->performance_levels[i].sclk, 5117 1.1 riastrad &t_l, 5118 1.1 riastrad &t_h); 5119 1.1 riastrad 5120 1.1 riastrad if (ret) { 5121 1.1 riastrad t_h = (i + 1) * 1000 - 50 * R600_AH_DFLT; 5122 1.1 riastrad t_l = (i + 1) * 1000 + 50 * R600_AH_DFLT; 5123 1.1 riastrad } 5124 1.1 riastrad 5125 1.1 riastrad a_t = be32_to_cpu(smc_state->levels[i].aT) & ~CG_R_MASK; 5126 1.1 riastrad a_t |= CG_R(t_l * pi->bsp / 20000); 5127 1.1 riastrad smc_state->levels[i].aT = cpu_to_be32(a_t); 5128 1.1 riastrad 5129 1.1 riastrad high_bsp = (i == state->performance_level_count - 2) ? 5130 1.1 riastrad pi->pbsp : pi->bsp; 5131 1.1 riastrad a_t = CG_R(0xffff) | CG_L(t_h * high_bsp / 20000); 5132 1.1 riastrad smc_state->levels[i + 1].aT = cpu_to_be32(a_t); 5133 1.1 riastrad } 5134 1.1 riastrad 5135 1.1 riastrad return 0; 5136 1.1 riastrad } 5137 1.1 riastrad 5138 1.1 riastrad static int si_disable_ulv(struct radeon_device *rdev) 5139 1.1 riastrad { 5140 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 5141 1.1 riastrad struct si_ulv_param *ulv = &si_pi->ulv; 5142 1.1 riastrad 5143 1.1 riastrad if (ulv->supported) 5144 1.1 riastrad return (si_send_msg_to_smc(rdev, PPSMC_MSG_DisableULV) == PPSMC_Result_OK) ? 5145 1.1 riastrad 0 : -EINVAL; 5146 1.1 riastrad 5147 1.1 riastrad return 0; 5148 1.1 riastrad } 5149 1.1 riastrad 5150 1.1 riastrad static bool si_is_state_ulv_compatible(struct radeon_device *rdev, 5151 1.1 riastrad struct radeon_ps *radeon_state) 5152 1.1 riastrad { 5153 1.1 riastrad const struct si_power_info *si_pi = si_get_pi(rdev); 5154 1.1 riastrad const struct si_ulv_param *ulv = &si_pi->ulv; 5155 1.1 riastrad const struct ni_ps *state = ni_get_ps(radeon_state); 5156 1.1 riastrad int i; 5157 1.1 riastrad 5158 1.1 riastrad if (state->performance_levels[0].mclk != ulv->pl.mclk) 5159 1.1 riastrad return false; 5160 1.1 riastrad 5161 1.1 riastrad /* XXX validate against display requirements! */ 5162 1.1 riastrad 5163 1.1 riastrad for (i = 0; i < rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.count; i++) { 5164 1.1 riastrad if (rdev->clock.current_dispclk <= 5165 1.1 riastrad rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries[i].clk) { 5166 1.1 riastrad if (ulv->pl.vddc < 5167 1.1 riastrad rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries[i].v) 5168 1.1 riastrad return false; 5169 1.1 riastrad } 5170 1.1 riastrad } 5171 1.1 riastrad 5172 1.1 riastrad if ((radeon_state->vclk != 0) || (radeon_state->dclk != 0)) 5173 1.1 riastrad return false; 5174 1.1 riastrad 5175 1.1 riastrad return true; 5176 1.1 riastrad } 5177 1.1 riastrad 5178 1.1 riastrad static int si_set_power_state_conditionally_enable_ulv(struct radeon_device *rdev, 5179 1.1 riastrad struct radeon_ps *radeon_new_state) 5180 1.1 riastrad { 5181 1.1 riastrad const struct si_power_info *si_pi = si_get_pi(rdev); 5182 1.1 riastrad const struct si_ulv_param *ulv = &si_pi->ulv; 5183 1.1 riastrad 5184 1.1 riastrad if (ulv->supported) { 5185 1.1 riastrad if (si_is_state_ulv_compatible(rdev, radeon_new_state)) 5186 1.1 riastrad return (si_send_msg_to_smc(rdev, PPSMC_MSG_EnableULV) == PPSMC_Result_OK) ? 5187 1.1 riastrad 0 : -EINVAL; 5188 1.1 riastrad } 5189 1.1 riastrad return 0; 5190 1.1 riastrad } 5191 1.1 riastrad 5192 1.1 riastrad static int si_convert_power_state_to_smc(struct radeon_device *rdev, 5193 1.1 riastrad struct radeon_ps *radeon_state, 5194 1.1 riastrad SISLANDS_SMC_SWSTATE *smc_state) 5195 1.1 riastrad { 5196 1.1 riastrad struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); 5197 1.1 riastrad struct ni_power_info *ni_pi = ni_get_pi(rdev); 5198 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 5199 1.1 riastrad struct ni_ps *state = ni_get_ps(radeon_state); 5200 1.1 riastrad int i, ret; 5201 1.1 riastrad u32 threshold; 5202 1.1 riastrad u32 sclk_in_sr = 1350; /* ??? */ 5203 1.1 riastrad 5204 1.1 riastrad if (state->performance_level_count > SISLANDS_MAX_HARDWARE_POWERLEVELS) 5205 1.1 riastrad return -EINVAL; 5206 1.1 riastrad 5207 1.1 riastrad threshold = state->performance_levels[state->performance_level_count-1].sclk * 100 / 100; 5208 1.1 riastrad 5209 1.1 riastrad if (radeon_state->vclk && radeon_state->dclk) { 5210 1.1 riastrad eg_pi->uvd_enabled = true; 5211 1.1 riastrad if (eg_pi->smu_uvd_hs) 5212 1.1 riastrad smc_state->flags |= PPSMC_SWSTATE_FLAG_UVD; 5213 1.1 riastrad } else { 5214 1.1 riastrad eg_pi->uvd_enabled = false; 5215 1.1 riastrad } 5216 1.1 riastrad 5217 1.1 riastrad if (state->dc_compatible) 5218 1.1 riastrad smc_state->flags |= PPSMC_SWSTATE_FLAG_DC; 5219 1.1 riastrad 5220 1.1 riastrad smc_state->levelCount = 0; 5221 1.1 riastrad for (i = 0; i < state->performance_level_count; i++) { 5222 1.1 riastrad if (eg_pi->sclk_deep_sleep) { 5223 1.1 riastrad if ((i == 0) || si_pi->sclk_deep_sleep_above_low) { 5224 1.1 riastrad if (sclk_in_sr <= SCLK_MIN_DEEPSLEEP_FREQ) 5225 1.1 riastrad smc_state->levels[i].stateFlags |= PPSMC_STATEFLAG_DEEPSLEEP_BYPASS; 5226 1.1 riastrad else 5227 1.1 riastrad smc_state->levels[i].stateFlags |= PPSMC_STATEFLAG_DEEPSLEEP_THROTTLE; 5228 1.1 riastrad } 5229 1.1 riastrad } 5230 1.1 riastrad 5231 1.1 riastrad ret = si_convert_power_level_to_smc(rdev, &state->performance_levels[i], 5232 1.1 riastrad &smc_state->levels[i]); 5233 1.1 riastrad smc_state->levels[i].arbRefreshState = 5234 1.1 riastrad (u8)(SISLANDS_DRIVER_STATE_ARB_INDEX + i); 5235 1.1 riastrad 5236 1.1 riastrad if (ret) 5237 1.1 riastrad return ret; 5238 1.1 riastrad 5239 1.1 riastrad if (ni_pi->enable_power_containment) 5240 1.1 riastrad smc_state->levels[i].displayWatermark = 5241 1.1 riastrad (state->performance_levels[i].sclk < threshold) ? 5242 1.1 riastrad PPSMC_DISPLAY_WATERMARK_LOW : PPSMC_DISPLAY_WATERMARK_HIGH; 5243 1.1 riastrad else 5244 1.1 riastrad smc_state->levels[i].displayWatermark = (i < 2) ? 5245 1.1 riastrad PPSMC_DISPLAY_WATERMARK_LOW : PPSMC_DISPLAY_WATERMARK_HIGH; 5246 1.1 riastrad 5247 1.1 riastrad if (eg_pi->dynamic_ac_timing) 5248 1.1 riastrad smc_state->levels[i].ACIndex = SISLANDS_MCREGISTERTABLE_FIRST_DRIVERSTATE_SLOT + i; 5249 1.1 riastrad else 5250 1.1 riastrad smc_state->levels[i].ACIndex = 0; 5251 1.1 riastrad 5252 1.1 riastrad smc_state->levelCount++; 5253 1.1 riastrad } 5254 1.1 riastrad 5255 1.1 riastrad si_write_smc_soft_register(rdev, 5256 1.1 riastrad SI_SMC_SOFT_REGISTER_watermark_threshold, 5257 1.1 riastrad threshold / 512); 5258 1.1 riastrad 5259 1.1 riastrad si_populate_smc_sp(rdev, radeon_state, smc_state); 5260 1.1 riastrad 5261 1.1 riastrad ret = si_populate_power_containment_values(rdev, radeon_state, smc_state); 5262 1.1 riastrad if (ret) 5263 1.1 riastrad ni_pi->enable_power_containment = false; 5264 1.1 riastrad 5265 1.1 riastrad ret = si_populate_sq_ramping_values(rdev, radeon_state, smc_state); 5266 1.5 riastrad if (ret) 5267 1.1 riastrad ni_pi->enable_sq_ramping = false; 5268 1.1 riastrad 5269 1.1 riastrad return si_populate_smc_t(rdev, radeon_state, smc_state); 5270 1.1 riastrad } 5271 1.1 riastrad 5272 1.1 riastrad static int si_upload_sw_state(struct radeon_device *rdev, 5273 1.1 riastrad struct radeon_ps *radeon_new_state) 5274 1.1 riastrad { 5275 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 5276 1.1 riastrad struct ni_ps *new_state = ni_get_ps(radeon_new_state); 5277 1.1 riastrad int ret; 5278 1.1 riastrad u32 address = si_pi->state_table_start + 5279 1.1 riastrad offsetof(SISLANDS_SMC_STATETABLE, driverState); 5280 1.1 riastrad u32 state_size = sizeof(SISLANDS_SMC_SWSTATE) + 5281 1.1 riastrad ((new_state->performance_level_count - 1) * 5282 1.1 riastrad sizeof(SISLANDS_SMC_HW_PERFORMANCE_LEVEL)); 5283 1.1 riastrad SISLANDS_SMC_SWSTATE *smc_state = &si_pi->smc_statetable.driverState; 5284 1.1 riastrad 5285 1.1 riastrad memset(smc_state, 0, state_size); 5286 1.1 riastrad 5287 1.1 riastrad ret = si_convert_power_state_to_smc(rdev, radeon_new_state, smc_state); 5288 1.1 riastrad if (ret) 5289 1.1 riastrad return ret; 5290 1.1 riastrad 5291 1.1 riastrad ret = si_copy_bytes_to_smc(rdev, address, (u8 *)smc_state, 5292 1.1 riastrad state_size, si_pi->sram_end); 5293 1.1 riastrad 5294 1.1 riastrad return ret; 5295 1.1 riastrad } 5296 1.1 riastrad 5297 1.1 riastrad static int si_upload_ulv_state(struct radeon_device *rdev) 5298 1.1 riastrad { 5299 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 5300 1.1 riastrad struct si_ulv_param *ulv = &si_pi->ulv; 5301 1.1 riastrad int ret = 0; 5302 1.1 riastrad 5303 1.1 riastrad if (ulv->supported && ulv->pl.vddc) { 5304 1.1 riastrad u32 address = si_pi->state_table_start + 5305 1.1 riastrad offsetof(SISLANDS_SMC_STATETABLE, ULVState); 5306 1.1 riastrad SISLANDS_SMC_SWSTATE *smc_state = &si_pi->smc_statetable.ULVState; 5307 1.1 riastrad u32 state_size = sizeof(SISLANDS_SMC_SWSTATE); 5308 1.1 riastrad 5309 1.1 riastrad memset(smc_state, 0, state_size); 5310 1.1 riastrad 5311 1.1 riastrad ret = si_populate_ulv_state(rdev, smc_state); 5312 1.1 riastrad if (!ret) 5313 1.1 riastrad ret = si_copy_bytes_to_smc(rdev, address, (u8 *)smc_state, 5314 1.1 riastrad state_size, si_pi->sram_end); 5315 1.1 riastrad } 5316 1.1 riastrad 5317 1.1 riastrad return ret; 5318 1.1 riastrad } 5319 1.1 riastrad 5320 1.1 riastrad static int si_upload_smc_data(struct radeon_device *rdev) 5321 1.1 riastrad { 5322 1.1 riastrad struct radeon_crtc *radeon_crtc = NULL; 5323 1.1 riastrad int i; 5324 1.1 riastrad 5325 1.1 riastrad if (rdev->pm.dpm.new_active_crtc_count == 0) 5326 1.1 riastrad return 0; 5327 1.1 riastrad 5328 1.1 riastrad for (i = 0; i < rdev->num_crtc; i++) { 5329 1.1 riastrad if (rdev->pm.dpm.new_active_crtcs & (1 << i)) { 5330 1.1 riastrad radeon_crtc = rdev->mode_info.crtcs[i]; 5331 1.1 riastrad break; 5332 1.1 riastrad } 5333 1.1 riastrad } 5334 1.1 riastrad 5335 1.1 riastrad if (radeon_crtc == NULL) 5336 1.1 riastrad return 0; 5337 1.1 riastrad 5338 1.1 riastrad if (radeon_crtc->line_time <= 0) 5339 1.1 riastrad return 0; 5340 1.1 riastrad 5341 1.1 riastrad if (si_write_smc_soft_register(rdev, 5342 1.1 riastrad SI_SMC_SOFT_REGISTER_crtc_index, 5343 1.1 riastrad radeon_crtc->crtc_id) != PPSMC_Result_OK) 5344 1.1 riastrad return 0; 5345 1.1 riastrad 5346 1.1 riastrad if (si_write_smc_soft_register(rdev, 5347 1.1 riastrad SI_SMC_SOFT_REGISTER_mclk_change_block_cp_min, 5348 1.1 riastrad radeon_crtc->wm_high / radeon_crtc->line_time) != PPSMC_Result_OK) 5349 1.1 riastrad return 0; 5350 1.1 riastrad 5351 1.1 riastrad if (si_write_smc_soft_register(rdev, 5352 1.1 riastrad SI_SMC_SOFT_REGISTER_mclk_change_block_cp_max, 5353 1.1 riastrad radeon_crtc->wm_low / radeon_crtc->line_time) != PPSMC_Result_OK) 5354 1.1 riastrad return 0; 5355 1.1 riastrad 5356 1.1 riastrad return 0; 5357 1.1 riastrad } 5358 1.1 riastrad 5359 1.1 riastrad static int si_set_mc_special_registers(struct radeon_device *rdev, 5360 1.1 riastrad struct si_mc_reg_table *table) 5361 1.1 riastrad { 5362 1.1 riastrad struct rv7xx_power_info *pi = rv770_get_pi(rdev); 5363 1.1 riastrad u8 i, j, k; 5364 1.1 riastrad u32 temp_reg; 5365 1.1 riastrad 5366 1.1 riastrad for (i = 0, j = table->last; i < table->last; i++) { 5367 1.1 riastrad if (j >= SMC_SISLANDS_MC_REGISTER_ARRAY_SIZE) 5368 1.1 riastrad return -EINVAL; 5369 1.1 riastrad switch (table->mc_reg_address[i].s1 << 2) { 5370 1.1 riastrad case MC_SEQ_MISC1: 5371 1.1 riastrad temp_reg = RREG32(MC_PMG_CMD_EMRS); 5372 1.1 riastrad table->mc_reg_address[j].s1 = MC_PMG_CMD_EMRS >> 2; 5373 1.1 riastrad table->mc_reg_address[j].s0 = MC_SEQ_PMG_CMD_EMRS_LP >> 2; 5374 1.1 riastrad for (k = 0; k < table->num_entries; k++) 5375 1.1 riastrad table->mc_reg_table_entry[k].mc_data[j] = 5376 1.1 riastrad ((temp_reg & 0xffff0000)) | 5377 1.1 riastrad ((table->mc_reg_table_entry[k].mc_data[i] & 0xffff0000) >> 16); 5378 1.1 riastrad j++; 5379 1.1 riastrad if (j >= SMC_SISLANDS_MC_REGISTER_ARRAY_SIZE) 5380 1.1 riastrad return -EINVAL; 5381 1.1 riastrad 5382 1.1 riastrad temp_reg = RREG32(MC_PMG_CMD_MRS); 5383 1.1 riastrad table->mc_reg_address[j].s1 = MC_PMG_CMD_MRS >> 2; 5384 1.1 riastrad table->mc_reg_address[j].s0 = MC_SEQ_PMG_CMD_MRS_LP >> 2; 5385 1.1 riastrad for (k = 0; k < table->num_entries; k++) { 5386 1.1 riastrad table->mc_reg_table_entry[k].mc_data[j] = 5387 1.1 riastrad (temp_reg & 0xffff0000) | 5388 1.1 riastrad (table->mc_reg_table_entry[k].mc_data[i] & 0x0000ffff); 5389 1.1 riastrad if (!pi->mem_gddr5) 5390 1.1 riastrad table->mc_reg_table_entry[k].mc_data[j] |= 0x100; 5391 1.1 riastrad } 5392 1.1 riastrad j++; 5393 1.1 riastrad if (j >= SMC_SISLANDS_MC_REGISTER_ARRAY_SIZE) 5394 1.1 riastrad return -EINVAL; 5395 1.1 riastrad 5396 1.1 riastrad if (!pi->mem_gddr5) { 5397 1.1 riastrad table->mc_reg_address[j].s1 = MC_PMG_AUTO_CMD >> 2; 5398 1.1 riastrad table->mc_reg_address[j].s0 = MC_PMG_AUTO_CMD >> 2; 5399 1.1 riastrad for (k = 0; k < table->num_entries; k++) 5400 1.1 riastrad table->mc_reg_table_entry[k].mc_data[j] = 5401 1.1 riastrad (table->mc_reg_table_entry[k].mc_data[i] & 0xffff0000) >> 16; 5402 1.1 riastrad j++; 5403 1.1 riastrad if (j >= SMC_SISLANDS_MC_REGISTER_ARRAY_SIZE) 5404 1.1 riastrad return -EINVAL; 5405 1.1 riastrad } 5406 1.1 riastrad break; 5407 1.1 riastrad case MC_SEQ_RESERVE_M: 5408 1.1 riastrad temp_reg = RREG32(MC_PMG_CMD_MRS1); 5409 1.1 riastrad table->mc_reg_address[j].s1 = MC_PMG_CMD_MRS1 >> 2; 5410 1.1 riastrad table->mc_reg_address[j].s0 = MC_SEQ_PMG_CMD_MRS1_LP >> 2; 5411 1.1 riastrad for(k = 0; k < table->num_entries; k++) 5412 1.1 riastrad table->mc_reg_table_entry[k].mc_data[j] = 5413 1.1 riastrad (temp_reg & 0xffff0000) | 5414 1.1 riastrad (table->mc_reg_table_entry[k].mc_data[i] & 0x0000ffff); 5415 1.1 riastrad j++; 5416 1.1 riastrad if (j >= SMC_SISLANDS_MC_REGISTER_ARRAY_SIZE) 5417 1.1 riastrad return -EINVAL; 5418 1.1 riastrad break; 5419 1.1 riastrad default: 5420 1.1 riastrad break; 5421 1.1 riastrad } 5422 1.1 riastrad } 5423 1.1 riastrad 5424 1.1 riastrad table->last = j; 5425 1.1 riastrad 5426 1.1 riastrad return 0; 5427 1.1 riastrad } 5428 1.1 riastrad 5429 1.1 riastrad static bool si_check_s0_mc_reg_index(u16 in_reg, u16 *out_reg) 5430 1.1 riastrad { 5431 1.1 riastrad bool result = true; 5432 1.1 riastrad 5433 1.1 riastrad switch (in_reg) { 5434 1.1 riastrad case MC_SEQ_RAS_TIMING >> 2: 5435 1.1 riastrad *out_reg = MC_SEQ_RAS_TIMING_LP >> 2; 5436 1.1 riastrad break; 5437 1.5 riastrad case MC_SEQ_CAS_TIMING >> 2: 5438 1.1 riastrad *out_reg = MC_SEQ_CAS_TIMING_LP >> 2; 5439 1.1 riastrad break; 5440 1.5 riastrad case MC_SEQ_MISC_TIMING >> 2: 5441 1.1 riastrad *out_reg = MC_SEQ_MISC_TIMING_LP >> 2; 5442 1.1 riastrad break; 5443 1.5 riastrad case MC_SEQ_MISC_TIMING2 >> 2: 5444 1.1 riastrad *out_reg = MC_SEQ_MISC_TIMING2_LP >> 2; 5445 1.1 riastrad break; 5446 1.5 riastrad case MC_SEQ_RD_CTL_D0 >> 2: 5447 1.1 riastrad *out_reg = MC_SEQ_RD_CTL_D0_LP >> 2; 5448 1.1 riastrad break; 5449 1.5 riastrad case MC_SEQ_RD_CTL_D1 >> 2: 5450 1.1 riastrad *out_reg = MC_SEQ_RD_CTL_D1_LP >> 2; 5451 1.1 riastrad break; 5452 1.5 riastrad case MC_SEQ_WR_CTL_D0 >> 2: 5453 1.1 riastrad *out_reg = MC_SEQ_WR_CTL_D0_LP >> 2; 5454 1.1 riastrad break; 5455 1.5 riastrad case MC_SEQ_WR_CTL_D1 >> 2: 5456 1.1 riastrad *out_reg = MC_SEQ_WR_CTL_D1_LP >> 2; 5457 1.1 riastrad break; 5458 1.5 riastrad case MC_PMG_CMD_EMRS >> 2: 5459 1.1 riastrad *out_reg = MC_SEQ_PMG_CMD_EMRS_LP >> 2; 5460 1.1 riastrad break; 5461 1.5 riastrad case MC_PMG_CMD_MRS >> 2: 5462 1.1 riastrad *out_reg = MC_SEQ_PMG_CMD_MRS_LP >> 2; 5463 1.1 riastrad break; 5464 1.5 riastrad case MC_PMG_CMD_MRS1 >> 2: 5465 1.1 riastrad *out_reg = MC_SEQ_PMG_CMD_MRS1_LP >> 2; 5466 1.1 riastrad break; 5467 1.5 riastrad case MC_SEQ_PMG_TIMING >> 2: 5468 1.1 riastrad *out_reg = MC_SEQ_PMG_TIMING_LP >> 2; 5469 1.1 riastrad break; 5470 1.5 riastrad case MC_PMG_CMD_MRS2 >> 2: 5471 1.1 riastrad *out_reg = MC_SEQ_PMG_CMD_MRS2_LP >> 2; 5472 1.1 riastrad break; 5473 1.5 riastrad case MC_SEQ_WR_CTL_2 >> 2: 5474 1.1 riastrad *out_reg = MC_SEQ_WR_CTL_2_LP >> 2; 5475 1.1 riastrad break; 5476 1.5 riastrad default: 5477 1.1 riastrad result = false; 5478 1.1 riastrad break; 5479 1.1 riastrad } 5480 1.1 riastrad 5481 1.1 riastrad return result; 5482 1.1 riastrad } 5483 1.1 riastrad 5484 1.1 riastrad static void si_set_valid_flag(struct si_mc_reg_table *table) 5485 1.1 riastrad { 5486 1.1 riastrad u8 i, j; 5487 1.1 riastrad 5488 1.1 riastrad for (i = 0; i < table->last; i++) { 5489 1.1 riastrad for (j = 1; j < table->num_entries; j++) { 5490 1.1 riastrad if (table->mc_reg_table_entry[j-1].mc_data[i] != table->mc_reg_table_entry[j].mc_data[i]) { 5491 1.1 riastrad table->valid_flag |= 1 << i; 5492 1.1 riastrad break; 5493 1.1 riastrad } 5494 1.1 riastrad } 5495 1.1 riastrad } 5496 1.1 riastrad } 5497 1.1 riastrad 5498 1.1 riastrad static void si_set_s0_mc_reg_index(struct si_mc_reg_table *table) 5499 1.1 riastrad { 5500 1.1 riastrad u32 i; 5501 1.1 riastrad u16 address; 5502 1.1 riastrad 5503 1.1 riastrad for (i = 0; i < table->last; i++) 5504 1.1 riastrad table->mc_reg_address[i].s0 = si_check_s0_mc_reg_index(table->mc_reg_address[i].s1, &address) ? 5505 1.1 riastrad address : table->mc_reg_address[i].s1; 5506 1.1 riastrad 5507 1.1 riastrad } 5508 1.1 riastrad 5509 1.1 riastrad static int si_copy_vbios_mc_reg_table(struct atom_mc_reg_table *table, 5510 1.1 riastrad struct si_mc_reg_table *si_table) 5511 1.1 riastrad { 5512 1.1 riastrad u8 i, j; 5513 1.1 riastrad 5514 1.1 riastrad if (table->last > SMC_SISLANDS_MC_REGISTER_ARRAY_SIZE) 5515 1.1 riastrad return -EINVAL; 5516 1.1 riastrad if (table->num_entries > MAX_AC_TIMING_ENTRIES) 5517 1.1 riastrad return -EINVAL; 5518 1.1 riastrad 5519 1.1 riastrad for (i = 0; i < table->last; i++) 5520 1.1 riastrad si_table->mc_reg_address[i].s1 = table->mc_reg_address[i].s1; 5521 1.1 riastrad si_table->last = table->last; 5522 1.1 riastrad 5523 1.1 riastrad for (i = 0; i < table->num_entries; i++) { 5524 1.1 riastrad si_table->mc_reg_table_entry[i].mclk_max = 5525 1.1 riastrad table->mc_reg_table_entry[i].mclk_max; 5526 1.1 riastrad for (j = 0; j < table->last; j++) { 5527 1.1 riastrad si_table->mc_reg_table_entry[i].mc_data[j] = 5528 1.1 riastrad table->mc_reg_table_entry[i].mc_data[j]; 5529 1.1 riastrad } 5530 1.1 riastrad } 5531 1.1 riastrad si_table->num_entries = table->num_entries; 5532 1.1 riastrad 5533 1.1 riastrad return 0; 5534 1.1 riastrad } 5535 1.1 riastrad 5536 1.1 riastrad static int si_initialize_mc_reg_table(struct radeon_device *rdev) 5537 1.1 riastrad { 5538 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 5539 1.1 riastrad struct atom_mc_reg_table *table; 5540 1.1 riastrad struct si_mc_reg_table *si_table = &si_pi->mc_reg_table; 5541 1.1 riastrad u8 module_index = rv770_get_memory_module_index(rdev); 5542 1.1 riastrad int ret; 5543 1.1 riastrad 5544 1.1 riastrad table = kzalloc(sizeof(struct atom_mc_reg_table), GFP_KERNEL); 5545 1.1 riastrad if (!table) 5546 1.1 riastrad return -ENOMEM; 5547 1.1 riastrad 5548 1.1 riastrad WREG32(MC_SEQ_RAS_TIMING_LP, RREG32(MC_SEQ_RAS_TIMING)); 5549 1.1 riastrad WREG32(MC_SEQ_CAS_TIMING_LP, RREG32(MC_SEQ_CAS_TIMING)); 5550 1.1 riastrad WREG32(MC_SEQ_MISC_TIMING_LP, RREG32(MC_SEQ_MISC_TIMING)); 5551 1.1 riastrad WREG32(MC_SEQ_MISC_TIMING2_LP, RREG32(MC_SEQ_MISC_TIMING2)); 5552 1.1 riastrad WREG32(MC_SEQ_PMG_CMD_EMRS_LP, RREG32(MC_PMG_CMD_EMRS)); 5553 1.1 riastrad WREG32(MC_SEQ_PMG_CMD_MRS_LP, RREG32(MC_PMG_CMD_MRS)); 5554 1.1 riastrad WREG32(MC_SEQ_PMG_CMD_MRS1_LP, RREG32(MC_PMG_CMD_MRS1)); 5555 1.1 riastrad WREG32(MC_SEQ_WR_CTL_D0_LP, RREG32(MC_SEQ_WR_CTL_D0)); 5556 1.1 riastrad WREG32(MC_SEQ_WR_CTL_D1_LP, RREG32(MC_SEQ_WR_CTL_D1)); 5557 1.1 riastrad WREG32(MC_SEQ_RD_CTL_D0_LP, RREG32(MC_SEQ_RD_CTL_D0)); 5558 1.1 riastrad WREG32(MC_SEQ_RD_CTL_D1_LP, RREG32(MC_SEQ_RD_CTL_D1)); 5559 1.1 riastrad WREG32(MC_SEQ_PMG_TIMING_LP, RREG32(MC_SEQ_PMG_TIMING)); 5560 1.1 riastrad WREG32(MC_SEQ_PMG_CMD_MRS2_LP, RREG32(MC_PMG_CMD_MRS2)); 5561 1.1 riastrad WREG32(MC_SEQ_WR_CTL_2_LP, RREG32(MC_SEQ_WR_CTL_2)); 5562 1.1 riastrad 5563 1.5 riastrad ret = radeon_atom_init_mc_reg_table(rdev, module_index, table); 5564 1.5 riastrad if (ret) 5565 1.5 riastrad goto init_mc_done; 5566 1.5 riastrad 5567 1.5 riastrad ret = si_copy_vbios_mc_reg_table(table, si_table); 5568 1.5 riastrad if (ret) 5569 1.5 riastrad goto init_mc_done; 5570 1.1 riastrad 5571 1.1 riastrad si_set_s0_mc_reg_index(si_table); 5572 1.1 riastrad 5573 1.1 riastrad ret = si_set_mc_special_registers(rdev, si_table); 5574 1.5 riastrad if (ret) 5575 1.5 riastrad goto init_mc_done; 5576 1.1 riastrad 5577 1.1 riastrad si_set_valid_flag(si_table); 5578 1.1 riastrad 5579 1.1 riastrad init_mc_done: 5580 1.1 riastrad kfree(table); 5581 1.1 riastrad 5582 1.1 riastrad return ret; 5583 1.1 riastrad 5584 1.1 riastrad } 5585 1.1 riastrad 5586 1.1 riastrad static void si_populate_mc_reg_addresses(struct radeon_device *rdev, 5587 1.1 riastrad SMC_SIslands_MCRegisters *mc_reg_table) 5588 1.1 riastrad { 5589 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 5590 1.1 riastrad u32 i, j; 5591 1.1 riastrad 5592 1.1 riastrad for (i = 0, j = 0; j < si_pi->mc_reg_table.last; j++) { 5593 1.1 riastrad if (si_pi->mc_reg_table.valid_flag & (1 << j)) { 5594 1.1 riastrad if (i >= SMC_SISLANDS_MC_REGISTER_ARRAY_SIZE) 5595 1.1 riastrad break; 5596 1.1 riastrad mc_reg_table->address[i].s0 = 5597 1.1 riastrad cpu_to_be16(si_pi->mc_reg_table.mc_reg_address[j].s0); 5598 1.1 riastrad mc_reg_table->address[i].s1 = 5599 1.1 riastrad cpu_to_be16(si_pi->mc_reg_table.mc_reg_address[j].s1); 5600 1.1 riastrad i++; 5601 1.1 riastrad } 5602 1.1 riastrad } 5603 1.1 riastrad mc_reg_table->last = (u8)i; 5604 1.1 riastrad } 5605 1.1 riastrad 5606 1.1 riastrad static void si_convert_mc_registers(const struct si_mc_reg_entry *entry, 5607 1.1 riastrad SMC_SIslands_MCRegisterSet *data, 5608 1.1 riastrad u32 num_entries, u32 valid_flag) 5609 1.1 riastrad { 5610 1.1 riastrad u32 i, j; 5611 1.1 riastrad 5612 1.1 riastrad for(i = 0, j = 0; j < num_entries; j++) { 5613 1.1 riastrad if (valid_flag & (1 << j)) { 5614 1.1 riastrad data->value[i] = cpu_to_be32(entry->mc_data[j]); 5615 1.1 riastrad i++; 5616 1.1 riastrad } 5617 1.1 riastrad } 5618 1.1 riastrad } 5619 1.1 riastrad 5620 1.1 riastrad static void si_convert_mc_reg_table_entry_to_smc(struct radeon_device *rdev, 5621 1.1 riastrad struct rv7xx_pl *pl, 5622 1.1 riastrad SMC_SIslands_MCRegisterSet *mc_reg_table_data) 5623 1.1 riastrad { 5624 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 5625 1.1 riastrad u32 i = 0; 5626 1.1 riastrad 5627 1.1 riastrad for (i = 0; i < si_pi->mc_reg_table.num_entries; i++) { 5628 1.1 riastrad if (pl->mclk <= si_pi->mc_reg_table.mc_reg_table_entry[i].mclk_max) 5629 1.1 riastrad break; 5630 1.1 riastrad } 5631 1.1 riastrad 5632 1.1 riastrad if ((i == si_pi->mc_reg_table.num_entries) && (i > 0)) 5633 1.1 riastrad --i; 5634 1.1 riastrad 5635 1.1 riastrad si_convert_mc_registers(&si_pi->mc_reg_table.mc_reg_table_entry[i], 5636 1.1 riastrad mc_reg_table_data, si_pi->mc_reg_table.last, 5637 1.1 riastrad si_pi->mc_reg_table.valid_flag); 5638 1.1 riastrad } 5639 1.1 riastrad 5640 1.1 riastrad static void si_convert_mc_reg_table_to_smc(struct radeon_device *rdev, 5641 1.1 riastrad struct radeon_ps *radeon_state, 5642 1.1 riastrad SMC_SIslands_MCRegisters *mc_reg_table) 5643 1.1 riastrad { 5644 1.1 riastrad struct ni_ps *state = ni_get_ps(radeon_state); 5645 1.1 riastrad int i; 5646 1.1 riastrad 5647 1.1 riastrad for (i = 0; i < state->performance_level_count; i++) { 5648 1.1 riastrad si_convert_mc_reg_table_entry_to_smc(rdev, 5649 1.1 riastrad &state->performance_levels[i], 5650 1.1 riastrad &mc_reg_table->data[SISLANDS_MCREGISTERTABLE_FIRST_DRIVERSTATE_SLOT + i]); 5651 1.1 riastrad } 5652 1.1 riastrad } 5653 1.1 riastrad 5654 1.1 riastrad static int si_populate_mc_reg_table(struct radeon_device *rdev, 5655 1.1 riastrad struct radeon_ps *radeon_boot_state) 5656 1.1 riastrad { 5657 1.1 riastrad struct ni_ps *boot_state = ni_get_ps(radeon_boot_state); 5658 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 5659 1.1 riastrad struct si_ulv_param *ulv = &si_pi->ulv; 5660 1.1 riastrad SMC_SIslands_MCRegisters *smc_mc_reg_table = &si_pi->smc_mc_reg_table; 5661 1.1 riastrad 5662 1.1 riastrad memset(smc_mc_reg_table, 0, sizeof(SMC_SIslands_MCRegisters)); 5663 1.1 riastrad 5664 1.1 riastrad si_write_smc_soft_register(rdev, SI_SMC_SOFT_REGISTER_seq_index, 1); 5665 1.1 riastrad 5666 1.1 riastrad si_populate_mc_reg_addresses(rdev, smc_mc_reg_table); 5667 1.1 riastrad 5668 1.1 riastrad si_convert_mc_reg_table_entry_to_smc(rdev, &boot_state->performance_levels[0], 5669 1.1 riastrad &smc_mc_reg_table->data[SISLANDS_MCREGISTERTABLE_INITIAL_SLOT]); 5670 1.1 riastrad 5671 1.1 riastrad si_convert_mc_registers(&si_pi->mc_reg_table.mc_reg_table_entry[0], 5672 1.1 riastrad &smc_mc_reg_table->data[SISLANDS_MCREGISTERTABLE_ACPI_SLOT], 5673 1.1 riastrad si_pi->mc_reg_table.last, 5674 1.1 riastrad si_pi->mc_reg_table.valid_flag); 5675 1.1 riastrad 5676 1.1 riastrad if (ulv->supported && ulv->pl.vddc != 0) 5677 1.1 riastrad si_convert_mc_reg_table_entry_to_smc(rdev, &ulv->pl, 5678 1.1 riastrad &smc_mc_reg_table->data[SISLANDS_MCREGISTERTABLE_ULV_SLOT]); 5679 1.1 riastrad else 5680 1.1 riastrad si_convert_mc_registers(&si_pi->mc_reg_table.mc_reg_table_entry[0], 5681 1.1 riastrad &smc_mc_reg_table->data[SISLANDS_MCREGISTERTABLE_ULV_SLOT], 5682 1.1 riastrad si_pi->mc_reg_table.last, 5683 1.1 riastrad si_pi->mc_reg_table.valid_flag); 5684 1.1 riastrad 5685 1.1 riastrad si_convert_mc_reg_table_to_smc(rdev, radeon_boot_state, smc_mc_reg_table); 5686 1.1 riastrad 5687 1.1 riastrad return si_copy_bytes_to_smc(rdev, si_pi->mc_reg_table_start, 5688 1.1 riastrad (u8 *)smc_mc_reg_table, 5689 1.1 riastrad sizeof(SMC_SIslands_MCRegisters), si_pi->sram_end); 5690 1.1 riastrad } 5691 1.1 riastrad 5692 1.1 riastrad static int si_upload_mc_reg_table(struct radeon_device *rdev, 5693 1.1 riastrad struct radeon_ps *radeon_new_state) 5694 1.1 riastrad { 5695 1.1 riastrad struct ni_ps *new_state = ni_get_ps(radeon_new_state); 5696 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 5697 1.1 riastrad u32 address = si_pi->mc_reg_table_start + 5698 1.1 riastrad offsetof(SMC_SIslands_MCRegisters, 5699 1.1 riastrad data[SISLANDS_MCREGISTERTABLE_FIRST_DRIVERSTATE_SLOT]); 5700 1.1 riastrad SMC_SIslands_MCRegisters *smc_mc_reg_table = &si_pi->smc_mc_reg_table; 5701 1.1 riastrad 5702 1.1 riastrad memset(smc_mc_reg_table, 0, sizeof(SMC_SIslands_MCRegisters)); 5703 1.1 riastrad 5704 1.1 riastrad si_convert_mc_reg_table_to_smc(rdev, radeon_new_state, smc_mc_reg_table); 5705 1.1 riastrad 5706 1.1 riastrad 5707 1.1 riastrad return si_copy_bytes_to_smc(rdev, address, 5708 1.1 riastrad (u8 *)&smc_mc_reg_table->data[SISLANDS_MCREGISTERTABLE_FIRST_DRIVERSTATE_SLOT], 5709 1.1 riastrad sizeof(SMC_SIslands_MCRegisterSet) * new_state->performance_level_count, 5710 1.1 riastrad si_pi->sram_end); 5711 1.1 riastrad 5712 1.1 riastrad } 5713 1.1 riastrad 5714 1.1 riastrad static void si_enable_voltage_control(struct radeon_device *rdev, bool enable) 5715 1.1 riastrad { 5716 1.5 riastrad if (enable) 5717 1.5 riastrad WREG32_P(GENERAL_PWRMGT, VOLT_PWRMGT_EN, ~VOLT_PWRMGT_EN); 5718 1.5 riastrad else 5719 1.5 riastrad WREG32_P(GENERAL_PWRMGT, 0, ~VOLT_PWRMGT_EN); 5720 1.1 riastrad } 5721 1.1 riastrad 5722 1.1 riastrad static enum radeon_pcie_gen si_get_maximum_link_speed(struct radeon_device *rdev, 5723 1.1 riastrad struct radeon_ps *radeon_state) 5724 1.1 riastrad { 5725 1.1 riastrad struct ni_ps *state = ni_get_ps(radeon_state); 5726 1.1 riastrad int i; 5727 1.1 riastrad u16 pcie_speed, max_speed = 0; 5728 1.1 riastrad 5729 1.1 riastrad for (i = 0; i < state->performance_level_count; i++) { 5730 1.1 riastrad pcie_speed = state->performance_levels[i].pcie_gen; 5731 1.1 riastrad if (max_speed < pcie_speed) 5732 1.1 riastrad max_speed = pcie_speed; 5733 1.1 riastrad } 5734 1.1 riastrad return max_speed; 5735 1.1 riastrad } 5736 1.1 riastrad 5737 1.1 riastrad static u16 si_get_current_pcie_speed(struct radeon_device *rdev) 5738 1.1 riastrad { 5739 1.1 riastrad u32 speed_cntl; 5740 1.1 riastrad 5741 1.1 riastrad speed_cntl = RREG32_PCIE_PORT(PCIE_LC_SPEED_CNTL) & LC_CURRENT_DATA_RATE_MASK; 5742 1.1 riastrad speed_cntl >>= LC_CURRENT_DATA_RATE_SHIFT; 5743 1.1 riastrad 5744 1.1 riastrad return (u16)speed_cntl; 5745 1.1 riastrad } 5746 1.1 riastrad 5747 1.1 riastrad static void si_request_link_speed_change_before_state_change(struct radeon_device *rdev, 5748 1.1 riastrad struct radeon_ps *radeon_new_state, 5749 1.1 riastrad struct radeon_ps *radeon_current_state) 5750 1.1 riastrad { 5751 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 5752 1.1 riastrad enum radeon_pcie_gen target_link_speed = si_get_maximum_link_speed(rdev, radeon_new_state); 5753 1.1 riastrad enum radeon_pcie_gen current_link_speed; 5754 1.1 riastrad 5755 1.1 riastrad if (si_pi->force_pcie_gen == RADEON_PCIE_GEN_INVALID) 5756 1.1 riastrad current_link_speed = si_get_maximum_link_speed(rdev, radeon_current_state); 5757 1.1 riastrad else 5758 1.1 riastrad current_link_speed = si_pi->force_pcie_gen; 5759 1.1 riastrad 5760 1.1 riastrad si_pi->force_pcie_gen = RADEON_PCIE_GEN_INVALID; 5761 1.1 riastrad si_pi->pspp_notify_required = false; 5762 1.1 riastrad if (target_link_speed > current_link_speed) { 5763 1.1 riastrad switch (target_link_speed) { 5764 1.1 riastrad #if defined(CONFIG_ACPI) 5765 1.1 riastrad case RADEON_PCIE_GEN3: 5766 1.1 riastrad if (radeon_acpi_pcie_performance_request(rdev, PCIE_PERF_REQ_PECI_GEN3, false) == 0) 5767 1.1 riastrad break; 5768 1.1 riastrad si_pi->force_pcie_gen = RADEON_PCIE_GEN2; 5769 1.1 riastrad if (current_link_speed == RADEON_PCIE_GEN2) 5770 1.1 riastrad break; 5771 1.5 riastrad /* fall through */ 5772 1.1 riastrad case RADEON_PCIE_GEN2: 5773 1.1 riastrad if (radeon_acpi_pcie_performance_request(rdev, PCIE_PERF_REQ_PECI_GEN2, false) == 0) 5774 1.1 riastrad break; 5775 1.1 riastrad #endif 5776 1.5 riastrad /* fall through */ 5777 1.1 riastrad default: 5778 1.1 riastrad si_pi->force_pcie_gen = si_get_current_pcie_speed(rdev); 5779 1.1 riastrad break; 5780 1.1 riastrad } 5781 1.1 riastrad } else { 5782 1.1 riastrad if (target_link_speed < current_link_speed) 5783 1.1 riastrad si_pi->pspp_notify_required = true; 5784 1.1 riastrad } 5785 1.1 riastrad } 5786 1.1 riastrad 5787 1.1 riastrad static void si_notify_link_speed_change_after_state_change(struct radeon_device *rdev, 5788 1.1 riastrad struct radeon_ps *radeon_new_state, 5789 1.1 riastrad struct radeon_ps *radeon_current_state) 5790 1.1 riastrad { 5791 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 5792 1.1 riastrad enum radeon_pcie_gen target_link_speed = si_get_maximum_link_speed(rdev, radeon_new_state); 5793 1.1 riastrad u8 request; 5794 1.1 riastrad 5795 1.1 riastrad if (si_pi->pspp_notify_required) { 5796 1.1 riastrad if (target_link_speed == RADEON_PCIE_GEN3) 5797 1.1 riastrad request = PCIE_PERF_REQ_PECI_GEN3; 5798 1.1 riastrad else if (target_link_speed == RADEON_PCIE_GEN2) 5799 1.1 riastrad request = PCIE_PERF_REQ_PECI_GEN2; 5800 1.1 riastrad else 5801 1.1 riastrad request = PCIE_PERF_REQ_PECI_GEN1; 5802 1.1 riastrad 5803 1.1 riastrad if ((request == PCIE_PERF_REQ_PECI_GEN1) && 5804 1.1 riastrad (si_get_current_pcie_speed(rdev) > 0)) 5805 1.1 riastrad return; 5806 1.1 riastrad 5807 1.1 riastrad #if defined(CONFIG_ACPI) 5808 1.1 riastrad radeon_acpi_pcie_performance_request(rdev, request, false); 5809 1.1 riastrad #endif 5810 1.1 riastrad } 5811 1.1 riastrad } 5812 1.1 riastrad 5813 1.1 riastrad #if 0 5814 1.1 riastrad static int si_ds_request(struct radeon_device *rdev, 5815 1.1 riastrad bool ds_status_on, u32 count_write) 5816 1.1 riastrad { 5817 1.1 riastrad struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); 5818 1.1 riastrad 5819 1.1 riastrad if (eg_pi->sclk_deep_sleep) { 5820 1.1 riastrad if (ds_status_on) 5821 1.1 riastrad return (si_send_msg_to_smc(rdev, PPSMC_MSG_CancelThrottleOVRDSCLKDS) == 5822 1.1 riastrad PPSMC_Result_OK) ? 5823 1.1 riastrad 0 : -EINVAL; 5824 1.1 riastrad else 5825 1.1 riastrad return (si_send_msg_to_smc(rdev, PPSMC_MSG_ThrottleOVRDSCLKDS) == 5826 1.1 riastrad PPSMC_Result_OK) ? 0 : -EINVAL; 5827 1.1 riastrad } 5828 1.1 riastrad return 0; 5829 1.1 riastrad } 5830 1.1 riastrad #endif 5831 1.1 riastrad 5832 1.1 riastrad static void si_set_max_cu_value(struct radeon_device *rdev) 5833 1.1 riastrad { 5834 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 5835 1.1 riastrad 5836 1.1 riastrad if (rdev->family == CHIP_VERDE) { 5837 1.1 riastrad switch (rdev->pdev->device) { 5838 1.1 riastrad case 0x6820: 5839 1.1 riastrad case 0x6825: 5840 1.1 riastrad case 0x6821: 5841 1.1 riastrad case 0x6823: 5842 1.1 riastrad case 0x6827: 5843 1.1 riastrad si_pi->max_cu = 10; 5844 1.1 riastrad break; 5845 1.1 riastrad case 0x682D: 5846 1.1 riastrad case 0x6824: 5847 1.1 riastrad case 0x682F: 5848 1.1 riastrad case 0x6826: 5849 1.1 riastrad si_pi->max_cu = 8; 5850 1.1 riastrad break; 5851 1.1 riastrad case 0x6828: 5852 1.1 riastrad case 0x6830: 5853 1.1 riastrad case 0x6831: 5854 1.1 riastrad case 0x6838: 5855 1.1 riastrad case 0x6839: 5856 1.1 riastrad case 0x683D: 5857 1.1 riastrad si_pi->max_cu = 10; 5858 1.1 riastrad break; 5859 1.1 riastrad case 0x683B: 5860 1.1 riastrad case 0x683F: 5861 1.1 riastrad case 0x6829: 5862 1.1 riastrad si_pi->max_cu = 8; 5863 1.1 riastrad break; 5864 1.1 riastrad default: 5865 1.1 riastrad si_pi->max_cu = 0; 5866 1.1 riastrad break; 5867 1.1 riastrad } 5868 1.1 riastrad } else { 5869 1.1 riastrad si_pi->max_cu = 0; 5870 1.1 riastrad } 5871 1.1 riastrad } 5872 1.1 riastrad 5873 1.1 riastrad static int si_patch_single_dependency_table_based_on_leakage(struct radeon_device *rdev, 5874 1.1 riastrad struct radeon_clock_voltage_dependency_table *table) 5875 1.1 riastrad { 5876 1.1 riastrad u32 i; 5877 1.1 riastrad int j; 5878 1.1 riastrad u16 leakage_voltage; 5879 1.1 riastrad 5880 1.1 riastrad if (table) { 5881 1.1 riastrad for (i = 0; i < table->count; i++) { 5882 1.1 riastrad switch (si_get_leakage_voltage_from_leakage_index(rdev, 5883 1.1 riastrad table->entries[i].v, 5884 1.1 riastrad &leakage_voltage)) { 5885 1.1 riastrad case 0: 5886 1.1 riastrad table->entries[i].v = leakage_voltage; 5887 1.1 riastrad break; 5888 1.1 riastrad case -EAGAIN: 5889 1.1 riastrad return -EINVAL; 5890 1.1 riastrad case -EINVAL: 5891 1.1 riastrad default: 5892 1.1 riastrad break; 5893 1.1 riastrad } 5894 1.1 riastrad } 5895 1.1 riastrad 5896 1.1 riastrad for (j = (table->count - 2); j >= 0; j--) { 5897 1.1 riastrad table->entries[j].v = (table->entries[j].v <= table->entries[j + 1].v) ? 5898 1.1 riastrad table->entries[j].v : table->entries[j + 1].v; 5899 1.1 riastrad } 5900 1.1 riastrad } 5901 1.1 riastrad return 0; 5902 1.1 riastrad } 5903 1.1 riastrad 5904 1.1 riastrad static int si_patch_dependency_tables_based_on_leakage(struct radeon_device *rdev) 5905 1.1 riastrad { 5906 1.5 riastrad int ret; 5907 1.1 riastrad 5908 1.1 riastrad ret = si_patch_single_dependency_table_based_on_leakage(rdev, 5909 1.1 riastrad &rdev->pm.dpm.dyn_state.vddc_dependency_on_sclk); 5910 1.1 riastrad ret = si_patch_single_dependency_table_based_on_leakage(rdev, 5911 1.1 riastrad &rdev->pm.dpm.dyn_state.vddc_dependency_on_mclk); 5912 1.1 riastrad ret = si_patch_single_dependency_table_based_on_leakage(rdev, 5913 1.1 riastrad &rdev->pm.dpm.dyn_state.vddci_dependency_on_mclk); 5914 1.1 riastrad return ret; 5915 1.1 riastrad } 5916 1.1 riastrad 5917 1.1 riastrad static void si_set_pcie_lane_width_in_smc(struct radeon_device *rdev, 5918 1.1 riastrad struct radeon_ps *radeon_new_state, 5919 1.1 riastrad struct radeon_ps *radeon_current_state) 5920 1.1 riastrad { 5921 1.1 riastrad u32 lane_width; 5922 1.1 riastrad u32 new_lane_width = 5923 1.1 riastrad ((radeon_new_state->caps & ATOM_PPLIB_PCIE_LINK_WIDTH_MASK) >> ATOM_PPLIB_PCIE_LINK_WIDTH_SHIFT) + 1; 5924 1.1 riastrad u32 current_lane_width = 5925 1.1 riastrad ((radeon_current_state->caps & ATOM_PPLIB_PCIE_LINK_WIDTH_MASK) >> ATOM_PPLIB_PCIE_LINK_WIDTH_SHIFT) + 1; 5926 1.1 riastrad 5927 1.1 riastrad if (new_lane_width != current_lane_width) { 5928 1.1 riastrad radeon_set_pcie_lanes(rdev, new_lane_width); 5929 1.1 riastrad lane_width = radeon_get_pcie_lanes(rdev); 5930 1.1 riastrad si_write_smc_soft_register(rdev, SI_SMC_SOFT_REGISTER_non_ulv_pcie_link_width, lane_width); 5931 1.1 riastrad } 5932 1.1 riastrad } 5933 1.1 riastrad 5934 1.1 riastrad static void si_set_vce_clock(struct radeon_device *rdev, 5935 1.1 riastrad struct radeon_ps *new_rps, 5936 1.1 riastrad struct radeon_ps *old_rps) 5937 1.1 riastrad { 5938 1.1 riastrad if ((old_rps->evclk != new_rps->evclk) || 5939 1.1 riastrad (old_rps->ecclk != new_rps->ecclk)) { 5940 1.1 riastrad /* turn the clocks on when encoding, off otherwise */ 5941 1.1 riastrad if (new_rps->evclk || new_rps->ecclk) 5942 1.1 riastrad vce_v1_0_enable_mgcg(rdev, false); 5943 1.1 riastrad else 5944 1.1 riastrad vce_v1_0_enable_mgcg(rdev, true); 5945 1.1 riastrad radeon_set_vce_clocks(rdev, new_rps->evclk, new_rps->ecclk); 5946 1.1 riastrad } 5947 1.1 riastrad } 5948 1.1 riastrad 5949 1.1 riastrad void si_dpm_setup_asic(struct radeon_device *rdev) 5950 1.1 riastrad { 5951 1.1 riastrad int r; 5952 1.1 riastrad 5953 1.1 riastrad r = si_mc_load_microcode(rdev); 5954 1.1 riastrad if (r) 5955 1.1 riastrad DRM_ERROR("Failed to load MC firmware!\n"); 5956 1.1 riastrad rv770_get_memory_type(rdev); 5957 1.1 riastrad si_read_clock_registers(rdev); 5958 1.1 riastrad si_enable_acpi_power_management(rdev); 5959 1.1 riastrad } 5960 1.1 riastrad 5961 1.1 riastrad static int si_thermal_enable_alert(struct radeon_device *rdev, 5962 1.1 riastrad bool enable) 5963 1.1 riastrad { 5964 1.1 riastrad u32 thermal_int = RREG32(CG_THERMAL_INT); 5965 1.1 riastrad 5966 1.1 riastrad if (enable) { 5967 1.1 riastrad PPSMC_Result result; 5968 1.1 riastrad 5969 1.1 riastrad thermal_int &= ~(THERM_INT_MASK_HIGH | THERM_INT_MASK_LOW); 5970 1.1 riastrad WREG32(CG_THERMAL_INT, thermal_int); 5971 1.1 riastrad rdev->irq.dpm_thermal = false; 5972 1.1 riastrad result = si_send_msg_to_smc(rdev, PPSMC_MSG_EnableThermalInterrupt); 5973 1.1 riastrad if (result != PPSMC_Result_OK) { 5974 1.1 riastrad DRM_DEBUG_KMS("Could not enable thermal interrupts.\n"); 5975 1.1 riastrad return -EINVAL; 5976 1.1 riastrad } 5977 1.1 riastrad } else { 5978 1.1 riastrad thermal_int |= THERM_INT_MASK_HIGH | THERM_INT_MASK_LOW; 5979 1.1 riastrad WREG32(CG_THERMAL_INT, thermal_int); 5980 1.1 riastrad rdev->irq.dpm_thermal = true; 5981 1.1 riastrad } 5982 1.1 riastrad 5983 1.1 riastrad return 0; 5984 1.1 riastrad } 5985 1.1 riastrad 5986 1.1 riastrad static int si_thermal_set_temperature_range(struct radeon_device *rdev, 5987 1.1 riastrad int min_temp, int max_temp) 5988 1.1 riastrad { 5989 1.1 riastrad int low_temp = 0 * 1000; 5990 1.1 riastrad int high_temp = 255 * 1000; 5991 1.1 riastrad 5992 1.1 riastrad if (low_temp < min_temp) 5993 1.1 riastrad low_temp = min_temp; 5994 1.1 riastrad if (high_temp > max_temp) 5995 1.1 riastrad high_temp = max_temp; 5996 1.1 riastrad if (high_temp < low_temp) { 5997 1.1 riastrad DRM_ERROR("invalid thermal range: %d - %d\n", low_temp, high_temp); 5998 1.1 riastrad return -EINVAL; 5999 1.1 riastrad } 6000 1.1 riastrad 6001 1.1 riastrad WREG32_P(CG_THERMAL_INT, DIG_THERM_INTH(high_temp / 1000), ~DIG_THERM_INTH_MASK); 6002 1.1 riastrad WREG32_P(CG_THERMAL_INT, DIG_THERM_INTL(low_temp / 1000), ~DIG_THERM_INTL_MASK); 6003 1.1 riastrad WREG32_P(CG_THERMAL_CTRL, DIG_THERM_DPM(high_temp / 1000), ~DIG_THERM_DPM_MASK); 6004 1.1 riastrad 6005 1.1 riastrad rdev->pm.dpm.thermal.min_temp = low_temp; 6006 1.1 riastrad rdev->pm.dpm.thermal.max_temp = high_temp; 6007 1.1 riastrad 6008 1.1 riastrad return 0; 6009 1.1 riastrad } 6010 1.1 riastrad 6011 1.1 riastrad static void si_fan_ctrl_set_static_mode(struct radeon_device *rdev, u32 mode) 6012 1.1 riastrad { 6013 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 6014 1.1 riastrad u32 tmp; 6015 1.1 riastrad 6016 1.1 riastrad if (si_pi->fan_ctrl_is_in_default_mode) { 6017 1.1 riastrad tmp = (RREG32(CG_FDO_CTRL2) & FDO_PWM_MODE_MASK) >> FDO_PWM_MODE_SHIFT; 6018 1.1 riastrad si_pi->fan_ctrl_default_mode = tmp; 6019 1.1 riastrad tmp = (RREG32(CG_FDO_CTRL2) & TMIN_MASK) >> TMIN_SHIFT; 6020 1.1 riastrad si_pi->t_min = tmp; 6021 1.1 riastrad si_pi->fan_ctrl_is_in_default_mode = false; 6022 1.1 riastrad } 6023 1.1 riastrad 6024 1.1 riastrad tmp = RREG32(CG_FDO_CTRL2) & ~TMIN_MASK; 6025 1.1 riastrad tmp |= TMIN(0); 6026 1.1 riastrad WREG32(CG_FDO_CTRL2, tmp); 6027 1.1 riastrad 6028 1.1 riastrad tmp = RREG32(CG_FDO_CTRL2) & ~FDO_PWM_MODE_MASK; 6029 1.1 riastrad tmp |= FDO_PWM_MODE(mode); 6030 1.1 riastrad WREG32(CG_FDO_CTRL2, tmp); 6031 1.1 riastrad } 6032 1.1 riastrad 6033 1.1 riastrad static int si_thermal_setup_fan_table(struct radeon_device *rdev) 6034 1.1 riastrad { 6035 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 6036 1.1 riastrad PP_SIslands_FanTable fan_table = { FDO_MODE_HARDWARE }; 6037 1.1 riastrad u32 duty100; 6038 1.1 riastrad u32 t_diff1, t_diff2, pwm_diff1, pwm_diff2; 6039 1.1 riastrad u16 fdo_min, slope1, slope2; 6040 1.1 riastrad u32 reference_clock, tmp; 6041 1.1 riastrad int ret; 6042 1.1 riastrad u64 tmp64; 6043 1.1 riastrad 6044 1.1 riastrad if (!si_pi->fan_table_start) { 6045 1.1 riastrad rdev->pm.dpm.fan.ucode_fan_control = false; 6046 1.1 riastrad return 0; 6047 1.1 riastrad } 6048 1.1 riastrad 6049 1.1 riastrad duty100 = (RREG32(CG_FDO_CTRL1) & FMAX_DUTY100_MASK) >> FMAX_DUTY100_SHIFT; 6050 1.1 riastrad 6051 1.1 riastrad if (duty100 == 0) { 6052 1.1 riastrad rdev->pm.dpm.fan.ucode_fan_control = false; 6053 1.1 riastrad return 0; 6054 1.1 riastrad } 6055 1.1 riastrad 6056 1.1 riastrad tmp64 = (u64)rdev->pm.dpm.fan.pwm_min * duty100; 6057 1.1 riastrad do_div(tmp64, 10000); 6058 1.1 riastrad fdo_min = (u16)tmp64; 6059 1.1 riastrad 6060 1.1 riastrad t_diff1 = rdev->pm.dpm.fan.t_med - rdev->pm.dpm.fan.t_min; 6061 1.1 riastrad t_diff2 = rdev->pm.dpm.fan.t_high - rdev->pm.dpm.fan.t_med; 6062 1.1 riastrad 6063 1.1 riastrad pwm_diff1 = rdev->pm.dpm.fan.pwm_med - rdev->pm.dpm.fan.pwm_min; 6064 1.1 riastrad pwm_diff2 = rdev->pm.dpm.fan.pwm_high - rdev->pm.dpm.fan.pwm_med; 6065 1.1 riastrad 6066 1.1 riastrad slope1 = (u16)((50 + ((16 * duty100 * pwm_diff1) / t_diff1)) / 100); 6067 1.1 riastrad slope2 = (u16)((50 + ((16 * duty100 * pwm_diff2) / t_diff2)) / 100); 6068 1.1 riastrad 6069 1.1 riastrad fan_table.temp_min = cpu_to_be16((50 + rdev->pm.dpm.fan.t_min) / 100); 6070 1.1 riastrad fan_table.temp_med = cpu_to_be16((50 + rdev->pm.dpm.fan.t_med) / 100); 6071 1.1 riastrad fan_table.temp_max = cpu_to_be16((50 + rdev->pm.dpm.fan.t_max) / 100); 6072 1.1 riastrad 6073 1.1 riastrad fan_table.slope1 = cpu_to_be16(slope1); 6074 1.1 riastrad fan_table.slope2 = cpu_to_be16(slope2); 6075 1.1 riastrad 6076 1.1 riastrad fan_table.fdo_min = cpu_to_be16(fdo_min); 6077 1.1 riastrad 6078 1.1 riastrad fan_table.hys_down = cpu_to_be16(rdev->pm.dpm.fan.t_hyst); 6079 1.1 riastrad 6080 1.1 riastrad fan_table.hys_up = cpu_to_be16(1); 6081 1.1 riastrad 6082 1.1 riastrad fan_table.hys_slope = cpu_to_be16(1); 6083 1.1 riastrad 6084 1.1 riastrad fan_table.temp_resp_lim = cpu_to_be16(5); 6085 1.1 riastrad 6086 1.1 riastrad reference_clock = radeon_get_xclk(rdev); 6087 1.1 riastrad 6088 1.1 riastrad fan_table.refresh_period = cpu_to_be32((rdev->pm.dpm.fan.cycle_delay * 6089 1.1 riastrad reference_clock) / 1600); 6090 1.1 riastrad 6091 1.1 riastrad fan_table.fdo_max = cpu_to_be16((u16)duty100); 6092 1.1 riastrad 6093 1.1 riastrad tmp = (RREG32(CG_MULT_THERMAL_CTRL) & TEMP_SEL_MASK) >> TEMP_SEL_SHIFT; 6094 1.1 riastrad fan_table.temp_src = (uint8_t)tmp; 6095 1.1 riastrad 6096 1.1 riastrad ret = si_copy_bytes_to_smc(rdev, 6097 1.1 riastrad si_pi->fan_table_start, 6098 1.1 riastrad (u8 *)(&fan_table), 6099 1.1 riastrad sizeof(fan_table), 6100 1.1 riastrad si_pi->sram_end); 6101 1.1 riastrad 6102 1.1 riastrad if (ret) { 6103 1.1 riastrad DRM_ERROR("Failed to load fan table to the SMC."); 6104 1.1 riastrad rdev->pm.dpm.fan.ucode_fan_control = false; 6105 1.1 riastrad } 6106 1.1 riastrad 6107 1.1 riastrad return 0; 6108 1.1 riastrad } 6109 1.1 riastrad 6110 1.1 riastrad static int si_fan_ctrl_start_smc_fan_control(struct radeon_device *rdev) 6111 1.1 riastrad { 6112 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 6113 1.1 riastrad PPSMC_Result ret; 6114 1.1 riastrad 6115 1.1 riastrad ret = si_send_msg_to_smc(rdev, PPSMC_StartFanControl); 6116 1.1 riastrad if (ret == PPSMC_Result_OK) { 6117 1.1 riastrad si_pi->fan_is_controlled_by_smc = true; 6118 1.1 riastrad return 0; 6119 1.1 riastrad } else { 6120 1.1 riastrad return -EINVAL; 6121 1.1 riastrad } 6122 1.1 riastrad } 6123 1.1 riastrad 6124 1.1 riastrad static int si_fan_ctrl_stop_smc_fan_control(struct radeon_device *rdev) 6125 1.1 riastrad { 6126 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 6127 1.1 riastrad PPSMC_Result ret; 6128 1.1 riastrad 6129 1.1 riastrad ret = si_send_msg_to_smc(rdev, PPSMC_StopFanControl); 6130 1.1 riastrad 6131 1.1 riastrad if (ret == PPSMC_Result_OK) { 6132 1.1 riastrad si_pi->fan_is_controlled_by_smc = false; 6133 1.1 riastrad return 0; 6134 1.1 riastrad } else { 6135 1.1 riastrad return -EINVAL; 6136 1.1 riastrad } 6137 1.1 riastrad } 6138 1.1 riastrad 6139 1.1 riastrad int si_fan_ctrl_get_fan_speed_percent(struct radeon_device *rdev, 6140 1.1 riastrad u32 *speed) 6141 1.1 riastrad { 6142 1.1 riastrad u32 duty, duty100; 6143 1.1 riastrad u64 tmp64; 6144 1.1 riastrad 6145 1.1 riastrad if (rdev->pm.no_fan) 6146 1.1 riastrad return -ENOENT; 6147 1.1 riastrad 6148 1.1 riastrad duty100 = (RREG32(CG_FDO_CTRL1) & FMAX_DUTY100_MASK) >> FMAX_DUTY100_SHIFT; 6149 1.1 riastrad duty = (RREG32(CG_THERMAL_STATUS) & FDO_PWM_DUTY_MASK) >> FDO_PWM_DUTY_SHIFT; 6150 1.1 riastrad 6151 1.1 riastrad if (duty100 == 0) 6152 1.1 riastrad return -EINVAL; 6153 1.1 riastrad 6154 1.1 riastrad tmp64 = (u64)duty * 100; 6155 1.1 riastrad do_div(tmp64, duty100); 6156 1.1 riastrad *speed = (u32)tmp64; 6157 1.1 riastrad 6158 1.1 riastrad if (*speed > 100) 6159 1.1 riastrad *speed = 100; 6160 1.1 riastrad 6161 1.1 riastrad return 0; 6162 1.1 riastrad } 6163 1.1 riastrad 6164 1.1 riastrad int si_fan_ctrl_set_fan_speed_percent(struct radeon_device *rdev, 6165 1.1 riastrad u32 speed) 6166 1.1 riastrad { 6167 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 6168 1.1 riastrad u32 tmp; 6169 1.1 riastrad u32 duty, duty100; 6170 1.1 riastrad u64 tmp64; 6171 1.1 riastrad 6172 1.1 riastrad if (rdev->pm.no_fan) 6173 1.1 riastrad return -ENOENT; 6174 1.1 riastrad 6175 1.1 riastrad if (si_pi->fan_is_controlled_by_smc) 6176 1.1 riastrad return -EINVAL; 6177 1.1 riastrad 6178 1.1 riastrad if (speed > 100) 6179 1.1 riastrad return -EINVAL; 6180 1.1 riastrad 6181 1.1 riastrad duty100 = (RREG32(CG_FDO_CTRL1) & FMAX_DUTY100_MASK) >> FMAX_DUTY100_SHIFT; 6182 1.1 riastrad 6183 1.1 riastrad if (duty100 == 0) 6184 1.1 riastrad return -EINVAL; 6185 1.1 riastrad 6186 1.1 riastrad tmp64 = (u64)speed * duty100; 6187 1.1 riastrad do_div(tmp64, 100); 6188 1.1 riastrad duty = (u32)tmp64; 6189 1.1 riastrad 6190 1.1 riastrad tmp = RREG32(CG_FDO_CTRL0) & ~FDO_STATIC_DUTY_MASK; 6191 1.1 riastrad tmp |= FDO_STATIC_DUTY(duty); 6192 1.1 riastrad WREG32(CG_FDO_CTRL0, tmp); 6193 1.1 riastrad 6194 1.1 riastrad return 0; 6195 1.1 riastrad } 6196 1.1 riastrad 6197 1.1 riastrad void si_fan_ctrl_set_mode(struct radeon_device *rdev, u32 mode) 6198 1.1 riastrad { 6199 1.1 riastrad if (mode) { 6200 1.1 riastrad /* stop auto-manage */ 6201 1.1 riastrad if (rdev->pm.dpm.fan.ucode_fan_control) 6202 1.1 riastrad si_fan_ctrl_stop_smc_fan_control(rdev); 6203 1.1 riastrad si_fan_ctrl_set_static_mode(rdev, mode); 6204 1.1 riastrad } else { 6205 1.1 riastrad /* restart auto-manage */ 6206 1.1 riastrad if (rdev->pm.dpm.fan.ucode_fan_control) 6207 1.1 riastrad si_thermal_start_smc_fan_control(rdev); 6208 1.1 riastrad else 6209 1.1 riastrad si_fan_ctrl_set_default_mode(rdev); 6210 1.1 riastrad } 6211 1.1 riastrad } 6212 1.1 riastrad 6213 1.1 riastrad u32 si_fan_ctrl_get_mode(struct radeon_device *rdev) 6214 1.1 riastrad { 6215 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 6216 1.1 riastrad u32 tmp; 6217 1.1 riastrad 6218 1.1 riastrad if (si_pi->fan_is_controlled_by_smc) 6219 1.1 riastrad return 0; 6220 1.1 riastrad 6221 1.1 riastrad tmp = RREG32(CG_FDO_CTRL2) & FDO_PWM_MODE_MASK; 6222 1.1 riastrad return (tmp >> FDO_PWM_MODE_SHIFT); 6223 1.1 riastrad } 6224 1.1 riastrad 6225 1.1 riastrad #if 0 6226 1.1 riastrad static int si_fan_ctrl_get_fan_speed_rpm(struct radeon_device *rdev, 6227 1.1 riastrad u32 *speed) 6228 1.1 riastrad { 6229 1.1 riastrad u32 tach_period; 6230 1.1 riastrad u32 xclk = radeon_get_xclk(rdev); 6231 1.1 riastrad 6232 1.1 riastrad if (rdev->pm.no_fan) 6233 1.1 riastrad return -ENOENT; 6234 1.1 riastrad 6235 1.1 riastrad if (rdev->pm.fan_pulses_per_revolution == 0) 6236 1.1 riastrad return -ENOENT; 6237 1.1 riastrad 6238 1.1 riastrad tach_period = (RREG32(CG_TACH_STATUS) & TACH_PERIOD_MASK) >> TACH_PERIOD_SHIFT; 6239 1.1 riastrad if (tach_period == 0) 6240 1.1 riastrad return -ENOENT; 6241 1.1 riastrad 6242 1.1 riastrad *speed = 60 * xclk * 10000 / tach_period; 6243 1.1 riastrad 6244 1.1 riastrad return 0; 6245 1.1 riastrad } 6246 1.1 riastrad 6247 1.1 riastrad static int si_fan_ctrl_set_fan_speed_rpm(struct radeon_device *rdev, 6248 1.1 riastrad u32 speed) 6249 1.1 riastrad { 6250 1.1 riastrad u32 tach_period, tmp; 6251 1.1 riastrad u32 xclk = radeon_get_xclk(rdev); 6252 1.1 riastrad 6253 1.1 riastrad if (rdev->pm.no_fan) 6254 1.1 riastrad return -ENOENT; 6255 1.1 riastrad 6256 1.1 riastrad if (rdev->pm.fan_pulses_per_revolution == 0) 6257 1.1 riastrad return -ENOENT; 6258 1.1 riastrad 6259 1.1 riastrad if ((speed < rdev->pm.fan_min_rpm) || 6260 1.1 riastrad (speed > rdev->pm.fan_max_rpm)) 6261 1.1 riastrad return -EINVAL; 6262 1.1 riastrad 6263 1.1 riastrad if (rdev->pm.dpm.fan.ucode_fan_control) 6264 1.1 riastrad si_fan_ctrl_stop_smc_fan_control(rdev); 6265 1.1 riastrad 6266 1.1 riastrad tach_period = 60 * xclk * 10000 / (8 * speed); 6267 1.1 riastrad tmp = RREG32(CG_TACH_CTRL) & ~TARGET_PERIOD_MASK; 6268 1.1 riastrad tmp |= TARGET_PERIOD(tach_period); 6269 1.1 riastrad WREG32(CG_TACH_CTRL, tmp); 6270 1.1 riastrad 6271 1.1 riastrad si_fan_ctrl_set_static_mode(rdev, FDO_PWM_MODE_STATIC_RPM); 6272 1.1 riastrad 6273 1.1 riastrad return 0; 6274 1.1 riastrad } 6275 1.1 riastrad #endif 6276 1.1 riastrad 6277 1.1 riastrad static void si_fan_ctrl_set_default_mode(struct radeon_device *rdev) 6278 1.1 riastrad { 6279 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 6280 1.1 riastrad u32 tmp; 6281 1.1 riastrad 6282 1.1 riastrad if (!si_pi->fan_ctrl_is_in_default_mode) { 6283 1.1 riastrad tmp = RREG32(CG_FDO_CTRL2) & ~FDO_PWM_MODE_MASK; 6284 1.1 riastrad tmp |= FDO_PWM_MODE(si_pi->fan_ctrl_default_mode); 6285 1.1 riastrad WREG32(CG_FDO_CTRL2, tmp); 6286 1.1 riastrad 6287 1.1 riastrad tmp = RREG32(CG_FDO_CTRL2) & ~TMIN_MASK; 6288 1.1 riastrad tmp |= TMIN(si_pi->t_min); 6289 1.1 riastrad WREG32(CG_FDO_CTRL2, tmp); 6290 1.1 riastrad si_pi->fan_ctrl_is_in_default_mode = true; 6291 1.1 riastrad } 6292 1.1 riastrad } 6293 1.1 riastrad 6294 1.1 riastrad static void si_thermal_start_smc_fan_control(struct radeon_device *rdev) 6295 1.1 riastrad { 6296 1.1 riastrad if (rdev->pm.dpm.fan.ucode_fan_control) { 6297 1.1 riastrad si_fan_ctrl_start_smc_fan_control(rdev); 6298 1.1 riastrad si_fan_ctrl_set_static_mode(rdev, FDO_PWM_MODE_STATIC); 6299 1.1 riastrad } 6300 1.1 riastrad } 6301 1.1 riastrad 6302 1.1 riastrad static void si_thermal_initialize(struct radeon_device *rdev) 6303 1.1 riastrad { 6304 1.1 riastrad u32 tmp; 6305 1.1 riastrad 6306 1.1 riastrad if (rdev->pm.fan_pulses_per_revolution) { 6307 1.1 riastrad tmp = RREG32(CG_TACH_CTRL) & ~EDGE_PER_REV_MASK; 6308 1.1 riastrad tmp |= EDGE_PER_REV(rdev->pm.fan_pulses_per_revolution -1); 6309 1.1 riastrad WREG32(CG_TACH_CTRL, tmp); 6310 1.1 riastrad } 6311 1.1 riastrad 6312 1.1 riastrad tmp = RREG32(CG_FDO_CTRL2) & ~TACH_PWM_RESP_RATE_MASK; 6313 1.1 riastrad tmp |= TACH_PWM_RESP_RATE(0x28); 6314 1.1 riastrad WREG32(CG_FDO_CTRL2, tmp); 6315 1.1 riastrad } 6316 1.1 riastrad 6317 1.1 riastrad static int si_thermal_start_thermal_controller(struct radeon_device *rdev) 6318 1.1 riastrad { 6319 1.1 riastrad int ret; 6320 1.1 riastrad 6321 1.1 riastrad si_thermal_initialize(rdev); 6322 1.1 riastrad ret = si_thermal_set_temperature_range(rdev, R600_TEMP_RANGE_MIN, R600_TEMP_RANGE_MAX); 6323 1.1 riastrad if (ret) 6324 1.1 riastrad return ret; 6325 1.1 riastrad ret = si_thermal_enable_alert(rdev, true); 6326 1.1 riastrad if (ret) 6327 1.1 riastrad return ret; 6328 1.1 riastrad if (rdev->pm.dpm.fan.ucode_fan_control) { 6329 1.1 riastrad ret = si_halt_smc(rdev); 6330 1.1 riastrad if (ret) 6331 1.1 riastrad return ret; 6332 1.1 riastrad ret = si_thermal_setup_fan_table(rdev); 6333 1.1 riastrad if (ret) 6334 1.1 riastrad return ret; 6335 1.1 riastrad ret = si_resume_smc(rdev); 6336 1.1 riastrad if (ret) 6337 1.1 riastrad return ret; 6338 1.1 riastrad si_thermal_start_smc_fan_control(rdev); 6339 1.1 riastrad } 6340 1.1 riastrad 6341 1.1 riastrad return 0; 6342 1.1 riastrad } 6343 1.1 riastrad 6344 1.1 riastrad static void si_thermal_stop_thermal_controller(struct radeon_device *rdev) 6345 1.1 riastrad { 6346 1.1 riastrad if (!rdev->pm.no_fan) { 6347 1.1 riastrad si_fan_ctrl_set_default_mode(rdev); 6348 1.1 riastrad si_fan_ctrl_stop_smc_fan_control(rdev); 6349 1.1 riastrad } 6350 1.1 riastrad } 6351 1.1 riastrad 6352 1.1 riastrad int si_dpm_enable(struct radeon_device *rdev) 6353 1.1 riastrad { 6354 1.1 riastrad struct rv7xx_power_info *pi = rv770_get_pi(rdev); 6355 1.1 riastrad struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); 6356 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 6357 1.1 riastrad struct radeon_ps *boot_ps = rdev->pm.dpm.boot_ps; 6358 1.1 riastrad int ret; 6359 1.1 riastrad 6360 1.1 riastrad if (si_is_smc_running(rdev)) 6361 1.1 riastrad return -EINVAL; 6362 1.1 riastrad if (pi->voltage_control || si_pi->voltage_control_svi2) 6363 1.1 riastrad si_enable_voltage_control(rdev, true); 6364 1.1 riastrad if (pi->mvdd_control) 6365 1.1 riastrad si_get_mvdd_configuration(rdev); 6366 1.1 riastrad if (pi->voltage_control || si_pi->voltage_control_svi2) { 6367 1.1 riastrad ret = si_construct_voltage_tables(rdev); 6368 1.1 riastrad if (ret) { 6369 1.1 riastrad DRM_ERROR("si_construct_voltage_tables failed\n"); 6370 1.1 riastrad return ret; 6371 1.1 riastrad } 6372 1.1 riastrad } 6373 1.1 riastrad if (eg_pi->dynamic_ac_timing) { 6374 1.1 riastrad ret = si_initialize_mc_reg_table(rdev); 6375 1.1 riastrad if (ret) 6376 1.1 riastrad eg_pi->dynamic_ac_timing = false; 6377 1.1 riastrad } 6378 1.1 riastrad if (pi->dynamic_ss) 6379 1.1 riastrad si_enable_spread_spectrum(rdev, true); 6380 1.1 riastrad if (pi->thermal_protection) 6381 1.1 riastrad si_enable_thermal_protection(rdev, true); 6382 1.1 riastrad si_setup_bsp(rdev); 6383 1.1 riastrad si_program_git(rdev); 6384 1.1 riastrad si_program_tp(rdev); 6385 1.1 riastrad si_program_tpp(rdev); 6386 1.1 riastrad si_program_sstp(rdev); 6387 1.1 riastrad si_enable_display_gap(rdev); 6388 1.1 riastrad si_program_vc(rdev); 6389 1.1 riastrad ret = si_upload_firmware(rdev); 6390 1.1 riastrad if (ret) { 6391 1.1 riastrad DRM_ERROR("si_upload_firmware failed\n"); 6392 1.1 riastrad return ret; 6393 1.1 riastrad } 6394 1.1 riastrad ret = si_process_firmware_header(rdev); 6395 1.1 riastrad if (ret) { 6396 1.1 riastrad DRM_ERROR("si_process_firmware_header failed\n"); 6397 1.1 riastrad return ret; 6398 1.1 riastrad } 6399 1.1 riastrad ret = si_initial_switch_from_arb_f0_to_f1(rdev); 6400 1.1 riastrad if (ret) { 6401 1.1 riastrad DRM_ERROR("si_initial_switch_from_arb_f0_to_f1 failed\n"); 6402 1.1 riastrad return ret; 6403 1.1 riastrad } 6404 1.1 riastrad ret = si_init_smc_table(rdev); 6405 1.1 riastrad if (ret) { 6406 1.1 riastrad DRM_ERROR("si_init_smc_table failed\n"); 6407 1.1 riastrad return ret; 6408 1.1 riastrad } 6409 1.1 riastrad ret = si_init_smc_spll_table(rdev); 6410 1.1 riastrad if (ret) { 6411 1.1 riastrad DRM_ERROR("si_init_smc_spll_table failed\n"); 6412 1.1 riastrad return ret; 6413 1.1 riastrad } 6414 1.1 riastrad ret = si_init_arb_table_index(rdev); 6415 1.1 riastrad if (ret) { 6416 1.1 riastrad DRM_ERROR("si_init_arb_table_index failed\n"); 6417 1.1 riastrad return ret; 6418 1.1 riastrad } 6419 1.1 riastrad if (eg_pi->dynamic_ac_timing) { 6420 1.1 riastrad ret = si_populate_mc_reg_table(rdev, boot_ps); 6421 1.1 riastrad if (ret) { 6422 1.1 riastrad DRM_ERROR("si_populate_mc_reg_table failed\n"); 6423 1.1 riastrad return ret; 6424 1.1 riastrad } 6425 1.1 riastrad } 6426 1.1 riastrad ret = si_initialize_smc_cac_tables(rdev); 6427 1.1 riastrad if (ret) { 6428 1.1 riastrad DRM_ERROR("si_initialize_smc_cac_tables failed\n"); 6429 1.1 riastrad return ret; 6430 1.1 riastrad } 6431 1.1 riastrad ret = si_initialize_hardware_cac_manager(rdev); 6432 1.1 riastrad if (ret) { 6433 1.1 riastrad DRM_ERROR("si_initialize_hardware_cac_manager failed\n"); 6434 1.1 riastrad return ret; 6435 1.1 riastrad } 6436 1.1 riastrad ret = si_initialize_smc_dte_tables(rdev); 6437 1.1 riastrad if (ret) { 6438 1.1 riastrad DRM_ERROR("si_initialize_smc_dte_tables failed\n"); 6439 1.1 riastrad return ret; 6440 1.1 riastrad } 6441 1.1 riastrad ret = si_populate_smc_tdp_limits(rdev, boot_ps); 6442 1.1 riastrad if (ret) { 6443 1.1 riastrad DRM_ERROR("si_populate_smc_tdp_limits failed\n"); 6444 1.1 riastrad return ret; 6445 1.1 riastrad } 6446 1.1 riastrad ret = si_populate_smc_tdp_limits_2(rdev, boot_ps); 6447 1.1 riastrad if (ret) { 6448 1.1 riastrad DRM_ERROR("si_populate_smc_tdp_limits_2 failed\n"); 6449 1.1 riastrad return ret; 6450 1.1 riastrad } 6451 1.1 riastrad si_program_response_times(rdev); 6452 1.1 riastrad si_program_ds_registers(rdev); 6453 1.1 riastrad si_dpm_start_smc(rdev); 6454 1.1 riastrad ret = si_notify_smc_display_change(rdev, false); 6455 1.1 riastrad if (ret) { 6456 1.1 riastrad DRM_ERROR("si_notify_smc_display_change failed\n"); 6457 1.1 riastrad return ret; 6458 1.1 riastrad } 6459 1.1 riastrad si_enable_sclk_control(rdev, true); 6460 1.1 riastrad si_start_dpm(rdev); 6461 1.1 riastrad 6462 1.1 riastrad si_enable_auto_throttle_source(rdev, RADEON_DPM_AUTO_THROTTLE_SRC_THERMAL, true); 6463 1.1 riastrad 6464 1.1 riastrad si_thermal_start_thermal_controller(rdev); 6465 1.1 riastrad 6466 1.1 riastrad ni_update_current_ps(rdev, boot_ps); 6467 1.1 riastrad 6468 1.1 riastrad return 0; 6469 1.1 riastrad } 6470 1.1 riastrad 6471 1.1 riastrad static int si_set_temperature_range(struct radeon_device *rdev) 6472 1.1 riastrad { 6473 1.1 riastrad int ret; 6474 1.1 riastrad 6475 1.1 riastrad ret = si_thermal_enable_alert(rdev, false); 6476 1.1 riastrad if (ret) 6477 1.1 riastrad return ret; 6478 1.1 riastrad ret = si_thermal_set_temperature_range(rdev, R600_TEMP_RANGE_MIN, R600_TEMP_RANGE_MAX); 6479 1.1 riastrad if (ret) 6480 1.1 riastrad return ret; 6481 1.1 riastrad ret = si_thermal_enable_alert(rdev, true); 6482 1.1 riastrad if (ret) 6483 1.1 riastrad return ret; 6484 1.1 riastrad 6485 1.1 riastrad return ret; 6486 1.1 riastrad } 6487 1.1 riastrad 6488 1.1 riastrad int si_dpm_late_enable(struct radeon_device *rdev) 6489 1.1 riastrad { 6490 1.1 riastrad int ret; 6491 1.1 riastrad 6492 1.1 riastrad ret = si_set_temperature_range(rdev); 6493 1.1 riastrad if (ret) 6494 1.1 riastrad return ret; 6495 1.1 riastrad 6496 1.1 riastrad return ret; 6497 1.1 riastrad } 6498 1.1 riastrad 6499 1.1 riastrad void si_dpm_disable(struct radeon_device *rdev) 6500 1.1 riastrad { 6501 1.1 riastrad struct rv7xx_power_info *pi = rv770_get_pi(rdev); 6502 1.1 riastrad struct radeon_ps *boot_ps = rdev->pm.dpm.boot_ps; 6503 1.1 riastrad 6504 1.1 riastrad if (!si_is_smc_running(rdev)) 6505 1.1 riastrad return; 6506 1.1 riastrad si_thermal_stop_thermal_controller(rdev); 6507 1.1 riastrad si_disable_ulv(rdev); 6508 1.1 riastrad si_clear_vc(rdev); 6509 1.1 riastrad if (pi->thermal_protection) 6510 1.1 riastrad si_enable_thermal_protection(rdev, false); 6511 1.1 riastrad si_enable_power_containment(rdev, boot_ps, false); 6512 1.1 riastrad si_enable_smc_cac(rdev, boot_ps, false); 6513 1.1 riastrad si_enable_spread_spectrum(rdev, false); 6514 1.1 riastrad si_enable_auto_throttle_source(rdev, RADEON_DPM_AUTO_THROTTLE_SRC_THERMAL, false); 6515 1.1 riastrad si_stop_dpm(rdev); 6516 1.1 riastrad si_reset_to_default(rdev); 6517 1.1 riastrad si_dpm_stop_smc(rdev); 6518 1.1 riastrad si_force_switch_to_arb_f0(rdev); 6519 1.1 riastrad 6520 1.1 riastrad ni_update_current_ps(rdev, boot_ps); 6521 1.1 riastrad } 6522 1.1 riastrad 6523 1.1 riastrad int si_dpm_pre_set_power_state(struct radeon_device *rdev) 6524 1.1 riastrad { 6525 1.1 riastrad struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); 6526 1.1 riastrad struct radeon_ps requested_ps = *rdev->pm.dpm.requested_ps; 6527 1.1 riastrad struct radeon_ps *new_ps = &requested_ps; 6528 1.1 riastrad 6529 1.1 riastrad ni_update_requested_ps(rdev, new_ps); 6530 1.1 riastrad 6531 1.1 riastrad si_apply_state_adjust_rules(rdev, &eg_pi->requested_rps); 6532 1.1 riastrad 6533 1.1 riastrad return 0; 6534 1.1 riastrad } 6535 1.1 riastrad 6536 1.1 riastrad static int si_power_control_set_level(struct radeon_device *rdev) 6537 1.1 riastrad { 6538 1.1 riastrad struct radeon_ps *new_ps = rdev->pm.dpm.requested_ps; 6539 1.1 riastrad int ret; 6540 1.1 riastrad 6541 1.1 riastrad ret = si_restrict_performance_levels_before_switch(rdev); 6542 1.1 riastrad if (ret) 6543 1.1 riastrad return ret; 6544 1.1 riastrad ret = si_halt_smc(rdev); 6545 1.1 riastrad if (ret) 6546 1.1 riastrad return ret; 6547 1.1 riastrad ret = si_populate_smc_tdp_limits(rdev, new_ps); 6548 1.1 riastrad if (ret) 6549 1.1 riastrad return ret; 6550 1.1 riastrad ret = si_populate_smc_tdp_limits_2(rdev, new_ps); 6551 1.1 riastrad if (ret) 6552 1.1 riastrad return ret; 6553 1.1 riastrad ret = si_resume_smc(rdev); 6554 1.1 riastrad if (ret) 6555 1.1 riastrad return ret; 6556 1.1 riastrad ret = si_set_sw_state(rdev); 6557 1.1 riastrad if (ret) 6558 1.1 riastrad return ret; 6559 1.1 riastrad return 0; 6560 1.1 riastrad } 6561 1.1 riastrad 6562 1.1 riastrad int si_dpm_set_power_state(struct radeon_device *rdev) 6563 1.1 riastrad { 6564 1.1 riastrad struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); 6565 1.1 riastrad struct radeon_ps *new_ps = &eg_pi->requested_rps; 6566 1.1 riastrad struct radeon_ps *old_ps = &eg_pi->current_rps; 6567 1.1 riastrad int ret; 6568 1.1 riastrad 6569 1.1 riastrad ret = si_disable_ulv(rdev); 6570 1.1 riastrad if (ret) { 6571 1.1 riastrad DRM_ERROR("si_disable_ulv failed\n"); 6572 1.1 riastrad return ret; 6573 1.1 riastrad } 6574 1.1 riastrad ret = si_restrict_performance_levels_before_switch(rdev); 6575 1.1 riastrad if (ret) { 6576 1.1 riastrad DRM_ERROR("si_restrict_performance_levels_before_switch failed\n"); 6577 1.1 riastrad return ret; 6578 1.1 riastrad } 6579 1.1 riastrad if (eg_pi->pcie_performance_request) 6580 1.1 riastrad si_request_link_speed_change_before_state_change(rdev, new_ps, old_ps); 6581 1.1 riastrad ni_set_uvd_clock_before_set_eng_clock(rdev, new_ps, old_ps); 6582 1.1 riastrad ret = si_enable_power_containment(rdev, new_ps, false); 6583 1.1 riastrad if (ret) { 6584 1.1 riastrad DRM_ERROR("si_enable_power_containment failed\n"); 6585 1.1 riastrad return ret; 6586 1.1 riastrad } 6587 1.1 riastrad ret = si_enable_smc_cac(rdev, new_ps, false); 6588 1.1 riastrad if (ret) { 6589 1.1 riastrad DRM_ERROR("si_enable_smc_cac failed\n"); 6590 1.1 riastrad return ret; 6591 1.1 riastrad } 6592 1.1 riastrad ret = si_halt_smc(rdev); 6593 1.1 riastrad if (ret) { 6594 1.1 riastrad DRM_ERROR("si_halt_smc failed\n"); 6595 1.1 riastrad return ret; 6596 1.1 riastrad } 6597 1.1 riastrad ret = si_upload_sw_state(rdev, new_ps); 6598 1.1 riastrad if (ret) { 6599 1.1 riastrad DRM_ERROR("si_upload_sw_state failed\n"); 6600 1.1 riastrad return ret; 6601 1.1 riastrad } 6602 1.1 riastrad ret = si_upload_smc_data(rdev); 6603 1.1 riastrad if (ret) { 6604 1.1 riastrad DRM_ERROR("si_upload_smc_data failed\n"); 6605 1.1 riastrad return ret; 6606 1.1 riastrad } 6607 1.1 riastrad ret = si_upload_ulv_state(rdev); 6608 1.1 riastrad if (ret) { 6609 1.1 riastrad DRM_ERROR("si_upload_ulv_state failed\n"); 6610 1.1 riastrad return ret; 6611 1.1 riastrad } 6612 1.1 riastrad if (eg_pi->dynamic_ac_timing) { 6613 1.1 riastrad ret = si_upload_mc_reg_table(rdev, new_ps); 6614 1.1 riastrad if (ret) { 6615 1.1 riastrad DRM_ERROR("si_upload_mc_reg_table failed\n"); 6616 1.1 riastrad return ret; 6617 1.1 riastrad } 6618 1.1 riastrad } 6619 1.1 riastrad ret = si_program_memory_timing_parameters(rdev, new_ps); 6620 1.1 riastrad if (ret) { 6621 1.1 riastrad DRM_ERROR("si_program_memory_timing_parameters failed\n"); 6622 1.1 riastrad return ret; 6623 1.1 riastrad } 6624 1.1 riastrad si_set_pcie_lane_width_in_smc(rdev, new_ps, old_ps); 6625 1.1 riastrad 6626 1.1 riastrad ret = si_resume_smc(rdev); 6627 1.1 riastrad if (ret) { 6628 1.1 riastrad DRM_ERROR("si_resume_smc failed\n"); 6629 1.1 riastrad return ret; 6630 1.1 riastrad } 6631 1.1 riastrad ret = si_set_sw_state(rdev); 6632 1.1 riastrad if (ret) { 6633 1.1 riastrad DRM_ERROR("si_set_sw_state failed\n"); 6634 1.1 riastrad return ret; 6635 1.1 riastrad } 6636 1.1 riastrad ni_set_uvd_clock_after_set_eng_clock(rdev, new_ps, old_ps); 6637 1.1 riastrad si_set_vce_clock(rdev, new_ps, old_ps); 6638 1.1 riastrad if (eg_pi->pcie_performance_request) 6639 1.1 riastrad si_notify_link_speed_change_after_state_change(rdev, new_ps, old_ps); 6640 1.1 riastrad ret = si_set_power_state_conditionally_enable_ulv(rdev, new_ps); 6641 1.1 riastrad if (ret) { 6642 1.1 riastrad DRM_ERROR("si_set_power_state_conditionally_enable_ulv failed\n"); 6643 1.1 riastrad return ret; 6644 1.1 riastrad } 6645 1.1 riastrad ret = si_enable_smc_cac(rdev, new_ps, true); 6646 1.1 riastrad if (ret) { 6647 1.1 riastrad DRM_ERROR("si_enable_smc_cac failed\n"); 6648 1.1 riastrad return ret; 6649 1.1 riastrad } 6650 1.1 riastrad ret = si_enable_power_containment(rdev, new_ps, true); 6651 1.1 riastrad if (ret) { 6652 1.1 riastrad DRM_ERROR("si_enable_power_containment failed\n"); 6653 1.1 riastrad return ret; 6654 1.1 riastrad } 6655 1.1 riastrad 6656 1.1 riastrad ret = si_power_control_set_level(rdev); 6657 1.1 riastrad if (ret) { 6658 1.1 riastrad DRM_ERROR("si_power_control_set_level failed\n"); 6659 1.1 riastrad return ret; 6660 1.1 riastrad } 6661 1.1 riastrad 6662 1.1 riastrad return 0; 6663 1.1 riastrad } 6664 1.1 riastrad 6665 1.1 riastrad void si_dpm_post_set_power_state(struct radeon_device *rdev) 6666 1.1 riastrad { 6667 1.1 riastrad struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); 6668 1.1 riastrad struct radeon_ps *new_ps = &eg_pi->requested_rps; 6669 1.1 riastrad 6670 1.1 riastrad ni_update_current_ps(rdev, new_ps); 6671 1.1 riastrad } 6672 1.1 riastrad 6673 1.1 riastrad #if 0 6674 1.1 riastrad void si_dpm_reset_asic(struct radeon_device *rdev) 6675 1.1 riastrad { 6676 1.1 riastrad si_restrict_performance_levels_before_switch(rdev); 6677 1.1 riastrad si_disable_ulv(rdev); 6678 1.1 riastrad si_set_boot_state(rdev); 6679 1.1 riastrad } 6680 1.1 riastrad #endif 6681 1.1 riastrad 6682 1.1 riastrad void si_dpm_display_configuration_changed(struct radeon_device *rdev) 6683 1.1 riastrad { 6684 1.1 riastrad si_program_display_gap(rdev); 6685 1.1 riastrad } 6686 1.1 riastrad 6687 1.1 riastrad union power_info { 6688 1.1 riastrad struct _ATOM_POWERPLAY_INFO info; 6689 1.1 riastrad struct _ATOM_POWERPLAY_INFO_V2 info_2; 6690 1.1 riastrad struct _ATOM_POWERPLAY_INFO_V3 info_3; 6691 1.1 riastrad struct _ATOM_PPLIB_POWERPLAYTABLE pplib; 6692 1.1 riastrad struct _ATOM_PPLIB_POWERPLAYTABLE2 pplib2; 6693 1.1 riastrad struct _ATOM_PPLIB_POWERPLAYTABLE3 pplib3; 6694 1.1 riastrad }; 6695 1.1 riastrad 6696 1.1 riastrad union pplib_clock_info { 6697 1.1 riastrad struct _ATOM_PPLIB_R600_CLOCK_INFO r600; 6698 1.1 riastrad struct _ATOM_PPLIB_RS780_CLOCK_INFO rs780; 6699 1.1 riastrad struct _ATOM_PPLIB_EVERGREEN_CLOCK_INFO evergreen; 6700 1.1 riastrad struct _ATOM_PPLIB_SUMO_CLOCK_INFO sumo; 6701 1.1 riastrad struct _ATOM_PPLIB_SI_CLOCK_INFO si; 6702 1.1 riastrad }; 6703 1.1 riastrad 6704 1.1 riastrad union pplib_power_state { 6705 1.1 riastrad struct _ATOM_PPLIB_STATE v1; 6706 1.1 riastrad struct _ATOM_PPLIB_STATE_V2 v2; 6707 1.1 riastrad }; 6708 1.1 riastrad 6709 1.1 riastrad static void si_parse_pplib_non_clock_info(struct radeon_device *rdev, 6710 1.1 riastrad struct radeon_ps *rps, 6711 1.1 riastrad struct _ATOM_PPLIB_NONCLOCK_INFO *non_clock_info, 6712 1.1 riastrad u8 table_rev) 6713 1.1 riastrad { 6714 1.1 riastrad rps->caps = le32_to_cpu(non_clock_info->ulCapsAndSettings); 6715 1.1 riastrad rps->class = le16_to_cpu(non_clock_info->usClassification); 6716 1.1 riastrad rps->class2 = le16_to_cpu(non_clock_info->usClassification2); 6717 1.1 riastrad 6718 1.1 riastrad if (ATOM_PPLIB_NONCLOCKINFO_VER1 < table_rev) { 6719 1.1 riastrad rps->vclk = le32_to_cpu(non_clock_info->ulVCLK); 6720 1.1 riastrad rps->dclk = le32_to_cpu(non_clock_info->ulDCLK); 6721 1.1 riastrad } else if (r600_is_uvd_state(rps->class, rps->class2)) { 6722 1.1 riastrad rps->vclk = RV770_DEFAULT_VCLK_FREQ; 6723 1.1 riastrad rps->dclk = RV770_DEFAULT_DCLK_FREQ; 6724 1.1 riastrad } else { 6725 1.1 riastrad rps->vclk = 0; 6726 1.1 riastrad rps->dclk = 0; 6727 1.1 riastrad } 6728 1.1 riastrad 6729 1.1 riastrad if (rps->class & ATOM_PPLIB_CLASSIFICATION_BOOT) 6730 1.1 riastrad rdev->pm.dpm.boot_ps = rps; 6731 1.1 riastrad if (rps->class & ATOM_PPLIB_CLASSIFICATION_UVDSTATE) 6732 1.1 riastrad rdev->pm.dpm.uvd_ps = rps; 6733 1.1 riastrad } 6734 1.1 riastrad 6735 1.1 riastrad static void si_parse_pplib_clock_info(struct radeon_device *rdev, 6736 1.1 riastrad struct radeon_ps *rps, int index, 6737 1.1 riastrad union pplib_clock_info *clock_info) 6738 1.1 riastrad { 6739 1.1 riastrad struct rv7xx_power_info *pi = rv770_get_pi(rdev); 6740 1.1 riastrad struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); 6741 1.1 riastrad struct si_power_info *si_pi = si_get_pi(rdev); 6742 1.1 riastrad struct ni_ps *ps = ni_get_ps(rps); 6743 1.1 riastrad u16 leakage_voltage; 6744 1.1 riastrad struct rv7xx_pl *pl = &ps->performance_levels[index]; 6745 1.1 riastrad int ret; 6746 1.1 riastrad 6747 1.1 riastrad ps->performance_level_count = index + 1; 6748 1.1 riastrad 6749 1.1 riastrad pl->sclk = le16_to_cpu(clock_info->si.usEngineClockLow); 6750 1.1 riastrad pl->sclk |= clock_info->si.ucEngineClockHigh << 16; 6751 1.1 riastrad pl->mclk = le16_to_cpu(clock_info->si.usMemoryClockLow); 6752 1.1 riastrad pl->mclk |= clock_info->si.ucMemoryClockHigh << 16; 6753 1.1 riastrad 6754 1.1 riastrad pl->vddc = le16_to_cpu(clock_info->si.usVDDC); 6755 1.1 riastrad pl->vddci = le16_to_cpu(clock_info->si.usVDDCI); 6756 1.1 riastrad pl->flags = le32_to_cpu(clock_info->si.ulFlags); 6757 1.1 riastrad pl->pcie_gen = r600_get_pcie_gen_support(rdev, 6758 1.1 riastrad si_pi->sys_pcie_mask, 6759 1.1 riastrad si_pi->boot_pcie_gen, 6760 1.1 riastrad clock_info->si.ucPCIEGen); 6761 1.1 riastrad 6762 1.1 riastrad /* patch up vddc if necessary */ 6763 1.1 riastrad ret = si_get_leakage_voltage_from_leakage_index(rdev, pl->vddc, 6764 1.1 riastrad &leakage_voltage); 6765 1.1 riastrad if (ret == 0) 6766 1.1 riastrad pl->vddc = leakage_voltage; 6767 1.1 riastrad 6768 1.1 riastrad if (rps->class & ATOM_PPLIB_CLASSIFICATION_ACPI) { 6769 1.1 riastrad pi->acpi_vddc = pl->vddc; 6770 1.1 riastrad eg_pi->acpi_vddci = pl->vddci; 6771 1.1 riastrad si_pi->acpi_pcie_gen = pl->pcie_gen; 6772 1.1 riastrad } 6773 1.1 riastrad 6774 1.1 riastrad if ((rps->class2 & ATOM_PPLIB_CLASSIFICATION2_ULV) && 6775 1.1 riastrad index == 0) { 6776 1.1 riastrad /* XXX disable for A0 tahiti */ 6777 1.1 riastrad si_pi->ulv.supported = false; 6778 1.1 riastrad si_pi->ulv.pl = *pl; 6779 1.1 riastrad si_pi->ulv.one_pcie_lane_in_ulv = false; 6780 1.1 riastrad si_pi->ulv.volt_change_delay = SISLANDS_ULVVOLTAGECHANGEDELAY_DFLT; 6781 1.1 riastrad si_pi->ulv.cg_ulv_parameter = SISLANDS_CGULVPARAMETER_DFLT; 6782 1.1 riastrad si_pi->ulv.cg_ulv_control = SISLANDS_CGULVCONTROL_DFLT; 6783 1.1 riastrad } 6784 1.1 riastrad 6785 1.1 riastrad if (pi->min_vddc_in_table > pl->vddc) 6786 1.1 riastrad pi->min_vddc_in_table = pl->vddc; 6787 1.1 riastrad 6788 1.1 riastrad if (pi->max_vddc_in_table < pl->vddc) 6789 1.1 riastrad pi->max_vddc_in_table = pl->vddc; 6790 1.1 riastrad 6791 1.1 riastrad /* patch up boot state */ 6792 1.1 riastrad if (rps->class & ATOM_PPLIB_CLASSIFICATION_BOOT) { 6793 1.1 riastrad u16 vddc, vddci, mvdd; 6794 1.1 riastrad radeon_atombios_get_default_voltages(rdev, &vddc, &vddci, &mvdd); 6795 1.1 riastrad pl->mclk = rdev->clock.default_mclk; 6796 1.1 riastrad pl->sclk = rdev->clock.default_sclk; 6797 1.1 riastrad pl->vddc = vddc; 6798 1.1 riastrad pl->vddci = vddci; 6799 1.1 riastrad si_pi->mvdd_bootup_value = mvdd; 6800 1.1 riastrad } 6801 1.1 riastrad 6802 1.1 riastrad if ((rps->class & ATOM_PPLIB_CLASSIFICATION_UI_MASK) == 6803 1.1 riastrad ATOM_PPLIB_CLASSIFICATION_UI_PERFORMANCE) { 6804 1.1 riastrad rdev->pm.dpm.dyn_state.max_clock_voltage_on_ac.sclk = pl->sclk; 6805 1.1 riastrad rdev->pm.dpm.dyn_state.max_clock_voltage_on_ac.mclk = pl->mclk; 6806 1.1 riastrad rdev->pm.dpm.dyn_state.max_clock_voltage_on_ac.vddc = pl->vddc; 6807 1.1 riastrad rdev->pm.dpm.dyn_state.max_clock_voltage_on_ac.vddci = pl->vddci; 6808 1.1 riastrad } 6809 1.1 riastrad } 6810 1.1 riastrad 6811 1.1 riastrad static int si_parse_power_table(struct radeon_device *rdev) 6812 1.1 riastrad { 6813 1.1 riastrad struct radeon_mode_info *mode_info = &rdev->mode_info; 6814 1.1 riastrad struct _ATOM_PPLIB_NONCLOCK_INFO *non_clock_info; 6815 1.1 riastrad union pplib_power_state *power_state; 6816 1.1 riastrad int i, j, k, non_clock_array_index, clock_array_index; 6817 1.1 riastrad union pplib_clock_info *clock_info; 6818 1.1 riastrad struct _StateArray *state_array; 6819 1.1 riastrad struct _ClockInfoArray *clock_info_array; 6820 1.1 riastrad struct _NonClockInfoArray *non_clock_info_array; 6821 1.1 riastrad union power_info *power_info; 6822 1.1 riastrad int index = GetIndexIntoMasterTable(DATA, PowerPlayInfo); 6823 1.5 riastrad u16 data_offset; 6824 1.1 riastrad u8 frev, crev; 6825 1.1 riastrad u8 *power_state_offset; 6826 1.1 riastrad struct ni_ps *ps; 6827 1.1 riastrad 6828 1.1 riastrad if (!atom_parse_data_header(mode_info->atom_context, index, NULL, 6829 1.1 riastrad &frev, &crev, &data_offset)) 6830 1.1 riastrad return -EINVAL; 6831 1.1 riastrad power_info = (union power_info *)(mode_info->atom_context->bios + data_offset); 6832 1.1 riastrad 6833 1.1 riastrad state_array = (struct _StateArray *) 6834 1.1 riastrad (mode_info->atom_context->bios + data_offset + 6835 1.1 riastrad le16_to_cpu(power_info->pplib.usStateArrayOffset)); 6836 1.1 riastrad clock_info_array = (struct _ClockInfoArray *) 6837 1.1 riastrad (mode_info->atom_context->bios + data_offset + 6838 1.1 riastrad le16_to_cpu(power_info->pplib.usClockInfoArrayOffset)); 6839 1.1 riastrad non_clock_info_array = (struct _NonClockInfoArray *) 6840 1.1 riastrad (mode_info->atom_context->bios + data_offset + 6841 1.1 riastrad le16_to_cpu(power_info->pplib.usNonClockInfoArrayOffset)); 6842 1.1 riastrad 6843 1.5 riastrad rdev->pm.dpm.ps = kcalloc(state_array->ucNumEntries, 6844 1.5 riastrad sizeof(struct radeon_ps), 6845 1.5 riastrad GFP_KERNEL); 6846 1.1 riastrad if (!rdev->pm.dpm.ps) 6847 1.1 riastrad return -ENOMEM; 6848 1.1 riastrad power_state_offset = (u8 *)state_array->states; 6849 1.1 riastrad for (i = 0; i < state_array->ucNumEntries; i++) { 6850 1.1 riastrad u8 *idx; 6851 1.1 riastrad power_state = (union pplib_power_state *)power_state_offset; 6852 1.1 riastrad non_clock_array_index = power_state->v2.nonClockInfoIndex; 6853 1.1 riastrad non_clock_info = (struct _ATOM_PPLIB_NONCLOCK_INFO *) 6854 1.1 riastrad &non_clock_info_array->nonClockInfo[non_clock_array_index]; 6855 1.1 riastrad if (!rdev->pm.power_state[i].clock_info) 6856 1.1 riastrad return -EINVAL; 6857 1.1 riastrad ps = kzalloc(sizeof(struct ni_ps), GFP_KERNEL); 6858 1.1 riastrad if (ps == NULL) { 6859 1.1 riastrad kfree(rdev->pm.dpm.ps); 6860 1.1 riastrad return -ENOMEM; 6861 1.1 riastrad } 6862 1.1 riastrad rdev->pm.dpm.ps[i].ps_priv = ps; 6863 1.1 riastrad si_parse_pplib_non_clock_info(rdev, &rdev->pm.dpm.ps[i], 6864 1.1 riastrad non_clock_info, 6865 1.1 riastrad non_clock_info_array->ucEntrySize); 6866 1.1 riastrad k = 0; 6867 1.1 riastrad idx = (u8 *)&power_state->v2.clockInfoIndex[0]; 6868 1.1 riastrad for (j = 0; j < power_state->v2.ucNumDPMLevels; j++) { 6869 1.1 riastrad clock_array_index = idx[j]; 6870 1.1 riastrad if (clock_array_index >= clock_info_array->ucNumEntries) 6871 1.1 riastrad continue; 6872 1.1 riastrad if (k >= SISLANDS_MAX_HARDWARE_POWERLEVELS) 6873 1.1 riastrad break; 6874 1.1 riastrad clock_info = (union pplib_clock_info *) 6875 1.1 riastrad ((u8 *)&clock_info_array->clockInfo[0] + 6876 1.1 riastrad (clock_array_index * clock_info_array->ucEntrySize)); 6877 1.1 riastrad si_parse_pplib_clock_info(rdev, 6878 1.1 riastrad &rdev->pm.dpm.ps[i], k, 6879 1.1 riastrad clock_info); 6880 1.1 riastrad k++; 6881 1.1 riastrad } 6882 1.1 riastrad power_state_offset += 2 + power_state->v2.ucNumDPMLevels; 6883 1.1 riastrad } 6884 1.1 riastrad rdev->pm.dpm.num_ps = state_array->ucNumEntries; 6885 1.1 riastrad 6886 1.1 riastrad /* fill in the vce power states */ 6887 1.1 riastrad for (i = 0; i < RADEON_MAX_VCE_LEVELS; i++) { 6888 1.1 riastrad u32 sclk, mclk; 6889 1.1 riastrad clock_array_index = rdev->pm.dpm.vce_states[i].clk_idx; 6890 1.1 riastrad clock_info = (union pplib_clock_info *) 6891 1.1 riastrad &clock_info_array->clockInfo[clock_array_index * clock_info_array->ucEntrySize]; 6892 1.1 riastrad sclk = le16_to_cpu(clock_info->si.usEngineClockLow); 6893 1.1 riastrad sclk |= clock_info->si.ucEngineClockHigh << 16; 6894 1.1 riastrad mclk = le16_to_cpu(clock_info->si.usMemoryClockLow); 6895 1.1 riastrad mclk |= clock_info->si.ucMemoryClockHigh << 16; 6896 1.1 riastrad rdev->pm.dpm.vce_states[i].sclk = sclk; 6897 1.1 riastrad rdev->pm.dpm.vce_states[i].mclk = mclk; 6898 1.1 riastrad } 6899 1.1 riastrad 6900 1.1 riastrad return 0; 6901 1.1 riastrad } 6902 1.1 riastrad 6903 1.1 riastrad int si_dpm_init(struct radeon_device *rdev) 6904 1.1 riastrad { 6905 1.1 riastrad struct rv7xx_power_info *pi; 6906 1.1 riastrad struct evergreen_power_info *eg_pi; 6907 1.1 riastrad struct ni_power_info *ni_pi; 6908 1.1 riastrad struct si_power_info *si_pi; 6909 1.1 riastrad struct atom_clock_dividers dividers; 6910 1.5 riastrad enum pci_bus_speed speed_cap = PCI_SPEED_UNKNOWN; 6911 1.5 riastrad struct pci_dev *root = rdev->pdev->bus->self; 6912 1.1 riastrad int ret; 6913 1.1 riastrad 6914 1.1 riastrad si_pi = kzalloc(sizeof(struct si_power_info), GFP_KERNEL); 6915 1.1 riastrad if (si_pi == NULL) 6916 1.1 riastrad return -ENOMEM; 6917 1.1 riastrad rdev->pm.dpm.priv = si_pi; 6918 1.1 riastrad ni_pi = &si_pi->ni; 6919 1.1 riastrad eg_pi = &ni_pi->eg; 6920 1.1 riastrad pi = &eg_pi->rv7xx; 6921 1.1 riastrad 6922 1.5 riastrad if (!pci_is_root_bus(rdev->pdev->bus)) 6923 1.5 riastrad speed_cap = pcie_get_speed_cap(root); 6924 1.5 riastrad if (speed_cap == PCI_SPEED_UNKNOWN) { 6925 1.1 riastrad si_pi->sys_pcie_mask = 0; 6926 1.5 riastrad } else { 6927 1.5 riastrad if (speed_cap == PCIE_SPEED_8_0GT) 6928 1.5 riastrad si_pi->sys_pcie_mask = RADEON_PCIE_SPEED_25 | 6929 1.5 riastrad RADEON_PCIE_SPEED_50 | 6930 1.5 riastrad RADEON_PCIE_SPEED_80; 6931 1.5 riastrad else if (speed_cap == PCIE_SPEED_5_0GT) 6932 1.5 riastrad si_pi->sys_pcie_mask = RADEON_PCIE_SPEED_25 | 6933 1.5 riastrad RADEON_PCIE_SPEED_50; 6934 1.5 riastrad else 6935 1.5 riastrad si_pi->sys_pcie_mask = RADEON_PCIE_SPEED_25; 6936 1.5 riastrad } 6937 1.1 riastrad si_pi->force_pcie_gen = RADEON_PCIE_GEN_INVALID; 6938 1.1 riastrad si_pi->boot_pcie_gen = si_get_current_pcie_speed(rdev); 6939 1.1 riastrad 6940 1.1 riastrad si_set_max_cu_value(rdev); 6941 1.1 riastrad 6942 1.1 riastrad rv770_get_max_vddc(rdev); 6943 1.1 riastrad si_get_leakage_vddc(rdev); 6944 1.1 riastrad si_patch_dependency_tables_based_on_leakage(rdev); 6945 1.1 riastrad 6946 1.1 riastrad pi->acpi_vddc = 0; 6947 1.1 riastrad eg_pi->acpi_vddci = 0; 6948 1.1 riastrad pi->min_vddc_in_table = 0; 6949 1.1 riastrad pi->max_vddc_in_table = 0; 6950 1.1 riastrad 6951 1.1 riastrad ret = r600_get_platform_caps(rdev); 6952 1.1 riastrad if (ret) 6953 1.1 riastrad return ret; 6954 1.1 riastrad 6955 1.1 riastrad ret = r600_parse_extended_power_table(rdev); 6956 1.1 riastrad if (ret) 6957 1.1 riastrad return ret; 6958 1.1 riastrad 6959 1.1 riastrad ret = si_parse_power_table(rdev); 6960 1.1 riastrad if (ret) 6961 1.1 riastrad return ret; 6962 1.1 riastrad 6963 1.1 riastrad rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries = 6964 1.5 riastrad kcalloc(4, 6965 1.5 riastrad sizeof(struct radeon_clock_voltage_dependency_entry), 6966 1.5 riastrad GFP_KERNEL); 6967 1.1 riastrad if (!rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries) { 6968 1.1 riastrad r600_free_extended_power_table(rdev); 6969 1.1 riastrad return -ENOMEM; 6970 1.1 riastrad } 6971 1.1 riastrad rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.count = 4; 6972 1.1 riastrad rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries[0].clk = 0; 6973 1.1 riastrad rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries[0].v = 0; 6974 1.1 riastrad rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries[1].clk = 36000; 6975 1.1 riastrad rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries[1].v = 720; 6976 1.1 riastrad rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries[2].clk = 54000; 6977 1.1 riastrad rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries[2].v = 810; 6978 1.1 riastrad rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries[3].clk = 72000; 6979 1.1 riastrad rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries[3].v = 900; 6980 1.1 riastrad 6981 1.1 riastrad if (rdev->pm.dpm.voltage_response_time == 0) 6982 1.1 riastrad rdev->pm.dpm.voltage_response_time = R600_VOLTAGERESPONSETIME_DFLT; 6983 1.1 riastrad if (rdev->pm.dpm.backbias_response_time == 0) 6984 1.1 riastrad rdev->pm.dpm.backbias_response_time = R600_BACKBIASRESPONSETIME_DFLT; 6985 1.1 riastrad 6986 1.1 riastrad ret = radeon_atom_get_clock_dividers(rdev, COMPUTE_ENGINE_PLL_PARAM, 6987 1.1 riastrad 0, false, ÷rs); 6988 1.1 riastrad if (ret) 6989 1.1 riastrad pi->ref_div = dividers.ref_div + 1; 6990 1.1 riastrad else 6991 1.1 riastrad pi->ref_div = R600_REFERENCEDIVIDER_DFLT; 6992 1.1 riastrad 6993 1.1 riastrad eg_pi->smu_uvd_hs = false; 6994 1.1 riastrad 6995 1.1 riastrad pi->mclk_strobe_mode_threshold = 40000; 6996 1.1 riastrad if (si_is_special_1gb_platform(rdev)) 6997 1.1 riastrad pi->mclk_stutter_mode_threshold = 0; 6998 1.1 riastrad else 6999 1.1 riastrad pi->mclk_stutter_mode_threshold = pi->mclk_strobe_mode_threshold; 7000 1.1 riastrad pi->mclk_edc_enable_threshold = 40000; 7001 1.1 riastrad eg_pi->mclk_edc_wr_enable_threshold = 40000; 7002 1.1 riastrad 7003 1.1 riastrad ni_pi->mclk_rtt_mode_threshold = eg_pi->mclk_edc_wr_enable_threshold; 7004 1.1 riastrad 7005 1.1 riastrad pi->voltage_control = 7006 1.1 riastrad radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDC, 7007 1.1 riastrad VOLTAGE_OBJ_GPIO_LUT); 7008 1.1 riastrad if (!pi->voltage_control) { 7009 1.1 riastrad si_pi->voltage_control_svi2 = 7010 1.1 riastrad radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDC, 7011 1.1 riastrad VOLTAGE_OBJ_SVID2); 7012 1.1 riastrad if (si_pi->voltage_control_svi2) 7013 1.1 riastrad radeon_atom_get_svi2_info(rdev, SET_VOLTAGE_TYPE_ASIC_VDDC, 7014 1.1 riastrad &si_pi->svd_gpio_id, &si_pi->svc_gpio_id); 7015 1.1 riastrad } 7016 1.1 riastrad 7017 1.1 riastrad pi->mvdd_control = 7018 1.1 riastrad radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_MVDDC, 7019 1.1 riastrad VOLTAGE_OBJ_GPIO_LUT); 7020 1.1 riastrad 7021 1.1 riastrad eg_pi->vddci_control = 7022 1.1 riastrad radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDCI, 7023 1.1 riastrad VOLTAGE_OBJ_GPIO_LUT); 7024 1.1 riastrad if (!eg_pi->vddci_control) 7025 1.1 riastrad si_pi->vddci_control_svi2 = 7026 1.1 riastrad radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDCI, 7027 1.1 riastrad VOLTAGE_OBJ_SVID2); 7028 1.1 riastrad 7029 1.1 riastrad si_pi->vddc_phase_shed_control = 7030 1.1 riastrad radeon_atom_is_voltage_gpio(rdev, SET_VOLTAGE_TYPE_ASIC_VDDC, 7031 1.1 riastrad VOLTAGE_OBJ_PHASE_LUT); 7032 1.1 riastrad 7033 1.1 riastrad rv770_get_engine_memory_ss(rdev); 7034 1.1 riastrad 7035 1.1 riastrad pi->asi = RV770_ASI_DFLT; 7036 1.1 riastrad pi->pasi = CYPRESS_HASI_DFLT; 7037 1.1 riastrad pi->vrc = SISLANDS_VRC_DFLT; 7038 1.1 riastrad 7039 1.1 riastrad pi->gfx_clock_gating = true; 7040 1.1 riastrad 7041 1.1 riastrad eg_pi->sclk_deep_sleep = true; 7042 1.1 riastrad si_pi->sclk_deep_sleep_above_low = false; 7043 1.1 riastrad 7044 1.1 riastrad if (rdev->pm.int_thermal_type != THERMAL_TYPE_NONE) 7045 1.1 riastrad pi->thermal_protection = true; 7046 1.1 riastrad else 7047 1.1 riastrad pi->thermal_protection = false; 7048 1.1 riastrad 7049 1.1 riastrad eg_pi->dynamic_ac_timing = true; 7050 1.1 riastrad 7051 1.1 riastrad eg_pi->light_sleep = true; 7052 1.1 riastrad #if defined(CONFIG_ACPI) 7053 1.1 riastrad eg_pi->pcie_performance_request = 7054 1.1 riastrad radeon_acpi_is_pcie_performance_request_supported(rdev); 7055 1.1 riastrad #else 7056 1.1 riastrad eg_pi->pcie_performance_request = false; 7057 1.1 riastrad #endif 7058 1.1 riastrad 7059 1.1 riastrad si_pi->sram_end = SMC_RAM_END; 7060 1.1 riastrad 7061 1.1 riastrad rdev->pm.dpm.dyn_state.mclk_sclk_ratio = 4; 7062 1.1 riastrad rdev->pm.dpm.dyn_state.sclk_mclk_delta = 15000; 7063 1.1 riastrad rdev->pm.dpm.dyn_state.vddc_vddci_delta = 200; 7064 1.1 riastrad rdev->pm.dpm.dyn_state.valid_sclk_values.count = 0; 7065 1.1 riastrad rdev->pm.dpm.dyn_state.valid_sclk_values.values = NULL; 7066 1.1 riastrad rdev->pm.dpm.dyn_state.valid_mclk_values.count = 0; 7067 1.1 riastrad rdev->pm.dpm.dyn_state.valid_mclk_values.values = NULL; 7068 1.1 riastrad 7069 1.1 riastrad si_initialize_powertune_defaults(rdev); 7070 1.1 riastrad 7071 1.1 riastrad /* make sure dc limits are valid */ 7072 1.1 riastrad if ((rdev->pm.dpm.dyn_state.max_clock_voltage_on_dc.sclk == 0) || 7073 1.1 riastrad (rdev->pm.dpm.dyn_state.max_clock_voltage_on_dc.mclk == 0)) 7074 1.1 riastrad rdev->pm.dpm.dyn_state.max_clock_voltage_on_dc = 7075 1.1 riastrad rdev->pm.dpm.dyn_state.max_clock_voltage_on_ac; 7076 1.1 riastrad 7077 1.1 riastrad si_pi->fan_ctrl_is_in_default_mode = true; 7078 1.1 riastrad 7079 1.1 riastrad return 0; 7080 1.1 riastrad } 7081 1.1 riastrad 7082 1.1 riastrad void si_dpm_fini(struct radeon_device *rdev) 7083 1.1 riastrad { 7084 1.1 riastrad int i; 7085 1.1 riastrad 7086 1.1 riastrad for (i = 0; i < rdev->pm.dpm.num_ps; i++) { 7087 1.1 riastrad kfree(rdev->pm.dpm.ps[i].ps_priv); 7088 1.1 riastrad } 7089 1.1 riastrad kfree(rdev->pm.dpm.ps); 7090 1.1 riastrad kfree(rdev->pm.dpm.priv); 7091 1.1 riastrad kfree(rdev->pm.dpm.dyn_state.vddc_dependency_on_dispclk.entries); 7092 1.1 riastrad r600_free_extended_power_table(rdev); 7093 1.1 riastrad } 7094 1.1 riastrad 7095 1.1 riastrad #ifdef CONFIG_DEBUG_FS 7096 1.1 riastrad void si_dpm_debugfs_print_current_performance_level(struct radeon_device *rdev, 7097 1.1 riastrad struct seq_file *m) 7098 1.1 riastrad { 7099 1.1 riastrad struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); 7100 1.1 riastrad struct radeon_ps *rps = &eg_pi->current_rps; 7101 1.1 riastrad struct ni_ps *ps = ni_get_ps(rps); 7102 1.1 riastrad struct rv7xx_pl *pl; 7103 1.1 riastrad u32 current_index = 7104 1.1 riastrad (RREG32(TARGET_AND_CURRENT_PROFILE_INDEX) & CURRENT_STATE_INDEX_MASK) >> 7105 1.1 riastrad CURRENT_STATE_INDEX_SHIFT; 7106 1.1 riastrad 7107 1.1 riastrad if (current_index >= ps->performance_level_count) { 7108 1.1 riastrad seq_printf(m, "invalid dpm profile %d\n", current_index); 7109 1.1 riastrad } else { 7110 1.1 riastrad pl = &ps->performance_levels[current_index]; 7111 1.1 riastrad seq_printf(m, "uvd vclk: %d dclk: %d\n", rps->vclk, rps->dclk); 7112 1.1 riastrad seq_printf(m, "power level %d sclk: %u mclk: %u vddc: %u vddci: %u pcie gen: %u\n", 7113 1.1 riastrad current_index, pl->sclk, pl->mclk, pl->vddc, pl->vddci, pl->pcie_gen + 1); 7114 1.1 riastrad } 7115 1.1 riastrad } 7116 1.1 riastrad #endif 7117 1.1 riastrad 7118 1.1 riastrad u32 si_dpm_get_current_sclk(struct radeon_device *rdev) 7119 1.1 riastrad { 7120 1.1 riastrad struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); 7121 1.1 riastrad struct radeon_ps *rps = &eg_pi->current_rps; 7122 1.1 riastrad struct ni_ps *ps = ni_get_ps(rps); 7123 1.1 riastrad struct rv7xx_pl *pl; 7124 1.1 riastrad u32 current_index = 7125 1.1 riastrad (RREG32(TARGET_AND_CURRENT_PROFILE_INDEX) & CURRENT_STATE_INDEX_MASK) >> 7126 1.1 riastrad CURRENT_STATE_INDEX_SHIFT; 7127 1.1 riastrad 7128 1.1 riastrad if (current_index >= ps->performance_level_count) { 7129 1.1 riastrad return 0; 7130 1.1 riastrad } else { 7131 1.1 riastrad pl = &ps->performance_levels[current_index]; 7132 1.1 riastrad return pl->sclk; 7133 1.1 riastrad } 7134 1.1 riastrad } 7135 1.1 riastrad 7136 1.1 riastrad u32 si_dpm_get_current_mclk(struct radeon_device *rdev) 7137 1.1 riastrad { 7138 1.1 riastrad struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev); 7139 1.1 riastrad struct radeon_ps *rps = &eg_pi->current_rps; 7140 1.1 riastrad struct ni_ps *ps = ni_get_ps(rps); 7141 1.1 riastrad struct rv7xx_pl *pl; 7142 1.1 riastrad u32 current_index = 7143 1.1 riastrad (RREG32(TARGET_AND_CURRENT_PROFILE_INDEX) & CURRENT_STATE_INDEX_MASK) >> 7144 1.1 riastrad CURRENT_STATE_INDEX_SHIFT; 7145 1.1 riastrad 7146 1.1 riastrad if (current_index >= ps->performance_level_count) { 7147 1.1 riastrad return 0; 7148 1.1 riastrad } else { 7149 1.1 riastrad pl = &ps->performance_levels[current_index]; 7150 1.1 riastrad return pl->mclk; 7151 1.1 riastrad } 7152 1.1 riastrad } 7153