Skip to content

Commit a68654b

Browse files
amd-pvishwakalexdeucher
authored andcommitted
drm/amd: Enable SMU 15_0_0 firmware headers
Add SMU 15_0_0 firmware headers v2: squash in updates (Alex) Signed-off-by: Pratik Vishwakarma <Pratik.Vishwakarma@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 52cd9bc commit a68654b

3 files changed

Lines changed: 524 additions & 0 deletions

File tree

Lines changed: 231 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,231 @@
1+
/*
2+
* Copyright 2025 Advanced Micro Devices, Inc.
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a
5+
* copy of this software and associated documentation files (the "Software"),
6+
* to deal in the Software without restriction, including without limitation
7+
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
8+
* and/or sell copies of the Software, and to permit persons to whom the
9+
* Software is furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in
12+
* all copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17+
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18+
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19+
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20+
* OTHER DEALINGS IN THE SOFTWARE.
21+
*
22+
*/
23+
24+
#ifndef SMU15_DRIVER_IF_V15_0_0_H
25+
#define SMU15_DRIVER_IF_V15_0_0_H
26+
27+
typedef struct {
28+
int32_t value;
29+
uint32_t numFractionalBits;
30+
} FloatInIntFormat_t;
31+
32+
typedef enum {
33+
DSPCLK_DCFCLK = 0,
34+
DSPCLK_DISPCLK,
35+
DSPCLK_PIXCLK,
36+
DSPCLK_PHYCLK,
37+
DSPCLK_COUNT,
38+
} DSPCLK_e;
39+
40+
typedef struct {
41+
uint16_t Freq; // in MHz
42+
uint16_t Vid; // min voltage in SVI3 VID
43+
} DisplayClockTable_t;
44+
45+
typedef struct {
46+
uint16_t MinClock; // This is either DCFCLK or SOCCLK (in MHz)
47+
uint16_t MaxClock; // This is either DCFCLK or SOCCLK (in MHz)
48+
uint16_t MinMclk;
49+
uint16_t MaxMclk;
50+
51+
uint8_t WmSetting;
52+
uint8_t WmType; // Used for normal pstate change or memory retraining
53+
uint8_t Padding[2];
54+
} WatermarkRowGeneric_t;
55+
56+
#define NUM_WM_RANGES 4
57+
#define WM_PSTATE_CHG 0
58+
#define WM_RETRAINING 1
59+
60+
typedef enum {
61+
WM_SOCCLK = 0,
62+
WM_DCFCLK,
63+
WM_COUNT,
64+
} WM_CLOCK_e;
65+
66+
typedef struct {
67+
// Watermarks
68+
WatermarkRowGeneric_t WatermarkRow[WM_COUNT][NUM_WM_RANGES];
69+
70+
uint32_t MmHubPadding[7]; // SMU internal use
71+
} Watermarks_t;
72+
73+
typedef enum {
74+
CUSTOM_DPM_SETTING_GFXCLK,
75+
CUSTOM_DPM_SETTING_CCLK,
76+
CUSTOM_DPM_SETTING_FCLK_CCX,
77+
CUSTOM_DPM_SETTING_FCLK_GFX,
78+
CUSTOM_DPM_SETTING_FCLK_STALLS,
79+
CUSTOM_DPM_SETTING_LCLK,
80+
CUSTOM_DPM_SETTING_COUNT,
81+
} CUSTOM_DPM_SETTING_e;
82+
83+
typedef struct {
84+
uint8_t ActiveHystLimit;
85+
uint8_t IdleHystLimit;
86+
uint8_t FPS;
87+
uint8_t MinActiveFreqType;
88+
FloatInIntFormat_t MinActiveFreq;
89+
FloatInIntFormat_t PD_Data_limit;
90+
FloatInIntFormat_t PD_Data_time_constant;
91+
FloatInIntFormat_t PD_Data_error_coeff;
92+
FloatInIntFormat_t PD_Data_error_rate_coeff;
93+
} DpmActivityMonitorCoeffExt_t;
94+
95+
typedef struct {
96+
DpmActivityMonitorCoeffExt_t DpmActivityMonitorCoeff[CUSTOM_DPM_SETTING_COUNT];
97+
} CustomDpmSettings_t;
98+
99+
#define NUM_DCFCLK_DPM_LEVELS 8
100+
#define NUM_DISPCLK_DPM_LEVELS 8
101+
#define NUM_DPPCLK_DPM_LEVELS 8
102+
#define NUM_SOCCLK_DPM_LEVELS 8
103+
#define NUM_VCN_DPM_LEVELS 8
104+
#define NUM_SOC_VOLTAGE_LEVELS 8
105+
#define NUM_VPE_DPM_LEVELS 8
106+
#define NUM_FCLK_DPM_LEVELS 8
107+
#define NUM_MEM_PSTATE_LEVELS 4
108+
109+
110+
typedef struct {
111+
uint32_t UClk;
112+
uint32_t MemClk;
113+
uint32_t Voltage;
114+
uint8_t WckRatio;
115+
uint8_t Spare[3];
116+
} MemPstateTable_t;
117+
118+
//Freq in MHz
119+
//Voltage in milli volts with 2 fractional bits
120+
typedef struct {
121+
uint32_t DcfClocks[NUM_DCFCLK_DPM_LEVELS];
122+
uint32_t DispClocks[NUM_DISPCLK_DPM_LEVELS];
123+
uint32_t DppClocks[NUM_DPPCLK_DPM_LEVELS];
124+
uint32_t SocClocks[NUM_SOCCLK_DPM_LEVELS];
125+
uint32_t VClocks[NUM_VCN_DPM_LEVELS];
126+
uint32_t DClocks[NUM_VCN_DPM_LEVELS];
127+
uint32_t VPEClocks[NUM_VPE_DPM_LEVELS];
128+
uint32_t FclkClocks_Freq[NUM_FCLK_DPM_LEVELS];
129+
uint32_t FclkClocks_Voltage[NUM_FCLK_DPM_LEVELS];
130+
uint32_t SocVoltage[NUM_SOC_VOLTAGE_LEVELS];
131+
MemPstateTable_t MemPstateTable[NUM_MEM_PSTATE_LEVELS];
132+
133+
uint8_t NumDcfClkLevelsEnabled;
134+
uint8_t NumDispClkLevelsEnabled; //Applies to both Dispclk and Dppclk
135+
uint8_t NumSocClkLevelsEnabled;
136+
uint8_t VcnClkLevelsEnabled; //Applies to both Vclk and Dclk
137+
138+
uint8_t VpeClkLevelsEnabled;
139+
uint8_t NumMemPstatesEnabled;
140+
uint8_t NumFclkLevelsEnabled;
141+
uint8_t spare;
142+
143+
uint32_t MinGfxClk;
144+
uint32_t MaxGfxClk;
145+
} DpmClocks_t;
146+
147+
typedef struct {
148+
uint16_t CoreFrequency[16]; //Target core frequency [MHz]
149+
uint16_t CorePower[16]; //CAC calculated core power [mW]
150+
uint16_t CoreTemperature[16]; //TSEN measured core temperature [centi-C]
151+
uint16_t GfxTemperature; //TSEN measured GFX temperature [centi-C]
152+
uint16_t SocTemperature; //TSEN measured SOC temperature [centi-C]
153+
uint16_t StapmOpnLimit; //Maximum IRM defined STAPM power limit [mW]
154+
uint16_t StapmCurrentLimit; //Time filtered STAPM power limit [mW]
155+
uint16_t InfrastructureCpuMaxFreq; //CCLK frequency limit enforced on classic cores [MHz]
156+
uint16_t InfrastructureGfxMaxFreq; //GFXCLK frequency limit enforced on GFX [MHz]
157+
uint16_t SkinTemp; //Maximum skin temperature reported by APU and HS2 chassis sensors [centi-C]
158+
uint16_t GfxclkFrequency; //Time filtered target GFXCLK frequency [MHz]
159+
uint16_t FclkFrequency; //Time filtered target FCLK frequency [MHz]
160+
uint16_t GfxActivity; //Time filtered GFX busy % [0-100]
161+
uint16_t SocclkFrequency; //Time filtered target SOCCLK frequency [MHz]
162+
uint16_t VclkFrequency; //Time filtered target VCLK frequency [MHz]
163+
uint16_t VcnActivity; //Time filtered VCN busy % [0-100]
164+
uint16_t VpeclkFrequency; //Time filtered target VPECLK frequency [MHz]
165+
uint16_t NpuclkFrequency; //Time filtered target NPUCLK frequency [MHz]
166+
uint16_t NpuBusy[8]; //Time filtered NPU per-column busy % [0-100]
167+
uint16_t DRAMReads; //Time filtered DRAM read bandwidth [MB/sec]
168+
uint16_t DRAMWrites; //Time filtered DRAM write bandwidth [MB/sec]
169+
uint16_t CoreC0Residency[16]; //Time filtered per-core C0 residency % [0-100]
170+
uint16_t NpuPower; //Time filtered NPU power [mW]
171+
uint32_t ApuPower; //Time filtered APU power [mW]
172+
uint32_t GfxPower; //Time filtered GFX power [mW]
173+
uint32_t dGpuPower; //Time filtered dGPU power [mW]
174+
uint32_t SocketPower; //Time filtered power used for PPT/STAPM [APU+dGPU] [mW]
175+
uint32_t AllCorePower; //Time filtered sum of core power across all cores in the socket [mW]
176+
uint32_t FilterAlphaValue; //Metrics table alpha filter time constant [us]
177+
uint32_t MetricsCounter; //Counter that is incremented on every metrics table update [PM_TIMER cycles]
178+
uint16_t MemclkFrequency; //Time filtered target MEMCLK frequency [MHz]
179+
uint16_t AieclkFrequency; //Time filtered target AIECLK frequency [MHz]
180+
uint16_t NpuReads; //Time filtered NPU read bandwidth [MB/sec]
181+
uint16_t NpuWrites; //Time filtered NPU write bandwidth [MB/sec]
182+
uint32_t ThrottleResidency_PROCHOT; //Counter that is incremented on every metrics table update when PROCHOT was engaged [PM_TIMER cycles]
183+
uint32_t ThrottleResidency_SPL; //Counter that is incremented on every metrics table update when SPL was engaged [PM_TIMER cycles]
184+
uint32_t ThrottleResidency_FPPT; //Counter that is incremented on every metrics table update when fast PPT was engaged [PM_TIMER cycles]
185+
uint32_t ThrottleResidency_SPPT; //Counter that is incremented on every metrics table update when slow PPT was engaged [PM_TIMER cycles]
186+
uint32_t ThrottleResidency_THM_VDD; //Counter that is incremented on every metrics table update when VDD thermal throttling was engaged [PM_TIMER cycles]
187+
uint32_t ThrottleResidency_THM_SOC; //Counter that is incremented on every metrics table update when SOC thermal throttling was engaged [PM_TIMER cycles]
188+
uint16_t Psys; //Time filtered Psys power [mW]
189+
uint16_t spare1;
190+
uint32_t spare[6];
191+
} SmuMetrics_t;
192+
193+
//ISP tile definitions
194+
typedef enum {
195+
TILE_XTILE = 0, //ONO0
196+
TILE_MTILE, //ONO1
197+
TILE_PDP, //ONO2
198+
TILE_CSTAT, //ONO2
199+
TILE_LME, //ONO3
200+
TILE_BYRP, //ONO4
201+
TILE_GRBP, //ONO4
202+
TILE_MCFP, //ONO4
203+
TILE_YUVP, //ONO4
204+
TILE_MCSC, //ONO4
205+
TILE_GDC, //ONO5
206+
TILE_MAX
207+
} TILE_NUM_e;
208+
209+
// Tile Selection (Based on arguments)
210+
#define ISP_TILE_SEL(tile) (1<<tile)
211+
#define ISP_TILE_SEL_ALL 0x7FF
212+
213+
// Workload bits
214+
#define WORKLOAD_PPLIB_FULL_SCREEN_3D_BIT 0
215+
#define WORKLOAD_PPLIB_VIDEO_BIT 2
216+
#define WORKLOAD_PPLIB_VR_BIT 3
217+
#define WORKLOAD_PPLIB_COMPUTE_BIT 4
218+
#define WORKLOAD_PPLIB_CUSTOM_BIT 5
219+
#define WORKLOAD_PPLIB_COUNT 6
220+
221+
#define TABLE_BIOS_IF 0 // Called by BIOS
222+
#define TABLE_WATERMARKS 1 // Called by DAL through VBIOS, for Medusa generation this should no longer be used
223+
#define TABLE_CUSTOM_DPM 2 // Called by Driver
224+
#define TABLE_BIOS_GPIO_CONFIG 3 // Called by BIOS
225+
#define TABLE_DPMCLOCKS 4 // Called by Driver and VBIOS
226+
#define TABLE_SPARE0 5 // Unused
227+
#define TABLE_SPARE1 6 // Unused
228+
#define TABLE_SMU_METRICS 7 // Called by Driver and SMF/PMF
229+
#define TABLE_COUNT 8
230+
231+
#endif
Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
/*
2+
* Copyright 2025 Advanced Micro Devices, Inc.
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a
5+
* copy of this software and associated documentation files (the "Software"),
6+
* to deal in the Software without restriction, including without limitation
7+
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
8+
* and/or sell copies of the Software, and to permit persons to whom the
9+
* Software is furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in
12+
* all copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17+
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18+
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19+
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20+
* OTHER DEALINGS IN THE SOFTWARE.
21+
*
22+
*/
23+
24+
#ifndef SMU15_DRIVER_IF_V15_0_H
25+
#define SMU15_DRIVER_IF_V15_0_H
26+
27+
#include "smu15_driver_if_v15_0_0.h"
28+
29+
#pragma pack(push, 1)
30+
31+
#define ENABLE_DEBUG_FEATURES
32+
33+
// Firmware features
34+
// Feature Control Defines
35+
#define FEATURE_CCLK_DPM_BIT 0
36+
#define FEATURE_FAN_CONTROLLER_BIT 1
37+
#define FEATURE_DATA_CALCULATION_BIT 2
38+
#define FEATURE_PPT_BIT 3
39+
#define FEATURE_TDC_BIT 4
40+
#define FEATURE_THERMAL_BIT 5
41+
#define FEATURE_FIT_BIT 6
42+
#define FEATURE_EDC_BIT 7
43+
#define FEATURE_PLL_POWER_DOWN_BIT 8
44+
#define FEATURE_VDDOFF_BIT 9
45+
#define FEATURE_VCN_DPM_BIT 10
46+
#define FEATURE_DS_MPM_BIT 11
47+
#define FEATURE_FCLK_DPM_BIT 12
48+
#define FEATURE_SOCCLK_DPM_BIT 13
49+
#define FEATURE_DS_MPIO_BIT 14
50+
#define FEATURE_LCLK_DPM_BIT 15
51+
#define FEATURE_SHUBCLK_DPM_BIT 16
52+
#define FEATURE_DCFCLK_DPM_BIT 17
53+
#define FEATURE_ISP_DPM_BIT 18
54+
#define FEATURE_NPU_DPM_BIT 19
55+
#define FEATURE_GFX_DPM_BIT 20
56+
#define FEATURE_DS_GFXCLK_BIT 21
57+
#define FEATURE_DS_SOCCLK_BIT 22
58+
#define FEATURE_DS_LCLK_BIT 23
59+
#define FEATURE_LOW_POWER_DCNCLKS_BIT 24 // for all DISP clks
60+
#define FEATURE_DS_SHUBCLK_BIT 25
61+
#define FEATURE_VRHOT_BIT 26
62+
#define FEATURE_Z8_BIT 27
63+
#define FEATURE_PCC_BIT 28
64+
#define FEATURE_DS_FCLK_BIT 29
65+
#define FEATURE_DS_SMNCLK_BIT 30
66+
#define FEATURE_DS_MP1CLK_BIT 31
67+
#define FEATURE_SPM_BIT 32
68+
#define FEATURE_SMU_LOW_POWER_BIT 33
69+
#define FEATURE_SMART_L3_RINSER_BIT 34 // Amit: it is spare
70+
#define FEATURE_DS_DACCCLK_BIT 35
71+
#define FEATURE_PSI_BIT 36
72+
#define FEATURE_PROCHOT_BIT 37
73+
#define FEATURE_CPUOFF_BIT 38
74+
#define FEATURE_STAPM_BIT 39
75+
#define FEATURE_S0I3_BIT 40
76+
#define FEATURE_DF_LIGHT_CSTATE 41
77+
#define FEATURE_PERF_LIMIT_BIT 42
78+
#define FEATURE_CORE_DLDO_BIT 43
79+
#define FEATURE_DVO_BIT 44
80+
#define FEATURE_DS_VCN_BIT 45
81+
#define FEATURE_CPPC_BIT 46
82+
#define FEATURE_CPPC_PREFERRED_CORES 47
83+
#define FEATURE_DF_CSTATES_BIT 48
84+
#define FEATURE_CSTATE_BOOST_BIT 49
85+
#define FEATURE_ATHUB_PG_BIT 50
86+
#define FEATURE_VDDOFF_ECO_BIT 51
87+
#define FEATURE_SC_DIDT_BIT 52 //SC_DIDT
88+
#define FEATURE_CC6_BIT 53
89+
#define FEATURE_DS_UMCCLK_BIT 54
90+
#define FEATURE_DS_ISPCLK_BIT 55
91+
#define FEATURE_DS_HSPCLK_BIT 56
92+
#define FEATURE_P3T_BIT 57
93+
#define FEATURE_DS_NPUCLK_BIT 58
94+
#define FEATURE_DS_VPECLK_BIT 59
95+
#define FEATURE_VPE_DPM_BIT 60
96+
#define FEATURE_DACCCLK_DPM_BIT 61
97+
#define FEATURE_FP_DIDT 62
98+
#define FEATURE_MMHUB_PG_BIT 63
99+
#define NUM_FEATURES 64
100+
101+
// Firmware Header/Footer
102+
struct SMU_Firmware_Footer {
103+
uint32_t Signature;
104+
};
105+
typedef struct SMU_Firmware_Footer SMU_Firmware_Footer;
106+
107+
// PSP3.0 Header Definition
108+
typedef struct {
109+
uint32_t ImageVersion;
110+
uint32_t ImageVersion2; // This is repeated because DW0 cannot be written in SRAM due to HW bug.
111+
uint32_t Padding0[3];
112+
uint32_t SizeFWSigned;
113+
uint32_t Padding1[25];
114+
uint32_t FirmwareType;
115+
uint32_t Filler[32];
116+
} SMU_Firmware_Header;
117+
118+
typedef struct {
119+
// MP1_EXT_SCRATCH0
120+
uint32_t DpmHandlerID : 8;
121+
uint32_t ActivityMonitorID : 8;
122+
uint32_t DpmTimerID : 8;
123+
uint32_t DpmHubID : 4;
124+
uint32_t DpmHubTask : 4;
125+
// MP1_EXT_SCRATCH1
126+
uint32_t CclkSyncStatus : 8;
127+
uint32_t Ccx0CpuOff : 2;
128+
uint32_t Ccx1CpuOff : 2;
129+
uint32_t Ccx2CpuOff : 2;
130+
uint32_t GfxOffStatus : 2;
131+
uint32_t VddOff : 1;
132+
uint32_t InWhisperMode : 1;
133+
uint32_t ZstateStatus : 4;
134+
uint32_t DcnIps2Status : 2;
135+
uint32_t DstateFun : 4;
136+
uint32_t DstateDev : 4;
137+
// MP1_EXT_SCRATCH2
138+
uint32_t P2JobHandler :24;
139+
uint32_t RsmuPmiP2PendingCnt : 8;
140+
// MP1_EXT_SCRATCH3
141+
uint32_t PostCode :32;
142+
// MP1_EXT_SCRATCH4
143+
uint32_t MsgPortBusy :24;
144+
uint32_t RsmuPmiP1Pending : 1;
145+
uint32_t DfCstateExitPending : 1;
146+
uint32_t Ccx0Pc6ExitPending : 1;
147+
uint32_t Ccx1Pc6ExitPending : 1;
148+
uint32_t Ccx2Pc6ExitPending : 1;
149+
uint32_t WarmResetPending : 1;
150+
uint32_t spare1 : 2;
151+
// MP1_EXT_SCRATCH5
152+
uint32_t IdleMask :32;
153+
// MP1_EXT_SCRATCH6 = RTOS threads' status
154+
// MP1_EXT_SCRATCH7 = RTOS Current Job
155+
} FwStatus_t;
156+
157+
158+
#pragma pack(pop)
159+
160+
#endif

0 commit comments

Comments
 (0)