xref: /linux/drivers/gpu/drm/amd/pm/powerplay/inc/cz_ppsmc.h (revision 837d542a09cd533055423dfca7e621a9c1d13c5b)
1aaa36a97SAlex Deucher /*
2aaa36a97SAlex Deucher  * Copyright 2014 Advanced Micro Devices, Inc.
3aaa36a97SAlex Deucher  *
4aaa36a97SAlex Deucher  * Permission is hereby granted, free of charge, to any person obtaining a
5aaa36a97SAlex Deucher  * copy of this software and associated documentation files (the "Software"),
6aaa36a97SAlex Deucher  * to deal in the Software without restriction, including without limitation
7aaa36a97SAlex Deucher  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8aaa36a97SAlex Deucher  * and/or sell copies of the Software, and to permit persons to whom the
9aaa36a97SAlex Deucher  * Software is furnished to do so, subject to the following conditions:
10aaa36a97SAlex Deucher  *
11aaa36a97SAlex Deucher  * The above copyright notice and this permission notice shall be included in
12aaa36a97SAlex Deucher  * all copies or substantial portions of the Software.
13aaa36a97SAlex Deucher  *
14aaa36a97SAlex Deucher  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15aaa36a97SAlex Deucher  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16aaa36a97SAlex Deucher  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17aaa36a97SAlex Deucher  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18aaa36a97SAlex Deucher  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19aaa36a97SAlex Deucher  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20aaa36a97SAlex Deucher  * OTHER DEALINGS IN THE SOFTWARE.
21aaa36a97SAlex Deucher  *
22aaa36a97SAlex Deucher  */
23aaa36a97SAlex Deucher 
24aaa36a97SAlex Deucher #ifndef CZ_PP_SMC_H
25aaa36a97SAlex Deucher #define CZ_PP_SMC_H
26aaa36a97SAlex Deucher 
27aaa36a97SAlex Deucher #pragma pack(push, 1)
28aaa36a97SAlex Deucher 
29aaa36a97SAlex Deucher /* Fan control algorithm:*/
30aaa36a97SAlex Deucher #define FDO_MODE_HARDWARE 0
31aaa36a97SAlex Deucher #define FDO_MODE_PIECE_WISE_LINEAR 1
32aaa36a97SAlex Deucher 
33aaa36a97SAlex Deucher enum FAN_CONTROL {
34aaa36a97SAlex Deucher     FAN_CONTROL_FUZZY,
35aaa36a97SAlex Deucher     FAN_CONTROL_TABLE
36aaa36a97SAlex Deucher };
37aaa36a97SAlex Deucher 
38aaa36a97SAlex Deucher enum DPM_ARRAY {
39aaa36a97SAlex Deucher     DPM_ARRAY_HARD_MAX,
40aaa36a97SAlex Deucher     DPM_ARRAY_HARD_MIN,
41aaa36a97SAlex Deucher     DPM_ARRAY_SOFT_MAX,
42aaa36a97SAlex Deucher     DPM_ARRAY_SOFT_MIN
43aaa36a97SAlex Deucher };
44aaa36a97SAlex Deucher 
45aaa36a97SAlex Deucher /*
46aaa36a97SAlex Deucher  * Return codes for driver to SMC communication.
47aaa36a97SAlex Deucher  * Leave these #define-s, enums might not be exactly 8-bits on the microcontroller.
48aaa36a97SAlex Deucher  */
49aaa36a97SAlex Deucher #define PPSMC_Result_OK             ((uint16_t)0x01)
50aaa36a97SAlex Deucher #define PPSMC_Result_NoMore         ((uint16_t)0x02)
51aaa36a97SAlex Deucher #define PPSMC_Result_NotNow         ((uint16_t)0x03)
52aaa36a97SAlex Deucher #define PPSMC_Result_Failed         ((uint16_t)0xFF)
53aaa36a97SAlex Deucher #define PPSMC_Result_UnknownCmd     ((uint16_t)0xFE)
54aaa36a97SAlex Deucher #define PPSMC_Result_UnknownVT      ((uint16_t)0xFD)
55aaa36a97SAlex Deucher 
56aaa36a97SAlex Deucher #define PPSMC_isERROR(x)            ((uint16_t)0x80 & (x))
57aaa36a97SAlex Deucher 
58aaa36a97SAlex Deucher /*
59aaa36a97SAlex Deucher  * Supported driver messages
60aaa36a97SAlex Deucher  */
61aaa36a97SAlex Deucher #define PPSMC_MSG_Test                        ((uint16_t) 0x1)
62aaa36a97SAlex Deucher #define PPSMC_MSG_GetFeatureStatus            ((uint16_t) 0x2)
63aaa36a97SAlex Deucher #define PPSMC_MSG_EnableAllSmuFeatures        ((uint16_t) 0x3)
64aaa36a97SAlex Deucher #define PPSMC_MSG_DisableAllSmuFeatures       ((uint16_t) 0x4)
65aaa36a97SAlex Deucher #define PPSMC_MSG_OptimizeBattery             ((uint16_t) 0x5)
66aaa36a97SAlex Deucher #define PPSMC_MSG_MaximizePerf                ((uint16_t) 0x6)
67aaa36a97SAlex Deucher #define PPSMC_MSG_UVDPowerOFF                 ((uint16_t) 0x7)
68aaa36a97SAlex Deucher #define PPSMC_MSG_UVDPowerON                  ((uint16_t) 0x8)
69aaa36a97SAlex Deucher #define PPSMC_MSG_VCEPowerOFF                 ((uint16_t) 0x9)
70aaa36a97SAlex Deucher #define PPSMC_MSG_VCEPowerON                  ((uint16_t) 0xA)
71aaa36a97SAlex Deucher #define PPSMC_MSG_ACPPowerOFF                 ((uint16_t) 0xB)
72aaa36a97SAlex Deucher #define PPSMC_MSG_ACPPowerON                  ((uint16_t) 0xC)
73aaa36a97SAlex Deucher #define PPSMC_MSG_SDMAPowerOFF                ((uint16_t) 0xD)
74aaa36a97SAlex Deucher #define PPSMC_MSG_SDMAPowerON                 ((uint16_t) 0xE)
75aaa36a97SAlex Deucher #define PPSMC_MSG_XDMAPowerOFF                ((uint16_t) 0xF)
76aaa36a97SAlex Deucher #define PPSMC_MSG_XDMAPowerON                 ((uint16_t) 0x10)
77aaa36a97SAlex Deucher #define PPSMC_MSG_SetMinDeepSleepSclk         ((uint16_t) 0x11)
78aaa36a97SAlex Deucher #define PPSMC_MSG_SetSclkSoftMin              ((uint16_t) 0x12)
79aaa36a97SAlex Deucher #define PPSMC_MSG_SetSclkSoftMax              ((uint16_t) 0x13)
80aaa36a97SAlex Deucher #define PPSMC_MSG_SetSclkHardMin              ((uint16_t) 0x14)
81aaa36a97SAlex Deucher #define PPSMC_MSG_SetSclkHardMax              ((uint16_t) 0x15)
82aaa36a97SAlex Deucher #define PPSMC_MSG_SetLclkSoftMin              ((uint16_t) 0x16)
83aaa36a97SAlex Deucher #define PPSMC_MSG_SetLclkSoftMax              ((uint16_t) 0x17)
84aaa36a97SAlex Deucher #define PPSMC_MSG_SetLclkHardMin              ((uint16_t) 0x18)
85aaa36a97SAlex Deucher #define PPSMC_MSG_SetLclkHardMax              ((uint16_t) 0x19)
86aaa36a97SAlex Deucher #define PPSMC_MSG_SetUvdSoftMin               ((uint16_t) 0x1A)
87aaa36a97SAlex Deucher #define PPSMC_MSG_SetUvdSoftMax               ((uint16_t) 0x1B)
88aaa36a97SAlex Deucher #define PPSMC_MSG_SetUvdHardMin               ((uint16_t) 0x1C)
89aaa36a97SAlex Deucher #define PPSMC_MSG_SetUvdHardMax               ((uint16_t) 0x1D)
90aaa36a97SAlex Deucher #define PPSMC_MSG_SetEclkSoftMin              ((uint16_t) 0x1E)
91aaa36a97SAlex Deucher #define PPSMC_MSG_SetEclkSoftMax              ((uint16_t) 0x1F)
92aaa36a97SAlex Deucher #define PPSMC_MSG_SetEclkHardMin              ((uint16_t) 0x20)
93aaa36a97SAlex Deucher #define PPSMC_MSG_SetEclkHardMax              ((uint16_t) 0x21)
94aaa36a97SAlex Deucher #define PPSMC_MSG_SetAclkSoftMin              ((uint16_t) 0x22)
95aaa36a97SAlex Deucher #define PPSMC_MSG_SetAclkSoftMax              ((uint16_t) 0x23)
96aaa36a97SAlex Deucher #define PPSMC_MSG_SetAclkHardMin              ((uint16_t) 0x24)
97aaa36a97SAlex Deucher #define PPSMC_MSG_SetAclkHardMax              ((uint16_t) 0x25)
98aaa36a97SAlex Deucher #define PPSMC_MSG_SetNclkSoftMin              ((uint16_t) 0x26)
99aaa36a97SAlex Deucher #define PPSMC_MSG_SetNclkSoftMax              ((uint16_t) 0x27)
100aaa36a97SAlex Deucher #define PPSMC_MSG_SetNclkHardMin              ((uint16_t) 0x28)
101aaa36a97SAlex Deucher #define PPSMC_MSG_SetNclkHardMax              ((uint16_t) 0x29)
102aaa36a97SAlex Deucher #define PPSMC_MSG_SetPstateSoftMin            ((uint16_t) 0x2A)
103aaa36a97SAlex Deucher #define PPSMC_MSG_SetPstateSoftMax            ((uint16_t) 0x2B)
104aaa36a97SAlex Deucher #define PPSMC_MSG_SetPstateHardMin            ((uint16_t) 0x2C)
105aaa36a97SAlex Deucher #define PPSMC_MSG_SetPstateHardMax            ((uint16_t) 0x2D)
106aaa36a97SAlex Deucher #define PPSMC_MSG_DisableLowMemoryPstate      ((uint16_t) 0x2E)
107aaa36a97SAlex Deucher #define PPSMC_MSG_EnableLowMemoryPstate       ((uint16_t) 0x2F)
108aaa36a97SAlex Deucher #define PPSMC_MSG_UcodeAddressLow             ((uint16_t) 0x30)
109aaa36a97SAlex Deucher #define PPSMC_MSG_UcodeAddressHigh            ((uint16_t) 0x31)
110aaa36a97SAlex Deucher #define PPSMC_MSG_UcodeLoadStatus             ((uint16_t) 0x32)
111aaa36a97SAlex Deucher #define PPSMC_MSG_DriverDramAddrHi            ((uint16_t) 0x33)
112aaa36a97SAlex Deucher #define PPSMC_MSG_DriverDramAddrLo            ((uint16_t) 0x34)
113aaa36a97SAlex Deucher #define PPSMC_MSG_CondExecDramAddrHi          ((uint16_t) 0x35)
114aaa36a97SAlex Deucher #define PPSMC_MSG_CondExecDramAddrLo          ((uint16_t) 0x36)
115aaa36a97SAlex Deucher #define PPSMC_MSG_LoadUcodes                  ((uint16_t) 0x37)
116aaa36a97SAlex Deucher #define PPSMC_MSG_DriverResetMode             ((uint16_t) 0x38)
117aaa36a97SAlex Deucher #define PPSMC_MSG_PowerStateNotify            ((uint16_t) 0x39)
118aaa36a97SAlex Deucher #define PPSMC_MSG_SetDisplayPhyConfig         ((uint16_t) 0x3A)
119aaa36a97SAlex Deucher #define PPSMC_MSG_GetMaxSclkLevel             ((uint16_t) 0x3B)
120aaa36a97SAlex Deucher #define PPSMC_MSG_GetMaxLclkLevel             ((uint16_t) 0x3C)
121aaa36a97SAlex Deucher #define PPSMC_MSG_GetMaxUvdLevel              ((uint16_t) 0x3D)
122aaa36a97SAlex Deucher #define PPSMC_MSG_GetMaxEclkLevel             ((uint16_t) 0x3E)
123aaa36a97SAlex Deucher #define PPSMC_MSG_GetMaxAclkLevel             ((uint16_t) 0x3F)
124aaa36a97SAlex Deucher #define PPSMC_MSG_GetMaxNclkLevel             ((uint16_t) 0x40)
125aaa36a97SAlex Deucher #define PPSMC_MSG_GetMaxPstate                ((uint16_t) 0x41)
126aaa36a97SAlex Deucher #define PPSMC_MSG_DramAddrHiVirtual           ((uint16_t) 0x42)
127aaa36a97SAlex Deucher #define PPSMC_MSG_DramAddrLoVirtual           ((uint16_t) 0x43)
128aaa36a97SAlex Deucher #define PPSMC_MSG_DramAddrHiPhysical          ((uint16_t) 0x44)
129aaa36a97SAlex Deucher #define PPSMC_MSG_DramAddrLoPhysical          ((uint16_t) 0x45)
130aaa36a97SAlex Deucher #define PPSMC_MSG_DramBufferSize              ((uint16_t) 0x46)
131aaa36a97SAlex Deucher #define PPSMC_MSG_SetMmPwrLogDramAddrHi       ((uint16_t) 0x47)
132aaa36a97SAlex Deucher #define PPSMC_MSG_SetMmPwrLogDramAddrLo       ((uint16_t) 0x48)
133aaa36a97SAlex Deucher #define PPSMC_MSG_SetClkTableAddrHi           ((uint16_t) 0x49)
134aaa36a97SAlex Deucher #define PPSMC_MSG_SetClkTableAddrLo           ((uint16_t) 0x4A)
135aaa36a97SAlex Deucher #define PPSMC_MSG_GetConservativePowerLimit   ((uint16_t) 0x4B)
136aaa36a97SAlex Deucher 
137aaa36a97SAlex Deucher #define PPSMC_MSG_InitJobs                    ((uint16_t) 0x252)
138aaa36a97SAlex Deucher #define PPSMC_MSG_ExecuteJob                  ((uint16_t) 0x254)
139aaa36a97SAlex Deucher 
140aaa36a97SAlex Deucher #define PPSMC_MSG_NBDPM_Enable                ((uint16_t) 0x140)
141aaa36a97SAlex Deucher #define PPSMC_MSG_NBDPM_Disable               ((uint16_t) 0x141)
142aaa36a97SAlex Deucher 
143aaa36a97SAlex Deucher #define PPSMC_MSG_DPM_FPS_Mode                ((uint16_t) 0x15d)
144aaa36a97SAlex Deucher #define PPSMC_MSG_DPM_Activity_Mode           ((uint16_t) 0x15e)
145aaa36a97SAlex Deucher 
146aaa36a97SAlex Deucher #define PPSMC_MSG_PmStatusLogStart            ((uint16_t) 0x170)
147aaa36a97SAlex Deucher #define PPSMC_MSG_PmStatusLogSample           ((uint16_t) 0x171)
148aaa36a97SAlex Deucher 
149aaa36a97SAlex Deucher #define PPSMC_MSG_AllowLowSclkInterrupt       ((uint16_t) 0x184)
150aaa36a97SAlex Deucher #define PPSMC_MSG_MmPowerMonitorStart         ((uint16_t) 0x18F)
151aaa36a97SAlex Deucher #define PPSMC_MSG_MmPowerMonitorStop          ((uint16_t) 0x190)
152aaa36a97SAlex Deucher #define PPSMC_MSG_MmPowerMonitorRestart       ((uint16_t) 0x191)
153aaa36a97SAlex Deucher 
154aaa36a97SAlex Deucher #define PPSMC_MSG_SetClockGateMask            ((uint16_t) 0x260)
155aaa36a97SAlex Deucher #define PPSMC_MSG_SetFpsThresholdLo           ((uint16_t) 0x264)
156aaa36a97SAlex Deucher #define PPSMC_MSG_SetFpsThresholdHi           ((uint16_t) 0x265)
157aaa36a97SAlex Deucher #define PPSMC_MSG_SetLowSclkIntrThreshold     ((uint16_t) 0x266)
158aaa36a97SAlex Deucher 
159aaa36a97SAlex Deucher #define PPSMC_MSG_ClkTableXferToDram          ((uint16_t) 0x267)
160aaa36a97SAlex Deucher #define PPSMC_MSG_ClkTableXferToSmu           ((uint16_t) 0x268)
161aaa36a97SAlex Deucher #define PPSMC_MSG_GetAverageGraphicsActivity  ((uint16_t) 0x269)
162aaa36a97SAlex Deucher #define PPSMC_MSG_GetAverageGioActivity       ((uint16_t) 0x26A)
163aaa36a97SAlex Deucher #define PPSMC_MSG_SetLoggerBufferSize         ((uint16_t) 0x26B)
164aaa36a97SAlex Deucher #define PPSMC_MSG_SetLoggerAddressHigh        ((uint16_t) 0x26C)
165aaa36a97SAlex Deucher #define PPSMC_MSG_SetLoggerAddressLow         ((uint16_t) 0x26D)
166aaa36a97SAlex Deucher #define PPSMC_MSG_SetWatermarkFrequency       ((uint16_t) 0x26E)
167*aceae1bfSRex Zhu #define PPSMC_MSG_SetDisplaySizePowerParams   ((uint16_t) 0x26F)
168aaa36a97SAlex Deucher 
169aaa36a97SAlex Deucher /* REMOVE LATER*/
170aaa36a97SAlex Deucher #define PPSMC_MSG_DPM_ForceState              ((uint16_t) 0x104)
171aaa36a97SAlex Deucher 
172aaa36a97SAlex Deucher /* Feature Enable Masks*/
173aaa36a97SAlex Deucher #define NB_DPM_MASK             0x00000800
174aaa36a97SAlex Deucher #define VDDGFX_MASK             0x00800000
175aaa36a97SAlex Deucher #define VCE_DPM_MASK            0x00400000
176aaa36a97SAlex Deucher #define ACP_DPM_MASK            0x00040000
177aaa36a97SAlex Deucher #define UVD_DPM_MASK            0x00010000
178aaa36a97SAlex Deucher #define GFX_CU_PG_MASK          0x00004000
179aaa36a97SAlex Deucher #define SCLK_DPM_MASK           0x00080000
180aaa36a97SAlex Deucher 
181aaa36a97SAlex Deucher #if !defined(SMC_MICROCODE)
182aaa36a97SAlex Deucher #pragma pack(pop)
183aaa36a97SAlex Deucher 
184aaa36a97SAlex Deucher #endif
185aaa36a97SAlex Deucher 
186aaa36a97SAlex Deucher #endif
187