smu7.h 5.9 KB

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