treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / drivers / gpu / drm / amd / powerplay / inc / smu11_driver_if_arcturus.h
blobce5b5011c122ac86f82c3d386bab98e5e9a11921
1 /*
2 * Copyright 2019 Advanced Micro Devices, Inc.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
24 #ifndef SMU11_DRIVER_IF_ARCTURUS_H
25 #define SMU11_DRIVER_IF_ARCTURUS_H
27 // *** IMPORTANT ***
28 // SMU TEAM: Always increment the interface version if
29 // any structure is changed in this file
30 //#define SMU11_DRIVER_IF_VERSION 0x09
32 #define PPTABLE_ARCTURUS_SMU_VERSION 4
34 #define NUM_GFXCLK_DPM_LEVELS 16
35 #define NUM_VCLK_DPM_LEVELS 8
36 #define NUM_DCLK_DPM_LEVELS 8
37 #define NUM_MP0CLK_DPM_LEVELS 2
38 #define NUM_SOCCLK_DPM_LEVELS 8
39 #define NUM_UCLK_DPM_LEVELS 4
40 #define NUM_FCLK_DPM_LEVELS 8
41 #define NUM_XGMI_LEVELS 2
42 #define NUM_XGMI_PSTATE_LEVELS 4
44 #define MAX_GFXCLK_DPM_LEVEL (NUM_GFXCLK_DPM_LEVELS - 1)
45 #define MAX_VCLK_DPM_LEVEL (NUM_VCLK_DPM_LEVELS - 1)
46 #define MAX_DCLK_DPM_LEVEL (NUM_DCLK_DPM_LEVELS - 1)
47 #define MAX_MP0CLK_DPM_LEVEL (NUM_MP0CLK_DPM_LEVELS - 1)
48 #define MAX_SOCCLK_DPM_LEVEL (NUM_SOCCLK_DPM_LEVELS - 1)
49 #define MAX_UCLK_DPM_LEVEL (NUM_UCLK_DPM_LEVELS - 1)
50 #define MAX_FCLK_DPM_LEVEL (NUM_FCLK_DPM_LEVELS - 1)
51 #define MAX_XGMI_LEVEL (NUM_XGMI_LEVELS - 1)
52 #define MAX_XGMI_PSTATE_LEVEL (NUM_XGMI_PSTATE_LEVELS - 1)
54 // Feature Control Defines
55 // DPM
56 #define FEATURE_DPM_PREFETCHER_BIT 0
57 #define FEATURE_DPM_GFXCLK_BIT 1
58 #define FEATURE_DPM_UCLK_BIT 2
59 #define FEATURE_DPM_SOCCLK_BIT 3
60 #define FEATURE_DPM_FCLK_BIT 4
61 #define FEATURE_DPM_MP0CLK_BIT 5
62 #define FEATURE_DPM_XGMI_BIT 6
63 // Idle
64 #define FEATURE_DS_GFXCLK_BIT 7
65 #define FEATURE_DS_SOCCLK_BIT 8
66 #define FEATURE_DS_LCLK_BIT 9
67 #define FEATURE_DS_FCLK_BIT 10
68 #define FEATURE_DS_UCLK_BIT 11
69 #define FEATURE_GFX_ULV_BIT 12
70 #define FEATURE_DPM_VCN_BIT 13
71 #define FEATURE_RSMU_SMN_CG_BIT 14
72 #define FEATURE_WAFL_CG_BIT 15
73 // Throttler/Response
74 #define FEATURE_PPT_BIT 16
75 #define FEATURE_TDC_BIT 17
76 #define FEATURE_APCC_PLUS_BIT 18
77 #define FEATURE_VR0HOT_BIT 19
78 #define FEATURE_VR1HOT_BIT 20
79 #define FEATURE_FW_CTF_BIT 21
80 #define FEATURE_FAN_CONTROL_BIT 22
81 #define FEATURE_THERMAL_BIT 23
82 // Other
83 #define FEATURE_OUT_OF_BAND_MONITOR_BIT 24
84 #define FEATURE_TEMP_DEPENDENT_VMIN_BIT 25
86 #define FEATURE_SPARE_26_BIT 26
87 #define FEATURE_SPARE_27_BIT 27
88 #define FEATURE_SPARE_28_BIT 28
89 #define FEATURE_SPARE_29_BIT 29
90 #define FEATURE_SPARE_30_BIT 30
91 #define FEATURE_SPARE_31_BIT 31
92 #define FEATURE_SPARE_32_BIT 32
93 #define FEATURE_SPARE_33_BIT 33
94 #define FEATURE_SPARE_34_BIT 34
95 #define FEATURE_SPARE_35_BIT 35
96 #define FEATURE_SPARE_36_BIT 36
97 #define FEATURE_SPARE_37_BIT 37
98 #define FEATURE_SPARE_38_BIT 38
99 #define FEATURE_SPARE_39_BIT 39
100 #define FEATURE_SPARE_40_BIT 40
101 #define FEATURE_SPARE_41_BIT 41
102 #define FEATURE_SPARE_42_BIT 42
103 #define FEATURE_SPARE_43_BIT 43
104 #define FEATURE_SPARE_44_BIT 44
105 #define FEATURE_SPARE_45_BIT 45
106 #define FEATURE_SPARE_46_BIT 46
107 #define FEATURE_SPARE_47_BIT 47
108 #define FEATURE_SPARE_48_BIT 48
109 #define FEATURE_SPARE_49_BIT 49
110 #define FEATURE_SPARE_50_BIT 50
111 #define FEATURE_SPARE_51_BIT 51
112 #define FEATURE_SPARE_52_BIT 52
113 #define FEATURE_SPARE_53_BIT 53
114 #define FEATURE_SPARE_54_BIT 54
115 #define FEATURE_SPARE_55_BIT 55
116 #define FEATURE_SPARE_56_BIT 56
117 #define FEATURE_SPARE_57_BIT 57
118 #define FEATURE_SPARE_58_BIT 58
119 #define FEATURE_SPARE_59_BIT 59
120 #define FEATURE_SPARE_60_BIT 60
121 #define FEATURE_SPARE_61_BIT 61
122 #define FEATURE_SPARE_62_BIT 62
123 #define FEATURE_SPARE_63_BIT 63
125 #define NUM_FEATURES 64
128 #define FEATURE_DPM_PREFETCHER_MASK (1 << FEATURE_DPM_PREFETCHER_BIT )
129 #define FEATURE_DPM_GFXCLK_MASK (1 << FEATURE_DPM_GFXCLK_BIT )
130 #define FEATURE_DPM_UCLK_MASK (1 << FEATURE_DPM_UCLK_BIT )
131 #define FEATURE_DPM_SOCCLK_MASK (1 << FEATURE_DPM_SOCCLK_BIT )
132 #define FEATURE_DPM_FCLK_MASK (1 << FEATURE_DPM_FCLK_BIT )
133 #define FEATURE_DPM_MP0CLK_MASK (1 << FEATURE_DPM_MP0CLK_BIT )
134 #define FEATURE_DPM_XGMI_MASK (1 << FEATURE_DPM_XGMI_BIT )
136 #define FEATURE_DS_GFXCLK_MASK (1 << FEATURE_DS_GFXCLK_BIT )
137 #define FEATURE_DS_SOCCLK_MASK (1 << FEATURE_DS_SOCCLK_BIT )
138 #define FEATURE_DS_LCLK_MASK (1 << FEATURE_DS_LCLK_BIT )
139 #define FEATURE_DS_FCLK_MASK (1 << FEATURE_DS_FCLK_BIT )
140 #define FEATURE_DS_UCLK_MASK (1 << FEATURE_DS_UCLK_BIT )
141 #define FEATURE_GFX_ULV_MASK (1 << FEATURE_GFX_ULV_BIT )
142 #define FEATURE_DPM_VCN_MASK (1 << FEATURE_DPM_VCN_BIT )
143 #define FEATURE_RSMU_SMN_CG_MASK (1 << FEATURE_RSMU_SMN_CG_BIT )
144 #define FEATURE_WAFL_CG_MASK (1 << FEATURE_WAFL_CG_BIT )
146 #define FEATURE_PPT_MASK (1 << FEATURE_PPT_BIT )
147 #define FEATURE_TDC_MASK (1 << FEATURE_TDC_BIT )
148 #define FEATURE_APCC_PLUS_MASK (1 << FEATURE_APCC_PLUS_BIT )
149 #define FEATURE_VR0HOT_MASK (1 << FEATURE_VR0HOT_BIT )
150 #define FEATURE_VR1HOT_MASK (1 << FEATURE_VR1HOT_BIT )
151 #define FEATURE_FW_CTF_MASK (1 << FEATURE_FW_CTF_BIT )
152 #define FEATURE_FAN_CONTROL_MASK (1 << FEATURE_FAN_CONTROL_BIT )
153 #define FEATURE_THERMAL_MASK (1 << FEATURE_THERMAL_BIT )
155 #define FEATURE_OUT_OF_BAND_MONITOR_MASK (1 << FEATURE_OUT_OF_BAND_MONITOR_BIT )
156 #define FEATURE_TEMP_DEPENDENT_VMIN_MASK (1 << FEATURE_TEMP_DEPENDENT_VMIN_BIT )
159 //FIXME need updating
160 // Debug Overrides Bitmask
161 #define DPM_OVERRIDE_DISABLE_UCLK_PID 0x00000001
162 #define DPM_OVERRIDE_DISABLE_VOLT_LINK_VCN_FCLK 0x00000002
164 // I2C Config Bit Defines
165 #define I2C_CONTROLLER_ENABLED 1
166 #define I2C_CONTROLLER_DISABLED 0
168 // VR Mapping Bit Defines
169 #define VR_MAPPING_VR_SELECT_MASK 0x01
170 #define VR_MAPPING_VR_SELECT_SHIFT 0x00
172 #define VR_MAPPING_PLANE_SELECT_MASK 0x02
173 #define VR_MAPPING_PLANE_SELECT_SHIFT 0x01
175 // PSI Bit Defines
176 #define PSI_SEL_VR0_PLANE0_PSI0 0x01
177 #define PSI_SEL_VR0_PLANE0_PSI1 0x02
178 #define PSI_SEL_VR0_PLANE1_PSI0 0x04
179 #define PSI_SEL_VR0_PLANE1_PSI1 0x08
180 #define PSI_SEL_VR1_PLANE0_PSI0 0x10
181 #define PSI_SEL_VR1_PLANE0_PSI1 0x20
182 #define PSI_SEL_VR1_PLANE1_PSI0 0x40
183 #define PSI_SEL_VR1_PLANE1_PSI1 0x80
185 // Throttler Control/Status Bits
186 #define THROTTLER_PADDING_BIT 0
187 #define THROTTLER_TEMP_EDGE_BIT 1
188 #define THROTTLER_TEMP_HOTSPOT_BIT 2
189 #define THROTTLER_TEMP_MEM_BIT 3
190 #define THROTTLER_TEMP_VR_GFX_BIT 4
191 #define THROTTLER_TEMP_VR_MEM_BIT 5
192 #define THROTTLER_TEMP_VR_SOC_BIT 6
193 #define THROTTLER_TDC_GFX_BIT 7
194 #define THROTTLER_TDC_SOC_BIT 8
195 #define THROTTLER_PPT0_BIT 9
196 #define THROTTLER_PPT1_BIT 10
197 #define THROTTLER_PPT2_BIT 11
198 #define THROTTLER_PPT3_BIT 12
199 #define THROTTLER_PPM_BIT 13
200 #define THROTTLER_FIT_BIT 14
201 #define THROTTLER_APCC_BIT 15
203 // Table transfer status
204 #define TABLE_TRANSFER_OK 0x0
205 #define TABLE_TRANSFER_FAILED 0xFF
206 #define TABLE_TRANSFER_PENDING 0xAB
208 // Workload bits
209 #define WORKLOAD_PPLIB_DEFAULT_BIT 0
210 #define WORKLOAD_PPLIB_POWER_SAVING_BIT 1
211 #define WORKLOAD_PPLIB_VIDEO_BIT 2
212 #define WORKLOAD_PPLIB_COMPUTE_BIT 3
213 #define WORKLOAD_PPLIB_CUSTOM_BIT 4
214 #define WORKLOAD_PPLIB_COUNT 5
216 //XGMI performance states
217 #define XGMI_STATE_D0 1
218 #define XGMI_STATE_D3 0
220 #define NUM_I2C_CONTROLLERS 8
222 #define I2C_CONTROLLER_ENABLED 1
223 #define I2C_CONTROLLER_DISABLED 0
225 #define MAX_SW_I2C_COMMANDS 8
227 typedef enum {
228 I2C_CONTROLLER_PORT_0 = 0, //CKSVII2C0
229 I2C_CONTROLLER_PORT_1 = 1, //CKSVII2C1
230 I2C_CONTROLLER_PORT_COUNT,
231 } I2cControllerPort_e;
233 typedef enum {
234 I2C_CONTROLLER_NAME_VR_GFX = 0,
235 I2C_CONTROLLER_NAME_VR_SOC,
236 I2C_CONTROLLER_NAME_VR_MEM,
237 I2C_CONTROLLER_NAME_SPARE,
238 I2C_CONTROLLER_NAME_COUNT,
239 } I2cControllerName_e;
241 typedef enum {
242 I2C_CONTROLLER_THROTTLER_TYPE_NONE = 0,
243 I2C_CONTROLLER_THROTTLER_VR_GFX,
244 I2C_CONTROLLER_THROTTLER_VR_SOC,
245 I2C_CONTROLLER_THROTTLER_VR_MEM,
246 I2C_CONTROLLER_THROTTLER_COUNT,
247 } I2cControllerThrottler_e;
249 typedef enum {
250 I2C_CONTROLLER_PROTOCOL_VR_0,
251 I2C_CONTROLLER_PROTOCOL_VR_1,
252 I2C_CONTROLLER_PROTOCOL_TMP_0,
253 I2C_CONTROLLER_PROTOCOL_TMP_1,
254 I2C_CONTROLLER_PROTOCOL_SPARE_0,
255 I2C_CONTROLLER_PROTOCOL_SPARE_1,
256 I2C_CONTROLLER_PROTOCOL_COUNT,
257 } I2cControllerProtocol_e;
259 typedef struct {
260 uint8_t Enabled;
261 uint8_t Speed;
262 uint8_t Padding[2];
263 uint32_t SlaveAddress;
264 uint8_t ControllerPort;
265 uint8_t ControllerName;
266 uint8_t ThermalThrotter;
267 uint8_t I2cProtocol;
268 } I2cControllerConfig_t;
270 typedef enum {
271 I2C_PORT_SVD_SCL = 0,
272 I2C_PORT_GPIO,
273 } I2cPort_e;
275 typedef enum {
276 I2C_SPEED_FAST_50K = 0, //50 Kbits/s
277 I2C_SPEED_FAST_100K, //100 Kbits/s
278 I2C_SPEED_FAST_400K, //400 Kbits/s
279 I2C_SPEED_FAST_PLUS_1M, //1 Mbits/s (in fast mode)
280 I2C_SPEED_HIGH_1M, //1 Mbits/s (in high speed mode)
281 I2C_SPEED_HIGH_2M, //2.3 Mbits/s
282 I2C_SPEED_COUNT,
283 } I2cSpeed_e;
285 typedef enum {
286 I2C_CMD_READ = 0,
287 I2C_CMD_WRITE,
288 I2C_CMD_COUNT,
289 } I2cCmdType_e;
291 #define CMDCONFIG_STOP_BIT 0
292 #define CMDCONFIG_RESTART_BIT 1
294 #define CMDCONFIG_STOP_MASK (1 << CMDCONFIG_STOP_BIT)
295 #define CMDCONFIG_RESTART_MASK (1 << CMDCONFIG_RESTART_BIT)
297 typedef struct {
298 uint8_t RegisterAddr; ////only valid for write, ignored for read
299 uint8_t Cmd; //Read(0) or Write(1)
300 uint8_t Data; //Return data for read. Data to send for write
301 uint8_t CmdConfig; //Includes whether associated command should have a stop or restart command
302 } SwI2cCmd_t; //SW I2C Command Table
304 typedef struct {
305 uint8_t I2CcontrollerPort; //CKSVII2C0(0) or //CKSVII2C1(1)
306 uint8_t I2CSpeed; //Slow(0) or Fast(1)
307 uint16_t SlaveAddress;
308 uint8_t NumCmds; //Number of commands
309 uint8_t Padding[3];
311 SwI2cCmd_t SwI2cCmds[MAX_SW_I2C_COMMANDS];
313 uint32_t MmHubPadding[8]; // SMU internal use
315 } SwI2cRequest_t; // SW I2C Request Table
317 //D3HOT sequences
318 typedef enum {
319 BACO_SEQUENCE,
320 MSR_SEQUENCE,
321 BAMACO_SEQUENCE,
322 ULPS_SEQUENCE,
323 D3HOT_SEQUENCE_COUNT,
324 }D3HOTSequence_e;
326 //THis is aligned with RSMU PGFSM Register Mapping
327 typedef enum {
328 PG_DYNAMIC_MODE = 0,
329 PG_STATIC_MODE,
330 } PowerGatingMode_e;
332 //This is aligned with RSMU PGFSM Register Mapping
333 typedef enum {
334 PG_POWER_DOWN = 0,
335 PG_POWER_UP,
336 } PowerGatingSettings_e;
338 typedef struct {
339 uint32_t a; // store in IEEE float format in this variable
340 uint32_t b; // store in IEEE float format in this variable
341 uint32_t c; // store in IEEE float format in this variable
342 } QuadraticInt_t;
344 typedef struct {
345 uint32_t m; // store in IEEE float format in this variable
346 uint32_t b; // store in IEEE float format in this variable
347 } LinearInt_t;
349 typedef struct {
350 uint32_t a; // store in IEEE float format in this variable
351 uint32_t b; // store in IEEE float format in this variable
352 uint32_t c; // store in IEEE float format in this variable
353 } DroopInt_t;
355 typedef enum {
356 GFXCLK_SOURCE_PLL = 0,
357 GFXCLK_SOURCE_AFLL,
358 GFXCLK_SOURCE_COUNT,
359 } GfxclkSrc_e;
361 typedef enum {
362 PPCLK_GFXCLK,
363 PPCLK_VCLK,
364 PPCLK_DCLK,
365 PPCLK_SOCCLK,
366 PPCLK_UCLK,
367 PPCLK_FCLK,
368 PPCLK_COUNT,
369 } PPCLK_e;
371 typedef enum {
372 POWER_SOURCE_AC,
373 POWER_SOURCE_DC,
374 POWER_SOURCE_COUNT,
375 } POWER_SOURCE_e;
377 typedef enum {
378 TEMP_EDGE,
379 TEMP_HOTSPOT,
380 TEMP_MEM,
381 TEMP_VR_GFX,
382 TEMP_VR_SOC,
383 TEMP_VR_MEM,
384 TEMP_COUNT
385 } TEMP_TYPE_e;
387 typedef enum {
388 PPT_THROTTLER_PPT0,
389 PPT_THROTTLER_PPT1,
390 PPT_THROTTLER_PPT2,
391 PPT_THROTTLER_PPT3,
392 PPT_THROTTLER_COUNT
393 } PPT_THROTTLER_e;
395 typedef enum {
396 VOLTAGE_MODE_AVFS = 0,
397 VOLTAGE_MODE_AVFS_SS,
398 VOLTAGE_MODE_SS,
399 VOLTAGE_MODE_COUNT,
400 } VOLTAGE_MODE_e;
402 typedef enum {
403 AVFS_VOLTAGE_GFX = 0,
404 AVFS_VOLTAGE_SOC,
405 AVFS_VOLTAGE_COUNT,
406 } AVFS_VOLTAGE_TYPE_e;
408 typedef enum {
409 GPIO_INT_POLARITY_ACTIVE_LOW = 0,
410 GPIO_INT_POLARITY_ACTIVE_HIGH,
411 } GpioIntPolarity_e;
413 typedef enum {
414 MEMORY_TYPE_GDDR6 = 0,
415 MEMORY_TYPE_HBM,
416 } MemoryType_e;
418 typedef enum {
419 PWR_CONFIG_TDP = 0,
420 PWR_CONFIG_TGP,
421 PWR_CONFIG_TCP_ESTIMATED,
422 PWR_CONFIG_TCP_MEASURED,
423 } PwrConfig_e;
425 typedef enum {
426 XGMI_LINK_RATE_2 = 2, // 2Gbps
427 XGMI_LINK_RATE_4 = 4, // 4Gbps
428 XGMI_LINK_RATE_8 = 8, // 8Gbps
429 XGMI_LINK_RATE_12 = 12, // 12Gbps
430 XGMI_LINK_RATE_16 = 16, // 16Gbps
431 XGMI_LINK_RATE_17 = 17, // 17Gbps
432 XGMI_LINK_RATE_18 = 18, // 18Gbps
433 XGMI_LINK_RATE_19 = 19, // 19Gbps
434 XGMI_LINK_RATE_20 = 20, // 20Gbps
435 XGMI_LINK_RATE_21 = 21, // 21Gbps
436 XGMI_LINK_RATE_22 = 22, // 22Gbps
437 XGMI_LINK_RATE_23 = 23, // 23Gbps
438 XGMI_LINK_RATE_24 = 24, // 24Gbps
439 XGMI_LINK_RATE_25 = 25, // 25Gbps
440 XGMI_LINK_RATE_COUNT
441 } XGMI_LINK_RATE_e;
443 typedef enum {
444 XGMI_LINK_WIDTH_1 = 1, // x1
445 XGMI_LINK_WIDTH_2 = 2, // x2
446 XGMI_LINK_WIDTH_4 = 4, // x4
447 XGMI_LINK_WIDTH_8 = 8, // x8
448 XGMI_LINK_WIDTH_9 = 9, // x9
449 XGMI_LINK_WIDTH_16 = 16, // x16
450 XGMI_LINK_WIDTH_COUNT
451 } XGMI_LINK_WIDTH_e;
453 typedef struct {
454 uint8_t VoltageMode; // 0 - AVFS only, 1- min(AVFS,SS), 2-SS only
455 uint8_t SnapToDiscrete; // 0 - Fine grained DPM, 1 - Discrete DPM
456 uint8_t NumDiscreteLevels; // Set to 2 (Fmin, Fmax) when using fine grained DPM, otherwise set to # discrete levels used
457 uint8_t padding;
458 LinearInt_t ConversionToAvfsClk; // Transfer function to AVFS Clock (GHz->GHz)
459 QuadraticInt_t SsCurve; // Slow-slow curve (GHz->V)
460 uint16_t SsFmin; // Fmin for SS curve. If SS curve is selected, will use V@SSFmin for F <= Fmin
461 uint16_t Padding16;
462 } DpmDescriptor_t;
464 typedef struct {
465 uint32_t Version;
467 // SECTION: Feature Enablement
468 uint32_t FeaturesToRun[2];
470 // SECTION: Infrastructure Limits
471 uint16_t SocketPowerLimitAc[PPT_THROTTLER_COUNT];
472 uint16_t SocketPowerLimitAcTau[PPT_THROTTLER_COUNT];
473 uint16_t TdcLimitSoc; // Amps
474 uint16_t TdcLimitSocTau; // Time constant of LPF in ms
475 uint16_t TdcLimitGfx; // Amps
476 uint16_t TdcLimitGfxTau; // Time constant of LPF in ms
478 uint16_t TedgeLimit; // Celcius
479 uint16_t ThotspotLimit; // Celcius
480 uint16_t TmemLimit; // Celcius
481 uint16_t Tvr_gfxLimit; // Celcius
482 uint16_t Tvr_memLimit; // Celcius
483 uint16_t Tvr_socLimit; // Celcius
484 uint32_t FitLimit; // Failures in time (failures per million parts over the defined lifetime)
486 uint16_t PpmPowerLimit; // Switch this this power limit when temperature is above PpmTempThreshold
487 uint16_t PpmTemperatureThreshold;
489 // SECTION: Throttler settings
490 uint32_t ThrottlerControlMask; // See Throtter masks defines
492 // SECTION: ULV Settings
493 uint16_t UlvVoltageOffsetGfx; // In mV(Q2)
494 uint16_t UlvPadding; // Padding
496 uint8_t UlvGfxclkBypass; // 1 to turn off/bypass Gfxclk during ULV, 0 to leave Gfxclk on during ULV
497 uint8_t Padding234[3];
499 // SECTION: Voltage Control Parameters
500 uint16_t MinVoltageGfx; // In mV(Q2) Minimum Voltage ("Vmin") of VDD_GFX
501 uint16_t MinVoltageSoc; // In mV(Q2) Minimum Voltage ("Vmin") of VDD_SOC
502 uint16_t MaxVoltageGfx; // In mV(Q2) Maximum Voltage allowable of VDD_GFX
503 uint16_t MaxVoltageSoc; // In mV(Q2) Maximum Voltage allowable of VDD_SOC
505 uint16_t LoadLineResistanceGfx; // In mOhms with 8 fractional bits
506 uint16_t LoadLineResistanceSoc; // In mOhms with 8 fractional bits
508 //SECTION: DPM Config 1
509 DpmDescriptor_t DpmDescriptor[PPCLK_COUNT];
511 uint16_t FreqTableGfx [NUM_GFXCLK_DPM_LEVELS ]; // In MHz
512 uint16_t FreqTableVclk [NUM_VCLK_DPM_LEVELS ]; // In MHz
513 uint16_t FreqTableDclk [NUM_DCLK_DPM_LEVELS ]; // In MHz
514 uint16_t FreqTableSocclk [NUM_SOCCLK_DPM_LEVELS ]; // In MHz
515 uint16_t FreqTableUclk [NUM_UCLK_DPM_LEVELS ]; // In MHz
516 uint16_t FreqTableFclk [NUM_FCLK_DPM_LEVELS ]; // In MHz
518 uint32_t Paddingclks[16];
520 // SECTION: DPM Config 2
521 uint16_t Mp0clkFreq [NUM_MP0CLK_DPM_LEVELS]; // in MHz
522 uint16_t Mp0DpmVoltage [NUM_MP0CLK_DPM_LEVELS]; // mV(Q2)
524 // GFXCLK DPM
525 uint16_t GfxclkFidle; // In MHz
526 uint16_t GfxclkSlewRate; // for PLL babystepping???
527 uint8_t Padding567[4];
528 uint16_t GfxclkDsMaxFreq; // In MHz
529 uint8_t GfxclkSource; // 0 = PLL, 1 = AFLL
530 uint8_t Padding456;
532 // GFXCLK Thermal DPM (formerly 'Boost' Settings)
533 uint16_t EnableTdpm;
534 uint16_t TdpmHighHystTemperature;
535 uint16_t TdpmLowHystTemperature;
536 uint16_t GfxclkFreqHighTempLimit; // High limit on GFXCLK when temperature is high, for reliability.
538 // SECTION: Fan Control
539 uint16_t FanStopTemp; //Celcius
540 uint16_t FanStartTemp; //Celcius
542 uint16_t FanGainEdge;
543 uint16_t FanGainHotspot;
544 uint16_t FanGainVrGfx;
545 uint16_t FanGainVrSoc;
546 uint16_t FanGainVrMem;
547 uint16_t FanGainHbm;
548 uint16_t FanPwmMin;
549 uint16_t FanAcousticLimitRpm;
550 uint16_t FanThrottlingRpm;
551 uint16_t FanMaximumRpm;
552 uint16_t FanTargetTemperature;
553 uint16_t FanTargetGfxclk;
554 uint8_t FanZeroRpmEnable;
555 uint8_t FanTachEdgePerRev;
556 uint8_t FanTempInputSelect;
557 uint8_t padding8_Fan;
559 // The following are AFC override parameters. Leave at 0 to use FW defaults.
560 int16_t FuzzyFan_ErrorSetDelta;
561 int16_t FuzzyFan_ErrorRateSetDelta;
562 int16_t FuzzyFan_PwmSetDelta;
563 uint16_t FuzzyFan_Reserved;
566 // SECTION: AVFS
567 // Overrides
568 uint8_t OverrideAvfsGb[AVFS_VOLTAGE_COUNT];
569 uint8_t Padding8_Avfs[2];
571 QuadraticInt_t qAvfsGb[AVFS_VOLTAGE_COUNT]; // GHz->V Override of fused curve
572 DroopInt_t dBtcGbGfxPll; // GHz->V BtcGb
573 DroopInt_t dBtcGbGfxAfll; // GHz->V BtcGb
574 DroopInt_t dBtcGbSoc; // GHz->V BtcGb
575 LinearInt_t qAgingGb[AVFS_VOLTAGE_COUNT]; // GHz->V
577 QuadraticInt_t qStaticVoltageOffset[AVFS_VOLTAGE_COUNT]; // GHz->V
579 uint16_t DcTol[AVFS_VOLTAGE_COUNT]; // mV Q2
581 uint8_t DcBtcEnabled[AVFS_VOLTAGE_COUNT];
582 uint8_t Padding8_GfxBtc[2];
584 uint16_t DcBtcMin[AVFS_VOLTAGE_COUNT]; // mV Q2
585 uint16_t DcBtcMax[AVFS_VOLTAGE_COUNT]; // mV Q2
587 uint16_t DcBtcGb[AVFS_VOLTAGE_COUNT]; // mV Q2
589 // SECTION: XGMI
590 uint8_t XgmiDpmPstates[NUM_XGMI_LEVELS]; // 2 DPM states, high and low. 0-P0, 1-P1, 2-P2, 3-P3.
591 uint8_t XgmiDpmSpare[2];
593 // Temperature Dependent Vmin
594 uint16_t VDDGFX_TVmin; //Celcius
595 uint16_t VDDSOC_TVmin; //Celcius
596 uint16_t VDDGFX_Vmin_HiTemp; // mV Q2
597 uint16_t VDDGFX_Vmin_LoTemp; // mV Q2
598 uint16_t VDDSOC_Vmin_HiTemp; // mV Q2
599 uint16_t VDDSOC_Vmin_LoTemp; // mV Q2
601 uint16_t VDDGFX_TVminHystersis; // Celcius
602 uint16_t VDDSOC_TVminHystersis; // Celcius
605 // SECTION: Advanced Options
606 uint32_t DebugOverrides;
607 QuadraticInt_t ReservedEquation0;
608 QuadraticInt_t ReservedEquation1;
609 QuadraticInt_t ReservedEquation2;
610 QuadraticInt_t ReservedEquation3;
612 uint16_t MinVoltageUlvGfx; // In mV(Q2) Minimum Voltage ("Vmin") of VDD_GFX in ULV mode
613 uint16_t PaddingUlv; // Padding
615 // Total Power configuration, use defines from PwrConfig_e
616 uint8_t TotalPowerConfig; //0-TDP, 1-TGP, 2-TCP Estimated, 3-TCP Measured
617 uint8_t TotalPowerSpare1;
618 uint16_t TotalPowerSpare2;
620 // APCC Settings
621 uint16_t PccThresholdLow;
622 uint16_t PccThresholdHigh;
623 uint32_t PaddingAPCC[6]; //FIXME pending SPEC
625 // OOB Settings
626 uint16_t BasePerformanceCardPower;
627 uint16_t MaxPerformanceCardPower;
628 uint16_t BasePerformanceFrequencyCap; //In Mhz
629 uint16_t MaxPerformanceFrequencyCap; //In Mhz
631 // SECTION: Reserved
632 uint32_t Reserved[9];
634 // SECTION: BOARD PARAMETERS
636 // SVI2 Board Parameters
637 uint16_t MaxVoltageStepGfx; // In mV(Q2) Max voltage step that SMU will request. Multiple steps are taken if voltage change exceeds this value.
638 uint16_t MaxVoltageStepSoc; // In mV(Q2) Max voltage step that SMU will request. Multiple steps are taken if voltage change exceeds this value.
640 uint8_t VddGfxVrMapping; // Use VR_MAPPING* bitfields
641 uint8_t VddSocVrMapping; // Use VR_MAPPING* bitfields
642 uint8_t VddMemVrMapping; // Use VR_MAPPING* bitfields
643 uint8_t BoardVrMapping; // Use VR_MAPPING* bitfields
645 uint8_t GfxUlvPhaseSheddingMask; // set this to 1 to set PSI0/1 to 1 in ULV mode
646 uint8_t ExternalSensorPresent; // External RDI connected to TMON (aka TEMP IN)
647 uint8_t Padding8_V[2];
649 // Telemetry Settings
650 uint16_t GfxMaxCurrent; // in Amps
651 int8_t GfxOffset; // in Amps
652 uint8_t Padding_TelemetryGfx;
654 uint16_t SocMaxCurrent; // in Amps
655 int8_t SocOffset; // in Amps
656 uint8_t Padding_TelemetrySoc;
658 uint16_t MemMaxCurrent; // in Amps
659 int8_t MemOffset; // in Amps
660 uint8_t Padding_TelemetryMem;
662 uint16_t BoardMaxCurrent; // in Amps
663 int8_t BoardOffset; // in Amps
664 uint8_t Padding_TelemetryBoardInput;
666 // GPIO Settings
667 uint8_t VR0HotGpio; // GPIO pin configured for VR0 HOT event
668 uint8_t VR0HotPolarity; // GPIO polarity for VR0 HOT event
669 uint8_t VR1HotGpio; // GPIO pin configured for VR1 HOT event
670 uint8_t VR1HotPolarity; // GPIO polarity for VR1 HOT event
672 // GFXCLK PLL Spread Spectrum
673 uint8_t PllGfxclkSpreadEnabled; // on or off
674 uint8_t PllGfxclkSpreadPercent; // Q4.4
675 uint16_t PllGfxclkSpreadFreq; // kHz
677 // UCLK Spread Spectrum
678 uint8_t UclkSpreadEnabled; // on or off
679 uint8_t UclkSpreadPercent; // Q4.4
680 uint16_t UclkSpreadFreq; // kHz
682 // FCLK Spread Spectrum
683 uint8_t FclkSpreadEnabled; // on or off
684 uint8_t FclkSpreadPercent; // Q4.4
685 uint16_t FclkSpreadFreq; // kHz
687 // GFXCLK Fll Spread Spectrum
688 uint8_t FllGfxclkSpreadEnabled; // on or off
689 uint8_t FllGfxclkSpreadPercent; // Q4.4
690 uint16_t FllGfxclkSpreadFreq; // kHz
692 // I2C Controller Structure
693 I2cControllerConfig_t I2cControllers[NUM_I2C_CONTROLLERS];
695 // Memory section
696 uint32_t MemoryChannelEnabled; // For DRAM use only, Max 32 channels enabled bit mask.
698 uint8_t DramBitWidth; // For DRAM use only. See Dram Bit width type defines
699 uint8_t PaddingMem[3];
701 // Total board power
702 uint16_t TotalBoardPower; //Only needed for TCP Estimated case, where TCP = TGP+Total Board Power
703 uint16_t BoardPadding;
705 // SECTION: XGMI Training
706 uint8_t XgmiLinkSpeed [NUM_XGMI_PSTATE_LEVELS];
707 uint8_t XgmiLinkWidth [NUM_XGMI_PSTATE_LEVELS];
709 uint16_t XgmiFclkFreq [NUM_XGMI_PSTATE_LEVELS];
710 uint16_t XgmiSocVoltage [NUM_XGMI_PSTATE_LEVELS];
712 // GPIO pins for I2C communications with 2nd controller for Input Telemetry Sequence
713 uint8_t GpioI2cScl; // Serial Clock
714 uint8_t GpioI2cSda; // Serial Data
715 uint16_t GpioPadding;
717 // Platform input telemetry voltage coefficient
718 uint32_t BoardVoltageCoeffA; // decode by /1000
719 uint32_t BoardVoltageCoeffB; // decode by /1000
721 uint32_t BoardReserved[7];
723 // Padding for MMHUB - do not modify this
724 uint32_t MmHubPadding[8]; // SMU internal use
726 } PPTable_t;
728 typedef struct {
729 // Time constant parameters for clock averages in ms
730 uint16_t GfxclkAverageLpfTau;
731 uint16_t SocclkAverageLpfTau;
732 uint16_t UclkAverageLpfTau;
733 uint16_t GfxActivityLpfTau;
734 uint16_t UclkActivityLpfTau;
736 uint16_t SocketPowerLpfTau;
738 // Padding - ignore
739 uint32_t MmHubPadding[8]; // SMU internal use
740 } DriverSmuConfig_t;
742 typedef struct {
743 uint16_t CurrClock[PPCLK_COUNT];
744 uint16_t AverageGfxclkFrequency;
745 uint16_t AverageSocclkFrequency;
746 uint16_t AverageUclkFrequency ;
747 uint16_t AverageGfxActivity ;
748 uint16_t AverageUclkActivity ;
749 uint8_t CurrSocVoltageOffset ;
750 uint8_t CurrGfxVoltageOffset ;
751 uint8_t CurrMemVidOffset ;
752 uint8_t Padding8 ;
753 uint16_t AverageSocketPower ;
754 uint16_t TemperatureEdge ;
755 uint16_t TemperatureHotspot ;
756 uint16_t TemperatureHBM ;
757 uint16_t TemperatureVrGfx ;
758 uint16_t TemperatureVrSoc ;
759 uint16_t TemperatureVrMem ;
760 uint32_t ThrottlerStatus ;
762 uint16_t CurrFanSpeed ;
763 uint16_t Padding16;
765 uint32_t Padding[4];
767 // Padding - ignore
768 uint32_t MmHubPadding[8]; // SMU internal use
769 } SmuMetrics_t;
772 typedef struct {
773 uint16_t avgPsmCount[75];
774 uint16_t minPsmCount[75];
775 float avgPsmVoltage[75];
776 float minPsmVoltage[75];
778 uint32_t MmHubPadding[8]; // SMU internal use
779 } AvfsDebugTable_t;
781 typedef struct {
782 uint8_t AvfsVersion;
783 uint8_t Padding;
784 uint8_t AvfsEn[AVFS_VOLTAGE_COUNT];
786 uint8_t OverrideVFT[AVFS_VOLTAGE_COUNT];
787 uint8_t OverrideAvfsGb[AVFS_VOLTAGE_COUNT];
789 uint8_t OverrideTemperatures[AVFS_VOLTAGE_COUNT];
790 uint8_t OverrideVInversion[AVFS_VOLTAGE_COUNT];
791 uint8_t OverrideP2V[AVFS_VOLTAGE_COUNT];
792 uint8_t OverrideP2VCharzFreq[AVFS_VOLTAGE_COUNT];
794 int32_t VFT0_m1[AVFS_VOLTAGE_COUNT]; // Q8.24
795 int32_t VFT0_m2[AVFS_VOLTAGE_COUNT]; // Q12.12
796 int32_t VFT0_b[AVFS_VOLTAGE_COUNT]; // Q32
798 int32_t VFT1_m1[AVFS_VOLTAGE_COUNT]; // Q8.16
799 int32_t VFT1_m2[AVFS_VOLTAGE_COUNT]; // Q12.12
800 int32_t VFT1_b[AVFS_VOLTAGE_COUNT]; // Q32
802 int32_t VFT2_m1[AVFS_VOLTAGE_COUNT]; // Q8.16
803 int32_t VFT2_m2[AVFS_VOLTAGE_COUNT]; // Q12.12
804 int32_t VFT2_b[AVFS_VOLTAGE_COUNT]; // Q32
806 int32_t AvfsGb0_m1[AVFS_VOLTAGE_COUNT]; // Q8.24
807 int32_t AvfsGb0_m2[AVFS_VOLTAGE_COUNT]; // Q12.12
808 int32_t AvfsGb0_b[AVFS_VOLTAGE_COUNT]; // Q32
810 int32_t AcBtcGb_m1[AVFS_VOLTAGE_COUNT]; // Q8.24
811 int32_t AcBtcGb_m2[AVFS_VOLTAGE_COUNT]; // Q12.12
812 int32_t AcBtcGb_b[AVFS_VOLTAGE_COUNT]; // Q32
814 uint32_t AvfsTempCold[AVFS_VOLTAGE_COUNT];
815 uint32_t AvfsTempMid[AVFS_VOLTAGE_COUNT];
816 uint32_t AvfsTempHot[AVFS_VOLTAGE_COUNT];
818 uint32_t VInversion[AVFS_VOLTAGE_COUNT]; // in mV with 2 fractional bits
821 int32_t P2V_m1[AVFS_VOLTAGE_COUNT]; // Q8.24
822 int32_t P2V_m2[AVFS_VOLTAGE_COUNT]; // Q12.12
823 int32_t P2V_b[AVFS_VOLTAGE_COUNT]; // Q32
825 uint32_t P2VCharzFreq[AVFS_VOLTAGE_COUNT]; // in 10KHz units
827 uint32_t EnabledAvfsModules[3];
829 uint32_t MmHubPadding[8]; // SMU internal use
830 } AvfsFuseOverride_t;
832 typedef struct {
833 uint8_t Gfx_ActiveHystLimit;
834 uint8_t Gfx_IdleHystLimit;
835 uint8_t Gfx_FPS;
836 uint8_t Gfx_MinActiveFreqType;
837 uint8_t Gfx_BoosterFreqType;
838 uint8_t Gfx_MinFreqStep; // Minimum delta between current and target frequeny in order for FW to change clock.
839 uint8_t Gfx_UseRlcBusy;
840 uint8_t PaddingGfx[3];
841 uint16_t Gfx_MinActiveFreq; // MHz
842 uint16_t Gfx_BoosterFreq; // MHz
843 uint16_t Gfx_PD_Data_time_constant; // Time constant of PD controller in ms
844 uint32_t Gfx_PD_Data_limit_a; // Q16
845 uint32_t Gfx_PD_Data_limit_b; // Q16
846 uint32_t Gfx_PD_Data_limit_c; // Q16
847 uint32_t Gfx_PD_Data_error_coeff; // Q16
848 uint32_t Gfx_PD_Data_error_rate_coeff; // Q16
850 uint8_t Mem_ActiveHystLimit;
851 uint8_t Mem_IdleHystLimit;
852 uint8_t Mem_FPS;
853 uint8_t Mem_MinActiveFreqType;
854 uint8_t Mem_BoosterFreqType;
855 uint8_t Mem_MinFreqStep; // Minimum delta between current and target frequeny in order for FW to change clock.
856 uint8_t Mem_UseRlcBusy;
857 uint8_t PaddingMem[3];
858 uint16_t Mem_MinActiveFreq; // MHz
859 uint16_t Mem_BoosterFreq; // MHz
860 uint16_t Mem_PD_Data_time_constant; // Time constant of PD controller in ms
861 uint32_t Mem_PD_Data_limit_a; // Q16
862 uint32_t Mem_PD_Data_limit_b; // Q16
863 uint32_t Mem_PD_Data_limit_c; // Q16
864 uint32_t Mem_PD_Data_error_coeff; // Q16
865 uint32_t Mem_PD_Data_error_rate_coeff; // Q16
867 uint32_t Mem_UpThreshold_Limit; // Q16
868 uint8_t Mem_UpHystLimit;
869 uint8_t Mem_DownHystLimit;
870 uint16_t Mem_Fps;
872 uint32_t MmHubPadding[8]; // SMU internal use
873 } DpmActivityMonitorCoeffInt_t;
875 // These defines are used with the following messages:
876 // SMC_MSG_TransferTableDram2Smu
877 // SMC_MSG_TransferTableSmu2Dram
878 #define TABLE_PPTABLE 0
879 #define TABLE_AVFS 1
880 #define TABLE_AVFS_PSM_DEBUG 2
881 #define TABLE_AVFS_FUSE_OVERRIDE 3
882 #define TABLE_PMSTATUSLOG 4
883 #define TABLE_SMU_METRICS 5
884 #define TABLE_DRIVER_SMU_CONFIG 6
885 #define TABLE_OVERDRIVE 7
886 #define TABLE_WAFL_XGMI_TOPOLOGY 8
887 #define TABLE_I2C_COMMANDS 9
888 #define TABLE_ACTIVITY_MONITOR_COEFF 10
889 #define TABLE_COUNT 11
891 // These defines are used with the SMC_MSG_SetUclkFastSwitch message.
892 typedef enum {
893 DF_SWITCH_TYPE_FAST = 0,
894 DF_SWITCH_TYPE_SLOW,
895 DF_SWITCH_TYPE_COUNT,
896 } DF_SWITCH_TYPE_e;
898 typedef enum {
899 DRAM_BIT_WIDTH_DISABLED = 0,
900 DRAM_BIT_WIDTH_X_8,
901 DRAM_BIT_WIDTH_X_16,
902 DRAM_BIT_WIDTH_X_32,
903 DRAM_BIT_WIDTH_X_64, // NOT USED.
904 DRAM_BIT_WIDTH_X_128,
905 DRAM_BIT_WIDTH_COUNT,
906 } DRAM_BIT_WIDTH_TYPE_e;
908 #define REMOVE_FMAX_MARGIN_BIT 0x0
909 #define REMOVE_DCTOL_MARGIN_BIT 0x1
910 #define REMOVE_PLATFORM_MARGIN_BIT 0x2
912 #endif