18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * Copyright 2017 Advanced Micro Devices, Inc.
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
58c2ecf20Sopenharmony_ci * copy of this software and associated documentation files (the "Software"),
68c2ecf20Sopenharmony_ci * to deal in the Software without restriction, including without limitation
78c2ecf20Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense,
88c2ecf20Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the
98c2ecf20Sopenharmony_ci * Software is furnished to do so, subject to the following conditions:
108c2ecf20Sopenharmony_ci *
118c2ecf20Sopenharmony_ci * The above copyright notice and this permission notice shall be included in
128c2ecf20Sopenharmony_ci * all copies or substantial portions of the Software.
138c2ecf20Sopenharmony_ci *
148c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
158c2ecf20Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
168c2ecf20Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
178c2ecf20Sopenharmony_ci * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
188c2ecf20Sopenharmony_ci * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
198c2ecf20Sopenharmony_ci * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
208c2ecf20Sopenharmony_ci * OTHER DEALINGS IN THE SOFTWARE.
218c2ecf20Sopenharmony_ci *
228c2ecf20Sopenharmony_ci */
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci#ifndef SMU10_H
258c2ecf20Sopenharmony_ci#define SMU10_H
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci#pragma pack(push, 1)
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci#define ENABLE_DEBUG_FEATURES
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci/* Feature Control Defines */
328c2ecf20Sopenharmony_ci#define FEATURE_CCLK_CONTROLLER_BIT   0
338c2ecf20Sopenharmony_ci#define FEATURE_FAN_CONTROLLER_BIT    1
348c2ecf20Sopenharmony_ci#define FEATURE_DATA_CALCULATION_BIT  2
358c2ecf20Sopenharmony_ci#define FEATURE_PPT_BIT               3
368c2ecf20Sopenharmony_ci#define FEATURE_TDC_BIT               4
378c2ecf20Sopenharmony_ci#define FEATURE_THERMAL_BIT           5
388c2ecf20Sopenharmony_ci#define FEATURE_FIT_BIT               6
398c2ecf20Sopenharmony_ci#define FEATURE_EDC_BIT               7
408c2ecf20Sopenharmony_ci#define FEATURE_PLL_POWER_DOWN_BIT    8
418c2ecf20Sopenharmony_ci#define FEATURE_ULV_BIT               9
428c2ecf20Sopenharmony_ci#define FEATURE_VDDOFF_BIT            10
438c2ecf20Sopenharmony_ci#define FEATURE_VCN_DPM_BIT           11
448c2ecf20Sopenharmony_ci#define FEATURE_ACP_DPM_BIT           12
458c2ecf20Sopenharmony_ci#define FEATURE_ISP_DPM_BIT           13
468c2ecf20Sopenharmony_ci#define FEATURE_FCLK_DPM_BIT          14
478c2ecf20Sopenharmony_ci#define FEATURE_SOCCLK_DPM_BIT        15
488c2ecf20Sopenharmony_ci#define FEATURE_MP0CLK_DPM_BIT        16
498c2ecf20Sopenharmony_ci#define FEATURE_LCLK_DPM_BIT          17
508c2ecf20Sopenharmony_ci#define FEATURE_SHUBCLK_DPM_BIT       18
518c2ecf20Sopenharmony_ci#define FEATURE_DCEFCLK_DPM_BIT       19
528c2ecf20Sopenharmony_ci#define FEATURE_GFX_DPM_BIT           20
538c2ecf20Sopenharmony_ci#define FEATURE_DS_GFXCLK_BIT         21
548c2ecf20Sopenharmony_ci#define FEATURE_DS_SOCCLK_BIT         22
558c2ecf20Sopenharmony_ci#define FEATURE_DS_LCLK_BIT           23
568c2ecf20Sopenharmony_ci#define FEATURE_DS_DCEFCLK_BIT        24
578c2ecf20Sopenharmony_ci#define FEATURE_DS_SHUBCLK_BIT        25
588c2ecf20Sopenharmony_ci#define FEATURE_RM_BIT                26
598c2ecf20Sopenharmony_ci#define FEATURE_S0i2_BIT              27
608c2ecf20Sopenharmony_ci#define FEATURE_WHISPER_MODE_BIT      28
618c2ecf20Sopenharmony_ci#define FEATURE_DS_FCLK_BIT           29
628c2ecf20Sopenharmony_ci#define FEATURE_DS_SMNCLK_BIT         30
638c2ecf20Sopenharmony_ci#define FEATURE_DS_MP1CLK_BIT         31
648c2ecf20Sopenharmony_ci#define FEATURE_DS_MP0CLK_BIT         32
658c2ecf20Sopenharmony_ci#define FEATURE_MGCG_BIT              33
668c2ecf20Sopenharmony_ci#define FEATURE_DS_FUSE_SRAM_BIT      34
678c2ecf20Sopenharmony_ci#define FEATURE_GFX_CKS               35
688c2ecf20Sopenharmony_ci#define FEATURE_PSI0_BIT              36
698c2ecf20Sopenharmony_ci#define FEATURE_PROCHOT_BIT           37
708c2ecf20Sopenharmony_ci#define FEATURE_CPUOFF_BIT            38
718c2ecf20Sopenharmony_ci#define FEATURE_STAPM_BIT             39
728c2ecf20Sopenharmony_ci#define FEATURE_CORE_CSTATES_BIT      40
738c2ecf20Sopenharmony_ci#define FEATURE_SPARE_41_BIT          41
748c2ecf20Sopenharmony_ci#define FEATURE_SPARE_42_BIT          42
758c2ecf20Sopenharmony_ci#define FEATURE_SPARE_43_BIT          43
768c2ecf20Sopenharmony_ci#define FEATURE_SPARE_44_BIT          44
778c2ecf20Sopenharmony_ci#define FEATURE_SPARE_45_BIT          45
788c2ecf20Sopenharmony_ci#define FEATURE_SPARE_46_BIT          46
798c2ecf20Sopenharmony_ci#define FEATURE_SPARE_47_BIT          47
808c2ecf20Sopenharmony_ci#define FEATURE_SPARE_48_BIT          48
818c2ecf20Sopenharmony_ci#define FEATURE_SPARE_49_BIT          49
828c2ecf20Sopenharmony_ci#define FEATURE_SPARE_50_BIT          50
838c2ecf20Sopenharmony_ci#define FEATURE_SPARE_51_BIT          51
848c2ecf20Sopenharmony_ci#define FEATURE_SPARE_52_BIT          52
858c2ecf20Sopenharmony_ci#define FEATURE_SPARE_53_BIT          53
868c2ecf20Sopenharmony_ci#define FEATURE_SPARE_54_BIT          54
878c2ecf20Sopenharmony_ci#define FEATURE_SPARE_55_BIT          55
888c2ecf20Sopenharmony_ci#define FEATURE_SPARE_56_BIT          56
898c2ecf20Sopenharmony_ci#define FEATURE_SPARE_57_BIT          57
908c2ecf20Sopenharmony_ci#define FEATURE_SPARE_58_BIT          58
918c2ecf20Sopenharmony_ci#define FEATURE_SPARE_59_BIT          59
928c2ecf20Sopenharmony_ci#define FEATURE_SPARE_60_BIT          60
938c2ecf20Sopenharmony_ci#define FEATURE_SPARE_61_BIT          61
948c2ecf20Sopenharmony_ci#define FEATURE_SPARE_62_BIT          62
958c2ecf20Sopenharmony_ci#define FEATURE_SPARE_63_BIT          63
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_ci#define NUM_FEATURES                  64
988c2ecf20Sopenharmony_ci
998c2ecf20Sopenharmony_ci#define FEATURE_CCLK_CONTROLLER_MASK  (1 << FEATURE_CCLK_CONTROLLER_BIT)
1008c2ecf20Sopenharmony_ci#define FEATURE_FAN_CONTROLLER_MASK   (1 << FEATURE_FAN_CONTROLLER_BIT)
1018c2ecf20Sopenharmony_ci#define FEATURE_DATA_CALCULATION_MASK (1 << FEATURE_DATA_CALCULATION_BIT)
1028c2ecf20Sopenharmony_ci#define FEATURE_PPT_MASK              (1 << FEATURE_PPT_BIT)
1038c2ecf20Sopenharmony_ci#define FEATURE_TDC_MASK              (1 << FEATURE_TDC_BIT)
1048c2ecf20Sopenharmony_ci#define FEATURE_THERMAL_MASK          (1 << FEATURE_THERMAL_BIT)
1058c2ecf20Sopenharmony_ci#define FEATURE_FIT_MASK              (1 << FEATURE_FIT_BIT)
1068c2ecf20Sopenharmony_ci#define FEATURE_EDC_MASK              (1 << FEATURE_EDC_BIT)
1078c2ecf20Sopenharmony_ci#define FEATURE_PLL_POWER_DOWN_MASK   (1 << FEATURE_PLL_POWER_DOWN_BIT)
1088c2ecf20Sopenharmony_ci#define FEATURE_ULV_MASK              (1 << FEATURE_ULV_BIT)
1098c2ecf20Sopenharmony_ci#define FEATURE_VDDOFF_MASK           (1 << FEATURE_VDDOFF_BIT)
1108c2ecf20Sopenharmony_ci#define FEATURE_VCN_DPM_MASK          (1 << FEATURE_VCN_DPM_BIT)
1118c2ecf20Sopenharmony_ci#define FEATURE_ACP_DPM_MASK          (1 << FEATURE_ACP_DPM_BIT)
1128c2ecf20Sopenharmony_ci#define FEATURE_ISP_DPM_MASK          (1 << FEATURE_ISP_DPM_BIT)
1138c2ecf20Sopenharmony_ci#define FEATURE_FCLK_DPM_MASK         (1 << FEATURE_FCLK_DPM_BIT)
1148c2ecf20Sopenharmony_ci#define FEATURE_SOCCLK_DPM_MASK       (1 << FEATURE_SOCCLK_DPM_BIT)
1158c2ecf20Sopenharmony_ci#define FEATURE_MP0CLK_DPM_MASK       (1 << FEATURE_MP0CLK_DPM_BIT)
1168c2ecf20Sopenharmony_ci#define FEATURE_LCLK_DPM_MASK         (1 << FEATURE_LCLK_DPM_BIT)
1178c2ecf20Sopenharmony_ci#define FEATURE_SHUBCLK_DPM_MASK      (1 << FEATURE_SHUBCLK_DPM_BIT)
1188c2ecf20Sopenharmony_ci#define FEATURE_DCEFCLK_DPM_MASK      (1 << FEATURE_DCEFCLK_DPM_BIT)
1198c2ecf20Sopenharmony_ci#define FEATURE_GFX_DPM_MASK          (1 << FEATURE_GFX_DPM_BIT)
1208c2ecf20Sopenharmony_ci#define FEATURE_DS_GFXCLK_MASK        (1 << FEATURE_DS_GFXCLK_BIT)
1218c2ecf20Sopenharmony_ci#define FEATURE_DS_SOCCLK_MASK        (1 << FEATURE_DS_SOCCLK_BIT)
1228c2ecf20Sopenharmony_ci#define FEATURE_DS_LCLK_MASK          (1 << FEATURE_DS_LCLK_BIT)
1238c2ecf20Sopenharmony_ci#define FEATURE_DS_DCEFCLK_MASK       (1 << FEATURE_DS_DCEFCLK_BIT)
1248c2ecf20Sopenharmony_ci#define FEATURE_DS_SHUBCLK_MASK       (1 << FEATURE_DS_SHUBCLK_BIT)
1258c2ecf20Sopenharmony_ci#define FEATURE_RM_MASK               (1 << FEATURE_RM_BIT)
1268c2ecf20Sopenharmony_ci#define FEATURE_DS_FCLK_MASK          (1 << FEATURE_DS_FCLK_BIT)
1278c2ecf20Sopenharmony_ci#define FEATURE_DS_SMNCLK_MASK        (1 << FEATURE_DS_SMNCLK_BIT)
1288c2ecf20Sopenharmony_ci#define FEATURE_DS_MP1CLK_MASK        (1 << FEATURE_DS_MP1CLK_BIT)
1298c2ecf20Sopenharmony_ci#define FEATURE_DS_MP0CLK_MASK        (1 << FEATURE_DS_MP0CLK_BIT)
1308c2ecf20Sopenharmony_ci#define FEATURE_MGCG_MASK             (1 << FEATURE_MGCG_BIT)
1318c2ecf20Sopenharmony_ci#define FEATURE_DS_FUSE_SRAM_MASK     (1 << FEATURE_DS_FUSE_SRAM_BIT)
1328c2ecf20Sopenharmony_ci#define FEATURE_PSI0_MASK             (1 << FEATURE_PSI0_BIT)
1338c2ecf20Sopenharmony_ci#define FEATURE_STAPM_MASK            (1 << FEATURE_STAPM_BIT)
1348c2ecf20Sopenharmony_ci#define FEATURE_PROCHOT_MASK          (1 << FEATURE_PROCHOT_BIT)
1358c2ecf20Sopenharmony_ci#define FEATURE_CPUOFF_MASK           (1 << FEATURE_CPUOFF_BIT)
1368c2ecf20Sopenharmony_ci#define FEATURE_CORE_CSTATES_MASK     (1 << FEATURE_CORE_CSTATES_BIT)
1378c2ecf20Sopenharmony_ci
1388c2ecf20Sopenharmony_ci/* Workload bits */
1398c2ecf20Sopenharmony_ci#define WORKLOAD_PPLIB_FULL_SCREEN_3D_BIT 0
1408c2ecf20Sopenharmony_ci#define WORKLOAD_PPLIB_VIDEO_BIT          2
1418c2ecf20Sopenharmony_ci#define WORKLOAD_PPLIB_VR_BIT             3
1428c2ecf20Sopenharmony_ci#define WORKLOAD_PPLIB_COMPUTE_BIT        4
1438c2ecf20Sopenharmony_ci#define WORKLOAD_PPLIB_CUSTOM_BIT         5
1448c2ecf20Sopenharmony_ci#define WORKLOAD_PPLIB_COUNT              6
1458c2ecf20Sopenharmony_ci
1468c2ecf20Sopenharmony_citypedef struct {
1478c2ecf20Sopenharmony_ci	/* MP1_EXT_SCRATCH0 */
1488c2ecf20Sopenharmony_ci	uint32_t CurrLevel_ACP     : 4;
1498c2ecf20Sopenharmony_ci	uint32_t CurrLevel_ISP     : 4;
1508c2ecf20Sopenharmony_ci	uint32_t CurrLevel_VCN     : 4;
1518c2ecf20Sopenharmony_ci	uint32_t CurrLevel_LCLK    : 4;
1528c2ecf20Sopenharmony_ci	uint32_t CurrLevel_MP0CLK  : 4;
1538c2ecf20Sopenharmony_ci	uint32_t CurrLevel_FCLK    : 4;
1548c2ecf20Sopenharmony_ci	uint32_t CurrLevel_SOCCLK  : 4;
1558c2ecf20Sopenharmony_ci	uint32_t CurrLevel_DCEFCLK : 4;
1568c2ecf20Sopenharmony_ci	/* MP1_EXT_SCRATCH1 */
1578c2ecf20Sopenharmony_ci	uint32_t TargLevel_ACP     : 4;
1588c2ecf20Sopenharmony_ci	uint32_t TargLevel_ISP     : 4;
1598c2ecf20Sopenharmony_ci	uint32_t TargLevel_VCN     : 4;
1608c2ecf20Sopenharmony_ci	uint32_t TargLevel_LCLK    : 4;
1618c2ecf20Sopenharmony_ci	uint32_t TargLevel_MP0CLK  : 4;
1628c2ecf20Sopenharmony_ci	uint32_t TargLevel_FCLK    : 4;
1638c2ecf20Sopenharmony_ci	uint32_t TargLevel_SOCCLK  : 4;
1648c2ecf20Sopenharmony_ci	uint32_t TargLevel_DCEFCLK : 4;
1658c2ecf20Sopenharmony_ci	/* MP1_EXT_SCRATCH2 */
1668c2ecf20Sopenharmony_ci	uint32_t CurrLevel_SHUBCLK  : 4;
1678c2ecf20Sopenharmony_ci	uint32_t TargLevel_SHUBCLK  : 4;
1688c2ecf20Sopenharmony_ci	uint32_t InUlv              : 1;
1698c2ecf20Sopenharmony_ci	uint32_t InS0i2             : 1;
1708c2ecf20Sopenharmony_ci	uint32_t InWhisperMode      : 1;
1718c2ecf20Sopenharmony_ci	uint32_t Reserved           : 21;
1728c2ecf20Sopenharmony_ci	/* MP1_EXT_SCRATCH3-4 */
1738c2ecf20Sopenharmony_ci	uint32_t Reserved2[2];
1748c2ecf20Sopenharmony_ci	/* MP1_EXT_SCRATCH5 */
1758c2ecf20Sopenharmony_ci	uint32_t FeatureStatus[NUM_FEATURES / 32];
1768c2ecf20Sopenharmony_ci} FwStatus_t;
1778c2ecf20Sopenharmony_ci
1788c2ecf20Sopenharmony_ci#define TABLE_BIOS_IF            0 /* Called by BIOS */
1798c2ecf20Sopenharmony_ci#define TABLE_WATERMARKS         1 /* Called by Driver */
1808c2ecf20Sopenharmony_ci#define TABLE_CUSTOM_DPM         2 /* Called by Driver */
1818c2ecf20Sopenharmony_ci#define TABLE_PMSTATUSLOG        3 /* Called by Tools for Agm logging */
1828c2ecf20Sopenharmony_ci#define TABLE_DPMCLOCKS          4 /* Called by Driver */
1838c2ecf20Sopenharmony_ci#define TABLE_MOMENTARY_PM       5 /* Called by Tools */
1848c2ecf20Sopenharmony_ci#define TABLE_COUNT              6
1858c2ecf20Sopenharmony_ci
1868c2ecf20Sopenharmony_ci#pragma pack(pop)
1878c2ecf20Sopenharmony_ci
1888c2ecf20Sopenharmony_ci#endif
189