18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * Copyright 2013 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 SMU7_H 258c2ecf20Sopenharmony_ci#define SMU7_H 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci#pragma pack(push, 1) 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci#define SMU7_CONTEXT_ID_SMC 1 308c2ecf20Sopenharmony_ci#define SMU7_CONTEXT_ID_VBIOS 2 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ci#define SMU7_CONTEXT_ID_SMC 1 348c2ecf20Sopenharmony_ci#define SMU7_CONTEXT_ID_VBIOS 2 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ci#define SMU7_MAX_LEVELS_VDDC 8 378c2ecf20Sopenharmony_ci#define SMU7_MAX_LEVELS_VDDCI 4 388c2ecf20Sopenharmony_ci#define SMU7_MAX_LEVELS_MVDD 4 398c2ecf20Sopenharmony_ci#define SMU7_MAX_LEVELS_VDDNB 8 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ci#define SMU7_MAX_LEVELS_GRAPHICS SMU__NUM_SCLK_DPM_STATE // SCLK + SQ DPM + ULV 428c2ecf20Sopenharmony_ci#define SMU7_MAX_LEVELS_MEMORY SMU__NUM_MCLK_DPM_LEVELS // MCLK Levels DPM 438c2ecf20Sopenharmony_ci#define SMU7_MAX_LEVELS_GIO SMU__NUM_LCLK_DPM_LEVELS // LCLK Levels 448c2ecf20Sopenharmony_ci#define SMU7_MAX_LEVELS_LINK SMU__NUM_PCIE_DPM_LEVELS // PCIe speed and number of lanes. 458c2ecf20Sopenharmony_ci#define SMU7_MAX_LEVELS_UVD 8 // VCLK/DCLK levels for UVD. 468c2ecf20Sopenharmony_ci#define SMU7_MAX_LEVELS_VCE 8 // ECLK levels for VCE. 478c2ecf20Sopenharmony_ci#define SMU7_MAX_LEVELS_ACP 8 // ACLK levels for ACP. 488c2ecf20Sopenharmony_ci#define SMU7_MAX_LEVELS_SAMU 8 // SAMCLK levels for SAMU. 498c2ecf20Sopenharmony_ci#define SMU7_MAX_ENTRIES_SMIO 32 // Number of entries in SMIO table. 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_ci#define DPM_NO_LIMIT 0 528c2ecf20Sopenharmony_ci#define DPM_NO_UP 1 538c2ecf20Sopenharmony_ci#define DPM_GO_DOWN 2 548c2ecf20Sopenharmony_ci#define DPM_GO_UP 3 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ci#define SMU7_FIRST_DPM_GRAPHICS_LEVEL 0 578c2ecf20Sopenharmony_ci#define SMU7_FIRST_DPM_MEMORY_LEVEL 0 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_ci#define GPIO_CLAMP_MODE_VRHOT 1 608c2ecf20Sopenharmony_ci#define GPIO_CLAMP_MODE_THERM 2 618c2ecf20Sopenharmony_ci#define GPIO_CLAMP_MODE_DC 4 628c2ecf20Sopenharmony_ci 638c2ecf20Sopenharmony_ci#define SCRATCH_B_TARG_PCIE_INDEX_SHIFT 0 648c2ecf20Sopenharmony_ci#define SCRATCH_B_TARG_PCIE_INDEX_MASK (0x7<<SCRATCH_B_TARG_PCIE_INDEX_SHIFT) 658c2ecf20Sopenharmony_ci#define SCRATCH_B_CURR_PCIE_INDEX_SHIFT 3 668c2ecf20Sopenharmony_ci#define SCRATCH_B_CURR_PCIE_INDEX_MASK (0x7<<SCRATCH_B_CURR_PCIE_INDEX_SHIFT) 678c2ecf20Sopenharmony_ci#define SCRATCH_B_TARG_UVD_INDEX_SHIFT 6 688c2ecf20Sopenharmony_ci#define SCRATCH_B_TARG_UVD_INDEX_MASK (0x7<<SCRATCH_B_TARG_UVD_INDEX_SHIFT) 698c2ecf20Sopenharmony_ci#define SCRATCH_B_CURR_UVD_INDEX_SHIFT 9 708c2ecf20Sopenharmony_ci#define SCRATCH_B_CURR_UVD_INDEX_MASK (0x7<<SCRATCH_B_CURR_UVD_INDEX_SHIFT) 718c2ecf20Sopenharmony_ci#define SCRATCH_B_TARG_VCE_INDEX_SHIFT 12 728c2ecf20Sopenharmony_ci#define SCRATCH_B_TARG_VCE_INDEX_MASK (0x7<<SCRATCH_B_TARG_VCE_INDEX_SHIFT) 738c2ecf20Sopenharmony_ci#define SCRATCH_B_CURR_VCE_INDEX_SHIFT 15 748c2ecf20Sopenharmony_ci#define SCRATCH_B_CURR_VCE_INDEX_MASK (0x7<<SCRATCH_B_CURR_VCE_INDEX_SHIFT) 758c2ecf20Sopenharmony_ci#define SCRATCH_B_TARG_ACP_INDEX_SHIFT 18 768c2ecf20Sopenharmony_ci#define SCRATCH_B_TARG_ACP_INDEX_MASK (0x7<<SCRATCH_B_TARG_ACP_INDEX_SHIFT) 778c2ecf20Sopenharmony_ci#define SCRATCH_B_CURR_ACP_INDEX_SHIFT 21 788c2ecf20Sopenharmony_ci#define SCRATCH_B_CURR_ACP_INDEX_MASK (0x7<<SCRATCH_B_CURR_ACP_INDEX_SHIFT) 798c2ecf20Sopenharmony_ci#define SCRATCH_B_TARG_SAMU_INDEX_SHIFT 24 808c2ecf20Sopenharmony_ci#define SCRATCH_B_TARG_SAMU_INDEX_MASK (0x7<<SCRATCH_B_TARG_SAMU_INDEX_SHIFT) 818c2ecf20Sopenharmony_ci#define SCRATCH_B_CURR_SAMU_INDEX_SHIFT 27 828c2ecf20Sopenharmony_ci#define SCRATCH_B_CURR_SAMU_INDEX_MASK (0x7<<SCRATCH_B_CURR_SAMU_INDEX_SHIFT) 838c2ecf20Sopenharmony_ci 848c2ecf20Sopenharmony_ci 858c2ecf20Sopenharmony_cistruct SMU7_PIDController 868c2ecf20Sopenharmony_ci{ 878c2ecf20Sopenharmony_ci uint32_t Ki; 888c2ecf20Sopenharmony_ci int32_t LFWindupUL; 898c2ecf20Sopenharmony_ci int32_t LFWindupLL; 908c2ecf20Sopenharmony_ci uint32_t StatePrecision; 918c2ecf20Sopenharmony_ci uint32_t LfPrecision; 928c2ecf20Sopenharmony_ci uint32_t LfOffset; 938c2ecf20Sopenharmony_ci uint32_t MaxState; 948c2ecf20Sopenharmony_ci uint32_t MaxLfFraction; 958c2ecf20Sopenharmony_ci uint32_t StateShift; 968c2ecf20Sopenharmony_ci}; 978c2ecf20Sopenharmony_ci 988c2ecf20Sopenharmony_citypedef struct SMU7_PIDController SMU7_PIDController; 998c2ecf20Sopenharmony_ci 1008c2ecf20Sopenharmony_ci// ------------------------------------------------------------------------------------------------------------------------- 1018c2ecf20Sopenharmony_ci#define SMU7_MAX_PCIE_LINK_SPEEDS 3 /* 0:Gen1 1:Gen2 2:Gen3 */ 1028c2ecf20Sopenharmony_ci 1038c2ecf20Sopenharmony_ci#define SMU7_SCLK_DPM_CONFIG_MASK 0x01 1048c2ecf20Sopenharmony_ci#define SMU7_VOLTAGE_CONTROLLER_CONFIG_MASK 0x02 1058c2ecf20Sopenharmony_ci#define SMU7_THERMAL_CONTROLLER_CONFIG_MASK 0x04 1068c2ecf20Sopenharmony_ci#define SMU7_MCLK_DPM_CONFIG_MASK 0x08 1078c2ecf20Sopenharmony_ci#define SMU7_UVD_DPM_CONFIG_MASK 0x10 1088c2ecf20Sopenharmony_ci#define SMU7_VCE_DPM_CONFIG_MASK 0x20 1098c2ecf20Sopenharmony_ci#define SMU7_ACP_DPM_CONFIG_MASK 0x40 1108c2ecf20Sopenharmony_ci#define SMU7_SAMU_DPM_CONFIG_MASK 0x80 1118c2ecf20Sopenharmony_ci#define SMU7_PCIEGEN_DPM_CONFIG_MASK 0x100 1128c2ecf20Sopenharmony_ci 1138c2ecf20Sopenharmony_ci#define SMU7_ACP_MCLK_HANDSHAKE_DISABLE 0x00000001 1148c2ecf20Sopenharmony_ci#define SMU7_ACP_SCLK_HANDSHAKE_DISABLE 0x00000002 1158c2ecf20Sopenharmony_ci#define SMU7_UVD_MCLK_HANDSHAKE_DISABLE 0x00000100 1168c2ecf20Sopenharmony_ci#define SMU7_UVD_SCLK_HANDSHAKE_DISABLE 0x00000200 1178c2ecf20Sopenharmony_ci#define SMU7_VCE_MCLK_HANDSHAKE_DISABLE 0x00010000 1188c2ecf20Sopenharmony_ci#define SMU7_VCE_SCLK_HANDSHAKE_DISABLE 0x00020000 1198c2ecf20Sopenharmony_ci 1208c2ecf20Sopenharmony_cistruct SMU7_Firmware_Header 1218c2ecf20Sopenharmony_ci{ 1228c2ecf20Sopenharmony_ci uint32_t Digest[5]; 1238c2ecf20Sopenharmony_ci uint32_t Version; 1248c2ecf20Sopenharmony_ci uint32_t HeaderSize; 1258c2ecf20Sopenharmony_ci uint32_t Flags; 1268c2ecf20Sopenharmony_ci uint32_t EntryPoint; 1278c2ecf20Sopenharmony_ci uint32_t CodeSize; 1288c2ecf20Sopenharmony_ci uint32_t ImageSize; 1298c2ecf20Sopenharmony_ci 1308c2ecf20Sopenharmony_ci uint32_t Rtos; 1318c2ecf20Sopenharmony_ci uint32_t SoftRegisters; 1328c2ecf20Sopenharmony_ci uint32_t DpmTable; 1338c2ecf20Sopenharmony_ci uint32_t FanTable; 1348c2ecf20Sopenharmony_ci uint32_t CacConfigTable; 1358c2ecf20Sopenharmony_ci uint32_t CacStatusTable; 1368c2ecf20Sopenharmony_ci 1378c2ecf20Sopenharmony_ci uint32_t mcRegisterTable; 1388c2ecf20Sopenharmony_ci 1398c2ecf20Sopenharmony_ci uint32_t mcArbDramTimingTable; 1408c2ecf20Sopenharmony_ci 1418c2ecf20Sopenharmony_ci uint32_t PmFuseTable; 1428c2ecf20Sopenharmony_ci uint32_t Globals; 1438c2ecf20Sopenharmony_ci uint32_t Reserved[42]; 1448c2ecf20Sopenharmony_ci uint32_t Signature; 1458c2ecf20Sopenharmony_ci}; 1468c2ecf20Sopenharmony_ci 1478c2ecf20Sopenharmony_citypedef struct SMU7_Firmware_Header SMU7_Firmware_Header; 1488c2ecf20Sopenharmony_ci 1498c2ecf20Sopenharmony_ci#define SMU7_FIRMWARE_HEADER_LOCATION 0x20000 1508c2ecf20Sopenharmony_ci 1518c2ecf20Sopenharmony_cienum DisplayConfig { 1528c2ecf20Sopenharmony_ci PowerDown = 1, 1538c2ecf20Sopenharmony_ci DP54x4, 1548c2ecf20Sopenharmony_ci DP54x2, 1558c2ecf20Sopenharmony_ci DP54x1, 1568c2ecf20Sopenharmony_ci DP27x4, 1578c2ecf20Sopenharmony_ci DP27x2, 1588c2ecf20Sopenharmony_ci DP27x1, 1598c2ecf20Sopenharmony_ci HDMI297, 1608c2ecf20Sopenharmony_ci HDMI162, 1618c2ecf20Sopenharmony_ci LVDS, 1628c2ecf20Sopenharmony_ci DP324x4, 1638c2ecf20Sopenharmony_ci DP324x2, 1648c2ecf20Sopenharmony_ci DP324x1 1658c2ecf20Sopenharmony_ci}; 1668c2ecf20Sopenharmony_ci 1678c2ecf20Sopenharmony_ci#pragma pack(pop) 1688c2ecf20Sopenharmony_ci 1698c2ecf20Sopenharmony_ci#endif 1708c2ecf20Sopenharmony_ci 171