1/*	$NetBSD: vega10_ppsmc.h,v 1.2 2021/12/18 23:45:26 riastradh Exp $	*/
2
3/*
4 * Copyright 2016 Advanced Micro Devices, Inc.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 * OTHER DEALINGS IN THE SOFTWARE.
23 *
24 */
25
26#ifndef PP_SMC_H
27#define PP_SMC_H
28
29#pragma pack(push, 1)
30
31#define SMU_UCODE_VERSION                  0x001c0800
32
33/* SMU Response Codes: */
34#define PPSMC_Result_OK                    0x1
35#define PPSMC_Result_Failed                0xFF
36#define PPSMC_Result_UnknownCmd            0xFE
37#define PPSMC_Result_CmdRejectedPrereq     0xFD
38#define PPSMC_Result_CmdRejectedBusy       0xFC
39
40typedef uint16_t PPSMC_Result;
41
42/* Message Definitions */
43#define PPSMC_MSG_TestMessage                    0x1
44#define PPSMC_MSG_GetSmuVersion                  0x2
45#define PPSMC_MSG_GetDriverIfVersion             0x3
46#define PPSMC_MSG_EnableSmuFeatures              0x4
47#define PPSMC_MSG_DisableSmuFeatures             0x5
48#define PPSMC_MSG_GetEnabledSmuFeatures          0x6
49#define PPSMC_MSG_SetWorkloadMask                0x7
50#define PPSMC_MSG_SetPptLimit                    0x8
51#define PPSMC_MSG_SetDriverDramAddrHigh          0x9
52#define PPSMC_MSG_SetDriverDramAddrLow           0xA
53#define PPSMC_MSG_SetToolsDramAddrHigh           0xB
54#define PPSMC_MSG_SetToolsDramAddrLow            0xC
55#define PPSMC_MSG_TransferTableSmu2Dram          0xD
56#define PPSMC_MSG_TransferTableDram2Smu          0xE
57#define PPSMC_MSG_UseDefaultPPTable              0xF
58#define PPSMC_MSG_UseBackupPPTable               0x10
59#define PPSMC_MSG_RunBtc                         0x11
60#define PPSMC_MSG_RequestI2CBus                  0x12
61#define PPSMC_MSG_ReleaseI2CBus                  0x13
62#define PPSMC_MSG_ConfigureTelemetry             0x14
63#define PPSMC_MSG_SetUlvIpMask                   0x15
64#define PPSMC_MSG_SetSocVidOffset                0x16
65#define PPSMC_MSG_SetMemVidOffset                0x17
66#define PPSMC_MSG_GetSocVidOffset                0x18
67#define PPSMC_MSG_GetMemVidOffset                0x19
68#define PPSMC_MSG_SetFloorSocVoltage             0x1A
69#define PPSMC_MSG_SoftReset                      0x1B
70#define PPSMC_MSG_StartBacoMonitor               0x1C
71#define PPSMC_MSG_CancelBacoMonitor              0x1D
72#define PPSMC_MSG_EnterBaco                      0x1E
73#define PPSMC_MSG_AllowLowGfxclkInterrupt        0x1F
74#define PPSMC_MSG_SetLowGfxclkInterruptThreshold 0x20
75#define PPSMC_MSG_SetSoftMinGfxclkByIndex        0x21
76#define PPSMC_MSG_SetSoftMaxGfxclkByIndex        0x22
77#define PPSMC_MSG_GetCurrentGfxclkIndex          0x23
78#define PPSMC_MSG_SetSoftMinUclkByIndex          0x24
79#define PPSMC_MSG_SetSoftMaxUclkByIndex          0x25
80#define PPSMC_MSG_GetCurrentUclkIndex            0x26
81#define PPSMC_MSG_SetSoftMinUvdByIndex           0x27
82#define PPSMC_MSG_SetSoftMaxUvdByIndex           0x28
83#define PPSMC_MSG_GetCurrentUvdIndex             0x29
84#define PPSMC_MSG_SetSoftMinVceByIndex           0x2A
85#define PPSMC_MSG_SetSoftMaxVceByIndex           0x2B
86#define PPSMC_MSG_SetHardMinVceByIndex           0x2C
87#define PPSMC_MSG_GetCurrentVceIndex             0x2D
88#define PPSMC_MSG_SetSoftMinSocclkByIndex        0x2E
89#define PPSMC_MSG_SetHardMinSocclkByIndex        0x2F
90#define PPSMC_MSG_SetSoftMaxSocclkByIndex        0x30
91#define PPSMC_MSG_GetCurrentSocclkIndex          0x31
92#define PPSMC_MSG_SetMinLinkDpmByIndex           0x32
93#define PPSMC_MSG_GetCurrentLinkIndex            0x33
94#define PPSMC_MSG_GetAverageGfxclkFrequency      0x34
95#define PPSMC_MSG_GetAverageSocclkFrequency      0x35
96#define PPSMC_MSG_GetAverageUclkFrequency        0x36
97#define PPSMC_MSG_GetAverageGfxActivity          0x37
98#define PPSMC_MSG_GetTemperatureEdge             0x38
99#define PPSMC_MSG_GetTemperatureHotspot          0x39
100#define PPSMC_MSG_GetTemperatureHBM              0x3A
101#define PPSMC_MSG_GetTemperatureVrSoc            0x3B
102#define PPSMC_MSG_GetTemperatureVrMem            0x3C
103#define PPSMC_MSG_GetTemperatureLiquid           0x3D
104#define PPSMC_MSG_GetTemperaturePlx              0x3E
105#define PPSMC_MSG_OverDriveSetPercentage         0x3F
106#define PPSMC_MSG_SetMinDeepSleepDcefclk         0x40
107#define PPSMC_MSG_SwitchToAC                     0x41
108#define PPSMC_MSG_SetUclkFastSwitch              0x42
109#define PPSMC_MSG_SetUclkDownHyst                0x43
110#define PPSMC_MSG_RemoveDCClamp                  0x44
111#define PPSMC_MSG_GfxDeviceDriverReset           0x45
112#define PPSMC_MSG_GetCurrentRpm                  0x46
113#define PPSMC_MSG_SetVideoFps                    0x47
114#define PPSMC_MSG_SetCustomGfxDpmParameters      0x48
115#define PPSMC_MSG_SetTjMax                       0x49
116#define PPSMC_MSG_SetFanTemperatureTarget        0x4A
117#define PPSMC_MSG_PrepareMp1ForUnload            0x4B
118#define PPSMC_MSG_RequestDisplayClockByFreq      0x4C
119#define PPSMC_MSG_GetClockFreqMHz                0x4D
120#define PPSMC_MSG_DramLogSetDramAddrHigh         0x4E
121#define PPSMC_MSG_DramLogSetDramAddrLow          0x4F
122#define PPSMC_MSG_DramLogSetDramSize             0x50
123#define PPSMC_MSG_SetFanMaxRpm                   0x51
124#define PPSMC_MSG_SetFanMinPwm                   0x52
125#define PPSMC_MSG_ConfigureGfxDidt               0x55
126#define PPSMC_MSG_NumOfDisplays                  0x56
127#define PPSMC_MSG_ReadSerialNumTop32             0x58
128#define PPSMC_MSG_ReadSerialNumBottom32          0x59
129#define PPSMC_MSG_SetSystemVirtualDramAddrHigh   0x5A
130#define PPSMC_MSG_SetSystemVirtualDramAddrLow    0x5B
131#define PPSMC_MSG_RunAcgBtc                      0x5C
132#define PPSMC_MSG_RunAcgInClosedLoop             0x5D
133#define PPSMC_MSG_RunAcgInOpenLoop               0x5E
134#define PPSMC_MSG_InitializeAcg                  0x5F
135#define PPSMC_MSG_GetCurrPkgPwr                  0x61
136#define PPSMC_MSG_GetAverageGfxclkActualFrequency 0x63
137#define PPSMC_MSG_SetPccThrottleLevel            0x67
138#define PPSMC_MSG_UpdatePkgPwrPidAlpha           0x68
139#define PPSMC_Message_Count                      0x69
140
141
142typedef int PPSMC_Msg;
143
144#pragma pack(pop)
145
146#endif
147