1*4882a593Smuzhiyun /* 2*4882a593Smuzhiyun * Copyright 2013 Advanced Micro Devices, Inc. 3*4882a593Smuzhiyun * 4*4882a593Smuzhiyun * Permission is hereby granted, free of charge, to any person obtaining a 5*4882a593Smuzhiyun * copy of this software and associated documentation files (the "Software"), 6*4882a593Smuzhiyun * to deal in the Software without restriction, including without limitation 7*4882a593Smuzhiyun * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8*4882a593Smuzhiyun * and/or sell copies of the Software, and to permit persons to whom the 9*4882a593Smuzhiyun * Software is furnished to do so, subject to the following conditions: 10*4882a593Smuzhiyun * 11*4882a593Smuzhiyun * The above copyright notice and this permission notice shall be included in 12*4882a593Smuzhiyun * all copies or substantial portions of the Software. 13*4882a593Smuzhiyun * 14*4882a593Smuzhiyun * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15*4882a593Smuzhiyun * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16*4882a593Smuzhiyun * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17*4882a593Smuzhiyun * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18*4882a593Smuzhiyun * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19*4882a593Smuzhiyun * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20*4882a593Smuzhiyun * OTHER DEALINGS IN THE SOFTWARE. 21*4882a593Smuzhiyun * 22*4882a593Smuzhiyun */ 23*4882a593Smuzhiyun 24*4882a593Smuzhiyun #ifndef SMU7_H 25*4882a593Smuzhiyun #define SMU7_H 26*4882a593Smuzhiyun 27*4882a593Smuzhiyun #pragma pack(push, 1) 28*4882a593Smuzhiyun 29*4882a593Smuzhiyun #define SMU7_CONTEXT_ID_SMC 1 30*4882a593Smuzhiyun #define SMU7_CONTEXT_ID_VBIOS 2 31*4882a593Smuzhiyun 32*4882a593Smuzhiyun 33*4882a593Smuzhiyun #define SMU7_CONTEXT_ID_SMC 1 34*4882a593Smuzhiyun #define SMU7_CONTEXT_ID_VBIOS 2 35*4882a593Smuzhiyun 36*4882a593Smuzhiyun #define SMU7_MAX_LEVELS_VDDC 8 37*4882a593Smuzhiyun #define SMU7_MAX_LEVELS_VDDCI 4 38*4882a593Smuzhiyun #define SMU7_MAX_LEVELS_MVDD 4 39*4882a593Smuzhiyun #define SMU7_MAX_LEVELS_VDDNB 8 40*4882a593Smuzhiyun 41*4882a593Smuzhiyun #define SMU7_MAX_LEVELS_GRAPHICS SMU__NUM_SCLK_DPM_STATE // SCLK + SQ DPM + ULV 42*4882a593Smuzhiyun #define SMU7_MAX_LEVELS_MEMORY SMU__NUM_MCLK_DPM_LEVELS // MCLK Levels DPM 43*4882a593Smuzhiyun #define SMU7_MAX_LEVELS_GIO SMU__NUM_LCLK_DPM_LEVELS // LCLK Levels 44*4882a593Smuzhiyun #define SMU7_MAX_LEVELS_LINK SMU__NUM_PCIE_DPM_LEVELS // PCIe speed and number of lanes. 45*4882a593Smuzhiyun #define SMU7_MAX_LEVELS_UVD 8 // VCLK/DCLK levels for UVD. 46*4882a593Smuzhiyun #define SMU7_MAX_LEVELS_VCE 8 // ECLK levels for VCE. 47*4882a593Smuzhiyun #define SMU7_MAX_LEVELS_ACP 8 // ACLK levels for ACP. 48*4882a593Smuzhiyun #define SMU7_MAX_LEVELS_SAMU 8 // SAMCLK levels for SAMU. 49*4882a593Smuzhiyun #define SMU7_MAX_ENTRIES_SMIO 32 // Number of entries in SMIO table. 50*4882a593Smuzhiyun 51*4882a593Smuzhiyun #define DPM_NO_LIMIT 0 52*4882a593Smuzhiyun #define DPM_NO_UP 1 53*4882a593Smuzhiyun #define DPM_GO_DOWN 2 54*4882a593Smuzhiyun #define DPM_GO_UP 3 55*4882a593Smuzhiyun 56*4882a593Smuzhiyun #define SMU7_FIRST_DPM_GRAPHICS_LEVEL 0 57*4882a593Smuzhiyun #define SMU7_FIRST_DPM_MEMORY_LEVEL 0 58*4882a593Smuzhiyun 59*4882a593Smuzhiyun #define GPIO_CLAMP_MODE_VRHOT 1 60*4882a593Smuzhiyun #define GPIO_CLAMP_MODE_THERM 2 61*4882a593Smuzhiyun #define GPIO_CLAMP_MODE_DC 4 62*4882a593Smuzhiyun 63*4882a593Smuzhiyun #define SCRATCH_B_TARG_PCIE_INDEX_SHIFT 0 64*4882a593Smuzhiyun #define SCRATCH_B_TARG_PCIE_INDEX_MASK (0x7<<SCRATCH_B_TARG_PCIE_INDEX_SHIFT) 65*4882a593Smuzhiyun #define SCRATCH_B_CURR_PCIE_INDEX_SHIFT 3 66*4882a593Smuzhiyun #define SCRATCH_B_CURR_PCIE_INDEX_MASK (0x7<<SCRATCH_B_CURR_PCIE_INDEX_SHIFT) 67*4882a593Smuzhiyun #define SCRATCH_B_TARG_UVD_INDEX_SHIFT 6 68*4882a593Smuzhiyun #define SCRATCH_B_TARG_UVD_INDEX_MASK (0x7<<SCRATCH_B_TARG_UVD_INDEX_SHIFT) 69*4882a593Smuzhiyun #define SCRATCH_B_CURR_UVD_INDEX_SHIFT 9 70*4882a593Smuzhiyun #define SCRATCH_B_CURR_UVD_INDEX_MASK (0x7<<SCRATCH_B_CURR_UVD_INDEX_SHIFT) 71*4882a593Smuzhiyun #define SCRATCH_B_TARG_VCE_INDEX_SHIFT 12 72*4882a593Smuzhiyun #define SCRATCH_B_TARG_VCE_INDEX_MASK (0x7<<SCRATCH_B_TARG_VCE_INDEX_SHIFT) 73*4882a593Smuzhiyun #define SCRATCH_B_CURR_VCE_INDEX_SHIFT 15 74*4882a593Smuzhiyun #define SCRATCH_B_CURR_VCE_INDEX_MASK (0x7<<SCRATCH_B_CURR_VCE_INDEX_SHIFT) 75*4882a593Smuzhiyun #define SCRATCH_B_TARG_ACP_INDEX_SHIFT 18 76*4882a593Smuzhiyun #define SCRATCH_B_TARG_ACP_INDEX_MASK (0x7<<SCRATCH_B_TARG_ACP_INDEX_SHIFT) 77*4882a593Smuzhiyun #define SCRATCH_B_CURR_ACP_INDEX_SHIFT 21 78*4882a593Smuzhiyun #define SCRATCH_B_CURR_ACP_INDEX_MASK (0x7<<SCRATCH_B_CURR_ACP_INDEX_SHIFT) 79*4882a593Smuzhiyun #define SCRATCH_B_TARG_SAMU_INDEX_SHIFT 24 80*4882a593Smuzhiyun #define SCRATCH_B_TARG_SAMU_INDEX_MASK (0x7<<SCRATCH_B_TARG_SAMU_INDEX_SHIFT) 81*4882a593Smuzhiyun #define SCRATCH_B_CURR_SAMU_INDEX_SHIFT 27 82*4882a593Smuzhiyun #define SCRATCH_B_CURR_SAMU_INDEX_MASK (0x7<<SCRATCH_B_CURR_SAMU_INDEX_SHIFT) 83*4882a593Smuzhiyun 84*4882a593Smuzhiyun 85*4882a593Smuzhiyun struct SMU7_PIDController 86*4882a593Smuzhiyun { 87*4882a593Smuzhiyun uint32_t Ki; 88*4882a593Smuzhiyun int32_t LFWindupUL; 89*4882a593Smuzhiyun int32_t LFWindupLL; 90*4882a593Smuzhiyun uint32_t StatePrecision; 91*4882a593Smuzhiyun uint32_t LfPrecision; 92*4882a593Smuzhiyun uint32_t LfOffset; 93*4882a593Smuzhiyun uint32_t MaxState; 94*4882a593Smuzhiyun uint32_t MaxLfFraction; 95*4882a593Smuzhiyun uint32_t StateShift; 96*4882a593Smuzhiyun }; 97*4882a593Smuzhiyun 98*4882a593Smuzhiyun typedef struct SMU7_PIDController SMU7_PIDController; 99*4882a593Smuzhiyun 100*4882a593Smuzhiyun // ------------------------------------------------------------------------------------------------------------------------- 101*4882a593Smuzhiyun #define SMU7_MAX_PCIE_LINK_SPEEDS 3 /* 0:Gen1 1:Gen2 2:Gen3 */ 102*4882a593Smuzhiyun 103*4882a593Smuzhiyun #define SMU7_SCLK_DPM_CONFIG_MASK 0x01 104*4882a593Smuzhiyun #define SMU7_VOLTAGE_CONTROLLER_CONFIG_MASK 0x02 105*4882a593Smuzhiyun #define SMU7_THERMAL_CONTROLLER_CONFIG_MASK 0x04 106*4882a593Smuzhiyun #define SMU7_MCLK_DPM_CONFIG_MASK 0x08 107*4882a593Smuzhiyun #define SMU7_UVD_DPM_CONFIG_MASK 0x10 108*4882a593Smuzhiyun #define SMU7_VCE_DPM_CONFIG_MASK 0x20 109*4882a593Smuzhiyun #define SMU7_ACP_DPM_CONFIG_MASK 0x40 110*4882a593Smuzhiyun #define SMU7_SAMU_DPM_CONFIG_MASK 0x80 111*4882a593Smuzhiyun #define SMU7_PCIEGEN_DPM_CONFIG_MASK 0x100 112*4882a593Smuzhiyun 113*4882a593Smuzhiyun #define SMU7_ACP_MCLK_HANDSHAKE_DISABLE 0x00000001 114*4882a593Smuzhiyun #define SMU7_ACP_SCLK_HANDSHAKE_DISABLE 0x00000002 115*4882a593Smuzhiyun #define SMU7_UVD_MCLK_HANDSHAKE_DISABLE 0x00000100 116*4882a593Smuzhiyun #define SMU7_UVD_SCLK_HANDSHAKE_DISABLE 0x00000200 117*4882a593Smuzhiyun #define SMU7_VCE_MCLK_HANDSHAKE_DISABLE 0x00010000 118*4882a593Smuzhiyun #define SMU7_VCE_SCLK_HANDSHAKE_DISABLE 0x00020000 119*4882a593Smuzhiyun 120*4882a593Smuzhiyun struct SMU7_Firmware_Header 121*4882a593Smuzhiyun { 122*4882a593Smuzhiyun uint32_t Digest[5]; 123*4882a593Smuzhiyun uint32_t Version; 124*4882a593Smuzhiyun uint32_t HeaderSize; 125*4882a593Smuzhiyun uint32_t Flags; 126*4882a593Smuzhiyun uint32_t EntryPoint; 127*4882a593Smuzhiyun uint32_t CodeSize; 128*4882a593Smuzhiyun uint32_t ImageSize; 129*4882a593Smuzhiyun 130*4882a593Smuzhiyun uint32_t Rtos; 131*4882a593Smuzhiyun uint32_t SoftRegisters; 132*4882a593Smuzhiyun uint32_t DpmTable; 133*4882a593Smuzhiyun uint32_t FanTable; 134*4882a593Smuzhiyun uint32_t CacConfigTable; 135*4882a593Smuzhiyun uint32_t CacStatusTable; 136*4882a593Smuzhiyun 137*4882a593Smuzhiyun uint32_t mcRegisterTable; 138*4882a593Smuzhiyun 139*4882a593Smuzhiyun uint32_t mcArbDramTimingTable; 140*4882a593Smuzhiyun 141*4882a593Smuzhiyun uint32_t PmFuseTable; 142*4882a593Smuzhiyun uint32_t Globals; 143*4882a593Smuzhiyun uint32_t Reserved[42]; 144*4882a593Smuzhiyun uint32_t Signature; 145*4882a593Smuzhiyun }; 146*4882a593Smuzhiyun 147*4882a593Smuzhiyun typedef struct SMU7_Firmware_Header SMU7_Firmware_Header; 148*4882a593Smuzhiyun 149*4882a593Smuzhiyun #define SMU7_FIRMWARE_HEADER_LOCATION 0x20000 150*4882a593Smuzhiyun 151*4882a593Smuzhiyun enum DisplayConfig { 152*4882a593Smuzhiyun PowerDown = 1, 153*4882a593Smuzhiyun DP54x4, 154*4882a593Smuzhiyun DP54x2, 155*4882a593Smuzhiyun DP54x1, 156*4882a593Smuzhiyun DP27x4, 157*4882a593Smuzhiyun DP27x2, 158*4882a593Smuzhiyun DP27x1, 159*4882a593Smuzhiyun HDMI297, 160*4882a593Smuzhiyun HDMI162, 161*4882a593Smuzhiyun LVDS, 162*4882a593Smuzhiyun DP324x4, 163*4882a593Smuzhiyun DP324x2, 164*4882a593Smuzhiyun DP324x1 165*4882a593Smuzhiyun }; 166*4882a593Smuzhiyun 167*4882a593Smuzhiyun #pragma pack(pop) 168*4882a593Smuzhiyun 169*4882a593Smuzhiyun #endif 170*4882a593Smuzhiyun 171