psp_v3_1.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520
  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. * Author: Huang Rui
  23. *
  24. */
  25. #include <linux/firmware.h>
  26. #include <drm/drmP.h>
  27. #include "amdgpu.h"
  28. #include "amdgpu_psp.h"
  29. #include "amdgpu_ucode.h"
  30. #include "soc15_common.h"
  31. #include "psp_v3_1.h"
  32. #include "vega10/soc15ip.h"
  33. #include "vega10/MP/mp_9_0_offset.h"
  34. #include "vega10/MP/mp_9_0_sh_mask.h"
  35. #include "vega10/GC/gc_9_0_offset.h"
  36. #include "vega10/SDMA0/sdma0_4_0_offset.h"
  37. #include "vega10/NBIO/nbio_6_1_offset.h"
  38. MODULE_FIRMWARE("amdgpu/vega10_sos.bin");
  39. MODULE_FIRMWARE("amdgpu/vega10_asd.bin");
  40. #define smnMP1_FIRMWARE_FLAGS 0x3010028
  41. static int
  42. psp_v3_1_get_fw_type(struct amdgpu_firmware_info *ucode, enum psp_gfx_fw_type *type)
  43. {
  44. switch(ucode->ucode_id) {
  45. case AMDGPU_UCODE_ID_SDMA0:
  46. *type = GFX_FW_TYPE_SDMA0;
  47. break;
  48. case AMDGPU_UCODE_ID_SDMA1:
  49. *type = GFX_FW_TYPE_SDMA1;
  50. break;
  51. case AMDGPU_UCODE_ID_CP_CE:
  52. *type = GFX_FW_TYPE_CP_CE;
  53. break;
  54. case AMDGPU_UCODE_ID_CP_PFP:
  55. *type = GFX_FW_TYPE_CP_PFP;
  56. break;
  57. case AMDGPU_UCODE_ID_CP_ME:
  58. *type = GFX_FW_TYPE_CP_ME;
  59. break;
  60. case AMDGPU_UCODE_ID_CP_MEC1:
  61. *type = GFX_FW_TYPE_CP_MEC;
  62. break;
  63. case AMDGPU_UCODE_ID_CP_MEC1_JT:
  64. *type = GFX_FW_TYPE_CP_MEC_ME1;
  65. break;
  66. case AMDGPU_UCODE_ID_CP_MEC2:
  67. *type = GFX_FW_TYPE_CP_MEC;
  68. break;
  69. case AMDGPU_UCODE_ID_CP_MEC2_JT:
  70. *type = GFX_FW_TYPE_CP_MEC_ME2;
  71. break;
  72. case AMDGPU_UCODE_ID_RLC_G:
  73. *type = GFX_FW_TYPE_RLC_G;
  74. break;
  75. case AMDGPU_UCODE_ID_SMC:
  76. *type = GFX_FW_TYPE_SMU;
  77. break;
  78. case AMDGPU_UCODE_ID_UVD:
  79. *type = GFX_FW_TYPE_UVD;
  80. break;
  81. case AMDGPU_UCODE_ID_VCE:
  82. *type = GFX_FW_TYPE_VCE;
  83. break;
  84. case AMDGPU_UCODE_ID_MAXIMUM:
  85. default:
  86. return -EINVAL;
  87. }
  88. return 0;
  89. }
  90. int psp_v3_1_init_microcode(struct psp_context *psp)
  91. {
  92. struct amdgpu_device *adev = psp->adev;
  93. const char *chip_name;
  94. char fw_name[30];
  95. int err = 0;
  96. const struct psp_firmware_header_v1_0 *hdr;
  97. DRM_DEBUG("\n");
  98. switch (adev->asic_type) {
  99. case CHIP_VEGA10:
  100. chip_name = "vega10";
  101. break;
  102. default: BUG();
  103. }
  104. snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_sos.bin", chip_name);
  105. err = request_firmware(&adev->psp.sos_fw, fw_name, adev->dev);
  106. if (err)
  107. goto out;
  108. err = amdgpu_ucode_validate(adev->psp.sos_fw);
  109. if (err)
  110. goto out;
  111. hdr = (const struct psp_firmware_header_v1_0 *)adev->psp.sos_fw->data;
  112. adev->psp.sos_fw_version = le32_to_cpu(hdr->header.ucode_version);
  113. adev->psp.sos_feature_version = le32_to_cpu(hdr->ucode_feature_version);
  114. adev->psp.sos_bin_size = le32_to_cpu(hdr->sos_size_bytes);
  115. adev->psp.sys_bin_size = le32_to_cpu(hdr->header.ucode_size_bytes) -
  116. le32_to_cpu(hdr->sos_size_bytes);
  117. adev->psp.sys_start_addr = (uint8_t *)hdr +
  118. le32_to_cpu(hdr->header.ucode_array_offset_bytes);
  119. adev->psp.sos_start_addr = (uint8_t *)adev->psp.sys_start_addr +
  120. le32_to_cpu(hdr->sos_offset_bytes);
  121. snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_asd.bin", chip_name);
  122. err = request_firmware(&adev->psp.asd_fw, fw_name, adev->dev);
  123. if (err)
  124. goto out;
  125. err = amdgpu_ucode_validate(adev->psp.asd_fw);
  126. if (err)
  127. goto out;
  128. hdr = (const struct psp_firmware_header_v1_0 *)adev->psp.asd_fw->data;
  129. adev->psp.asd_fw_version = le32_to_cpu(hdr->header.ucode_version);
  130. adev->psp.asd_feature_version = le32_to_cpu(hdr->ucode_feature_version);
  131. adev->psp.asd_ucode_size = le32_to_cpu(hdr->header.ucode_size_bytes);
  132. adev->psp.asd_start_addr = (uint8_t *)hdr +
  133. le32_to_cpu(hdr->header.ucode_array_offset_bytes);
  134. return 0;
  135. out:
  136. if (err) {
  137. dev_err(adev->dev,
  138. "psp v3.1: Failed to load firmware \"%s\"\n",
  139. fw_name);
  140. release_firmware(adev->psp.sos_fw);
  141. adev->psp.sos_fw = NULL;
  142. release_firmware(adev->psp.asd_fw);
  143. adev->psp.asd_fw = NULL;
  144. }
  145. return err;
  146. }
  147. int psp_v3_1_bootloader_load_sysdrv(struct psp_context *psp)
  148. {
  149. int ret;
  150. uint32_t psp_gfxdrv_command_reg = 0;
  151. struct amdgpu_device *adev = psp->adev;
  152. uint32_t sol_reg;
  153. /* Check sOS sign of life register to confirm sys driver and sOS
  154. * are already been loaded.
  155. */
  156. sol_reg = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_81);
  157. if (sol_reg)
  158. return 0;
  159. /* Wait for bootloader to signify that is ready having bit 31 of C2PMSG_35 set to 1 */
  160. ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_35),
  161. 0x80000000, 0x80000000, false);
  162. if (ret)
  163. return ret;
  164. memset(psp->fw_pri_buf, 0, PSP_1_MEG);
  165. /* Copy PSP System Driver binary to memory */
  166. memcpy(psp->fw_pri_buf, psp->sys_start_addr, psp->sys_bin_size);
  167. /* Provide the sys driver to bootrom */
  168. WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_36,
  169. (uint32_t)(psp->fw_pri_mc_addr >> 20));
  170. psp_gfxdrv_command_reg = 1 << 16;
  171. WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_35,
  172. psp_gfxdrv_command_reg);
  173. /* there might be handshake issue with hardware which needs delay */
  174. mdelay(20);
  175. ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_35),
  176. 0x80000000, 0x80000000, false);
  177. return ret;
  178. }
  179. int psp_v3_1_bootloader_load_sos(struct psp_context *psp)
  180. {
  181. int ret;
  182. unsigned int psp_gfxdrv_command_reg = 0;
  183. struct amdgpu_device *adev = psp->adev;
  184. uint32_t sol_reg;
  185. /* Check sOS sign of life register to confirm sys driver and sOS
  186. * are already been loaded.
  187. */
  188. sol_reg = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_81);
  189. if (sol_reg)
  190. return 0;
  191. /* Wait for bootloader to signify that is ready having bit 31 of C2PMSG_35 set to 1 */
  192. ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_35),
  193. 0x80000000, 0x80000000, false);
  194. if (ret)
  195. return ret;
  196. memset(psp->fw_pri_buf, 0, PSP_1_MEG);
  197. /* Copy Secure OS binary to PSP memory */
  198. memcpy(psp->fw_pri_buf, psp->sos_start_addr, psp->sos_bin_size);
  199. /* Provide the PSP secure OS to bootrom */
  200. WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_36,
  201. (uint32_t)(psp->fw_pri_mc_addr >> 20));
  202. psp_gfxdrv_command_reg = 2 << 16;
  203. WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_35,
  204. psp_gfxdrv_command_reg);
  205. /* there might be handshake issue with hardware which needs delay */
  206. mdelay(20);
  207. ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_81),
  208. RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_81),
  209. 0, true);
  210. return ret;
  211. }
  212. int psp_v3_1_prep_cmd_buf(struct amdgpu_firmware_info *ucode, struct psp_gfx_cmd_resp *cmd)
  213. {
  214. int ret;
  215. uint64_t fw_mem_mc_addr = ucode->mc_addr;
  216. memset(cmd, 0, sizeof(struct psp_gfx_cmd_resp));
  217. cmd->cmd_id = GFX_CMD_ID_LOAD_IP_FW;
  218. cmd->cmd.cmd_load_ip_fw.fw_phy_addr_lo = lower_32_bits(fw_mem_mc_addr);
  219. cmd->cmd.cmd_load_ip_fw.fw_phy_addr_hi = upper_32_bits(fw_mem_mc_addr);
  220. cmd->cmd.cmd_load_ip_fw.fw_size = ucode->ucode_size;
  221. ret = psp_v3_1_get_fw_type(ucode, &cmd->cmd.cmd_load_ip_fw.fw_type);
  222. if (ret)
  223. DRM_ERROR("Unknown firmware type\n");
  224. return ret;
  225. }
  226. int psp_v3_1_ring_init(struct psp_context *psp, enum psp_ring_type ring_type)
  227. {
  228. int ret = 0;
  229. struct psp_ring *ring;
  230. struct amdgpu_device *adev = psp->adev;
  231. ring = &psp->km_ring;
  232. ring->ring_type = ring_type;
  233. /* allocate 4k Page of Local Frame Buffer memory for ring */
  234. ring->ring_size = 0x1000;
  235. ret = amdgpu_bo_create_kernel(adev, ring->ring_size, PAGE_SIZE,
  236. AMDGPU_GEM_DOMAIN_VRAM,
  237. &adev->firmware.rbuf,
  238. &ring->ring_mem_mc_addr,
  239. (void **)&ring->ring_mem);
  240. if (ret) {
  241. ring->ring_size = 0;
  242. return ret;
  243. }
  244. return 0;
  245. }
  246. int psp_v3_1_ring_create(struct psp_context *psp, enum psp_ring_type ring_type)
  247. {
  248. int ret = 0;
  249. unsigned int psp_ring_reg = 0;
  250. struct psp_ring *ring = &psp->km_ring;
  251. struct amdgpu_device *adev = psp->adev;
  252. /* Write low address of the ring to C2PMSG_69 */
  253. psp_ring_reg = lower_32_bits(ring->ring_mem_mc_addr);
  254. WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_69, psp_ring_reg);
  255. /* Write high address of the ring to C2PMSG_70 */
  256. psp_ring_reg = upper_32_bits(ring->ring_mem_mc_addr);
  257. WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_70, psp_ring_reg);
  258. /* Write size of ring to C2PMSG_71 */
  259. psp_ring_reg = ring->ring_size;
  260. WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_71, psp_ring_reg);
  261. /* Write the ring initialization command to C2PMSG_64 */
  262. psp_ring_reg = ring_type;
  263. psp_ring_reg = psp_ring_reg << 16;
  264. WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_64, psp_ring_reg);
  265. /* there might be handshake issue with hardware which needs delay */
  266. mdelay(20);
  267. /* Wait for response flag (bit 31) in C2PMSG_64 */
  268. ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_64),
  269. 0x80000000, 0x8000FFFF, false);
  270. return ret;
  271. }
  272. int psp_v3_1_ring_destroy(struct psp_context *psp, enum psp_ring_type ring_type)
  273. {
  274. int ret = 0;
  275. struct psp_ring *ring;
  276. unsigned int psp_ring_reg = 0;
  277. struct amdgpu_device *adev = psp->adev;
  278. ring = &psp->km_ring;
  279. /* Write the ring destroy command to C2PMSG_64 */
  280. psp_ring_reg = 3 << 16;
  281. WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_64, psp_ring_reg);
  282. /* there might be handshake issue with hardware which needs delay */
  283. mdelay(20);
  284. /* Wait for response flag (bit 31) in C2PMSG_64 */
  285. ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_64),
  286. 0x80000000, 0x80000000, false);
  287. amdgpu_bo_free_kernel(&adev->firmware.rbuf,
  288. &ring->ring_mem_mc_addr,
  289. (void **)&ring->ring_mem);
  290. return ret;
  291. }
  292. int psp_v3_1_cmd_submit(struct psp_context *psp,
  293. struct amdgpu_firmware_info *ucode,
  294. uint64_t cmd_buf_mc_addr, uint64_t fence_mc_addr,
  295. int index)
  296. {
  297. unsigned int psp_write_ptr_reg = 0;
  298. struct psp_gfx_rb_frame * write_frame = psp->km_ring.ring_mem;
  299. struct psp_ring *ring = &psp->km_ring;
  300. struct amdgpu_device *adev = psp->adev;
  301. uint32_t ring_size_dw = ring->ring_size / 4;
  302. uint32_t rb_frame_size_dw = sizeof(struct psp_gfx_rb_frame) / 4;
  303. /* KM (GPCOM) prepare write pointer */
  304. psp_write_ptr_reg = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_67);
  305. /* Update KM RB frame pointer to new frame */
  306. /* write_frame ptr increments by size of rb_frame in bytes */
  307. /* psp_write_ptr_reg increments by size of rb_frame in DWORDs */
  308. if ((psp_write_ptr_reg % ring_size_dw) == 0)
  309. write_frame = ring->ring_mem;
  310. else
  311. write_frame = ring->ring_mem + (psp_write_ptr_reg / rb_frame_size_dw);
  312. /* Initialize KM RB frame */
  313. memset(write_frame, 0, sizeof(struct psp_gfx_rb_frame));
  314. /* Update KM RB frame */
  315. write_frame->cmd_buf_addr_hi = upper_32_bits(cmd_buf_mc_addr);
  316. write_frame->cmd_buf_addr_lo = lower_32_bits(cmd_buf_mc_addr);
  317. write_frame->fence_addr_hi = upper_32_bits(fence_mc_addr);
  318. write_frame->fence_addr_lo = lower_32_bits(fence_mc_addr);
  319. write_frame->fence_value = index;
  320. /* Update the write Pointer in DWORDs */
  321. psp_write_ptr_reg = (psp_write_ptr_reg + rb_frame_size_dw) % ring_size_dw;
  322. WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_67, psp_write_ptr_reg);
  323. return 0;
  324. }
  325. static int
  326. psp_v3_1_sram_map(unsigned int *sram_offset, unsigned int *sram_addr_reg_offset,
  327. unsigned int *sram_data_reg_offset,
  328. enum AMDGPU_UCODE_ID ucode_id)
  329. {
  330. int ret = 0;
  331. switch(ucode_id) {
  332. /* TODO: needs to confirm */
  333. #if 0
  334. case AMDGPU_UCODE_ID_SMC:
  335. *sram_offset = 0;
  336. *sram_addr_reg_offset = 0;
  337. *sram_data_reg_offset = 0;
  338. break;
  339. #endif
  340. case AMDGPU_UCODE_ID_CP_CE:
  341. *sram_offset = 0x0;
  342. *sram_addr_reg_offset = SOC15_REG_OFFSET(GC, 0, mmCP_CE_UCODE_ADDR);
  343. *sram_data_reg_offset = SOC15_REG_OFFSET(GC, 0, mmCP_CE_UCODE_DATA);
  344. break;
  345. case AMDGPU_UCODE_ID_CP_PFP:
  346. *sram_offset = 0x0;
  347. *sram_addr_reg_offset = SOC15_REG_OFFSET(GC, 0, mmCP_PFP_UCODE_ADDR);
  348. *sram_data_reg_offset = SOC15_REG_OFFSET(GC, 0, mmCP_PFP_UCODE_DATA);
  349. break;
  350. case AMDGPU_UCODE_ID_CP_ME:
  351. *sram_offset = 0x0;
  352. *sram_addr_reg_offset = SOC15_REG_OFFSET(GC, 0, mmCP_HYP_ME_UCODE_ADDR);
  353. *sram_data_reg_offset = SOC15_REG_OFFSET(GC, 0, mmCP_HYP_ME_UCODE_DATA);
  354. break;
  355. case AMDGPU_UCODE_ID_CP_MEC1:
  356. *sram_offset = 0x10000;
  357. *sram_addr_reg_offset = SOC15_REG_OFFSET(GC, 0, mmCP_MEC_ME1_UCODE_ADDR);
  358. *sram_data_reg_offset = SOC15_REG_OFFSET(GC, 0, mmCP_MEC_ME1_UCODE_DATA);
  359. break;
  360. case AMDGPU_UCODE_ID_CP_MEC2:
  361. *sram_offset = 0x10000;
  362. *sram_addr_reg_offset = SOC15_REG_OFFSET(GC, 0, mmCP_HYP_MEC2_UCODE_ADDR);
  363. *sram_data_reg_offset = SOC15_REG_OFFSET(GC, 0, mmCP_HYP_MEC2_UCODE_DATA);
  364. break;
  365. case AMDGPU_UCODE_ID_RLC_G:
  366. *sram_offset = 0x2000;
  367. *sram_addr_reg_offset = SOC15_REG_OFFSET(GC, 0, mmRLC_GPM_UCODE_ADDR);
  368. *sram_data_reg_offset = SOC15_REG_OFFSET(GC, 0, mmRLC_GPM_UCODE_DATA);
  369. break;
  370. case AMDGPU_UCODE_ID_SDMA0:
  371. *sram_offset = 0x0;
  372. *sram_addr_reg_offset = SOC15_REG_OFFSET(SDMA0, 0, mmSDMA0_UCODE_ADDR);
  373. *sram_data_reg_offset = SOC15_REG_OFFSET(SDMA0, 0, mmSDMA0_UCODE_DATA);
  374. break;
  375. /* TODO: needs to confirm */
  376. #if 0
  377. case AMDGPU_UCODE_ID_SDMA1:
  378. *sram_offset = ;
  379. *sram_addr_reg_offset = ;
  380. break;
  381. case AMDGPU_UCODE_ID_UVD:
  382. *sram_offset = ;
  383. *sram_addr_reg_offset = ;
  384. break;
  385. case AMDGPU_UCODE_ID_VCE:
  386. *sram_offset = ;
  387. *sram_addr_reg_offset = ;
  388. break;
  389. #endif
  390. case AMDGPU_UCODE_ID_MAXIMUM:
  391. default:
  392. ret = -EINVAL;
  393. break;
  394. }
  395. return ret;
  396. }
  397. bool psp_v3_1_compare_sram_data(struct psp_context *psp,
  398. struct amdgpu_firmware_info *ucode,
  399. enum AMDGPU_UCODE_ID ucode_type)
  400. {
  401. int err = 0;
  402. unsigned int fw_sram_reg_val = 0;
  403. unsigned int fw_sram_addr_reg_offset = 0;
  404. unsigned int fw_sram_data_reg_offset = 0;
  405. unsigned int ucode_size;
  406. uint32_t *ucode_mem = NULL;
  407. struct amdgpu_device *adev = psp->adev;
  408. err = psp_v3_1_sram_map(&fw_sram_reg_val, &fw_sram_addr_reg_offset,
  409. &fw_sram_data_reg_offset, ucode_type);
  410. if (err)
  411. return false;
  412. WREG32(fw_sram_addr_reg_offset, fw_sram_reg_val);
  413. ucode_size = ucode->ucode_size;
  414. ucode_mem = (uint32_t *)ucode->kaddr;
  415. while (ucode_size) {
  416. fw_sram_reg_val = RREG32(fw_sram_data_reg_offset);
  417. if (*ucode_mem != fw_sram_reg_val)
  418. return false;
  419. ucode_mem++;
  420. /* 4 bytes */
  421. ucode_size -= 4;
  422. }
  423. return true;
  424. }
  425. bool psp_v3_1_smu_reload_quirk(struct psp_context *psp)
  426. {
  427. struct amdgpu_device *adev = psp->adev;
  428. uint32_t reg;
  429. reg = smnMP1_FIRMWARE_FLAGS | 0x03b00000;
  430. WREG32_SOC15(NBIO, 0, mmPCIE_INDEX2, reg);
  431. reg = RREG32_SOC15(NBIO, 0, mmPCIE_DATA2);
  432. return (reg & MP1_FIRMWARE_FLAGS__INTERRUPTS_ENABLED_MASK) ? true : false;
  433. }