diff options
author | Tom St Denis <tom.stdenis@amd.com> | 2017-06-12 13:45:30 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2017-06-15 11:50:34 -0400 |
commit | 3176810d60083d6eaf097a8762d2b6bcec9baa11 (patch) | |
tree | 802d5ef661756aac9d83e1d1c7c9ffb1904fb8a6 | |
parent | ba7d5a22a6a733ac5bead62da6f04fb4c67e3173 (diff) |
drm/amd/amdgpu: Port PSP v3.1 over to new SOC15 macros
Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/psp_v3_1.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v3_1.c b/drivers/gpu/drm/amd/amdgpu/psp_v3_1.c index 60a6407ba267..58ba3966f070 100644 --- a/drivers/gpu/drm/amd/amdgpu/psp_v3_1.c +++ b/drivers/gpu/drm/amd/amdgpu/psp_v3_1.c | |||
@@ -172,7 +172,7 @@ int psp_v3_1_bootloader_load_sysdrv(struct psp_context *psp) | |||
172 | /* Check sOS sign of life register to confirm sys driver and sOS | 172 | /* Check sOS sign of life register to confirm sys driver and sOS |
173 | * are already been loaded. | 173 | * are already been loaded. |
174 | */ | 174 | */ |
175 | sol_reg = RREG32(SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_81)); | 175 | sol_reg = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_81); |
176 | if (sol_reg) | 176 | if (sol_reg) |
177 | return 0; | 177 | return 0; |
178 | 178 | ||
@@ -188,10 +188,10 @@ int psp_v3_1_bootloader_load_sysdrv(struct psp_context *psp) | |||
188 | memcpy(psp->fw_pri_buf, psp->sys_start_addr, psp->sys_bin_size); | 188 | memcpy(psp->fw_pri_buf, psp->sys_start_addr, psp->sys_bin_size); |
189 | 189 | ||
190 | /* Provide the sys driver to bootrom */ | 190 | /* Provide the sys driver to bootrom */ |
191 | WREG32(SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_36), | 191 | WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_36, |
192 | (uint32_t)(psp->fw_pri_mc_addr >> 20)); | 192 | (uint32_t)(psp->fw_pri_mc_addr >> 20)); |
193 | psp_gfxdrv_command_reg = 1 << 16; | 193 | psp_gfxdrv_command_reg = 1 << 16; |
194 | WREG32(SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_35), | 194 | WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_35, |
195 | psp_gfxdrv_command_reg); | 195 | psp_gfxdrv_command_reg); |
196 | 196 | ||
197 | /* there might be handshake issue with hardware which needs delay */ | 197 | /* there might be handshake issue with hardware which needs delay */ |
@@ -213,7 +213,7 @@ int psp_v3_1_bootloader_load_sos(struct psp_context *psp) | |||
213 | /* Check sOS sign of life register to confirm sys driver and sOS | 213 | /* Check sOS sign of life register to confirm sys driver and sOS |
214 | * are already been loaded. | 214 | * are already been loaded. |
215 | */ | 215 | */ |
216 | sol_reg = RREG32(SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_81)); | 216 | sol_reg = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_81); |
217 | if (sol_reg) | 217 | if (sol_reg) |
218 | return 0; | 218 | return 0; |
219 | 219 | ||
@@ -229,17 +229,17 @@ int psp_v3_1_bootloader_load_sos(struct psp_context *psp) | |||
229 | memcpy(psp->fw_pri_buf, psp->sos_start_addr, psp->sos_bin_size); | 229 | memcpy(psp->fw_pri_buf, psp->sos_start_addr, psp->sos_bin_size); |
230 | 230 | ||
231 | /* Provide the PSP secure OS to bootrom */ | 231 | /* Provide the PSP secure OS to bootrom */ |
232 | WREG32(SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_36), | 232 | WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_36, |
233 | (uint32_t)(psp->fw_pri_mc_addr >> 20)); | 233 | (uint32_t)(psp->fw_pri_mc_addr >> 20)); |
234 | psp_gfxdrv_command_reg = 2 << 16; | 234 | psp_gfxdrv_command_reg = 2 << 16; |
235 | WREG32(SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_35), | 235 | WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_35, |
236 | psp_gfxdrv_command_reg); | 236 | psp_gfxdrv_command_reg); |
237 | 237 | ||
238 | /* there might be handshake issue with hardware which needs delay */ | 238 | /* there might be handshake issue with hardware which needs delay */ |
239 | mdelay(20); | 239 | mdelay(20); |
240 | #if 0 | 240 | #if 0 |
241 | ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_81), | 241 | ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_81), |
242 | RREG32(SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_81)), | 242 | RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_81), |
243 | 0, true); | 243 | 0, true); |
244 | #endif | 244 | #endif |
245 | 245 | ||
@@ -299,17 +299,17 @@ int psp_v3_1_ring_create(struct psp_context *psp, enum psp_ring_type ring_type) | |||
299 | 299 | ||
300 | /* Write low address of the ring to C2PMSG_69 */ | 300 | /* Write low address of the ring to C2PMSG_69 */ |
301 | psp_ring_reg = lower_32_bits(ring->ring_mem_mc_addr); | 301 | psp_ring_reg = lower_32_bits(ring->ring_mem_mc_addr); |
302 | WREG32(SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_69), psp_ring_reg); | 302 | WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_69, psp_ring_reg); |
303 | /* Write high address of the ring to C2PMSG_70 */ | 303 | /* Write high address of the ring to C2PMSG_70 */ |
304 | psp_ring_reg = upper_32_bits(ring->ring_mem_mc_addr); | 304 | psp_ring_reg = upper_32_bits(ring->ring_mem_mc_addr); |
305 | WREG32(SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_70), psp_ring_reg); | 305 | WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_70, psp_ring_reg); |
306 | /* Write size of ring to C2PMSG_71 */ | 306 | /* Write size of ring to C2PMSG_71 */ |
307 | psp_ring_reg = ring->ring_size; | 307 | psp_ring_reg = ring->ring_size; |
308 | WREG32(SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_71), psp_ring_reg); | 308 | WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_71, psp_ring_reg); |
309 | /* Write the ring initialization command to C2PMSG_64 */ | 309 | /* Write the ring initialization command to C2PMSG_64 */ |
310 | psp_ring_reg = ring_type; | 310 | psp_ring_reg = ring_type; |
311 | psp_ring_reg = psp_ring_reg << 16; | 311 | psp_ring_reg = psp_ring_reg << 16; |
312 | WREG32(SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_64), psp_ring_reg); | 312 | WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_64, psp_ring_reg); |
313 | 313 | ||
314 | /* there might be handshake issue with hardware which needs delay */ | 314 | /* there might be handshake issue with hardware which needs delay */ |
315 | mdelay(20); | 315 | mdelay(20); |
@@ -332,7 +332,7 @@ int psp_v3_1_ring_destroy(struct psp_context *psp, enum psp_ring_type ring_type) | |||
332 | 332 | ||
333 | /* Write the ring destroy command to C2PMSG_64 */ | 333 | /* Write the ring destroy command to C2PMSG_64 */ |
334 | psp_ring_reg = 3 << 16; | 334 | psp_ring_reg = 3 << 16; |
335 | WREG32(SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_64), psp_ring_reg); | 335 | WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_64, psp_ring_reg); |
336 | 336 | ||
337 | /* there might be handshake issue with hardware which needs delay */ | 337 | /* there might be handshake issue with hardware which needs delay */ |
338 | mdelay(20); | 338 | mdelay(20); |
@@ -361,7 +361,7 @@ int psp_v3_1_cmd_submit(struct psp_context *psp, | |||
361 | uint32_t rb_frame_size_dw = sizeof(struct psp_gfx_rb_frame) / 4; | 361 | uint32_t rb_frame_size_dw = sizeof(struct psp_gfx_rb_frame) / 4; |
362 | 362 | ||
363 | /* KM (GPCOM) prepare write pointer */ | 363 | /* KM (GPCOM) prepare write pointer */ |
364 | psp_write_ptr_reg = RREG32(SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_67)); | 364 | psp_write_ptr_reg = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_67); |
365 | 365 | ||
366 | /* Update KM RB frame pointer to new frame */ | 366 | /* Update KM RB frame pointer to new frame */ |
367 | /* write_frame ptr increments by size of rb_frame in bytes */ | 367 | /* write_frame ptr increments by size of rb_frame in bytes */ |
@@ -383,7 +383,7 @@ int psp_v3_1_cmd_submit(struct psp_context *psp, | |||
383 | 383 | ||
384 | /* Update the write Pointer in DWORDs */ | 384 | /* Update the write Pointer in DWORDs */ |
385 | psp_write_ptr_reg = (psp_write_ptr_reg + rb_frame_size_dw) % ring_size_dw; | 385 | psp_write_ptr_reg = (psp_write_ptr_reg + rb_frame_size_dw) % ring_size_dw; |
386 | WREG32(SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_67), psp_write_ptr_reg); | 386 | WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_67, psp_write_ptr_reg); |
387 | 387 | ||
388 | return 0; | 388 | return 0; |
389 | } | 389 | } |
@@ -515,7 +515,7 @@ bool psp_v3_1_smu_reload_quirk(struct psp_context *psp) | |||
515 | uint32_t reg; | 515 | uint32_t reg; |
516 | 516 | ||
517 | reg = smnMP1_FIRMWARE_FLAGS | 0x03b00000; | 517 | reg = smnMP1_FIRMWARE_FLAGS | 0x03b00000; |
518 | WREG32(SOC15_REG_OFFSET(NBIO, 0, mmPCIE_INDEX2), reg); | 518 | WREG32_SOC15(NBIO, 0, mmPCIE_INDEX2, reg); |
519 | reg = RREG32(SOC15_REG_OFFSET(NBIO, 0, mmPCIE_DATA2)); | 519 | reg = RREG32_SOC15(NBIO, 0, mmPCIE_DATA2); |
520 | return (reg & MP1_FIRMWARE_FLAGS__INTERRUPTS_ENABLED_MASK) ? true : false; | 520 | return (reg & MP1_FIRMWARE_FLAGS__INTERRUPTS_ENABLED_MASK) ? true : false; |
521 | } | 521 | } |