ppatomfwctrl.h 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. /*
  2. * Copyright 2016 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 PP_ATOMFWCTRL_H
  24. #define PP_ATOMFWCTRL_H
  25. #include "hwmgr.h"
  26. typedef enum atom_smu9_syspll0_clock_id BIOS_CLKID;
  27. #define GetIndexIntoMasterCmdTable(FieldName) \
  28. (((char*)(&((struct atom_master_list_of_command_functions_v2_1*)0)->FieldName)-(char*)0)/sizeof(uint16_t))
  29. #define GetIndexIntoMasterDataTable(FieldName) \
  30. (((char*)(&((struct atom_master_list_of_data_tables_v2_1*)0)->FieldName)-(char*)0)/sizeof(uint16_t))
  31. #define PP_ATOMFWCTRL_MAX_VOLTAGE_ENTRIES 32
  32. struct pp_atomfwctrl_voltage_table_entry {
  33. uint16_t value;
  34. uint32_t smio_low;
  35. };
  36. struct pp_atomfwctrl_voltage_table {
  37. uint32_t count;
  38. uint32_t mask_low;
  39. uint32_t phase_delay;
  40. uint8_t psi0_enable;
  41. uint8_t psi1_enable;
  42. uint8_t max_vid_step;
  43. uint8_t telemetry_offset;
  44. uint8_t telemetry_slope;
  45. struct pp_atomfwctrl_voltage_table_entry entries[PP_ATOMFWCTRL_MAX_VOLTAGE_ENTRIES];
  46. };
  47. struct pp_atomfwctrl_gpio_pin_assignment {
  48. uint16_t us_gpio_pin_aindex;
  49. uint8_t uc_gpio_pin_bit_shift;
  50. };
  51. struct pp_atomfwctrl_clock_dividers_soc15 {
  52. uint32_t ulClock; /* the actual clock */
  53. uint32_t ulDid; /* DFS divider */
  54. uint32_t ulPll_fb_mult; /* Feedback Multiplier: bit 8:0 int, bit 15:12 post_div, bit 31:16 frac */
  55. uint32_t ulPll_ss_fbsmult; /* Spread FB Multiplier: bit 8:0 int, bit 31:16 frac */
  56. uint16_t usPll_ss_slew_frac;
  57. uint8_t ucPll_ss_enable;
  58. uint8_t ucReserve;
  59. uint32_t ulReserve[2];
  60. };
  61. struct pp_atomfwctrl_avfs_parameters {
  62. uint32_t ulMaxVddc;
  63. uint32_t ulMinVddc;
  64. uint32_t ulMeanNsigmaAcontant0;
  65. uint32_t ulMeanNsigmaAcontant1;
  66. uint32_t ulMeanNsigmaAcontant2;
  67. uint16_t usMeanNsigmaDcTolSigma;
  68. uint16_t usMeanNsigmaPlatformMean;
  69. uint16_t usMeanNsigmaPlatformSigma;
  70. uint32_t ulGbVdroopTableCksoffA0;
  71. uint32_t ulGbVdroopTableCksoffA1;
  72. uint32_t ulGbVdroopTableCksoffA2;
  73. uint32_t ulGbVdroopTableCksonA0;
  74. uint32_t ulGbVdroopTableCksonA1;
  75. uint32_t ulGbVdroopTableCksonA2;
  76. uint32_t ulGbFuseTableCksoffM1;
  77. uint32_t ulGbFuseTableCksoffM2;
  78. uint32_t ulGbFuseTableCksoffB;
  79. uint32_t ulGbFuseTableCksonM1;
  80. uint32_t ulGbFuseTableCksonM2;
  81. uint32_t ulGbFuseTableCksonB;
  82. uint8_t ucEnableGbVdroopTableCkson;
  83. uint8_t ucEnableGbFuseTableCkson;
  84. uint16_t usPsmAgeComfactor;
  85. uint32_t ulDispclk2GfxclkM1;
  86. uint32_t ulDispclk2GfxclkM2;
  87. uint32_t ulDispclk2GfxclkB;
  88. uint32_t ulDcefclk2GfxclkM1;
  89. uint32_t ulDcefclk2GfxclkM2;
  90. uint32_t ulDcefclk2GfxclkB;
  91. uint32_t ulPixelclk2GfxclkM1;
  92. uint32_t ulPixelclk2GfxclkM2;
  93. uint32_t ulPixelclk2GfxclkB;
  94. uint32_t ulPhyclk2GfxclkM1;
  95. uint32_t ulPhyclk2GfxclkM2;
  96. uint32_t ulPhyclk2GfxclkB;
  97. uint32_t ulAcgGbVdroopTableA0;
  98. uint32_t ulAcgGbVdroopTableA1;
  99. uint32_t ulAcgGbVdroopTableA2;
  100. uint32_t ulAcgGbFuseTableM1;
  101. uint32_t ulAcgGbFuseTableM2;
  102. uint32_t ulAcgGbFuseTableB;
  103. uint32_t ucAcgEnableGbVdroopTable;
  104. uint32_t ucAcgEnableGbFuseTable;
  105. };
  106. struct pp_atomfwctrl_gpio_parameters {
  107. uint8_t ucAcDcGpio;
  108. uint8_t ucAcDcPolarity;
  109. uint8_t ucVR0HotGpio;
  110. uint8_t ucVR0HotPolarity;
  111. uint8_t ucVR1HotGpio;
  112. uint8_t ucVR1HotPolarity;
  113. uint8_t ucFwCtfGpio;
  114. uint8_t ucFwCtfPolarity;
  115. };
  116. struct pp_atomfwctrl_bios_boot_up_values {
  117. uint32_t ulRevision;
  118. uint32_t ulGfxClk;
  119. uint32_t ulUClk;
  120. uint32_t ulSocClk;
  121. uint32_t ulDCEFClk;
  122. uint32_t ulEClk;
  123. uint32_t ulVClk;
  124. uint32_t ulDClk;
  125. uint16_t usVddc;
  126. uint16_t usVddci;
  127. uint16_t usMvddc;
  128. uint16_t usVddGfx;
  129. uint8_t ucCoolingID;
  130. };
  131. struct pp_atomfwctrl_smc_dpm_parameters
  132. {
  133. uint8_t liquid1_i2c_address;
  134. uint8_t liquid2_i2c_address;
  135. uint8_t vr_i2c_address;
  136. uint8_t plx_i2c_address;
  137. uint8_t liquid_i2c_linescl;
  138. uint8_t liquid_i2c_linesda;
  139. uint8_t vr_i2c_linescl;
  140. uint8_t vr_i2c_linesda;
  141. uint8_t plx_i2c_linescl;
  142. uint8_t plx_i2c_linesda;
  143. uint8_t vrsensorpresent;
  144. uint8_t liquidsensorpresent;
  145. uint16_t maxvoltagestepgfx;
  146. uint16_t maxvoltagestepsoc;
  147. uint8_t vddgfxvrmapping;
  148. uint8_t vddsocvrmapping;
  149. uint8_t vddmem0vrmapping;
  150. uint8_t vddmem1vrmapping;
  151. uint8_t gfxulvphasesheddingmask;
  152. uint8_t soculvphasesheddingmask;
  153. uint16_t gfxmaxcurrent;
  154. uint8_t gfxoffset;
  155. uint8_t padding_telemetrygfx;
  156. uint16_t socmaxcurrent;
  157. uint8_t socoffset;
  158. uint8_t padding_telemetrysoc;
  159. uint16_t mem0maxcurrent;
  160. uint8_t mem0offset;
  161. uint8_t padding_telemetrymem0;
  162. uint16_t mem1maxcurrent;
  163. uint8_t mem1offset;
  164. uint8_t padding_telemetrymem1;
  165. uint8_t acdcgpio;
  166. uint8_t acdcpolarity;
  167. uint8_t vr0hotgpio;
  168. uint8_t vr0hotpolarity;
  169. uint8_t vr1hotgpio;
  170. uint8_t vr1hotpolarity;
  171. uint8_t padding1;
  172. uint8_t padding2;
  173. uint8_t ledpin0;
  174. uint8_t ledpin1;
  175. uint8_t ledpin2;
  176. uint8_t pllgfxclkspreadenabled;
  177. uint8_t pllgfxclkspreadpercent;
  178. uint16_t pllgfxclkspreadfreq;
  179. uint8_t uclkspreadenabled;
  180. uint8_t uclkspreadpercent;
  181. uint16_t uclkspreadfreq;
  182. uint8_t socclkspreadenabled;
  183. uint8_t socclkspreadpercent;
  184. uint16_t socclkspreadfreq;
  185. uint8_t acggfxclkspreadenabled;
  186. uint8_t acggfxclkspreadpercent;
  187. uint16_t acggfxclkspreadfreq;
  188. uint8_t Vr2_I2C_address;
  189. };
  190. int pp_atomfwctrl_get_gpu_pll_dividers_vega10(struct pp_hwmgr *hwmgr,
  191. uint32_t clock_type, uint32_t clock_value,
  192. struct pp_atomfwctrl_clock_dividers_soc15 *dividers);
  193. int pp_atomfwctrl_enter_self_refresh(struct pp_hwmgr *hwmgr);
  194. bool pp_atomfwctrl_get_pp_assign_pin(struct pp_hwmgr *hwmgr, const uint32_t pin_id,
  195. struct pp_atomfwctrl_gpio_pin_assignment *gpio_pin_assignment);
  196. int pp_atomfwctrl_get_voltage_table_v4(struct pp_hwmgr *hwmgr, uint8_t voltage_type,
  197. uint8_t voltage_mode, struct pp_atomfwctrl_voltage_table *voltage_table);
  198. bool pp_atomfwctrl_is_voltage_controlled_by_gpio_v4(struct pp_hwmgr *hwmgr,
  199. uint8_t voltage_type, uint8_t voltage_mode);
  200. int pp_atomfwctrl_get_avfs_information(struct pp_hwmgr *hwmgr,
  201. struct pp_atomfwctrl_avfs_parameters *param);
  202. int pp_atomfwctrl_get_gpio_information(struct pp_hwmgr *hwmgr,
  203. struct pp_atomfwctrl_gpio_parameters *param);
  204. int pp_atomfwctrl_get_vbios_bootup_values(struct pp_hwmgr *hwmgr,
  205. struct pp_atomfwctrl_bios_boot_up_values *boot_values);
  206. int pp_atomfwctrl_get_smc_dpm_information(struct pp_hwmgr *hwmgr,
  207. struct pp_atomfwctrl_smc_dpm_parameters *param);
  208. int pp_atomfwctrl_get_clk_information_by_clkid(struct pp_hwmgr *hwmgr,
  209. BIOS_CLKID id, uint32_t *frequency);
  210. #endif